Creating a remote from an already existing depo


Posted by Jaime | Posted in Coding, DevOps | Posted on 30-10-2016

Tags: , ,

Today, I created a remote depo, so that I can use the DVCS functionality in P4 with one of my projects.

First, I connected to my perforce server and typed:

$p4 remotes

To see all of the remotes that were on the server. Before doing this command you have to type:

$p4 login

Which thankfully, my username on the linux server is the same as my username in the Perforce server so I didn’t have to type that again.

Once I was logged in and saw that there was no remote set up for the project I wanted to use with DVCS, I typed:


This brought up NANO (I know some of you out there are rolling your eyes) and I modified the //local/… //remote/… paths to my liking. Remember, the left side represents the local depo representation on your computer and the right side of that mapping is the remote depo representation that is on your Perforce server.

Now, in another terminal, I typed:

$p4 -u jaimerios clone -p -r PROJECT_CODE_NAME

The last command then takes the files specified in the mapping and clones it to your local filesystem.

You can check that the origin server is set up by typing:

$p4 remote -o origin

Now, in my project, I had two read-only depos in my Perforce server that was for the Boost headers and the Google gtest framework libs.

For those normally import+ folders, I created a symbolic link to those folders that were already on my local filesystem:

$ln -s /Users/jaimerios/Development/Perforce/READONLY/libs/Boost ./Boost
$ln -s /Users/jaimerios/Development/Perforce/READONLY/libs/Google ./Google

And so far, everything seems to work well … except there are a few files I want p4 status to ignore, so:

$nano .p4ignore

I added some folders and files to ignore and life is good.

So, onto happy coding 🙂

How to install Perforce DVCS


Posted by Jaime | Posted in Coding, Tools, Utility | Posted on 20-09-2016

Tags: , , , ,

For 9 years now, I’ve used Perforce; before that, it was MKD, Subversion, VisualSourceSafe, CVS and a few others.

In the past year, I used Git.

One cool thing that Git has that Perforce didn’t have was being able to save your changes while not being connected to a central server.

However, Perforce recently added native DVCS to their source control tools so, checkouts and submits are now possible while offline.

Here are the steps you need to take if you want to use Perforce DVCS on your computer. Note, I’m using macOS, so my instructions are for that platform only.

Installation steps
Step 1: download Helix server at
You will need both p4d and p4 command line utilities, so head over to and download the “Helix Server” for your machine.

Step 2: Double-click the tar file to extract it
I think this step speaks for itself; on my computer I was able to double-click the tar file and everything appeared in a new folder.

Step 3: Make a folder for the binaries to live in
I created a bin folder in ~/Perforce/. I happen to have a dedicated Perforce folder in my home directory that I use for a lot of projects and the bin directory seemed to be a logical place to store the files.

From the command line you can type the following to make the folder:
mkdir -p ~/Perforce/bin

Step 4: Copy the binaries to the bin folder
Copy the p4d and p4 command line utilities to the ~/Perforce/bin folder (or whatever folder you just created)

Step 5: Add the path to the PATH environment variable
I edited my ~/.bash_login file using emacs to add the following:
export PATH=~/Perforce/bin:$PATH

Step 6: Load the Perforce bin path
Relaunch or open a new Terminal Window or source your .bash_login via
source ~/.bash_login

Step 7: Init your offline project
Here is how I got up and running:
p4 init -C1 -xi

The extra settings after init tell p4 what case-sensitivity is should use and whether or not to enable Unicode support. If I didn’t add those, p4 would try to find a server to copy those settings from and that won’t work for me.

Step 8: Enjoy
From here, you use the and p4 to perform all of your Perforce commands and enjoy the goodness that is Perforce… like the super-large-file-support-without-choking feature 😉

Haversine formula now on GitHub


Posted by Jaime | Posted in Coding | Posted on 03-06-2016


The C implementation of the Haversine formula I ported from Javascript is now hosted on GitHub.

The project from this website is now up on GitHub for anyone to view. I also plan to do some updates to the code since C++14 has been out and has a lot of good features to add.

Xcode plugin for Perforce


Posted by Jaime | Posted in Coding | Posted on 18-03-2015

Tags: , ,

I use Perforce as my version control system and Xcode as my IDE.

Unfortunately, Apple removed Perforce support from Xcode a whiles back for reasons unknown.

So, to work around the problem, I started to use of DTerm… but I wanted more.

I created AppleScripts for both Xcode4 and Xcode5 which was better, but… I wanted more.

So, I took the plung and wrote a plugin for Xcode using Swift.

The plugin is hosted on Perforce’s Swarm website, which you can download and build in Xcode. Once you build the project, the plugin is automatically installed for you.

Pay attention to the file: you will need set up files that contain the settings for your workspace, or workspaces, and those settings file are used by the plugin to do it’s work.

A big thanks to Delisa Mason for writing a Xcode plugin template. This template was a huge help in creating the plugin and the template available in the Alcatraz package manager as well as in GitHub:

If you don’t know what Alcatraz is, you should check out at

Xcode dylib constructor destructor


Posted by Jaime | Posted in Coding | Posted on 26-02-2015

Tags: ,

I meant to post this link a while ago, but here it is anyway:

So, in a dylib, you can have code execute when the dylib is loaded and execute code when the dylib is being unloaded:

static void initializer1() {
    printf("[%s] [%s]\n", __FILE__, __FUNCTION__);
static void initializer2() {
    printf("[%s] [%s]\n", __FILE__, __FUNCTION__);
static void finalizer1() {
    printf("[%s] [%s]\n", __FILE__, __FUNCTION__);
static void finalizer2() {
    printf("[%s] [%s]\n", __FILE__, __FUNCTION__);

openframeworks plugin for Xcode


Posted by Jaime | Posted in Coding | Posted on 23-12-2014


Sweet! Now you can add open frameworks add ons to your project from a Xcode plugin:

Of course, if you have Alcatraz, you won’t need to go to the github site to download the plugin, just get it from “Package Manager” within Xcode

You can run Swift code from the command line?


Posted by Jaime | Posted in Coding | Posted on 23-12-2014

Tags: , , ,

WAT? Now this is something else!

A package manager for Xcode named Alcatraz


Posted by Jaime | Posted in Coding, Tools | Posted on 25-09-2014

Tags: , ,

I learned about a package manager for Xcode named Alcatraz when I attended CocoaConf in San Jose earlier this year.

Extending the functionality of Xcode through plugins has been something I’ve been looking into for a while and the only plugins I knew about in the wild could only be found through Google searches or on


The tool makes it much easier to find plugins for Xcode. Buuuut, it actually also serves up themes, templates and more, all from a menu available within Xcode.

Installation is also simple. Type in a single Terminal command and hooorah, it’s installed: curl -fsSL | sh

Oh, and if you are looking to attend an Apple developer conference, you should definitely consider CocoaConf: the attendee group is primarily developers, attendees and speakers are easy to approach and exchange ideas with, and as they had advertised on CocoaConf’s site, the food is good.

And now, another language


Posted by Jaime | Posted in Coding | Posted on 05-06-2014

Tags: , , , , , , ,


You know, I was getting quite comfortable with Obj-C, C++11, and everything else I had learned over the years… now Apple has to go and introduce another language: Swift

I don’t know what to make of it. How much better can it be than Obj-C? I guess I’ll find out over the course of the year.

I do have to say though, that “let” and “var” are pretty cool, in the same way that “auto” is pretty cool in C++11.

Oh, and if you haven’t already read Herb Sutter’s article on why you should use “auto” in your code, check it out here: AAA

Aaaargh! Stop auto substituting my text!


Posted by Jaime | Posted in Coding, Not-so-funny | Posted on 20-03-2014

Tags: , , ,


I’ve been running into problems with my Jenkins scripts that would fail when attempting to run my p4 commands, because the three periods I inserted into the p4 command were automatically converted to an ellipsis by MacOSX, which is not a good thing: Three dots are automatically changed to an ellipsis