Archive for May, 2009
Low disk-space checking for your server
Running out of disk space on your server is a situation best left to your disaster-recovery testing. There’s no reason for significant data-loss if you’ve set up your server layout according to the best practices. As far as this situation is concerned it’s mostly about putting the database and journal on separate disks. Still, an ounce of prevention is worth pound of cure (something that doesn’t roll off the tongue nearly as well with metric units) and to that end, I wrote a little program to check for low-disk-space on your server.
It’s intended to be run as a change-submit trigger so if disk-space is too low, it can prevent submissions. You might want to take a look at the following KB articles: triggers and daemons and debugging triggers. While only blocking submits doesn’t guarantee that you won’t run out of space (since the log, journal and db files can still grow), it will certainly get the attention of your users who will no doubt go running into your office en-masse.
The most straight-forward way to try this out is to run the program without any arguments and view its help message:
USAGE: space_check (-r) admin_info path1 size1 … pathN sizeN
EXAMPLE: space_check admin@example.com
/disk1/p4_db/ 500M
/disk2/p4_depot/ 5G
/disk3/p4_logs/ 100MAvailable units of size are (M)egabytes and (G)igabytes.
Use the ‘-r’ argument to report values while debugging.
Use an absolute path in the trigger definition for the
best error reporting. UNC paths and drive letters on
Windows must have a trailing slash.
Then once you’re satisfied with the results, install it as a trigger:
low_space_check change-submit //… “e:\p4_triggers\space_check.exe admin@example.com t:\p4_root\ 1G n:\p4_depot\ 5G m:\p4_journal\ 500M t:\p4_logs\ 100M”
Now you can sit back and enjoy having another safeguard for your data-integrity. When disk space gets too low, your users will get a message like the following, sans coloring unless you add that in yourself.
*WARNING* ======================== *WARNING*
Minimum allowed disk space on “/” is 201G – currently at: 42
Submit *ABORTED* — Please *CONTACT* the administrator at: admin@example.com
Trigger program path: /disk4/p4_triggers/space_check
Depot ID: $Id: //depot/intranet/p4d/triggers/submit/space_check.cc#1 $
The trigger is a C++ program, so you need to compile it for your platform before you can run it. It should work on OSX, Linux, FreeBSD and Windows – or at least that’s where I tried it out. If you see anything amiss, let me know!
Get it from the Public Depot here: free space checking trigger, and don’t forget to check it into your depot with the “+k” filetype for keyword expansion.
Using Branch Diagrams to Scare your CEO!
I love branching strategies, and after a long while in the biz I’ve become a connoisseur. The two most popular are the wicked good Mainline Model and the lackluster yet popular Cascading Model. Because branching strategies are all about modeling your software development life cycle and release process, you can have theoretical discussions about branching strategies without considering which SCM tool you’re using. In practice, though, the ability to follow branching strategies depends in large part on your SCM tool and the ability of your team to use the tool.

Connoisseurs find that these help when analyzing particularly complex branching strategies.
That is in fact why many organizations follow the Cascading model as opposed to the Mainline Model. The Mainline Model can be made to work with any SCM tool in theory, but in practice it works a whole lot better if you’re got an SCM tool with powerful branching and merging functionality. If you’re stuck with an SCM tool that doesn’t provide powerful branch and merge technology, you might be better off just sticking with the Cascading Model. (Gasp! Did I just say that?)
Perforce Multimedia library
Documentation, documentation, documentation – all text and no pictures? Well, no – the product pages have slideshows for some of the products, but that’s really just intended for people who are seeing them for the first time.
So what’s there for existing/new users who want a good visual walkthrough or tutorial? Well, my coworker Brian Holtcamp has been steadily adding topical flash videos (and some audio) to our media library. We’ve got topics ranging from “Workspace Concepts and Setup in P4V” to “The Flow of Change”. They range in duration from five minutes to an hour, with most being under ten, so you should be able to go through them pretty fast.
If you have comments, ideas for new topics, etc – please let us know! (by sending an email to multimedia @ perforce dot com!)
Don’t Be a Pioneer!
Warning: This is a shameless plug for Perforce Consulting Services!
We’re seeing a lot of legacy SCM systems migrations to Perforce these days. While we like to think we’re always useful, the value proposition for consulting services is particularly high when you’re doing migrations from one specific technology to another. That’s where “Been there, done that!” experience can really make a difference.
There’s no need to be a pioneer when you’re doing SCM migrations! Why wouldn’t you want to be a pioneer? Aren’t they the brave, glamorous trendsetters, discoverers of new technology? Nah — more often the pioneer is the guy found dead by the side of the road, with an arrow in his chest! Better to hire a guide who has trodden that path path before.
Replacement of your SCM system can be a major undertaking. The SCM system is the foundation of any software production line, and replacing the foundation is tough, especially when the house is being used! But don’t let that deter you, because as the foundation, the capabilities and limitations of your SCM system determine, to a large degree, the capabilities and limitations of your entire software development organization. Get the right tools, and boost your developers to the top of their craft!

Pioneers -- They should have hired a guide!
Looking to replace ClearCase? Talk to us about it. Many Perforce fans who have been playing the SCM game for a long time were ClearCase admins once upon a time.
Perforce Anti-Patterns Part 2: Overuse of branching
Hi,
A few weeks ago I posted an article on Perforce Anti-Patterns, citing the overuse of labels as an example. Here, I would like to highlight another anti-pattern, following a similar theme: overuse of branching.
This seems to be an odd topic, given that Perforce is famous for its efficient and powerful way of using branches, providing inter-file branching and space- and time saving lazy copies. But herein lies the pitfall: too much of a good thing can still be a bad thing. Let me elaborate:
The use of branching in Perforce is cheap, but not free. For every file branched two entries are added to the database (in db.integed). After a while, these entries start to add up, and will hamper performance for certain operations, like “p4 integ”.
I encountered an extreme example at one customer’s site. The typical code line at this site contained about 45,000 files. For every bug fix and every programmer working on a bug fix, a tool automatically generated a new branch, integrating all 45,000 files. In the new branch, a handful of files would be modified and the changes integrated back to the parent branch. It is a credit to Perforce’s architecture that this went well for several years before the customer noticed real performance problems, given that on average the customer created several branches a day. In the end, creating a branch that used to take several seconds in the past would take an hour.
Adding Perforce connection details to your Bash shell prompt
Like other shells, Bash offers its users a wide range of customization options, one of which is the ability to change what the prompt says. Moving between different computers, you’re bound to see a variety of different information presented to you.
Commonly you’ll find the current path, day/time or the number of unread mail messages you’ve got. But since the prompt is just a user-supplied function, it could be any text that you like. The fancier you get with it, the more the prompt becomes a custom interface to the work you’re doing.
A web search for “bash prompt” will give you lots of detailed information about how to customize it. Since many of us spend a lot of time working with source control tools, it can be useful to have the prompt tell us something about what we’re doing. As an example of how to do this with Perforce, I’ve made a custom prompt that displays your current workspace and server using only client-side commands.
Here’s what the end result looks like. I’m using P4CONFIG files to keep track of my connection settings, so as I move between directories, the workspace/server combination changes.

And on to the code:
#!/bin/bash function get_p4set { echo `p4 set $1 | sed -e "s/$1=//" -e 's/ (.*)$//' 2>&1`; return 0; } function p4prompt { local NOCOLOR="\[33[0m\]" local YELLOW="\e[0;33m" local GRAY="\[33[0;37m\]" local CYAN="\[33[0;36m\]" nP4CLIENT=`get_p4set P4CLIENT` nP4PORT=`get_p4set P4PORT` if [ ${#nP4CLIENT} -eq 0 ] then nP4CLIENT="__client_unset__" fi if [ ${#nP4PORT} -eq 0 ] then # "p4" actually defaults to using "perforce:1666", so the # P4PORT is never really "unset". nP4PORT="__server_unset__" fi PS1="$GRAY[$CYAN\${nP4CLIENT}$GRAY@$YELLOW\${nP4PORT}$GRAY] \ \${PWD} $NOCOLOR-> " } PROMPT_COMMAND=p4prompt
Automated Lifecycle Management
The term “ALM” (Automated Lifecycle Management) has been getting a lot of exercise over the past few years. There are a lot of different people and vendors who use the term, and some variation on how they define it.

Collaborative Information Systems Integrations
One analogy I find fitting is “ERP meets the SDLC”. ERP, or Enterprise Resource Planning, kicked off a binge of systems integrations projects in the past decade or so, all with grand goals of integrating information systems across the entire breadth of the manufacturing process. The result of these systems integrations projects (the successful ones, anyway) was to provide a more common view from different perspectives, so that people with different roles could share the same key data, but with different views depending on their role. Read the rest of this entry »
Of Code and Cocktails – the 2009 Perforce User Conference
Perforce users and staff mixed it up for 3 days at the 2009 Perforce User Conference at the Flamingo Hotel in Las Vegas.

Perforce Consultant Richard Baum in his fabulous pink suit!
The presentations included a keynote by Robert X. Cringely, and talks by Pixar, Google, VMware, NVIDIA, Junction Point Studios, Bio-Rad, and Smart Bear. Perforce developers and consultants also presented, including p4 bloggers Tom Tyler, Rusty Jackson, Kevin Sawicki, Sven Erik Knop, and James Creasy. Perforce consultant Richard Baum, referred to in a #p4conf tweet as “the pink suited presenter”, talked about high availability and disaster recovery solutions for Perforce. Meanwhile, @p4james was tweeting updates about the proceedings and after parties.
The theme of the conference was “Make the Connection”, and there were plenty of opportunities for making connections with live tech support, usability testing, workshops, discussions, networking, and a little partaking of the fabulousness of Las Vegas. A Libations and Integrations margarita party sponsored by Perforce partners Smart Bear and Electric Cloud, and a Hawaiian Luau by the Flamingo Pool, featuring Perforce’s official cocktail the “p4 obliterate” (sort of like a Cosmopolitan but with mango), hula dancers, and a gold sequined disco tiki limbo dancer, rounded out the entertainment.
We always enjoy the opportunity to connect with our customers. Steve Voudouris from DST Output said it nicely: “It was very cool to have the opportunity to meet you. Your group’s skills and elegant sense of purpose is without peer.”
Thanks, Steve. We feel the same way about you, and all our customers.
See you at the next conference!
Tweeting from the 2009 Perforce User Conference
As I have done for previous user conferences in 2003 and 2005, I made the final adjustments to my presentation and packed in preparation for four long, productive days in Las Vegas.
This year was a little different because I volunteered to be the official conference tweeter. Never mind I had never so much as peeped a tweet until just a week before the conference; I was determined to bring the excitement of our conference to the tweetosphere.
To facilitate mobile tweeting, I brought my personal Dell Mini 9 running Leopard. At just over 2lbs and about 7″x9″x1.3″, I was able to tote it around with me everywhere during the conference events. Mac OS X made connecting to all the different Wi-Fi networks as easy as popping open the cover.
Before I went out at night, I downloaded a copy of Gravity to my Dell Mini and Bluetoothed it to my Nokia 6120 Classic- at 66cc and 84 grams the smallest Symbian S60 3rd Edition phone- perfect for fitting into tight club wear pockets. Dual band 3G/HSDPA with speeds up to 14.4 Mbit/s make sure tweets get posted instantly. This allowed me to update my Twitter status one handed *while* dancing in a crowd on a disco floor.
Most of the tweets were reporting what was going on with me or the conference, although a few were ’stunttweets’, for example posting from the dance floor and on stage during my presentation. Next I will push the envelope and try stunttweeting during a p4 merge or maybe even a p4 resolve.
I am tweeting as @p4james from the Perfortress and beyond. Conference related tweets can be reviewed by searching at search.twitter.com for the tag #p4conf.
I will continue to update my Twitter status as we push towards a huge set of features slated for the 9.2 release, albeit at a slightly slower rate!
Now I must go and tweet about writing a blog post about my tweeting!
>