• Stay in touch. Sign up for the 9seeds newsletter.
  • Stealing math from Wikipedia

    WordPress + Jetpack + LaTeX = Awesome

    On my personal WordPress website I wrote about an Arduino device I built to help brew beer.  Being my first foray into electronics, I wanted to document my experiences.  One of my difficulties centered around turning electrical values (voltage, resistance) into real-world values (temperature) using math.

    As part of my documentation, I wanted to re-create some equations that I had found on a Wikipedia page about thermistors.  While in the process of grabbing their images and putting them into the media library, I remembered something…

    One time while on the main Jetpack screen in the WordPress dashboard, I noticed a tile that advertised “Beautiful Math.”  So I looked into it.  Jetpack has a LaTeX module that can accomplish this.  LaTeX is a rather old-school markup/typesetting language that has been very popular in academia, especially in regards to math.

    So Jetpack and LaTeX can do math, but I didn’t really want to learn a new markup language, I just wanted to quickly copy & paste the equations into my post.

    Good Authors Borrow, Great Authors Steal

    So then I wondered how Wikipedia is storing the images or if they’re doing something similar.  Guess what?!?  They use LaTeX too!  Putting the same equation into WordPress is as easy as clicking “Edit” on the Wikipedia page and copying the text between <math> and </math> and pasting it in-between [latex] and [/latex] in WordPress.

    Native vs. Shortcode formatting Tricks

    Jetpack supports using the $latex $ native format instead of the shortcode, but there are a few noted (and undocumented) differences between using the two methods. For instance, if you want to increase the size of your rendered LaTeX text, you can use the s (size) parameter in your LaTeX equation as such:

    $latex \LaTeX&s=4$

    Where size in this example is “4.”  However if you try to do this using the shortcode as such:

    [latex] \LaTeX&s=4[/latex]

    it will render as:  \LaTeX&s=4 – Not exactly what you’d expect :( The trick is that the following LaTeX parameters need to be fed in as shortcode parameters:

    So if you want to have “LaTeX” rendered as:

    \LaTeX

    You can either do:

    $latex \LaTeX&bg=ffcccc&fg=cc00ff&s=4$

    or  move the size & color parameters into the shortcode tag like this:

    [latex bg=ffcccc fg=cc00ff s=4]\LaTeX[/latex]

    Some handy tools from the Community Summit

    A few weeks back I had the great privilege of attending the WordPress Community Summit. Rather than renting a hotel room by myself, instead I rented a house with 4 other Community Summit attendees; Ryan Imel, Brad Williams, Brandon Dove and Dre Armeda. Not exactly bad company to keep. We figured staying in the same house would help keep costs down and would also be a lot of fun. What we hadn’t really planned on was some of the great knowledge sharing that took place.

    One afternoon while we were hanging out in the house, we started talking about some of the handy tools we all use. As the conversation went on, Ryan had the quick sense to open up a Google doc and start taking notes. Below is the list of handy tools we came up with.

    Keep in mind, these lists are definitely not all inclusive. We know there are many other text editors and cool apps out there. But these are the ones that are top of mind that day.

    Text editors

    Mac Apps

    • Alfred – Easily launch applications, sites and perform several other tricks
    • CoBook – Amazingly easy and simple CRM tool
    • Spirited Away – Hides apps after a set amount of idle time
    • Hazel – Simple automation tool for dealing with files
    • Total Terminal – Formally called Visor, a system wide hotkey for terminal
    • Droplr – Easy screenshot/text file uploader for sharing
    • TypeIt4Me – Text expander

    Custom Searches for Alfred

    • http://wordpress.org/extend/plugins/search.php?q={query}
      Search the WordPress plugin repo
    • http://wordpress.org/search/_Reference+{query}
      Search wordpress.org for functions, actions, filters, etc
    • http://demo.studiopress.com/{query}
      Quickly load any StudioPress theme demo site

    If you’ve got another tool to add to the list, drop it in the comments.

    Converting Blogspot / Blogger to hosted WordPress

    First Try

    Migrating your Blogspot or Blogger weblog to a hosted WordPress installation should be easy.  But you may run into some problems along the way, so here are some quick ways to make it less painful.

    When I first attempted this, I used the Blogger Importer plugin found in the “Tools” → “Import” menu of a new WordPress installation.  It went OK.  The importer pulled in all of the posts and the comments, but there seemed to be some extra markup that made it’s way into the posts.  All of the post titles now started with “>”:

    >Why Hello There!

    Also, while images in the content seemed to be fine, none of the media was actually imported into WordPress, they were still being hosted on blogspot.com.

    Resetting the WordPress installation to start over

    So now WordPress has a bunch of content that I want to delete so that I can start over and hopefully get it right the next time.  For this I used WordPress Reset.  I was able to use it to remove the (bad) imported content and reset it back to a new installation.  It’s multi-site friendly and only restored the one site and left all the content from the parent and sibling sites alone – although I can’t vouch for what it would do if you ran it on the parent site of a network installation.

    A 2-Step Approach

    Now that I was back to square one it was time for a different approach.  After some reasearch, someone on the WordPress Forums mentioned using WordPress.com to do the Blogger import, then exporting from WordPress.com as a native WordPress export file (WXR / XML), and import that file into your new WordPress installation.

    Importing Blogspot / Blogger to WordPress.com

    So over at WordPress.com, everything is like a normal WordPress installation, except they have turned it up to 11.  They have powerful servers, and a dedicated staff that make amazing additions to the most popular free plugins – one of which is the Blogger import.  On WordPress.com you have an additional option to import a Blogger export file:

    Rather than authorizing the plugin to get everything from the site, we’ll export it to a file. Log into your Blogger account. When you’re logged in and viewing your blog there’s a “Design” link in the upper right menu bar, click that. Once you’re at the Blogger administration page click the “Settings” menu, and then “Other.” You will have an option under “Blog Tools” to “Export blog”:

    Take that file and import it into a new WordPress.com site. You’ll want to make sure that this blog is public (but not necessarily indexed by search engines) as our hosted WordPress installation will need to be able to pull media files from it, but we don’t want it to wind up on Google, as it’s only temporary. It might take a while to fully complete, but WordPress.com should bring in all your Posts, Comments, and Media just fine. Once you’re sure that it’s done, export the WordPress.com site through the “Tools” → “Export” menu, selecting “All Content.”

    Importing WordPress.com’s export into a hosted WordPress site

    Before we begin importing the content from WordPress.com, two things should be changed in the WordPress Importer plugin‘s wordpress-importer.php file, which can be done through the plugin editor.

    Just so we know when the importer runs into issues, change IMPORT_DEBUG to true:

    /** Display verbose errors */
    define( 'IMPORT_DEBUG', true );

    Then to make sure we get everything, find the line that starts with:

    $post_exists = post_exists( $post['post_title'], ...

    This was on line 539 for me.  Comment it out using slashes:

    //$post_exists = post_exists( $post['post_title'], ...

    Then just below that line add:

    $post_exists = false;

    I did this because when WordPress.com imported images from Blogger, it gave them the same name as the post title, So if a post was called “Why Hello There!” and it had 5 pictures in it, all 5 pictures also had the title “Why Hello There!” This was preventing the importer from getting everything. Plus I already reset the installation, so there’s no content to duplicate or overwrite anyway. And I reasonably trust that I want to retrieve everything contained in the WordPress.com export file.

    Run your import and everything should go smoothly. After you’ve verified you have everything in your new hosted WordPress installation, you can delete your WordPress.com site or make it private. You may also want to undo the WordPress Importer changes for future imports.

    Client Spotlight: Joe the Biker

    One of the great things about this line of work is getting the chance to meet folks outside of the realm of tech who do a range of neat things. Joe the Biker is one of those people.

    It’s probably not anything you’d expect from a big, bad biker. In fact, Joe the Biker – aka Joe Wojcik – is a really nice guy on a mission as a motivational speaker and advocate for kids who are victims of bullying. The passion behind his work stems from his personal struggles being bullied in his childhood, and dealing with the effects of that experience well into his adult years. Joe’s triumph over those challenges is a valuable lesson that he continuously shares to empower kids and their families, and his online presence serves as an important tool that connects him to the community and those he aims to help.

    Unfortunately, keeping his old website current had become an increasingly frustrating task for Joe. He had gone through several iterations of his site and was getting tired of dealing with a webmaster to have updates done. A personal friend of his was kind enough to recommend 9seeds to help Joe find a solution for his website woes.

    Joe wanted to be able to modify content on his own, and his old site just wouldn’t let him do that. He was willing to give WordPress a shot. Since he was generally happy with the look and feel of the old site, we customized a Genesis Child theme to match his existing design. We then moved all of his content over and made some adjustments to his liking. Since Joe was new to WordPress, we set him up with a bit of training and provided him with a number of key instructional videos that he could reference at any time.

    Managing the new Joe the Biker WordPress site has restored Joe’s sense of flexibility, and he’s expressed how happy he is with the end result. Joe recently wrote, “For the first time in four years I feel a sense of freedom knowing that as my project unfolds I can readily update my site…”

    We’re pretty proud to have played a part in enabling Joe to continue spreading his message and make a difference for those who can benefit from his movement. Kudos, Joe!

    2011 Holiday Schedule

    The holiday season is upon us. It’s time to go hang out with friends and family and look back on an amazing year.

    December 14th will be our last full day in the office this year. We will be back at our desks digging out from under a mountain of email on January 2nd.

    Have a terrific holiday and we look forward to working with you in 2012.

    Cheers!