pg_controldata
PostgreSQL ships with several utility applications to administer the server life cycle and clean up in the event of problems. I spent some time lately looking at what is probably one of the least well known of these, pg_controldata. This useful utility dumps out a number of useful tidbits about a database cluster, given the data directory it should look at. Here’s an example from a little-used 8.3.6 instance:
josh@eddie:~$ pg_controldata
pg_control version number: 833
Catalog version number: 200711281
Database system identifier: 5291243377389434335
Database cluster state: in production
pg_control last modified: Mon 09 Mar 2009 04:05:23 PM MDT
Latest checkpoint location: 0/B70E5B9C
Prior checkpoint location: 0/B70E5B5C
Latest checkpoint's REDO location: 0/B70E5B9C
Latest checkpoint's TimeLineID: 1
Latest checkpoint's NextXID: 0/307060
Latest checkpoint's NextOID: 37410
Latest checkpoint's NextMultiXactId: 1
Latest checkpoint's NextMultiOffset: 0
Time of latest checkpoint: Fri 06 Mar 2009 02:27:02 PM MST
Minimum recovery ending location: …
postgres
Scout barcode artistry
Once upon a time, UPC barcodes had to be pretty large for the barcode readers to work. That made the barcode roughly square. Some years ago newer standards came out and the barcodes were still the same width to maintain compatibility, but they could now be shorter, presumably because scanning technology had improved.
The combination of packaging that had space allocated for a tall barcode with the new reality that barcodes didn’t have to be tall was an invitation to creativity, as evidenced by the barcode on the box of this Scout Pinewood Derby kit I noticed today:
I love it—and the barcode is the only place on the box that the Scout emblem appears at all! Here it is closer up:
Has anyone seen this kind of artistically subverted but still functional barcode anywhere else?
art
Apache RewriteRule to a destination URL containing a space
Today I needed to do a 301 redirect for an old category page on a client’s site to a new category which contained spaces in the filename. The solution to this issue seemed like it would be easy and straight forward, and maybe it is to some, but I found it to be tricky as I had never escaped a space in an Apache RewriteRule on the destination page.
The rewrite rule needed to rewrite:
/scan/mp=cat/se=Video Games
to:
/scan/mp=cat/se=DS Video Games
I was able to get the first part of the rewrite rule quickly:
^/scan/mp=cat/se=Video\sGames\.html$
The issue was figuring out how to properly escape the space on the destination page. A literal space, %20 and \s all failed to work properly. Jon Jensen took a look and suggested a standard Unix escape of ‘\ ’ and that worked. Some times a solution is right under your nose and it’s obvious once you step back or ask for help from another engineer. Googling for the issue did not turn up such a simple solution, thus the reason for this blog posting.
The final rule:
RewriteRule ^/scan/mp=cat/se=Video\sGames\.html$ http://www.site.com/scan/mp=cat/se=DS\ Video\ Games.html [L,R=301]
hosting seo
Passenger and SELinux
We recently ran into an issue when launching a client’s site using Phusion Passenger where it would not function with SELinux enabled. It ended up being an issue with Apache having the ability to read/write the Passenger sockets. In researching the issue we found another engineer had reported the problem and there was discussion about having the ability to configure where the sockets could be placed. This solution would allow someone to place the sockets in a directory other than /tmp and set the context on the directory so that sockets created within it have the same context and then grant httpd the ability to read/write to sockets with that specific context. This is a win over granting httpd the ability to read/write to all sockets in /tmp since many other services place their sockets there and you may not want httpd to be able to read/write to those sockets.
End Point had planned to take on the task of patching passenger and submitting the patch. While collecting information about the issue this morning to pass to Max I found this in the issue tracker for Passenger:
Comment 4 by honglilai, Feb 21, 2009 Implemented.
Status: Fixed
Labels: Milestone-2.1.0
Excellent! We’ll be …
environment rails
Search Engine Optimization Thoughts
Search engine optimization and search engine marketing cover a wide range of opportunities to improve a website’s search engine traffic. When performining a search engine site review, here are several questions that I would investigate. Note that the questions are biased towards technical search engine optimization efforts. Some of the questions provide links to help define common search engine optimization terms. Although this is not typical End Point blog fashion, the answers to these questions can potentially lead to search engine optimization improvements.
Technical Topics
- Do the pages indexed by major search engines accurately represent the site’s content?
- Are there duplicate index pages indexed?
- Are there old index pages or domains that aren’t redirected?
- Are there pages missing from major search engine indexes?
- Are there too many pages in major search engine indexes?
- Are 301 redirects used permanently on the site?
- Can rel=“canonical” or the use of 301s be applied as a temporary solution to fix duplicate content issues?
- Is there low hanging fruit to fix duplicate content issues?
- Is there low hanging fruit to fix duplicate content generated by external links?
- Are …
seo
osCommerce dead and reborn
Here’s some interesting history of osCommerce. Sounds like it’s been quite the ride for its users. Congrats to those who finally forked it and started making releases.
ecommerce
Bare Git repositories and newspapers
During a recent discussion about Git, I realized yet again that previous knowledge of a version control system (VCS) actively hinders understanding of Git. This is especially challenging when trying to understand the difference between bare vs non-bare repositories.
An analogy might be helpful: Assume a modern newspaper, where the actual contents of the physical pages are stored in a database; i.e., the database might store contents of articles in one table, author information in another, page layout information in yet another table, and information on how an edition is built in yet another table, or perhaps in an external program. Any particular edition of the paper just happens to be a particular instantiation of items that live in the database.
Suppose an editor walks in and tells the staff “Create a special edition that consists of the front pages of the past week’s papers.” That edition could easily be created by taking all the front page articles from the past week from the database. No new content would be needed in the content tables themselves, just some metadata changes to label the new edition and description of how to build it.
One could consider the database, then, to …
git
Puppet PDX meeting
Even zombies like puppets!
If you live in or near Portland, OR, come join us for our first Puppet PDX meeting. We’re meeting from 6-7pm, at Paddy’s on SW 1st and Yamhill in Downtown Portland. It’s right on the MAX line.
Inspired by Puppet and the Reductive Labs team, we’re gathering people interested in all things related to configuration management. (Not sock puppet-making, sorry!) Cfengine user? Thinking about trying AutomateIt? Just have a pile of obsessively managed scripts? Come on down! We’ll discuss tools, best practices, and generally how to make your systems run so well you can get to the pub by 4 o’clock.
This is the first meetup. Hopefully we can get organized, get to know each other, and decide on what the goals of the group should be.
So if you are interested in automation, configuration management, cloud computing, and large scale computing environments, come join us for a few drinks and some lively chatter.
Please RSVP by sending an email to puppetpdx@reductivelabs.com so that we can get a bigger room if needed.
devops community puppet