Posts tagged with “configuration”

Firefox Profile Sharing with Dropbox

Not too long ago, I wrote about keeping Firefox sync’d across multiple machines using Dropbox. Now that I’ve used that system for going on two weeks, I feel like I can report that there’s nothing to report. By and large, things are running quite smoothly (since turning off Dropbox notifications). This morning, though, I did come across a gotcha that was a direct result of this profile sync’ing, so I thought I’d mention it and share the solution. Or at least a solution. There may be others.

This morning I tried to download something and couldn’t. I could click on it, I could even see the .part file appear in my downloads directory (~/Downloads for me), but that was it. Firefox seemed to create the partial download file and then stop. There was no error, no indication of anything afoul, just an aborted – and orphaned – download. My preferences all looked okay, so I rolled up my sleeves and ventured into about:config.

In about:config, I didn’t know what I was looking for so I did the obvious and typed “download” into the filter textbox. The only thing that looked odd in any way was that I had a preference named browser.download.lastDir (this may not be exactly right, after fixing the problem and before returning to write about it, the setting has disappeared) and the path it contained was a Windows path – the path to the downloads path I have set on the Windows box that shares this profile. I reset that value and tried my download again. This time it worked exactly as expected.

My guess is that the presence of backslashes in Windows paths throws the Unix-based Mac a curve ball it doesn’t know how to handle. Perhaps it’s treating the backslash (\) as an escape character in this context, but I don’t know that. I’m going to try turning off the download history retention on all of my machines to determine whether that makes any difference moving forward. I suspect it might. To do that, just open up Firefox’s Preferences, select the Privacy tab and uncheck Remember what I’ve downloaded.

Install "Non-Stable" PEAR Packages

Today I needed to install two PEAR packages on my machine. When I did, I got this:

me@mine [~] $ sudo pear install ole
Failed to download pear/ole within preferred state "stable", latest release is version 1.0.0RC1, stability "beta", use "channel://pear.php.net/ole-1.0.0RC1" to install
Cannot initialize 'channel://pear.php.net/ole', invalid or missing package file
Package "channel://pear.php.net/ole" is not valid
install failed

I’d seen this message before, but never at a time or place where it was important for me to dig in and figure out a way around it. Today I needed to do just that and I found that there are two ways.

Install This Beta Package, This One Time

To do this, simply follow the instructions in the error message:

$ sudo pear install channel://pear.php.net/ole-1.0.0RC1

By explicitly defining the channel from which to install the unstable package, PEAR seems to assume that you know exactly what you’re doing and leaves you alone to do it.

Allow Non-Stable Packages Without Complaining

The ability to “tinker” with libraries is somewhat inherent to a development environment so this is the direction I chose to go. I learned that PEAR recognizes the following application states (though I’m not sure exactly how each is defined):

  1. stable
  2. beta
  3. alpha
  4. devel
  5. snapshot

This information can be shown by running the pear executable’s config-help command:

$ pear config-help preferred_state

I decided to lower my standards gradually in order to protect some level of stability while still getting the functionality I needed. I opted to lower my preferred_state to beta.

$ pear config-set preferred_state beta

Now I can install beta packages normally (i.e. I no longer have to specify a channel) without all of the whining. PEAR doesn’t make this information as easy to find as I’d have liked, so maybe this will help someone else.

Stop Frequent Eclipse Crashes

I spent the better part of last weekend configuring my new work laptop to dual boot into Linux – 64 bit Ubuntu 8.04 (Hardy Heron) to be precise. A critical component of my install is Eclipse. To my aggravation, I found that when I was working Eclipse would crash with some meaningless error message about every 5-10 times I saved. I saw the same error – and crash – when I tried to refresh the explorer or perform a Subversion update using Subversive. For all intents and purposes, this made Eclipse unusable so I searched. And searched. And searched. And…you get the idea.

Eventually I stumbled on to a JVM bug and a related Eclipse bug that, frankly, sounded only marginally like what I was seeing (and that’s probably being generous). Nonetheless, desperation had set in and the JVM bug offered a workaround that was simple and would be easy to rollback so I decided to give it a shot. It worked.

Sometimes it’s better to be lucky than good. If the workaround had been more difficult I probably wouldn’t have tried it, but it wasn’t (more difficult), I did (try it) and it may be worth trying for anyone who’s experiencing similar issues. It’s as simple as adding the following lines to eclipse.ini:

-XX:CompileCommand=exclude,org/eclipse/core/internal/dtree/DataTreeNode,forwardDeltaWith
-XX:CompileCommand=exclude,org/eclipse/jdt/internal/compiler/lookup/ParameterizedMethodBinding,<init>

These lines should be added in the -vmargs section. For what it’s worth, I’m running java version 1.6.0_06 and offer the usual disclaimer that YMMV.

Ant Build Templates: The Environment

Second day of my Ant template lead up, second post. Hello, inertia. Nice to meet you. Check out the prelude, if you haven’t already.

Although my script is templated, it’s templated for my environment – both corporate and personal. Because I’m fortunate enough to be able to guide our corporate infrastructure, it’s been molded in the image of my personal environment. The script has certain expectations that, within the context of that infrastructure, are entirely fair and valid. Outside of that infrastructure, those expectations may not be valid. As such, I think it might be helpful to know a little bit about my environment; it may assist in reading the scripts and in understanding where changes could or should be made.

As is the case in most shops I’ve ever seen or worked in, I have three clusters: development, staging and production. There are also infrastructure and configuration aspects that are shared. We’ll start with the “universal” components.

Universal Elements

To dispense with the generics, the environment is a LAMP stack. Sure, there are some outlier projects that run other packages, but those can be ignored in this context.

The File System

In addition to a directory reserved for shared services that has been added to our include_path in %(technical)php.ini, we have any number of project roots (one per project, as you might expect). Project roots are organized like so:

<project root>/ _meta/ classes/ html/ maint/

The _meta/ directory contains any versioned files and code that are not required at runtime. For example, documentation and the build script itself. In fact, one of the things the build does is delete this directory once the deployment is complete. This directory does contain files that may be used during deployment like SQL files to create a database or shell scripts to aggregate any number of actions.

The classes/ directory contains the project’s supporting class files. These aren’t part of the web root, but are added to the include_path for the project. This keeps business logic outside of the web root. Handy for all of that top secret, for-your-eyes-only work I do. Heh.

The html/ directory is the project web root and contains all of the runtime files that need to be available to the web server.

The maint/ directory contains resources to display a maintenance screen. Slightly oversimplified, if the file /maint/maintenance.htm exists, it will be displayed. Period. One of the first tasks the build script performs is to enable the maintenance screen so that users aren’t greeted with a big server area.

NAS Mount

Most projects I’ve been involved with involve some degree of what I call user-contributed content. What I mean is that users can upload files to the system. Sometimes that means a lot of files. I consolidate that content in a single directory, named bin/, that sits in the web root. To help manage and serve that content, the bin/ directory and its subdirectories are NAS mounts. Every project has one and it’s created when the project is created on the server. For developers, it just exists.

The build must adjust for the fact that it can’t be deleted, nor can its permissions be altered. Hence its mention here.

Development

I do the bulk of my work locally as, I believe, should all developers. It just eliminates so many potential problems. It’s also a good learning experience. I think all web developers should be able to perform at least basic debugging and maintenance tasks on their web and database servers, etc. That said, I do have a development cluster that serves to meet needs that can’t be met on my laptop.

My development cluster includes a deployment server where developers can test, what else? The build script they’ve tailored to their own application and its deployment needs. It’s also available to test integration with third party systems that may not be available to the desktop environment, to provide shared access where business owners and stakeholders can review progress, etc.

In the development cluster, all machines have the following naming convention:

machinename.dev.domain.tld

For example, buildsrv.dev.robwilkerson.org.

Staging & Production

The goal, of course, is to have staging mirror production as closely as possible. I think this is the goal in every shop and it’s no different here. We do a pretty decent job, I think, so I feel comfortable lumping these two environments for the purpose of discussion.

Machines in these clusters are predictably named according to the following convention:

stagingmachine.stg.domain.tld productionmachine.prd.domain.tld

I’m admittedly not as anal as I should be about the naming convention (which is surprising for me). “dev” is sometimes “devel”, “prd” is sometimes “prod”, etc. The script covers all of my typical variations, as you’ll see.

In order to lock down these machines, we have a specialized build user with developer-level access to touch the areas of the file system required by builds. That user has specialized sudo privileges that allow it to do whatever it needs to do within the context of the build. Similarly, we have a debug user with those same privileges. Once the build is executed on one of these clusters, developers may need to physically access the machine in order to debug any problems. This user is locked by default and rarely unlocked, but is available if the need arises.

So that’s the world my template lives in. Hopefully, by understanding the differences between my world and yours, it will be easier to make any necessary modifications. Next up: the deployment process that my script must facilitate. Stay tuned.

Remove Console Output Limits in Eclipse

I run a lot of builds. I run the vast majority of those builds directly within Eclipse taking advantage of its integration with Ant and some of those builds are large. More accurately, some of those builds are verbose, whether it’s because I’m explicitly documenting what’s happening for later debugging or whether there’s a lot of output from a given task (svn export is a perfect example) that’s being displayed. Sometimes there’s so much output that the console’s buffer discards a portion of that output and prevents me from debugging effectively if a problem arises.

By default, Eclipse limits the console output buffer to 80,000 characters, but this can be changed easily enough. In my case, I like to remove the limit all together:

  1. From the menu bar, go to Window > Preferences > Run/Debug > Console.
  2. Uncheck the box labeled Limit console output.

With that limitation removed, I can access the unabridged version of my build output. This setting is not specific to Ant, of course. It will remove the buffer size limit for any action that directs output to the console.