Archive for the ‘ Tutorials ’ Category

How To Relocate An SVN Working Directory When a Repository Has Moved

Wednesday, November 16th, 2011

I’m a big fan of Versions.app. On the Mac, there is no better way to manage your SVN-controlled projects.

I’m also a fan of Versions’ sister site, Beanstalk. The two work seamlessly together and make version control a breeze, especially in a team coding environment.

If you’re like me, you have a bunch of archived projects that you have to dust off occasionally when an old client calls in a panic about something or other.  At some point in the past, Beanstalk (admirably) deprecated all their old http-accessed repositories in favor of more secure ones over https.  When this happened, it orphaned any working repositories that still pointed to their old http urls.

You’ll know you’re affected when you get a message like this:

svn: Repository moved permanently to 'https://account.svn.beanstalkapp.com/repo'; please relocate

While Versions itself doesn’t have a way to relocate a working directory, it’s dead-easy to do it via the command line.  Fire up your Terminal and type:

cd /path/to/working/directory
svn switch --relocate http://account.svn.beanstalkapp.com/repo https://account.svn.beanstalkapp.com/repo

(Obviously, change the path, “repo” and “account” placeholders with your own values.)

That’s it. Run an update and then you’re good to go.

Sphere: Related Content

Alternative to DigitalColor Meter in Lion (Updated)

Friday, October 14th, 2011

Update: With the release of 10.7.2, this issue is resolved. The Apple engineers have reverted the code back to its pre-Lion state complete with the ability to copy hex values.

Original post: Digital With the launch of Lion came the replacement of a little utility I use(d) every day, Apple’s DigitalColor Meter. This tool allowed (note tense) you to hover over any color visible on your screen and copy its corresponding hex value to your clipboard for use in your web development work.

With Lion, DigitalColor Meter’s ability to select hex values and copy them to the clipboard are both gone. This isn’t a bug; this was a deliberate choice by someone at Apple.  Why this person thought it was necessary to turn this decade old, one-trick-pony of a utility into, well, a hobbled old nag destined for the glue factory is beyond me.

Anyway, I’m never one to be deterred so I found a work-around.  It’s not perfect, but it’s working for now:

  1. Download and install this free extension to Apple’s built-in Color Picker from Waffle Software. You may need to reboot.
  2. Open AppleScript Editor
  3. Add simply, “choose color”
  4. Run it just to test.  The color picker should launch in stand-alone mode.
  5. Save your script as an application.
To add some extra sauce, set up this script as an Automator Service with a keyboard shortcut, or, like I do, trigger the newly created applet with a Quicksilver trigger.
Enjoy.
Sphere: Related Content

Tutorial: Use DropBox to Share a Database (or any file)

Friday, January 14th, 2011

Admittedly, this is a niche problem, but it’s one I run into quite frequently. I have several development machines, and it used to be a huge pain in the but to keep my MySQL databases synced between them all so that I’m always working with the same data.

Enter DropBox and symbolic linking on the Mac (sorry Windows users).

In your DropBox folder, create a folder that will hold your shared databases. In recent versions of DropBox, you’ll want to ensure that this folder is not excluded from syncing on your target machines.

Quick steps:

  1. Back up your db files
  2. Move the db folder you want to share from your MySQL db directory to its DropBox counterpart
  3. Create a symbolic link from the DropBox version to your MySQL directory

Detailed steps:

On your primary development machine (or the one with the latest version of the database you wish to share), navigate to the folder containing your MySQL database files (For MAMP installations, this is typically /Applications/MAMP/db/mysql).

WARNING: BACK UP YOUR DATA BEFORE PROCEEDING!

Now move the folder containing the database you wish to share to your newly created counterpart in your DropBox folder. Move it, don’t copy it.

Fire up your terminal window. You’re going replace the folder you just moved with a symbolic link (not an alias!) from your DropBox version. DropBox folders can live anywhere you choose, so replace this example with your own paths:

ln -s /Users/Steve/Dropbox/Databases/example_db /Applications/MAMP/db/mysql/

Now you should see the DropBox version of your db folder there in the finder. Because it’s a symbolic link, MySQL is tricked into seeing the shared directory even though it’s no longer in your database directory.

Repeat this on every machine on which you wish to share this database.

Some caveats: this is a development solution only! Obviously, you will not use this technique on your live database! Also, this technique is susceptible to version control errors. Hence, it’s a good solution when you’re the only developer hitting the database files. My own use-case, for example, is syncing between my primary MacPro and my travel laptop. Your mileage may vary.

But wait! There’s more! This trick works with anything and any app, not just database files and MySQL. Give it a try. It’s yet another reason DropBox is one of the greatest services available on the Net today.

Sphere: Related Content

Google’s New HTML5 Resource Site

Sunday, June 27th, 2010

матрациNot to be outdone by Apple’s recent launch of their HTML5 playground, Google has launched their own HTML5 Developer Resource site called HTML5Rocks.com.

The site has some useful tutorials and an interactive sandbox, but for the time-impaired, they also have an excellent presentation that shows you quickly what is new and different. As with most things Google, it’s not the prettiest site, but it gets the job done. Check it out.

Sphere: Related Content

HTML5 Demos & Tutorials

Friday, June 4th, 2010

Apple has just launched an effort to support more widespread adoption of HTML5 in the developer community. This page showcases a bunch of cutting-edge demos, and this page digs into the demos more deeply and provides more resources to learn how to develop features using HTML5.

Standards aren’t add-ons to the web. They are the web. And you can start using them today.

Sphere: Related Content

Is DropBox the Free Replacement to MobileMe We’ve Been Waiting For?

Tuesday, September 8th, 2009

Dropbox [link] is a highly recommended service that lets you share large files amongst different groups and machines that I’ve written about before [here].  MobileMe is a very not-free service that provides marginal utility for Mac users.

If you’re like me, the only reason to use MobileMe on a daily basis is to keep my machines in sync.  So if there was a technique to use DropBox rather than MobileMe to handle all that syncing of data, wouldn’t we all just drop MobileMe in a heartbeat?  I know I would.

Well, so far, I’ve managed to replace the syncing for my third-party apps with sym linking, terminal, and DropBox.  I won’t go into detail here.  Instead, I’ll refer you to a very excellent walkthroughхотелско обзавеждане of the technique provided by the makers of TextExpander over at SmileOnMyMac. Link to the story here.

You’ll want to signup and download DropBox for free if you haven’t already done so.

Now, if we can figure out how to sync first-party apps, we can finally kick MobileMe to the curb and spend that $100 a year on something better.

Sphere: Related Content

Tutorial: Launching MAMP Silently on Startup

Monday, August 25th, 2008

MAMP Web ServerMAMP is a great tool for running and managing a development server when you require more than the basic PHP configuration included with Leopard. However, getting the web server to run typically involves launching MAMP, entering your root password, and quitting MAMP.

This tutorial walks through the simple steps needed to launch MAMP silently on startup so that you do not have to enter your root password every time.

The issue with MAMP is that launching Apache must be done as root, so there’s no way to simply add MAMP to your startup items via the system’s Accounts Preferences in a way that will launch the app silently. But you don’t need to. Here’s the deal: MAMP’s launcher is just a pretty UI that opens a shell script that, in turn, launches MAMP’s Apache and MySQL servers.

You can set up launch daemons that do the exact same thing without the need to launch MAMP or enter a password.

Step 1: Create the Start-up Items

Open up your favorite text editor and paste the following into an empty document:

Create another for the MySQL start-up item:

Be sure to replace “YOUR_USERNAME” with the username for your account.

Step 2: Save the Files

Save this file as (or move the file to) /Library/LaunchDaemons/info.mamp.start.apache.plist and /Library/LaunchDaemons/info.mamp.start.mysql.plist, respectively.

Step 3: Set Permissions

If you try to launch the daemons at the moment, you’ll get a “dubious permissions” error. To correct this problem, you’ll need to change your permissions.

In your terminal, type:

You’re done! Reboot your computer and test that your development server is running as expected by opening a served page in your browser.

Sphere: Related Content

Integrating the iPhone SDK Simulator into Dreamweaver

Sunday, August 24th, 2008

Are you doing iPhone development on a Mac? Do you use Dreamweaver as your IDE? If your answer to both questions is ‘yes,’ then try this simple tip.

The iPhone SDK has an iPhone simulator that is, effectively, a fully functioning, pixel-perfect iPhone on your Mac. But because it’s an app on your Mac, it is also just another browser on your system. So treating it as such in Dreamweaver is a snap.

First, download and install the free iPhone SDK from Apple’s iPhone Development Center. Since you are not releasing apps through the App Store, you do not need to pay to be a part of the Application Developer Program. You just need a free developer account on Apple’s site.

Once you download and install the SDK, open up Dreamweaver.

  1. Go File > Preferences > Preview in Browser
  2. Click the “plus” button to add a new browser to your list
  3. Navigate to /Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/
  4. Select the iPhone Simulator.app
  5. Click Ok, and then close out your preferences
  6. Now the iPhone Simulator is in your list of browsers

There’s one quirk. The iPhone Simulator must be running in order for it to accept browser pages from Dreamweaver, so if you trigger it from Dreamwever and all you see is the iPhone’s Home Screen, then do it again in Dreamweaver. The second time, the page should come up in the iPhone’s browser.

Sphere: Related Content

Tutorial: Starting Subversion on Startup

Wednesday, November 28th, 2007

Subversion Version Control SystemHonestly, I can’t remember if Subversion came pre-installed on Tiger or not, but I know for a fact that it does come as a standard component on Leopard. This is great news.

One small issue, though, is that there is not a way in the OS X UI to have Subversion start up when your computer boots up. This tutorial will help you set up a launch daemon that will fire up Subversion silently when your computer boots up.

Before we begin, you’ll need to make sure you have enabled root access on your machine. In Tiger, follow these instructions. In Leopard, follow these instructions instead.

Step 1: Create a Start-up Item

Open up your favorite text editor and paste the following into an empty document:

Step 2: Locate your repository

On line 16 of the plist file, you’ll find the string “/usr/local/svn” which points to the default repository location. If you have installed your repository in a different location, change the contents of this line to point to your repository. For instance, mine is on a separate drive, so my line looks like:

/Volumes/Max/SVN_Repository

Step 3: Save the File

Save this file as (or move the file to) /Library/LaunchDaemons/org.tigris.Subversion.plist.

Step 4: Set Permissions

If you try to launch the daemon at the moment, you’ll get a “dubious permissions” error. To correct this problem, you’ll need to change your permissions.

In your terminal, type:

cd /Library/LaunchDaemons/
sudo chown root:wheel org.tigris.Subversion.plist

You’re done! Reboot your computer and test that your SVN server is running as expected.

Sphere: Related Content

Tutorial: Enabling Root Access in OS X (Leopard)

Wednesday, November 28th, 2007

By default, the root account is disabled in OS X. If you are a developer new to the platform, you will be needing to access many things that are available only with root access. This tutorial walks you through the process of enabling the root account in Leopard (OS X 10.5).

NOTE: This guide is specific to enabling root access on Leopard, (10.5). To learn how to enable root access on Snow Leopard (10.6), follow these instructions. To learn how to enable root access on Tiger (10.4), follow these instructions instead.

Enabling Root in Leopard:

  1. Open the Directory Utility: In the Finder, navigate to the Utilities folder (tip: click on the desktop, hit Cmd+Shift+U).
  2. Click on the padlock to allow edits.
  3. Go Edit > Enable Root Password
  4. Enter and re-enter your password.

Now, you are set to access protected areas of the system via the terminal.

Sphere: Related Content