Square Space

Working in my first Square Space site the other day, here are a couple of take-aways.

  1. They first optimize for rich site experience, which is nice for the user, and not for the search engine. Keep this in mind for SEO.
  2. Images are optimized for people, not search engines. Keep this in mind when looking up insert photographs into your site. Ensure they are the smallest, and compressed just before the point where a person would notice.
  3. There isn’t so much you can do with render blocking, caching, and aggregation, so your speed is really only going to come from properly sized images.
  4. They do have lovely, simple sites that anyone can build out. The key word there is “anyone”. Think on this before signing up for an account.

Speeding up that WordPress site

I read the article at  joaoperibeiro.com on Optimizing WordPress in 8 steps and found it very helpful. (Thank you for pointing me to Fast Velocity Minify) I also wanted to throw in a couple of items, and hopefully not cover what he covered so well.

Many times I have limited availability to server configuration, or the site is on a shared server. (I hear you shudder.) These are mostly sites that come across my desk to increase the speed. It is a good day if I have sftp access. A worse if it’s on a godaddy shared server.

But enough of that…on with the list:

  1. Google Page Speed for an initial number. You need to know where you started to see how well you’ve improved. This will also give you details on some common issues. (yes, it is usually just print ready images scaled down with css and all the javascript in the world jammed into the header)
  2. Another tool I use is a short script I wrote that uses phantomJS to grab a snapshot of the website. I do this for desktop, tablet, and phone renders. The reason is that once I’m in the actual files, moving js and css around, the site can start to get jacked up, and since I did not build the site it is good to have a reference for how it is supposed to look. If you are comfortable with command line scripts and have installed phantomJS, you may find my script here.
  3. Review plugins. What’s in there, what’s turned on, and what needs to be updated, and what I can turn off. You may be surprised what people think is important for their site to work properly in a production environment (Hello Dolly, I’m looking at you!)
  4. Add some plugins:
    1. WP Database Backup (Backup that database before making some changes!)
    2. I have been using WP Rocket cache with some good success, but please, use what you like. I’m not an expert enough to say what is better than another.
    3. P3 Profiler to review site
    4. WP Optimize to work on that database
    5. ShortPixel to optimize images
    6. There are others, depending on the site, but these are my go-to
  5. Once I know all the images have been optimized I begin the js/css aggregation and deferring. This is where things can get a bit wiggy, and where having that image from step 2 can come in handy. Things will break here.
  6. When I’m at the limit of what the software can do, sometimes it is just going into the the theme’s header.php and footer.php files and physically removing/moving items. I have found some fairly egregious issues hidden in the code, such as duplicated js libraries. Again, I did not build these sites. No idea who did. I’m only here to make it a bit faster.
  7. You may get lucky and move that 45/52 to a 78/91…or you may fight for hours to gain 3 points. Start big, go for the easy hits first, as those will be the greatest gains, and maintain a realistic expectation. And if this is on a production site, check that site often!

As much as I groan when a  Wordpress site comes across my desk, I do have to admit the joy in getting a slow site to load fast. Who knows…I may turn out to be a WordPress developer one day.

 

Open Letter To Tollway Drivers

If you are going to drive on my tollway, and not use iPass, please have your money ready to throw into the basket, and not stopping to look for extra nickels. Also, pretending you are throwing money and driving off makes you look like an idiot. Just go online and pay. It’s not rocket science. You don’t want big brother tracking you, I get it, but for Cthulhus’ sake, don’t be an ass and hold up the rest of progress because you can’t find two dimes in a cup holder you haven’t cleaned since last Lent. You remember that McFish purchase you regretted and you refuse to leave your hard change for the Ronald McDonald House, because why should you, right? You vote. That’s enough charity for you. Here’s the rub: You are a danger to others. It would probably just be better if you took a taxi. No, not Uber. You aren’t that cool.

jQuery DatePicker defaults to Chinese

This one drove me up the wall. The days and months in the datePicker() kept coming back as Chinese. Turns out the issue stemmed from a new theme, Experon Pro. This is probably not the best way to fix this issue, but it’s fixed and allowing me to move on to new tasks.

edit: wp-content/themes/Experon_Pro/admin/meta/js/jquery.datePicker.min.js

screen-shot-2017-01-17-at-10-07-39-am

In lines 41 and 42, and your language of choice.

screen-shot-2017-01-17-at-10-08-01-am

If you know a better way, please share as I would enjoy learning more on how WordPress functions.

FVCP January 2017 (The Bootcamp Continues!)

This is more an online prep for the next Fox Valley Computing Professionals for January 11th, 2017.

Topics I am presenting on:

  • Git
  • Red Bean ORM

Git

The last presentation on Git was in October, covered by Walter, where demonstrated clone, branch,checkout, pull and push. I will re-cover these as a refresher, and then move into:

  • git aliases
  • git lg (pretty logs)
  • git bisect

Red Bean ORM

I have given talks in the past on this tool at FVCP, but seeing the nature of the latest round of talks on development, it would be a good to demonstrate a simple database implementation for rapid development.

Pesky cache table

Sometimes that cache table just doesn’t clear. And when it doesn’t, look out. It’ll grow and grow until your website crashes into a glorious, user denied hellscape. Basically, it’ll just crash. Had this issue recently and while attempting to diagnose I came up with a little script to keep on top of things.

First, a spot of SQL

SELECT table_name AS “Tables”,
round(((data_length + index_length) / 1024 / 1024), 2) “Size in MB”
FROM information_schema.TABLES
WHERE table_schema = “DATABASE”
ORDER BY (data_length + index_length) DESC LIMIT 10;

Nothing too fancy here, just a list of the biggest tables

Next, we need a way to run that SQL on the command line. Well, it is a Drupal site, so drush is the answer

drush @prod sql-cli < table_size.sql

Again, nothing too fancy. Running an sql command line interface into the production alias and we will push in the above sql. This gives me:

Tables Size in MB
cache 6119.59
cache_menu 38.73
webform_submitted_data 31.09
search_index 16.03
cache_field 12.59
cache_metatag 5.58
field_revision_body 3.98
field_data_body 3.91
cache_form 3.53
cache_views 3.53

This is all fine and dandy, but I need something to tie it all together. Bash to the rescue!

#!/bin/sh
drush @prod sql-cli < table_size.sql 2>&1 | awk ‘{ print $1 ” ” $2 }’ | while read output;
do
echo $output >/dev/null
table=$(echo $output | awk ‘{ print $1}’ )
size=$(echo $output | awk ‘{ print $2 }’ )

#echo $table $size

if [ $size != “Size” ] && [ ${size%.*} -ge 6000 ]; then
#echo “Alert: $table table is $size mb”
mail -s “Alert: $table table is $size mb” MY_EMAIL_ADDRESS
fi
done

OK, let’s break this down.

  • Starting off we are reading that SQL output and pushing it into an output variable.
  • Using awk we get the table name and size.
  • There are some #echo’s in there I used for testing. Leave them in and uncomment for your own fun and profit.
  • From here we are testing that first the size is not the header “Size” and that it is in fact an integer larger than 6000. For production I increased this to 10000 but did not change it here. Set to your own liking.
  • If the size is indeed larger than your set number, fire off an email alert.

Could this be more robust? Sure. But the office is closing early for the holiday weekend and I wanted to get this off and running.

Have a great holiday everyone!

Kalabox 2.1.2: A Quick Adventure

This post is more for the Fox Valley Computing Professionals crew that may find this link via the #mug. If you found this helpful, glad I could help. If you have any insights on making what I have better, please let me know.

To Start:

I had a hacked WordPress site on a clients server with only production. No dev site to clean and do updates.

I recently updated Kalabox to 2.1.2, but had not run it.

Using FTP I was able to bring down the site and push up adminer so as to get into the database to create an SQL export. (no cpanel, or other access to the site was allowed)

Once the site was brought down I fired up Kalabox.

Oops

OK, this is my fault. I did not have the latest Mac Yosemite, so download the combo installer and update laptop.

Now we are ready

Nope. From the command line mysql is not found. Hmmm… kbox mysql? nope. kbox ssh? nope. I don’t really do much kalabox from the command line. To be honest I have only done a couple of WP sites using the Kalabox, so in no way am I a pro at it. That being said, could not find the db anywhere.

Hello

OK, Kalabox Connection Info.screen-shot-2016-11-22-at-11-53-24-am

Let’s fire up the Sequel Pro

screen-shot-2016-11-22-at-11-55-12-am

And there you go!

Should I have been able to do this from the command line? I would think so, but if you are stuck, fire up that SQL tool and connect with the info provide by Kalabox