Archive for the 'Tips' Category

Upgrading to Mac OS X 10.5.5

Friday, September 19th, 2008

The upgrading to Mac OS X 10.5.5 went fine. Downloading and installing 340Mb update was a breeze and a matter of 20 minutes, but then. Immediately after the restart neither the keyboard nor the touch pad worked. Putting into sleep (it was late night and I postponed the investigation until morning) and getting back to normal unfreezed the keyboard and mouse pointer, but the touch pad button still didn’t work.

Another reboot helped and now everything is working. One thing I noticed though, it was accessing the hard drive a LOT more during the startup. Maybe it was just installing / indexing changed parts, who knows… we’ll see.

Remember

  • If you see oddities right after upgrading, don’t panic. The reboot may help.
  • If your mouse isn’t working,use the power button (hardware) to call the reboot / sleep / shutdown dialog and the “space” key to select the Reboot option.
  • If your keyboard isn’t working, try closing your laptop to sleep.

Wordpress: “Unable to locate WordPress Plugin directory”

Wednesday, September 10th, 2008

Automatic plug-in updates are cool, but only when they work. I made attempts to understand what’s wrong with the “update automatically” feature several times, and always hit the same message after entering my FTP details: “Unable to locate WordPress Plugin directory”.

As a computer geek, I know why it needs FTP, but it wasn’t really clear what exactly it was looking for in the root of the FTP directory and why it didn’t find it. I figured that my server setup is a bit different from what they expected, and scanned the sources for clues.

Apparently, they are looking for the wp-settings.php file which is sitting in the root of the WP installation. So when they find the file, they know where to start looking for plug-ins folder. In my case, it was light years away from the FTP root, so here’s what I did:

  • Created an FTP user specifically for the blog
  • Made the root folder of the blog be the home directory of this user
  • Fed the user name and the password to WP when it asked for the FTP again

All went very nicely and hassle-free. Now you know what to do when you see “Unable to locate WordPress Plugin directory” when attempting to update your plug-ins automatically.

Ruby: Hash#fetch and More

Wednesday, September 10th, 2008

Sometimes you rediscover little features that make your life whole lot easier. Today when reviewing the code of my co-worker I stumbled upon the use of the “fetch” on the Hash object. Check it:

h = { :existing_key => "value" }

h.fetch(:existing_key)  # returns "value"

h.fetch(:some_key)  # raises exception
h.fetch(:some_key, "default") # returns "default"
h.fetch(:some_key) { ...some math... }  # returns some math

One other related technique is:

h[:existing_key]   # returns "value"
h[:some_key]  # returns nil
h[:some_key] || "default"  # returns "default"

Armed and ready!

P.S. Thanks for a great tip, Craig!

Timeout when publishing new posts in WP

Wednesday, July 23rd, 2008

By no means this is a usual thing, but since there’s very little information (in fact only one link that gives no real answers) on what to do when you see the error below upon publishing a post, I decided to share the solution:

Fatal error: Maximum execution time of 30 seconds exceeded in /home/…/public_html/wp-includes/wp-db.php on line 170

The error points to an innocent line that removes single quotes from a database query, and it’s misleading. One of the real causes for this problem may lay in the slug (post name) field. You can see this field in the Permalink line below the Title field in your post editor; it’s emphasized.

In my case, there was an endless attempt to find a unique name for a post having an HTML entity (long dash) in its slug. Even though it was correctly encoded with %NN sequences, the database sever had hard time executing the query correctly. So, the first check on your list is:

Make sure your post slug (that symbolic part of the permalink) has no special symbols, but only letters, digits and dashes.

Ubuntu 8.04 is Out

Friday, April 25th, 2008

It was Clean Thursday yesterday and hopefully you were cleaning your hard drive for a great new Ubuntu 8.04. It made it to the download sites in the evening and since then they creak under a heaviest load.

Have you ever wondered why they version their releases in that strange way — …, 7.04, 7.10, 8.04? I never mulled over that, but yesterday I was enlightened. Look at the numbers closely: 2007.04, 2007.10, 2008.04. Alright, now it does make perfect sense, doesn’t it?

While we are at it, let me explain briefly how I partition my hard drive to aid quick and painless system upgrades. Keeping in mind that Canonical releases a new version precisely once a half year, it is judicious to keep OS on a separate partition so that it can be easily replaced, while your home directories stay intact. This is how I do it:

  • / (root) partition — 5 Gb
  • /home partition — 5 Gb
  • swap partition — 2 Gb

Every time a new version of Ubuntu comes out, I simply format the root partition and install the release there from a Live CD. Certainly I need to restore all apps later, but it’s not a big deal actually as I maintain a nice list for this matter.

I know Ubuntu has a mechanism to upgrade itself to a newer version through the Updates manager, but, in practice, being upgraded in this fashion, OS doesn’t unveil its full potential, and more like “mimics” the previous version. I compared the two in the past and am inexpressibly happy about the discovery.

Hopefully this information will be valuable in the light of upcoming wave of upgrades.

Upgraded to WP 2.5

Wednesday, April 2nd, 2008

Finally upgraded my blog to WP 2.5 today. Looks so sweet that I can’t help sharing it with you.

The administrative part is completely reworked, and it was a stressful experience to see the updated Dashboard, but eventually I’m getting used to it (sort of).

Basically I like the AJAXy Write Post page packed with nice “Add media” section, dynamic tags and categories, improved editor and many other things. It became much lighter and noticeably easier to use.

Give it a spin, it’s worth it!

By the way, I find it a lot easier to maintain and upgrade when WP is installed by checking the code out of the Subversion repository. The whole upgrade process takes counted minutes as it involves running a single command to update sources and opening the database upgrade page in the browser. Check the WP on Subversion page for more details.

Productivity Tip

Wednesday, March 19th, 2008

Today, as I was playing with ideas after a big chunk of work, one interesting thought came, and it’s worth sharing. Everybody likes when the job is simple, straightforward and easy to do. Sometimes though times come when an assignment is … well, different.

I like to shoot these tasks first and, speaking in the context of PROgramming, like to make everything possible to never get back. If it implies writing a hundred of tests, that’s fine, just never again… you hear me? It’s not that I hate what I do, it’s that I, as a living being, hate stress.

Usually, I took the rest of the day off right after dealing with a complex or mundane to refresh the mind. It worked well, but took a lot of time and had a bitter taste of excuse to skip working hours. Today I invented something different for myself.

Here the summary of points that I (and hope you) usually keep in mind when working:

  • Focus on the task
  • Stop watching the clock
  • Keep a clear plan of attack with very small sub-tasks to cross them out as quickly as possible
  • Do whatever it takes to protect yourself from getting back (comprehensive tests suite, clear design etc)
  • Make a lot of comments to give you a hand if you still need to change something later

And now something new:

  • When the task is over, check in the sources, run all tests, and finish anything else that attaches you to the task, and then
  • Take a coffee break and detach yourself from it and the results as if somebody else did the job and you are left with an easy part (calling the module, using freshly designed database etc)
  • Start (not continue) working refreshed and, possibly, give you some easy and fun tasks to get the happy feeling of great job you always did

These are all simple steps, but I know no one who would follow them. I read many standard advices, like 50 minutes of work / 10 minutes of rest that are far from a silver bullet. They sound like a quick and dirty rule for those (or by those) who don’t really want to think WHY these breaks are important and, what’s more important, what to do during them.

With this last summary I feel I got closer to a better understanding of my own brain and how it works. Now I know how to reset that anxiety and stress to continue moving on without passively waiting for the same effect first.

Hope I induced some fresh ideas and insights. Feel free to share back.

Cheers!

SEO for Wordpress

Sunday, August 12th, 2007

Here’s one article that grabbed my attention this morning. It’s a nicely compiled list of suggestions for Wordpress bloggers on how to optimize their diaries for search engines. It’s a bit technical, yes, but pretty useful and easy to grasp. Truth be told, the long tail of responses clearly indicates that I’m not the only one attracted by the simplicity of narration.

Mounting Remote DVD Drive on Windows XP

Monday, December 18th, 2006

Yesterday I bought a breathtaking DVD game — Fahrenheit: Indigo Prophecy — which appeared to be too heavy for my laptop. Unfortunately, even though my desktop PC has the cutting-edge video card and tons of memory it is relatively old and has no DVD drive. At first I tried creating a disk image and mounting it as a virtual drive, but the attempt spectacularly failed because of StarForce copy-protection system. It just refused to recognize the disk even though the key perfectly matched. Eventually I was able to find the solution (credits go to Kate for her sensible suggestion) — mounting the remote DVD drive.

(more…)

Preserving Links When Moving From MovableType To Wordpress

Thursday, November 2nd, 2006

So you plan on moving from MovableType to Wordpress for one or another reason. The Wordpress has an excellent Import function which lets you move all posts and comments from your MT to its database. The real problem is that the URLs of the posts won’t look the same. If you leave it this way, you will lose all the references to your posts. Here’s my complete recipe — the detailed step-by-step guide.

(more…)