How to delete “nobody” files from a directory I own in FreeBSD?

Lazyweb, here’s a quick question for you. On a FreeBSD system, suppose I own a directory called “foo”. Inside that “foo” directory are some files (file1, file2, file3) owned by the “nobody” user. How do I delete those files? When I type the command “rm file1″ I get the response “rm: file1: Permission denied” even though I own the parent foo directory.

Any suggestions? It’s on a machine where I don’t have root access.

Update: Problem solved, but in an annoying way. The files were created by a PHP script, so I wrote a new PHP script to remove the files in question. It looked something like

<?php
unlink(“./advanced-cache.php”);
unlink(“./wp-cache-config.php”);
unlink(“./cache/meta/wp-cache-33c58158f712bca22c3414a8df924c46.meta”);
unlink(“./cache/meta/wp-cache-8f9198130973778a72a378ce93042c4b.meta”);

unlink(“./cache/meta/wp-cache-a9e95ca4074fc06d9672d81133751b8e.meta”);
rmdir(“./cache/meta”);
?>

This forum thread from 2001 describes the idea (thanks to Mark and the people that commented).

In case you’re wondering, pair Networks’ FreeBSD systems really don’t work well with the WordPress “WP Cache” or “WP Super Cache” plug-ins, because both plugins make files owned by the “nobody” user which appear to be impossible to delete from the SSH command-line.

Three tips for “company blogging”

This is my personal blog. I don’t run my draft posts by Google’s PR or legal team, other than maybe 2-3 times when I thought a post might have legal implications. But I have learned a few hard-won lessons. So, when someone recently asked me for tips about talking to the public, I couldn’t resist. Whether you blog for the company officially or unofficially, here are my top three rules of thumb:

  1. Don’t make hard promises about the future. One of the beauties of web-based software and services is you get to decide when to push out changes. Don’t give up that freedom by promising a feature to the outside world by a certain deadline. Maybe later you’ll decide that a different feature is a bigger win. Or you may want to hold off for a week to polish down the last rough edges on a product.
  2. Don’t trash talk a competitor. Your product should be strong enough that you don’t have to diss a competing company. Back in 2002, an article in the Boston Herald showed up about another search engine. The article claimed that “The entire XXXXXXXXX Catalog is updated every 9 to 11 days.” I knew for a fact that wasn’t true and at first I wanted to rip that claim to shreds like a bulldog. But (with the advice of some wiser Googlers), I decided to take the high road instead of picking a fight. In fact, claims like that motivated Google to be fresher and faster. Now I believe Google has the freshest index of any of the major web search engines.

    Sometimes other companies will throw dirt in your direction. In that case, the challenge is to correct any misperceptions without picking a fight. But first ask yourself: do you really need to respond at all? If not, then maybe it’s better not to get pulled into an argument where everyone involved loses a little credibility. So far I’ve written 10-15 draft posts (and who knows how many I’ve written in my head) where I was snarky about another search engine, and then not published the post. Each time when I look back after a few months, I’m glad that I didn’t post.

  3. Don’t post when you’re angry. This is probably the most important tip. If you have to write something, go ahead, but don’t press publish until you’ve slept on the situation or had a chance to calm down completely.

I’ve broken each of these rules, and regretted it almost every time. What tips would you suggest when blogging about your company?

A Quick Tutorial on JavaScript Bookmarklets

Bookmarklets are very handy pieces of JavaScript code that you can bookmark. In HTML, if you want a link to open in a new window, you’d write it like this:

<a href=”http://www.mattcutts.com/blog/” target=”_blank”>Matt Cutts</a>

Go on, try it on this link: Matt Cutts

If you wanted to create a bookmarklet to open a new window or tab, you’d do it like this:

javascript:(function(){ window.open(‘http://www.cnn.com/’); })();

so the actual bookmarklet link that would appear in your HTML as

<a href=”javascript:(function(){ window.open(‘http://www.cnn.com/’); })();”>CNN</a>

and if you want to play with it, here’s the trivial CNN example bookmarklet. On Firefox, you can drag the bookmarklet to your bookmarks bar. On Internet Explorer, you can right-click and select “Add to Favorites…”.

The reason I mention this is that bit.ly is a url shortening service that I like, and they have a bookmarklet, but it replaces the page that you’re shortening. Their bookmarklet looks like this:

javascript:location.href=’http://bit.ly/?url=’+encodeURIComponent(location.href)

So suppose you find a new page that you want to twitter about or shorten the url for some reason. You want a bookmarklet that opens the bit.ly url in a new window or tab instead of replacing the current page. Combining the two bookmarkets, you’d get

javascript:(function(){ window.open(‘http://bit.ly/?url=’+encodeURIComponent(location.href)); })();

and here is a bookmarklet for bit.ly that opens your bit.ly url in a new window or tab. You can just drag the bookmarklet to your bookmarks folder.

That’s enough to get you started with bookmarklets, but you can find more info about bookmarklets by searching or by looking at example bookmarklets around the web. For example, industrial-strength bookmarklets often load JavaScript dynamically from a webserver. That way if you want to upgrade or improve the functionality of the bookmarklet, you can change the code on the webserver instead of asking every user to update their bookmark. On the other end of the spectrum, some quick-and-dirty bookmarklets don’t even bother escaping the url.

I want to open a new tab, not a new window!

Some webmasters want to choose between a link opening a new tab vs. a new window. I believe that you don’t get that choice — it’s up to the user and their web browser. For example, in Firefox a user can select their desired behavior under Tools → Options → Tabs → “New pages should be opened in:” and choose “a new tab”. Or to tweak the setting directly, the user can type “about:config” into the location bar/address bar and then modify the “browser.link.open_newwindow” option to be one of the following values:

1 = open new windows in the existing window
2 = open new windows in a new window
3 = open new windows in a new tab (this is the default in Firefox 2 and Firefox 3)

See this about:config page for more info.

Likewise in Internet Explorer, the user can go into Tools → Internet Options → “Settings” button in the Tabs section and then under “When a pop-up is encountered:” choose “Always open pop-ups in a new tab”.

5 Steps to Upgrade From a Hacked iPhone to an iPhone 3G

I know what you’re thinking: “Matt, I hacked my original iPhone. Now I want to share in the iPhone 3G fun, but I’m worried that something horrible will happen if I upgrade to the iPhone 3G.”

Buck up, fellow iPhone hacker. I’ll tell you how to upgrade from your hacked Apple phone and keep all the settings you love from your original iPhone. The good news is that it’s not hard and there’s a set of five steps that will combine the comfort of your old settings with the joy of the new 3G iPhone. I’ll lead you through the steps.

1. Upgrade iTunes and sync your old hacked iPhone

Upgrade to iTunes 7.7 (or whatever the latest version is). Plug your hacked iPhone into your computer and make sure that you sync. When you sync, a backup of your iPhone’s settings data is stored in iTunes. Recharge the power in your old hacked iPhone and turn it off. If you want to be ultra-safe, see my post about how to backup iPhone data.

2. Buy an iPhone 3G

This step is time-consuming, but not hard. Apple has a page for its stores and after 9 p.m. you can check the Apple iPhone availability to find a store that has the new iPhone 3G. Hint: if there are multiple stores in your area, call each to see which has the shortest wait. When you buy the iPhone 3G, you don’t need to mention to the salespeople that your previous phone was hacked. Just buy the iPhone 3G and let them activate the phone in the store.

3. Restore the backup of your hacked iPhone to your iPhone 3G

(If you decide to “start fresh” with your new iPhone 3G and don’t want to restore contacts, bookmarks, music, etc. from your old phone, skip this step.)

Resist the temptation to start immediately customizing your iPhone 3G. You’re just going to override any changes when you restore your old iPhone’s settings anyway. In particular, make sure you keep the passlock (where you have to type a PIN to unlock your iPhone) off for the time being. Go home and plug your new iPhone 3G into the same computer with iTunes 7.7 where you did a sync on your old iPhone. iTunes will ask if you want to register your iPhone. I registered my iPhone, but I don’t think it was necessary — looking back, I think iTunes asked me to register to get permission to send me email offers. Next, iTunes will ask if you want to try 60 days free of MobileMe. I didn’t want that, so I declined. Only after those two offers did iTunes ask if I wanted to set up the new iPhone 3G as a new phone or restore from a backup. The choice looks like:

iTunes offers to restore iPhone

Choose to restore from a backup and the last sync of your old hacked iPhone should be offered as a choice. Let iTunes restore the backup data and settings from your hacked iPhone to your new iPhone 3G. Once it’s done, pretty much everything should be like it was on your hacked iPhone. The iPhone 2.0 firmware adds some new options, so make sure you explore the settings menu and set any new options the way that you want. Also, if your iPhone is configured to fetch email, your email passwords on the new iPhone 3G will be empty. You will need to re-enter your email passwords.

Finally, if you want to use the Apple App Store, you may need to add a credit card or authorize your computer to purchase things, even if you only want to download free applications. I have a personal policy not to put my data where I can’t get it back out, so I tend to buy MP3s instead of buying music with proprietary Digital Rights Management (DRM) from the Apple Store. As a result, my computer had never been authorized to buy things from the Apple Store. To authorize your computer, in the iTunes program click Store->Authorize Computer… and enter your Apple ID. Once your computer is authorized, you might need to click Store->Check for Purchases… if you tried to download an application from the App Store before your computer was authorized.

4. Upgrade your old iPhone to firmware version 2.0

The iPhone running software version 2.0 has been hacked, so there’s no need to keep running old firmware on your old hacked iPhone. Plug your old hacked iPhone into the computer running iTunes 7.7 and make sure that iTunes is running. Under the “Devices” entry on the left hand side of iTunes, when you click on the iPhone device, you should see a screen with a “Check for Update” button. Click that button. I was running firmware version 1.1.1 and at first it offered me firmware version 1.1.4. So I exited iTunes, restarted iTunes, and clicked “Check for Update” again. Then it offered me firmware version 2.0. Click to install firmware version 2.0 on the old hacked iPhone.

5. Erase the settings and data on your old iPhone

One nice thing about the iPhone’s firmware version 2.0 is that it adds a “secure wipe” that attempts to erase all data completely from your iPhone. That means you can sell the old iPhone or give it to a friend without worrying about all those crazy pictures you took, the 1-900 numbers in your contacts, the SMS messages that reveal things you want to keep private, etc. Here’s how to erase everything on your old iPhone. Eject the phone in iTunes, disconnect the phone from the computer, then press Settings, then General, then Reset, then Erase All Content and Settings, then Erase iPhone. You may have to confirm a couple times that yes, you really want to wipe your iPhone. The process takes about an hour, so I connected my iPhone to a cable that was plugged into a power outlet to ensure that the iPhone wouldn’t run out of power in the middle of wiping it.

When the iPhone is finished erasing itself, it’s suitable for giving to a family member or selling on eBay or whatever.

How to stop junk mail

I’ve been learning how to stop receiving junk mail, and I thought I’d share what I’ve learned.

Reducing Junk Mail

There are several services that will help you reduce your junk mail:

- GreenDimes offers a free basic service, but I decided to do their $20 one-time fee because it offered a few extra things I wanted. GreenDimes walks you through some easy steps that will reduce unsolicited mail, and also lets you decline catalogs. Each time you receive an unwanted catalog, you go to GreenDimes and type the name of the catalog in. GreenDimes takes care of removing you from that catalog’s mailing list. I’ve been quite happy with this service, especially since it’s a one-time fee.

- ProQuo is a free junk-mail reduction service. In the future, they intend to make money when consumers opt-in to request offers; ProQuo will make money from those advertisers. I tried this service today. It lets you stop many services with just a couple mouse clicks per service, but for about 50% of the marketers (maybe 10-15 of them) you have to print and send a letter or leave to an external website to complete a form. It’s still better than nothing though, because even if you’re lazy you can opt out of a lot of junk mail with just your mouse for free. Overall, the service is free, easy, and helps you opt out of a wide variety of lists.

- Catalog Choice is a site solely for opting out of catalogs. It doesn’t tackle things like credit card offers, PennySaver, or list brokers, but the site is clean with a really nice user interface. One of the founders, Daniel Katz, has been interviewed by Bill Moyers, so I trust that they’re a legit organization, even though their WHOIS information is private and there’s very little information about the group on their site. It sounds like three different environmental groups formed Catalog Choice as a non-profit. One piece of advice for Catalog Choice: please give a little more information about yourselves (e.g. history, founders, press) so that people can easily see that you’re legitimate.

- 41pounds.org charges $41 for five years of service. The name comes from the fact that they claim to block 41 pounds of junk mail per year for you. I haven’t tried this service.

Contacting services directly

- You can visit the webpage of the Direct Marketing Association (DMA) to opt-out online so that you don’t receive mail from companies that use DMA lists. The pretty url http://www.dmaconsumers.org/cgi/offmailinglist takes you to the url https://www.dmachoice.org/MPS/proto1.php where you want to select option #3 (“Remove your name from DMA Member Prospect Lists”). You will have to provide a valid credit card number, but your credit card will not be charged.

- You can opt out of ADVO online.

Other options

- While you’re at it, why not place yourself on the “Do not call” list at www.donotcall.gov to prevent most telemarketers from calling you? All you need to give is your phone number and an email address, and you will be permanently opted out. Read more about the do-not-call list if you’re interested.

All these actions won’t eliminate junk mail completely, but it will prevent a lot of the junk from showing up in your mailbox. These aren’t affiliate links, just stuff that I think people will find handy. Good luck!

css.php