All posts by Greg Bueno

Cakewalk SONAR X1 Picture Cache: Clean early and often

A few weeks back, I performed some not-so-insignificant upgrades to the system that powers my home recording studio. I bought the Session Strings Pro and Studio Drummer sample libraries for Native Instruments Kontakt, and they taxed the RAM of poor Windows 7 Professional 32-bit. So I upgraded to 64-bit, added another 2GB of RAM and reinstalled all the studio software.

At first, everything seemed fine. The expanded RAM gave Session Strings Pro and Studio Drummer much more room to grow, and a quick playback test of my Cakewalk SONAR X1 Producer projects showed no hints of disruption.

Another few weeks passed before I got to work on a demo in earnest, and at first, things seemed to be cool until I start bouncing tracks. That’s when SONAR popped up a vague dialog box: “General error”.

I tried saving my project. “General Error”. I rolled back a few edits in my history. “General Error”.

I’m not sure what voodoo I performed to get the project to save, but it meant losing some work.

Continue reading

How To: Transfer your PuTTY settings between Windows users

I have two Windows logins for the same computer at work, and I’ve been trying to make both of them as similar as possible. That means copying a lot of configuration files over from one login to another.

PuTTy is one tool I need for both logins, but alas, the session information is stored in the Windows Registry instead of a plain text file, something I learned from this informative article about transferring PuTTy settings between computers.

So what if I want to transfer session information between logins on the same computer?

One thing the article glosses over is the location in the Windows Registry where the information is stored. Rather than specifying to look under HKEY_USERS, Grant Robertson, the author of the article, instructs you to perform a search instead. That’s wise because the tree structure under HKEY_USERS will differ from computer to computer, or in my case, login to login.

Most of the situations where I’ve had to edit the Windows Registry involved making changes to HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE, and they usually involved the SOFTWARE key. For example:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer

HKEY_USERS is similar with one exception — the first nested level is a unique identifier for a particular login:

HKEY_USERS\{unique key}\Software\SimonTatham\PuTTY\Sessions

So the trick when transferring sessions between users is to figure out which unique key to use. What I ended up doing is using the search function to find the various instances where the PuTTY\Sessions key was repeated. One of them would have my sessions. (Let’s identify it as S-1-5-21-1234567890-123456789-1234567890-123456.) The other would not. (We’ll call that one S-1-5-21-0987654321-987654321-0987654321-654321.)

When I found the key that contained my PuTTy sessions, I exported it. Then I edited that export in Notepad and changed any reference to the unique identifier of my original login to the unique identifier of my new login.

HKEY_USERS\S-1-5-21-1234567890-123456789-1234567890-123456\Software\SimonTatham\PuTTY\Sessions

becomes

HKEY_USERS\S-1-5-21-0987654321-987654321-0987654321-654321\Software\SimonTatham\PuTTY\Sessions

I then imported the edited export file back into the Windows Registry.

When I launched PuTTY, the sessions were listed under my new login.

Domain names matter when creating a remote development mirror of WordPress

I probably spent too many hours today deleting cookies and restarting my browser, trying to figure out why logging into my WordPress multisite network kept redirecting me back to the login page.

I would get no feedback on the login failure, save for a mysterious value in the query string named reauth set to a value of 1 (true). The morning was spent cutting and pasting echo statements along the execution path of the code. Eventually, I traced the problem to the cookies set by WordPress. All I had to do was delete them to get the authorization back on track. Or so I thought.

There was just one problem — I use subdomains of my production instance to spin off my development instance. It’s a naming convention I employ with everything — if production is located at vigilantmedia.com, then test is available at test.vigilantmedia.com and development at dev.vigilantmedia.com.

In this case, blog.vigilantmedia.com is my production instance, and development was dev.blog.vigilantmedia.com. Nice and consistent, right?

Not for WordPress.

WordPress sets cookies with a leading dot in the domain name, thus the cookie for blog.vigilantmedia.com can be read by dev.blog.vigilantmedia.com. I guess it’s necessary for the way WordPress uses subdomains for a multisite network, but it’s terrible when subdomains are used to distinguish environments.

In my case, I would encounter a redirection loop if I logged into production before I logged into environment, but I could avoid the loop by logging into development before production. The state of one should never be dependent upon the other.

As a result, I’ve had to break my domain naming convention and use a different subdomain for my development instance. I won’t even go into all the myriad ways these shared cookies mess up domain mapping. It’s not pretty.

I like to make the differences in my development, test and production environments as minimal as possible — a reason I dislike using localhost on my local machine for development — but the architecture of WordPress makes that difficult.

I probably wouldn’t encounter these problems if I put each blog in its own instance, effectively duplicating resources. Movable Type does a far better job of creating networks — the schema is designed for it. The WordPress schema for its networks smells of monkeycode.

There is definitely room for improvement.

 

First impressions count, or why I haven’t used Chrome as my default browser

A scathing review of Firefox 11 finally pushed me to an experiment I should have done a long time ago — using Google Chrome as my default browser.

I’m not an early adopter. I may hear about something the early adopters will take up, but I let them vet it out before I take a stab at it. In the case of Google Chrome, I did actually try it out when it was first released, and … it failed. I had Japanese text on my website that would not render at all.

And it was a pretty specific situation too. The Japanese text would disappear when I list Helvetica as the first font for my style sheets to render, and it would happen only on Windows XP machines. As it turned out, the version of Helvetica installed on my computer was corrupt, and it didn’t affect just Chrome but anything using Webkit, including Safari and iTunes.

But the impression was made — I can’t use Chrome if it can’t render Japanese on my own websites. Then there was the matter of add-ons. When I tried out Chrome, AdBlock Plus and Rikaichan hadn’t yet been ported, and I depend on those add-ons.

I would eventually fire up Chrome for cross-browser testing and to use Google Apps at my last job — Firefox was having issues with GMail at some point — but, like Internet Explorer 6 users who couldn’t see the value of upgrading, I didn’t see the value of switching.

Those first impressions from when I gave Chrome a shot persisted. Yes, now that I’ve upgraded my operating system (and got rid of that errant Helvetica font), Japanese fonts appear on my web pages, and most of the add-ons I use from day to day have been ported to Chrome.1 But I gave Chrome a number of chances, and those failures — or the appearance of failures — didn’t endear me to it.

There’s nothing standing in my way now of using Chrome as my default browser, which I’m doing now as an experiment.

I didn’t realize it myself, but I have been grumbling about Firefox for a while. When it loads my last session, it always freezes up trying to render my Twitter stream. And when I visit my own jQuery-heavy sites, I can see Firefox drawing the page before displaying it properly. Even Internet Explorer 9 (on 64-bit, that is) doesn’t draw that slowly.

While I am impressed with Chrome’s speed so far, that hesitation remains. Will Chrome get in the way of my user experience again? And how bad will it be the next time? This experiment attempts to addresses these questions.

1I would like to see a Foxytunes port, but YAHOO! has enough trouble keeping the thing updated for Firefox.

I’m a PC. Except when I’m a Mac. Or a terminal.

I want to buy a MacBook Pro laptop.

Anyone who knows me will probably be taken aback by that sentence. I’m a Windows user and have been since 1995. But don’t mistake my adherence as advocacy.

When it comes to tools, I use what’s available. Hopefully, it’s the right tool designed for the job. You wouldn’t want to use a Philips screwdriver for something that needs a Thomas wrench, but if scissors aren’t available, a fingernail might do the trick.

One morning, I tweeted a complaint about iTunes on Windows, to which a friend of mine replied on Facebook with a question: “Why are you still using a PC?” I have standard answer to that question: I’m not in the income bracket for Apple products.

Yes, I’ve saddle myself with the Windows platform out of economics, not out of brand loyalty or platform advocacy. No, I don’t love Windows, and right now, I’m going through installation hell, having moved from Windows 7 32-bit to 64-bit. I didn’t work extensively with Apple computers till I got a web software engineering job at a Mac shop in 2010.

Till then, the last OS with which I worked on a Mac was System 7. Uh-huh. The late ’90s right around the time Steve Jobs came back into the fold. And boy, did those machines really suck. Back then, I was baffled by the Apple fan boys who insisted on the supremacy of the Mac operating system when it seemed neither Windows nor Mac worked very well. I remember Macs running System 7 crashing as much, if not more, than Windows 98.

A decade later, my previous perceptions were wiped away by the stability and ease of MacOS X, and I began to understand the accolades heaped on Apple. I have to admit — I was impressed. Impressed enough to decide that yes, I would welcome a Mac in home.

But I’m not so enamored that I would completely remake my technology stack to be exclusive to Apple. Not at this point. (That might change if/when I actually do get a Mac through the door. Price has always been a barrier of entry for me with Apple.)

In the 18 months I was working on a Mac in the office and Windows at home, I didn’t feel too much of a cognitive dissonance. Actually, working on a Mac convinced me to upgrade to Windows 7, and I found the transition from Windows XP to Windows 7 a lot easier because of it.

The truth is, I’m a mercenary when it comes to my tools. Could I make better music on a Mac than a PC? It might be easier, but I think the songs would sound the same given my level of skill with audio engineering. What about my work on the web? Most of the software I use to build websites are cross-platform, and I found no huge differences between user experiences.

In other words, it’s not the tool, it’s the person who’s using it. Yes, something could be said about tools getting in the way of the person using them — as Windows tends to do when it breaks down — but when they work, I’m usually too concentrated on the task at hand to notice the system running them. Which is how it should be.

Except when it comes to the COMMAND and CONTROL keys. Switching between those keystrokes is just messed up.

 

How to create a remotely-hosted mirror of a WordPress Network

I’ve been saddled with Movable Type since the start of the 2000s mainly because I coupled an external database with Movable Type a bit too tightly. It was a design decision that snowballed into a monstrosity from which I could not easily extricate myself.

Recently, I started a blog on WordPress.com and discovered I liked the responsiveness of the WordPress UI more than Movable Type. So I started to experiment with WordPress on my own server. The Network feature in 3.x appealed to me because I like being able to use one interface for multiple blogs.

(Side note: I had actually tried out WordPress a few years back, but the lack of support for multiple sites kept me in the Movable Type fold.)

I’ve been impressed so far, and I feel like I want to learn more about WordPress development. So I wanted to mirror the WordPress network I created for a development environment.

And that’s when the wheels came off.

Round and round: Redirection loop

WordPress does some funky things with redirection that I’ve not had time yet to reverse engineer. I just discovered that simply copying the file system and loading a database dump into a new database is not enough. The WordPress Codex site has documentation on creating a development mirror, but it only really works for single-blog installations. When you try to enable the WordPress Network configuration values in wp-conifig.php, you get a redirection loop.

On an unrelated task, I wanted to find out how to change the domain of the primary blog in a WordPress Network. A Google search led me to these instructions, which actually are a bit more heavy-handed than they need to be but contain all the right information to get it done. I noticed as I tried to get my domain changed that I was running into what seemed to be the same redirection loop.

Perhaps my trouble with creating a development mirror is related to changing the domain of the primary blog in the network? As a matter of fact, it was.

Change your primary blog’s domain in three queries

Despite what the instructions say, you do not need to replace every instance of your domain in your database dump. In fact, you can change the domain of the primary blog with three MySQL statements:

  • update wp_site set domain = 'newdomain.com';
  • update wp_options set option_value = 'http://newdomain.com' where option_name in ('home', 'siteurl');
  • update wp_blogs set domain = 'http://newdomain.com' where id = 'blog_id';

Of course, substitute newdomain.com in those examples with your own domain name. blog_id is the numeric id of your primary blog in the database, which is most likely “1”. NOTE: The table names in the example may not reflect the actual table names in your database. But some form of wp_ and site, options and blogs should be in the names.

You will need to change the DOMAIN_CURRENT_SITE constant in wp-config.php to your new domain name as well.

define('DOMAIN_CURRENT_SITE', 'newdomain.com');

These steps assume you’ve already set up a domain separate from your production site, and you’re pointing that domain to a development copy of your WordPress file system. They also assume you have access to a MySQL command-line interface.

In short, creating a development mirror of a WordPress Network involves changing the domain of your primary blog to prevent a redirection loop.

 

I don’t like programming as much as you

In his book Listen to This, Alex Ross profiles Marlboro Music, a summer retreat for classical musicians, with a particular focus on one of the festival’s directors, the pianist Mitsuko Uchida. In one anecdote, Uchida attempts to convince Romanian pianist Radu Lupu to visit Marlboro:

“I got very excited, describing how people do nothing but play music all day long. But he said no. His explanation was very funny. ‘Mitsuko,’ he said. ‘I don’t like music as much as you.'”

That sentiment sums up my relationship with software development.

Of course, Lupu has some level of dedication to his art, if winning the Van Cliburn competition in 1966 is any indication. At the same time, it’s refreshing to hear a performer of Lupu’s caliber admit to his limits, if only in jest.

I earn a living working with web sites and databases. I like it. The work day passes quickly when I’m head down in a project, turning an idea into a tangible product. Part of it is the wonder of getting something to work. The rest is ego in not letting that stupid bug or that idiotic configuration defeat me.

But there comes a point where the proverbial wall smashes into my face. HTML5? Node.js? Ruby on Rails? Hey, great! Wonderful! I’ll get right on that, but first, there’s this other project I’m working on that suits my state of mind right now. So I’ll get back to you.

There’s a lot of punditry out in the land of developer blogs about what makes a “good” developer/engineer/programmer/whatever. A lot of the talking points are the same — gotta be curious, gotta code outside of work, gotta have passion, gotta not treat it like some 9-to-5 job. If that’s the case, I was a damn good developer in the early 2000s, but I’m nowhere as good now.

Sorry, software engineering is not how I choose to center my life. It’s certainly how I choose to center my professional career, and I take those skills to other things I do. But I don’t like programming as much as you, and I don’t think that makes me any worse off.

Sure, I’ll code outside of work in moderation. I’m curious to a point, and my passion has its limits. But my 9-to-5 job is exactly that, and my “life” portion of my work/life balance contains more things than just code.

If anything has sustained my career for as long as it has, it’s a principle that drives any work I’ve done, be it music or journalism or development. Rands puts it succinctly and in italics: “We must not ship crap.”

Live by that and everything else falls into place.