Introducing YippieMove '09. Easy email transfers. Now open for all destinations.

It’s a good secure practice to force SSL on the the Admin back-end and the login-page in WordPress. I’m hardly the first one to point this out. There’s even an entire page over at WordPress’ website dedicated to this (Administration over SSL).

I’ve spent the last few days setting up WordPress as a CMS and webshop (with wp-e-commerce) for a company. While there are no credit cards involved in the webshop, I still wanted to secure the login and admin page. However, since the website is hosted at Dreamhost, I was limited to the .htaccess file. Moreover, since the .htaccess-file is the same for both SSL mode and non-SSL mode, I needed to use some kind of condition to avoid creating an infinite loop.

Enough rambling. The code snippets over at ‘Administration over SSL’ didn’t work, so I had to write one myself. Here it is:

RewriteCond %{HTTPS} !=on
RewriteRule ^(wp-admin.*|wp-login.*) https://www.yourdomain.com/$1
RewriteCond %{HTTPS} =on
RewriteRule !^(wp-admin.*|wp-login.*) http://www.yourdomain.com/$1

Also, please note that this snippet must be after WP’s own redirection snippet, otherwise it won’t work. The entire .htaccess file looks as follow:


RewriteEngine On

## WordPress' SEO permlinks
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

## Beefing up the security
RewriteCond %{HTTPS} !=on
RewriteRule ^(wp-admin.*|wp-login.*) https://www.yourdomain.com/$1
RewriteCond %{HTTPS} =on
RewriteRule !^(wp-admin.*|wp-login.*) http://www.yourdomain.com/$1

Update: This will actually not work very well as images for the back-end are not stored in any of the SSL folders. Hence the the server tries to serve the images without SSL while you are in SSL mode, which does not work very well.

Author: Tags: , ,
Introducing YippieMove '09. Easy email transfers. Now open for all destinations.

Update: Please note that this does not apply to FreeBSD 8.x as POSIX Semaphores are now enabled by default. Hence you do not need to recompile the kernel.

Celery is a great product. Unfortunately getting it to work on FreeBSD is a bit of a hassle. After some troubleshooting we managed to get it running, here’s how we did it.

We are running FreeBSD 7.2, but this is likely to work on 7.x.

Step 1: Recompile kernel

I assume that you know how to compile the kernel on FreeBSD. If not, you can find out how to do it here. I also assume that you have the source code for FreeBSD installed.

Let’s head over to the code.
#cd /usr/src/sys/i386/conf

Make a copy of the standard kernel-config.
#cp GENERIC YOUR_KERNEL

Now we need to edit the kernel-config. You can obviously use any editor, but I prefer joe.
#joe YOUR_KERNEL

Change the ‘ident’ from GENERIC to YOUR_KERNEL
ident YOUR_KERNEL

This is the most important part. We need to add support for POSIX Semaphores. Add the following line:
options P1003_1B_SEMAPHORES # POSIX-style semaphores

That’s it for the kernel-config. Now just save the changes and exit (^K+X in joe).

Next up is the compiling and installing the actual kernel.
#cd /usr/src
#make buildkernel KERNCONF=YOUR_KERNEL
#make installkernel KERNCONF=YOUR_KERNEL
#reboot

That’s it. If everything went well, you should now have a kernel with POSIX Semaphores enabled.

Step 1: Install Python

I assume you got the ports installed, so here we go.

#cd /usr/ports/lang/python26
#make config

Make sure to select SEM and deselect PTH. If PTH is enabled, Celery won’t work.

If you’re running FreeBSD <7.2, you will need to edit Makefile and comment out the following:

Line 63-71:
#.if defined(WITH_SEM)
#.if ${OSVERSION} >= 701106
#SEM_MSG= ""
#.else
#IGNORE= POSIX semaphore support only works in FreeBSD 7-STABLE and later
#.endif # ${OSVERSION} >= 701106
#.else # !defined(WITH_SEM)
#SEM_MSG= "@comment "
.#endif # defined(WITH_SEM)

and line 186:
#.if ${OSVERSION} >= 701106

Next up, install Python:
#make clean install

Step 3: Test with simple app

With Python installed, let’s see if it actually works. To accomplish that, we will create a simple app.

Create a new file: test_mp.py

import multiprocessing as mp
p = mp.Pool(16)
import time
p.apply_async(time.sleep, 1)

Let’s run it:
#python test_mp.py

If the application silently exits within a second or so, you’re good to go. If not, please re-visit Step 1 and Step 2 to make sure you configured everything properly.

Step 4: Install Celery

This is probably the easiest step:
#easy_install celery

That’s it! Good luck!

Credits: Thanks asksol and raysl over at #celery.

Author:
Introducing YippieMove '09. Easy email transfers. Now open for all destinations.

Did Expose/Spaces stop working all of the sudden? This happens to me almost every day. Most of this time this is when I resume my MacBook Pro at home. I assume this has something to do with the fact that I have an external monitor connected at the office, and that somehow messes with Expose/Spaces. Luckily there is a quite simple solution.

  • Fire up Activity Monitor (/Applications/Utilities/Activity Monitor)
  • Filter the results for ‘Dock’
  • Click on ‘Dock’ and ‘Quit Process’
Filter for 'Dock' in Activity Monitor

Filter for 'Dock' in Activity Monitor

Unfortunately this will collect all windows into a single ‘space,’ but you will be able to once again use Expose/Spaces. Enjoy!

Author: Tags:
Introducing YippieMove '09. Easy email transfers. Now open for all destinations.

I know, I know, this topic has been covered a billion times before. Everyone has got their own idea of what the perfect multimedia system is. But hear me out, I think you’ll like what I have to say. Since you’re probably in the process of upgrading to Snow Leopard, perhaps now is a good time to reorganize your media.

When we’re done you will have the following:

  • Central iPhoto and iMovie libraries
  • Your central iPhoto library accessible in Front Row
  • All your music, movies and TV shows, organized and accessible directly from your remote control

Have all your media accessible with your remote control.

Have all your media accessible with your remote control.

The requirements

Like all solutions, there are some requirements. However, I would consider these requirements pretty basic. For most gadgeteers out there, these are things you already got in your possession:

  • A Network Attached Storage (eg. Drobo, ReadyNAS, or an old Linux box). Preferably something with some redundancy (RAID1, RAID5, RAID-Z etc.)
  • Two or more Macs with Leopard or later (perhaps a Mac Mini to the TV/Projector and an iMac as a desktop)
  • A lot of media (picture, music, movies, TV shows etc).
  • Sounds too good to be true? Well, it isn’t. Best of all, you won’t have to spend a single dime on software. So what’s the secret? Good ‘ol UNIX symlinks and a software called Plex. That’s it.

    Configuring the NAS

    Since I have no idea what kind of NAS you’ve got (and it doesn’t really matter), all I’ll say is that I recommend that you create the following shares:

    • ‘pictures’ – for the iPhoto library
    • ‘videos’ – for the iMovie library
    • ‘movies’ – for all your movies
    • ‘tvshows’ – for all your TV shows
    • ‘music’ – for all your music

    If your NAS supports AFP, that’s great, but SMB will do just fine too.

Copying the media to the NAS

While I’m not going to cover how you copy your movies, TV shows and music (as I assume you know that), I will however cover how you copy your iPhoto and iMovie libraries.

Start by connecting to your network shares ‘pictures’ and ‘videos’ (or equivalent). You can do that either by browsing to them in Finder, or use Finder’s ‘Connect to server’ feature (available under ‘Go’ -> ‘Connect to server’).

If you’re a power user, skip the next four paragraphs.

Let’s start with the iPhoto library. Open up your home directory and go into the ‘Pictures’ folder. Now copy the ‘iPhoto Library’ folder over to the share ‘pictures’. Depending on the size of your archive and the speed of your network, this can take a while. Once done, rename the folder ‘iPhoto Library’ on your local computer to ‘iPhoto Library.old’ or something similar.

Now, this is the important part. Go over to the ‘picture’ share on the NAS and drag the iPhoto Library back to the local folder while pressing Command and Option. An arrow will show up under the icon you are dragging. Release the mouse button. If the files start to copy, you did not successfully press Command and Option.

We’re now done with iPhoto. You should now be able to fire up iPhoto and it will access the photos directly from the NAS. To do the same for another computer, all you need to do is to rename the local ‘iPhoto Library’ into something else, and create a link as we just did above.

Next up is the iMovie library (if you use it). Start by opening up the two folders (‘videos’ on the NAS and Movies in your home directory). Now copy the ‘iMovie Projects’ from the local Movies folder onto ‘videos’ on the NAS. Next, rename ‘iMovie Projects’ on the local machine to ‘iMovie Projects.old’ and create a link to the NAS (by dragging it from the ‘videos’ folder to the local ‘Movies’ folder with Command and Option held down). Repeat the same thing with the folder ‘iMovie Events’.

For the power-users out there, there is an easier way to do all this. Simply fire up the Terminal and run the following commands:
$ rsync -aP "~/Pictures/iPhoto Library" /Volumes/pictures/
$ mv "~/Pictures/iPhoto Library" "~/Pictures/iPhoto Library.old"
$ ln -s "/Volumes/pictures/iPhoto Library" ~/Pictures/
$ rsync -aP ~/Movies/iMovie* /Volumes/videos/
$ mv "~/Movies/iMovie Events" "~/Movies/iMovie Events.old"
$ mv "~/Movies/iMovie Projects" "~/Movies/iMovie Projects.old"
$ ln -s "/Volumes/videos/iMovie Events" ~/Movies/
$ ln -s "/Volumes/videos/iMovie Projects" ~/Movies/

For additional computers, just run the same commands, but leave out the rsync.

Automounting the shares

While you would imagine this to be very easy on a UNIX based system, it’s surprisingly difficult on Mac OS. Perhaps there is a better way, but this is the most straight-forward solution I’ve found. If you know of a better way of doing this, please let me know!

Finder -> 'Go' -> 'Connect to Server'
From Finder, navigate to the ‘Go’ menu and select ‘Connect to Server’. Once it opens up, you need to enter the address to your NAS (complete with the names of the share). That is, if you NAS is named FOO, enter ‘smb://foo/pictures’ and press the plus icon. Repeat this for the share ‘videos’.

Next we need to open up the folder ‘Library/Favorites’ in your home directory. Within this folder, you will see the two shares you just created in the step above. Leave this Finder window open while you click on ‘Apple’ -> ‘System Preferences’ -> ‘Accounts.’ Then select ‘Login Items.’ Now drag the two shares from Favorites into the list of Login Items.

The Items list after dragging in the two shares.

The Items list after dragging in the two shares.

The two shares will now automatically mount upon login for the current user. As noted above, this is not a great way to automatically mount shares, but as far as I know, this is the most convenient way. Keep in mind that, if you do not automatically mount the shares, you will not be able to access your iPhoto/iMovie library until you’ve manually mounted the shares.

Moving on to the other media

With iPhoto and iMovie moved to the central storage, it’s time to move on to the other media. Luckily this is much easier.

The cornerstone in managing all the remaining media is a software called Plex. If you never heard of it, Plex is basically a Mac OS version of the popular media center solution XBMC for Xbox. In its look and feel, Plex is quite similar to Front Row, but it offers a plethora of features that is missing in Front Row. Not only are you able to watch your Movies and TV Shows, you will also be able to install apps within Plex which allow you to stream media directly from sources such as Hulu and BBC.

Plex ContentAssuming you’ve already downloaded and installed Plex, just launch it and head to ‘Watch your Videos’ -> ‘Add Source’ -> ‘Browse’ -> ‘Windows Network (SMB)’ -> Locate your NAS and select the share ‘movies’ and press ‘OK.’ Now go to ‘Set Content,’ select ‘Movies,’ ‘imdb,’ and then press ‘Select’. Plex will now scan through the folder and all its sub-folders and run it against imdb to try to figure out what it is. If the movies are properly named, Plex will fetch the description of the movie, the cover as well as the full name and year. It will then take all of that data and present them neatly organized under ‘Watch your Movies’

Now repeat the same thing for ‘tvshows’ and ‘music,’ but select the content accordingly.

The whole process is pretty straight forward, but since the Plex Wiki already does a great job of describing this process in greater detail, I will simply recommend that you read more about that there.

There you go, that’s it really. While there is a whole lot of things that can be added to this article, such as iPhoto integration etc., I’ve intentionally left that out to keep the article a bit briefer. You might also wonder why I didn’t move the iTunes library over to the NAS. The reason for this is that I think that it might get corrupted if multiple users access it simultaneously. That’s why I instead suggested that you simply move the music-files itself to the network, and play them directly in Plex.

One obvious expansion of this setup is to include Plex Media Server. Perhaps I will cover that in a ‘Part 2′

Author: Tags: , , , ,
Introducing YippieMove '09. Easy email transfers. Now open for all destinations.
Jul
25.

A few months back we were working with a potential client to do a rather large migration from FirstClass to Google Apps. However, during our pilot we ran into a bug in IMAP. Being a good citizen, we reached out to Open Text Corporation (the company behind First Class) to report the bug. We described the bug and told them how to replicate the bug.

Since we were unable to take on the job due to the bug, we didn’t pay much attention to First Class and assumed that they would fix the bug in the next release.

Last week, we took the time to install a local copy of First Class to see if they had resolved the problem. Unfortunately the bug still remained in the latest version (9.1). Because of that, we thought it might be appropriate to write a brief blog post explaining the bug.

About the bug

The bug is pretty straight forward. It occurs when a message has a subject line that includes one or more quotation marks (“). The problem is not that a quotation mark is an illegal character according to the RFC’s, but rather that FirstClass fails to escape them ( ‘ ” ‘ should be ‘ \” ‘). Because of this, when we issue the FETCH command, it’s impossible to tell where the different different segments of the respond ends.

To put this in a real example, here’s an example of the FETCH response First Class is sending:

212 FETCH (ENVELOPE (“Fri, 30 May 2008 15:11:42 GMT” “Re: Fwd: lorem ipsum “foobar”” ((“Replace Replace” NIL “replacel” “replace.com”)) ((“Replace Replace” NIL “replacel” “replace.com”)) ((“Replace Replace” NIL “replacel” “replace.com”)) ((“Repl Repl” NIL “repla” “replace.com”)) ((“Rep Rerpla” NIL “replace” “replace.com”)) NIL NIL ““) RFC822.SIZE 5120 INTERNALDATE “30-May-2008 11:11:42 -0400″ FLAGS (\Seen) UID 89423624)

If this was properly formatted, the response should read:

212 FETCH (ENVELOPE (“Fri, 30 May 2008 15:11:42 GMT” “Re: Fwd: lorem ipsum \”foobar\”” ((“Replace Replace” NIL “replacel” “replace.com”)) ((“Replace Replace” NIL “replacel” “replace.com”)) ((“Replace Replace” NIL “replacel” “replace.com”)) ((“Repl Repl” NIL “repla” “replace.com”)) ((“Rep Rerpla” NIL “replace” “replace.com”)) NIL NIL ““) RFC822.SIZE 5120 INTERNALDATE “30-May-2008 11:11:42 -0400″ FLAGS (\Seen) UID 89423624)

While you might not consider this a very serious but, it really is. FETCH is a very important feature in IMAP and more emails than you’d imagine includes a quotation mark in the subject line. Let’s just hope Open Text Corporation will have this fixed in the next release.

Author: Tags: ,

© 2006-2009 WireLoad, LLC.
Logo photo by William Picard. Theme based on BlueMod © 2005 - 2009 FrederikM.de, based on blueblog_DE by Oliver Wunder.
Sitemap