Migrating Blog Content and Assets from SquareSpace to WordPress

Rather than explaining why anybody would want to migrate content from SquareSpace to WordPress, I thought it would be more efficient to just dig in. So, in order to migrate content and assets from SquareSpace to WordPress, you will need to follow these steps:

Configure WordPress for importing data from SquareSpace

Before you do anything, you will want to make sure that WordPress is configured to import data from SquareSpace. The import is done using the Movable Type and TypePad Importer plugin.

  • First, you will need to install the Movable Type and TypePad Importer plugin from http://wordpress.org/extend/plugins/movabletype-importer/ (you can also search for it in your plugins dashboard).
  • Next, activate the plugin either network wide (for multi-site WP installations, or for the site in which you are importing the SquareSpace content to)
  • Your WordPress blog is now configured to import from SquareSpace.

Export the data from SquareSpace

Next, navigate to http://yoursite.squarespace.com/display/Login and sign in so that you can perform administrative actions. Once you are in, follow these instructions:

  • Go to the home page of your SquareSpace site at http://yoursite.squarespace.com
  • At the top-right of the page, click on “structure”



  • Next, click on “configure this page” which is just above the title of the post

  •  Under “Journal Page Configuration” (the black slide-in that comes in on the right-half of the page), scroll all the way to the bottom and, under Data Export, click the “Export Blog Data” button.

  •  Confirm the data export when prompted and download the file to your Desktop.
  • The blog posts are now exported from SquareSpace.

Importing the SquareSpace content into WordPress

Now that you have exported the post content from SquareSpace, the Moveable Type and Typepad plugin is enabled, you are ready to import the content into WordPress. Follow these steps:

  •  Back to your WordPress site, navigate to the WordPress Dashboard for that site and go to tools > import.
  • Click on “Moveable Type and Typepad”
  • Browse for the file you exported from SquareSpace and upload it

  • That’s it! Your content should now be imported and, if you’re lucky like I was, all you will need to do now is import your images.

Importing Images

To continue with importing images, see Importing Images Into WordPress from SquareSpace.

RegEx for Redirection: A Reference Guide

Regular Expressions are very handy and save you a lot of time when you have the need to manipulate a lot of data in a little bit of time. When you have


multiplestrings where parts of them are the same, they are considered a pattern. Regular expressions can be built to match those patterns and manipulate them in many ways.

Meta Characters

A metacharacter is a character that has a special meaning (instead of a literal meaning) to a computer program, such as a shell interpreter or a regular expression engine. — http://en.wikipedia.org/wiki/Meta_Character. For a full list of meta characters, visit php.net.

Examples of Meta Characters:

^     The root of the domain - only what is on the right of this will be matched.
.     (period) Match anything
\     First part used with a meta character (see examples below)
\d    Match only digits
\D    Match only non-digits
\w    Match only words
\W    Match any non-words
\s    Match any white space
\S    Match any non-white space
*     Match the character to the left and match it 0 or more times.
+     Match the character to the left one or more times

*Note: If there is no d, w, s (or other meta character) then the character proceeding the \ is treated literally. You can also escape a backslash; \d tells regex to treat it as a digit, however \\d tells regex to actually look for a \d (literally as a backslash and d).

As another example, if you have a directory with spaces in the name such as “directory name,” you would need to escape the space (escape means put \ in front of something) as follows:

directory\ name == “directory name”

Regular Expression Examples

== Strip “articles” out of the URL ==

Regex:        ^    /articles/(.*)/       (.*)
Variables:         /          $1 /        $2
http://www.bees.com/        /bees/bee-left-in-the-cold
Resulting URL: http://www.bees.com/bees-abuse-1/bee-left-in-the-cold

== Strip out the .html from http://www.bees.com/filename.html ==

Regex:     ^       /    (.*) \.html$
Variables:         /     $1   /
Resulting URL: http://www.bees.com/honey_bees/

== The difference between / and not / ==

/title-of-post is not equal to /title-of-post/, however /title-of-post/*$ is equal to both of them.
If you are redirecting http://www.bees.com/honey-bee-shortage to http://www.bees.com/honey-bee-population-comeback, this is how you would do it in the redirection plugin:


== Detecting Digits ==

As you saw on the first page in the meta characters section, Regex can match digits.

http://bees.com/   2012   /     06     /   regex-is-amazingly-powerful   /
Regex:     ^   /   (\d*?) /   (\d*?)   /             (.*)                /    *$
Variables:     /     $1   /     $2     /              $3                 /

The output of the above would be just what the input is because I didn’t change anything – I just wrote down what everything was. However, if I wanted to display the URL above as http://bees.com/regex-is-amazingly-powerful/06/2012, here’s how I would do it:

http://bees.com/     $3   /    $2      /              $1                 /    *$

Here’s what it would look like in the redirection plugin:

== Strip out part of a word ==

Occasionally you may have a WordPress category such as types-of-honey-1. Suppose that the -1 shouldn’t be in the category – the category is actually supposed to be types-of-honey. Now, suppose there are 1,241 articles in the types-of-honey-1 category now, yet all the links point to types-of-honey. This would be a nightmare without Regex.

Stripping out the -1 is very simple:

http://www.bees.com        /    types-of-honey-1    /    clover-honey/
Regex:     ^               /        (.*)-1          /    clover-honey/
Variable:                  /         $1             /    clover-honey/
Result: http://www.bees.com/    types-of-honey      /    clover-honey/

Setting Up the Eclipse IDE With PHP

For Php developers, there are two options for setting up the Eclipse IDE. You can install the Php only version which is made specifically for those who use Php and only Php, or you can install the classic version and add Php into it. Systems Admins will want to install the classic version and add Php to it because of other tools that may be needed such as Ant. Ant is a Java program for building automated scripts for deployments, etc. There is another program which is based on Ant, but built with Php called Phing. If you use Phing, you do not need Ant. However, if you want to be able to launch Phing scripts from the Eclipse IDE, you can do it by using Ant to execute Phing which would execute Phing scripts in Eclipse’s built in console.Eclipse can be obtained from http://www.eclipse.org/downloads/. If you using a Mac, but don’t know if you need the 32-bit or 64-bit version, open up the Terminal.app and run the following command:

uname -a

After running that command, you should see an output similar to the following:

Darwin LB.local 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386

The very last “word” on the block above is i386. i386 means you have a 32-bit computer. This means you need the 32-bit version of Eclipse. If you see something different, such as x64 or x86-64 then that means you need the 64-bit version of Eclipse because your computer is running 64-bit software.

After you have downloaded and installed Eclipse (we are assuming you installed the classic version), you will then need to add Php tools to the IDE. You can do this like so:

  • Open Eclipse (start the program)
  • Click on Help > Install New Software
  • Where it says “Work with:”, select the dropdown menu (next to the “Add” button)
  • Select “All Available Sites”
  • Install the following modules and you should be set up:
    • Eclipse Platform
    • Eclipse RCP Target Components
    • Eclipse SDK
    • Under “Programming Languages,” select Php Development Tools and any other languages that you might need.
    • Under “Web, XML, Java EE…” select Php Development Tools…
Accept agreements as needed if you agree with them, and press next and let it work until it is finished. After it is finished, press the finished button and then restart the Eclipse IDE.

New PayPal Subscriptions for Automatic Payments

Due to popular demand, the KASL Network is now set up for PayPal subscriptions. This means that rather than paying a lump sum for month after month of web hosting, you can now pay automatically on a month-by-month basis. We would love to hear what you think of this addition – please leave your comments below to let us know!

To subscribe to automatic monthly payments, visit our “pay for hosting” page and scroll down towards the bottom.

Also, if you would like to see other payment solutions on our site, feel free to give us your opinions in the comments section below.

Make Google Drive Work for You!

Google_Drive_Logo_lrg-540x429After you get Google Drive set up, wouldn’t it be nice if you could automatically select which folders you would like to have sync’d – outside of the Google Drive folder? Well, with a simple tweak, you can make this happen. It’s not as seemless as SugarSync, but it works. To make this happen, you cannot be scared of the command line – however, eventually you may not even need it if this catches on:

This article is written for Unix and Unix-based OS’s such as Mac and Linux.

  • Get Google Drive installed and configured – download the app at http://drive.google.com.
  • Once it is all set up, open up your terminal of choice and type the following commands (these commands will move your Documents folder into the Google Drive, then create a shortcut to that moved version of the folder back where the folder was originally):
mv ~/Documents ~/Google Drive/ (you may need to put sudo in front.
ln -s ~/Google Drive/Documents ~/Documents
  • Now, open up your file browser (Finder, Nautilus, Dolphin, etc) and you will see your Documents folder there with either a blue sync mark or green check mark on it – depending on its stage of synchronization.

Please keep in mind that this is probably not exactly how Google Drive was intended to work, and if you ever uninstall Google Drive, you will have to manually restore your folders that you moved – or else re-install and activate Google Drive.

Amazing New Keyboard for Android and IOS

keyboardIf you are an Android or IOS user, you will be extremely happy when you get a chance to try the new keyboard that was recently released by Google. Gmail Tap allows you to type with two buttons and is so advanced, you can type without even looking.

See the video here:

Get the real file or directory size in unix or linux

Size of DirectoriesAll BASH users (Linux, Unix, OSX, etc) use the ls command, but when we want to know how much disk space has been used, the ls command just doesn’t cut it sometimes. While it is a useful command for listing information about files in a directory, or the directory structure, it doesn’t give you the overall space that a directory uses – including the files inside of it. Sometimes you need a lot more information and the commands to do it are not commonly known. Here’s a typical output of the ls command:

user@localhost:~/Pictures$ ls -lh

 total 644M
 -rw------- 1 user user 993K Jul 12 15:08 IMAG0142.jpg
 -rw------- 1 user user 790K Jul 12 15:08 IMAG0143.jpg
 -rw------- 1 user user 1.1M Jul 12 15:08 IMAG0144.jpg
 -rw------- 1 user user 1.3M Jul 12 15:08 IMAG0145.jpg
 -rw------- 1 user user 1.1M Jul 12 15:08 IMAG0146.jpg
 -rw------- 1 user user 1.1M Jul 12 15:08 IMAG0147.jpg

Notice how the output shows the sizes of the files. However, if we cd .. and look at the directory itself, it shows this:

drwxr-xr-x 2 user user 24K Jul 21 12:02 Pictures

Although it is clearly stated above while in the Pictures directory that the content takes up 644 Megabytes of space, listing the directory itself only shows that it is 24 Kilobytes. That’s a little misleading, don’t you think?

In order to get around this issue, there is a different command that will do the trick; the du command.

user@localhost:~/Pictures$ du -sh
 686M .

The command as typed above shows the combined size of all directories in the present working directory. However, if you were to add a directory name to the command, you would have this output:

user@localhost:~/$ du -sh Pictures
 644M Cell

If you were to use a * instead of a directory name, you would retrieve the results of all of the directories in the current directory:

user@localhost:~/$ du -sh *
 644M Pictures
 2.6M Videos
 4.5M Wallpapers

Remove DOS EOL ^M Character from File

endoflineIf you have the ^M character in your file, it is a Dos/Windows end of line character that is tough to get rid of. You could always ignore it, but the possibility of it corrupting a file is very high. Some editors such as Nano don’t even seem to show this character by default – maybe Nano strips it out – I’m not sure at this point.

If you are a vi warrior like I am, then you don’t really care for using Nano anyway. To remove the DOS EOL character using the vi editor, the easiest way is by following these steps:

vi filename

Press “:” to get to command mode.

Search and Replace all Globally is :%s/^M//g (Press control V then control M) which will replace ^M with nothing.

Then to write and quit enter “:wq”

In summary, here’s the command would look in vi:

vi filename

If you need the character to actually turn into line breaks, try this:

vi filename

rsync over SSH

sshMany of us use SSH multiple times on a daily basis times to do simple, complicated, and often redundant tasks. Often times the tasks are those which could be scripted and automated. For instance, if you have to synchronize files with a server often throughout the day, a cron job would be the ideal way because then it will be done automatically and you don’t have to worry about it. If you use SSH keys without a password to access a server, you can expand on it by using rsync to synchronize those local and remote directories.

Here is the command you would use to make this happen:

rsync -e 'ssh -i ~/.ssh/id_rsa' -rulvhtpz /Users/user/file_to_sync user@host.com:~/

rsync options used

-r, recursive throughout directories
-u, skip files that are newer at the destination (meaning only update old files)
-l, copy symlinks as symlinks
-v, verbose; show all output as it happens
-h, display output in human readable format
-t, preserve times of files
-p, preserve permissions
-z, compress files during transfer to preserve bandwith

Making rsync convenient:

rsync is really nice when it comes to automation. Adding rsync to a crontab entry comes really handy. There are all kinds of options for cron – to view them, check out my knowledge base article on it.

If we want rsync to run automatically at 12pm and 4pm, this is what we would do:

Open up your terminal app and type the following:

crontab -e

Add the following lines to the file:

00 12 * * * rsync -e 'ssh -i ~/.ssh/id_rsa' -rulvhtpz /Users/user/file_to_sync user@host.com:~/
00 16 * * * rsync -e 'ssh -i ~/.ssh/id_rsa' -rulvhtpz /Users/user/file_to_sync user@host.com:~/

If you’re really clever

If you are a programmer and want your code to automatically synchronize to a remote server, add a macro to your IDE that somehow that adds the rsync code to a button in. For instance, if you add the rsync command to the save button command, maybe it will kill two birds with one stone.

For more information

Go into your terminal and type man rsync or rsync -h

Backing up a server to S3

AWS LogoIf you run a server of any kind then you should know how important it is to regularly backup the server. Now even though backing up the server is a great thing to do, it doesn’t do any good if the backup is in the same location as the server itself; if the building burns down, everything is gone. It is best to have an off-site backup location in another city or even state or country.

This is where Amazon’s S3 service comes in handy. S3 is a service where you can store data of any type for a low monthly fee ( $0.14 per Gigabyte at the time of this writing ). S3 uses “buckets” to store your data – think of a bucket as a directory. To get started, do the following:

  • Sign up for am Amazon account at amazon.com.
  • Log in at aws.amazon.com. You will see a bunch of tabs at the top of the page. Click on the one for S3.
  • Create a new bucket and name it something relevant to what you are going to store inside of it.
  • Click on your name at the top-right of the page and select “security credentials”
  • Copy your access key and your security key (you can do this later – but just be aware of where they are)

Now you are set up to use Amazon’s S3. Next, you need to install a S3 client. I am running Ubuntu Server and the client I use is called s3cmd. To install s3cmd, do this (it should already be in your repository for Ubuntu Server):

sudo apt-get install s3cmd

After it is installed, you must configure the program (I did it as root since I will be running this program as root). To configure it, do this:

sudo s3cmd --configure

Go through the configuration wizard. Use the access and security keys you discovered above.

s3cmd has all kinds of options. The option I am using is the sync option since I will set the servers to sync every x amount of hours. If you want to learn about more s3cmd options, run this command:

s3cmd -h

The command I use to back up my servers is as follows (I run it as a cron job, but you can also run it manually):

s3cmd -rpH sync /home s3://my_bucket
  • the “r” option makes the sync go recursively (into sub-directories, etc)
  • the “p” option preserves permissions and ownership of files and dirs
  • the “H” option shows the file sizes in human readable format
  • “sync” tells it to sync between the server and s3
  • “/home” is the directory I am recursively backing up
  • “s3://my_bucket ” is the bucket location in S3 where everything will be backed up to.