chxo internets RSS

A network of memes,
by Chris Snyder

See also
CHXO Internet
twitter.com/64

Archive

Feb
10th
Wed
permalink

Farmville on Web Scaling

This was a pretty good read, How FarmVille Scales to Harvest 75 Million Players a Month. The lessons learned are worth generalizing:

  1. Interactive apps are write-heavy.
  2. Design every component as a degradable service, and provide a mechanism to degrade services server-side during peak demand.
  3. Cache incoming data - they cache everything coming in from Facebook
  4. Usage spikes during new releases of an app
  5. Use sampling to make sense of large traffic flows
Feb
2nd
Tue
permalink

De-columnize Regex

\s+\|\s*\n\|

This regular expression matches the pipes and spaces in mysql output like:

| $dq$$form                  | 
| $dq$$module                | 
| $dq$$place                 | 
| $dq$$site                  | 
| $dq$$thing                 | 

Sometimes it’s handy to extract just the values from a pasted query result.

Jan
23rd
Sat
permalink
Finding /dev/null from ZDE preferences.

Finding /dev/null from ZDE preferences.

permalink

Zend Studio 5.5 hangs “loading source control data”

Thanks to a post buried in the Google cache of Zend’s support boards, I give you the means to solve this annoying bug: set the svn and cvs paths to /dev/null.

I tried setting just the svn path to /dev/null, but ZDE.app was still loading source control data when opening the problem project. Then I set the cvs path to /dev/null, restarted, and no more loading.

According to the thread, this also works, changing ZDE/config_5.5/cvs_options.xml so that the value is false. Not sure if it works, I like the /dev/null solution too much.

<customized_property ID="cvs.enableCvsIntegration">
		<boolean value="false"/>

                        
Dec
22nd
Tue
permalink

Revert svn deleted symlink

Let’s say you have a symlink or two in your svn repository, and one day you decide to delete one of them. You use the svn rm command to do so.

$ ls -l tinymce-3.2.6
lrwxrwxrwx ... tinymce-3.2.6 -> ../../jslibs/tinymce-3.2.6
$ svn rm tinymce-3.2.6
D         tinymce-3.2.6 
$

But a minute later you realize that you actually need that symlink. You haven’t committed anything. Normally you would just svn revert and go about your business.

Alas, your working directory is in limbo now; svn revert won’t restore, and svn up ignores the missing symlink. The trick, apparently, is that you must commit the deletion before you can roll it back.

$ svn commit -m "Uh, accidentally deleted wrong version of tinymce"
Deleting       tinymce-3.2.6

Committed revision 12679.

Then you copy (I kid you not) the link back in from a previous revision, and commit that.

$ svn copy -r 12678 http://svn.example.org/path/to/tinymce-3.2.6 \ 
./tinymce-3.2.6
A         tinymce-3.2.6
$ svn commit -m "Respawned tinymce-3.2.6 from previous revision"
svn commit -m "'Resurrected' link from previous revision"
Adding         tinymce-3.2.6

Committed revision 12680.

Now the symlink is back and you can carry on.

The SVN Book calls this “resurrection”, I call it “respawning.” Thanks to this post for the tip.

Dec
19th
Sat
permalink

Rock Solid HTML Emails

Great (no, really great!) summary of the many quirks to keep in mind when building an HTML email template:

http://24ways.org/2009/rock-solid-html-emails

I had to learn most of these the hard way recently, but I haven’t tested against Y! mail so I’m sure some of my work is broken.

The biggest disappointment, by the way, is Gmail. I mean, inline CSS only? Really? What kind of kludge is that? It bulks up message size considerably. I guess the alternative is to use… an iframe. Oh well.

Dec
17th
Thu
permalink
The goal is to look over our shoulder and see Snow White and Pinocchio and Dumbo standing there saying, ‘Be this good.’ We shouldn’t be intimidated by them; they’re an arrow pointing someplace.
— Roy E. Disney [NYT]
Nov
19th
Thu
permalink
Setting middle click to three finger click in BetterTouchTool.

Setting middle click to three finger click in BetterTouchTool.

permalink

Middle Click on Multitouch Magic Mouse

Using my shiny new multi-touch “magic” mouse now, and I love it. Scrolling is as natural now as it is on a trackpad, and right-click works flawlessly for a mouse with no buttons. But, oops! How do I send a middle-click (button 3)? You know, to open a link in a new tab?

Typical Apple: two steps forward and one step back. The traditional Mouse preference pane allows you to assign button 3 to the scroll wheel. But the new Mouse preference pane, for the magic mouse, doesn’t. It plays little videos to show you how to use the mouse, but the number of things you can do with it has been limited. Ugh.

Enter BetterTouchTool by Andreas Hegenberg, available at http://blog.boastr.net/. Launch it, map “three finger click” to MiddleClick, and you’re done. It ain’t pretty (yet?) but it works.

Sep
11th
Fri
permalink

Host-Based Redirect in Apache

Here’s a recipe for redirecting by hostname in Apache. It’s like using Redirect but you can have more than one per VirtualHost container.

This is especially useful when you have a single SSL host with a lot of different sub-sites on it, and you want to provide the convenience of virutal host names to colleagues or clients. It’s obviously much easier for people to remember (and type) board.example.org than ssl.example.org/sites/board, and this technique makes it easy to provide that.

<VirtualHost *:80>
ServerAdmin webmaster@example.org
ServerName ops.example.org
ServerAlias board.example.org it.example.org
DocumentRoot /usr/share/apache2/htdocs

RewriteEngine On

RewriteCond %{HTTP_HOST} ops.example.org
RewriteRule ^(.*) https://ssl.example.org/sites/ops$1 [R=301]

RewriteCond %{HTTP_HOST} board.example.org
RewriteRule ^(.*) https://ssl.example.org/sites/board$1 [R=301]

RewriteCond %{HTTP_HOST} it.example.org
RewriteRule ^(.*) https://ssl.example.org/files/it$1 [R=301]
</VirtualHost>

These directives provide redirects for three different virtual hosts, subdomains of example.org. Each will redirect to a specific location at https://ssl.example.org/.

The $1 at the end of the RewriteRule causes the originally requested location to be appended to the redirect. In other words, a request for http://board.example.org/minutes.html will redirect to https://ssl.example.org/sites/board/minutes.html

Finally, the [R=301] flag causes Apache to issue a 301 Moved Permanently redirect, rather than the default 302. Some say this is better practice for search engines and such. That doesn’t really apply in this specific example (since these redirects are to secure sites) but it doesn’t hurt, either, and might save some browser overhead on subsequent requests for the virtual hostname.