Creating your Mindbody Credentials

Below is a segment of Devin Crossman’s great tutorial that got me started on the MindBody API. This is the section that explains how you have to create your settings within the MZ_MindBody_API plugin AND within Mindbody in order for the plugin to work.

Whether this is your first time developing with an API or not, you might have some trouble when you want to begin interacting with your MINDBODY data. I have created a simple guide will help you understand how the MINDBODY API works and how you can incorporate your MINDBODY business data on your own website using PHP.

How to prepare

You will need to have a web server running PHP with the SOAP extension installed and enabled. This can be a local development server setup (MAMP, WAMP) or an online server such as Digital Ocean who offer easy to manage VPS starting at $5/month.

Get your MINDBODY API credentials

Before you can start integrating your MINDBODY data you will need credentials to access the MINDBODY API. If you are just developing for a single business, follow the steps below. If you want to access the data for more than one business you will need to contact MINDBODY directly for this information.

  1. Complete the sign up form at the MINDBODY Partner Program website and write down your sourcename and key.
  2. This next step can be tricky. You have to make a call to the SiteService on the MINDBODY SOAP server to get an activation code. I made a form you can fill out instead. (UPDATE: MINDBODY has included this tool on the partner program website) You need the sourcename and key that you wrote down in the first step as well as your site id. If you don’t know what your site id is, log in to your MINDBODY account and check the URL. Your site id comes after “?studioid=” at the end of the URL.
  3. Give the activation link and code to the person with the ‘owner’ account for the MINDBODY site you want to access the data of.

Some API methods require user credentials as well. Set up a user for your application by following these steps.

  1. Log in to MINDBODY
  2. Go to Toolbox -> Setup -> Staff -> Staff Management
  3. Click Add New Staff Member

    Add New Staff Member

    Click on “Add New Staff Member”

  4. Enter something for the first and last name. I used first name “web” last name “developer”.
  5. Create a staff login with a new username and password and write these down.

    MINDBODY create staff log in

    Create a staff log in

  6. Save your new staff member.

Robin Nixon’s Computer Programming Books

After many many years of web development in PHP it finally became time to really learn the language. The essence of computer programming has always come down to the IF/THEN statement. All we’re doing is manipulating data and the various languages – C+, perl, java, php, javascript, ruby, etc. – have methods for storing and accessing the data and telling it what to do based on IF something is true or not. So it’s been kind of easy to make sense of various bits of code just based on common sense.

My grasp of these PHP has been of the order of an immigrant who can communicate well enough to make transactions, but by no means compose poetry and speak eloquently.

But working with an object-oriented library there was a lot of code that looked really confusing so I looked up the most popular publisher of computing books, O’Reilly, and got a copy of Learning PHP, MySQL and JavaScript by someone named Robin Nixon. PHP is language that’s been developed for running websites and sending information back and forth between the computer viewing a website and the one serving it. MySQL is a super-popular database system that stores “long-term” information in various tables on the “server” that hosts the website, and javascript does things on the computer of the person viewing a website so the three are kind of a trilogy of languages for website development.

A programming book needs to have not only a sense of humor, but also be written compassionately because computer programming can be a lonely and frustrating occupation and easily make someone feel intellectually inadequate. “Why isn’t this working? It should be so simple. I’m sure it IS so simple, but why is it taking 8 hours to make 12 lines of code work?”

In Learning PHP, MySQL and Javascript, Robin Nixon covers all of the basics, with downloadable examples to work with and little test sections at the end of each chapter. It’ nice having the book in paper because you don’t always have the leisure of being at the computer when you want to learn, and in many ways disciplining yourself the actually “read” each line of code until you understand it can be more illuminating than just copying bits of code and confirming that they work. But in working with the downloadable code examples, Robin Nixon offers many opportunities to experiment, insuring that your understanding is being cultivated. One cool thing about Robin’s androgynous name is that I read most of the book in a woman’s voice, ’till visiting the website I discovered Robin is a man. One who also has books on Creative Visualization , who ran an opium den (okay a coffee shop) in the heart of Texas (he’s from UK) and with his partner, raised like twelve disabled foster children. (I wonder if foster parents are more likely to be good or evil.)

By the way the copy of Learning PHP, MySQL and Javascript was a used copy, like 6 years old, for $7 including shipping as opposed to paying $30-something for the current version. Six years is a long time in web development, but the fundamentals are the same. Doing it again, I might have bought the newer one. Also wondering if the Pensacola Library has much available in computer programming books. One really awesome thing about the book is that Robin Nixon walks you through getting your own development server set up on your home computer, which is key in any website development because otherwise you have to upload your script changes every single time you make a little change. And mostly all you’re doing is making little changes and checking to see if they worked and/or if you’re any closed to having a working program.

Well Robin has another book on PHP called Robin Nixon’s PHP Crash Course, and one really interesting thing about reading PHP Crash Course right after Learning PHP, MySQL and Javascript (LPMJ) was comparing the output of a great mind within and outside of a large corporate machine. The O’Reilly book lists a small army of editors and the final product is a nearly flawless, glossy course that gets the user set up with all of the basic tools necessary to develop web sites.

Robin Nixon’s PHP Crash Course is a published version of a series of PHP lectures and showcases more of Robin’s unique way of understanding and explaining the PHP language in a more casual and open format. Some of the analogies are repeats of the analogies from LPMJ. Like the “chess board” you create using nested arrays. She, I mean he is a really fun writer who shares a firm grasp on the basics of PHP in both of these awesome books.

I’m looking forward to hopefully checking out Robin Nixon’s Javascript Crash Course as well. Thanks, Robin.

tutorial on using the awesome Magnific Pop-up within wordpress

Check out my man AJ Troxell’s terrific tutorial and adding the Magnific Pop (a responsive/modal image gallery based of jquery) to a wordpress installation.

There’s also the ZenMagnific plugin I helped develop for the Zen Cart shopping cart framework, which we’re using with the Renaissance Man, Inc site.

Now using it, combine with some WP Native Gallery Style Overrides, in the Storybook Sound website’s Album Art Gallery.

The code for selectively overriding some of the wordpress native gallery styling is this:

function enqueue_gallery_style() {
	wp_enqueue_style($handle = 'storybook-gallery-styling', $src = get_stylesheet_directory_uri() . '/album-gallery.css', $deps = array(), $ver = null, $media = null );
}
add_filter( 'post_gallery', 'enqueue_gallery_style', 1001, 2 );

The above code loads your custom css (/album-gallery.css) to the page (post_gallery) after the native styles are loaded (if my understanding is correct).

Capistrano & Command Line Poetry Class

Eager to step the local web development up a level with regular use of Command-line Version Control Repository, Dependency Management and Deployment automation.

When we are using an Apple or PC operating system like OSX or windows, we are using a graphic interface (also known as a graphical user interface or GUI) to interact with the systems that are communicating with the machine, which at it’s root, only understands sets of binary information (X/O, 1/0, ON/OFF). When we bypass the GUI we have to speak a language that the software communicating with the machine understands, and the language looks a bit ah… shorthand.

This computer is, shit – 5 years old, but running great and of course we don’t want to buy computers any more often than necessary (there is slave labor, land-stealing and environmentally wicked mining involved) so we’ll make these work as long as possible, right?

At any rate, WordPress is an awesome, extremely popular blogging platform that can even be used as a Content Management System and one of the ways of improving the speed and stability of it’s deployment is outlined in a blog from Roots.io.

Most of the challenges so far have been in configuring the Operating System on this box, OSX 10.6.8 Snow Leopard so that it can run versions of the recommended software which includes, Git, Composer, Ruby and Capistrano.

Git was fairly easy: download git-1.7.6.1-x86_64-snow-leopard.dmg (google it), then open terminal and type: git –version (log out and back into terminal may be necessary).

To install composer, in Terminal type: curl -sS https://getcomposer.org/installer | php

Helpful tutorial here. Confirm installation by typing either php composer.phar or php composer, depending on whether or not you installed systemwide using the sudo command (which grants you Administrative rights on the computer), or just for specific user (Users/yourname/your stuff).

Getting Ruby working has been a bit of a process. Ruby is a programming language developed  Yukihiro “Matz” Matsumoto in Japan in the mid-1990s that comes with the Mac OS, but the version with Snow Leopard is 1.8 and Capistrano depends on 1.9.

Upgrading to 1.9 required downloading this package, which is basically just the Ruby portion of the xCode package that you can get from Apple, but which is a huge file and maybe costs money and most of which is only useful for developing software for use with Apple products.

So after downloading the above package and installing it, you logout of terminal and back in and  – oh wait – first you have to install Ruby Version Manager, which is another little bit of software that enables you to Manage which version of Ruby you are using.

So you can follow this little tutorial on About.com (a sometimes useful site which annoyingly displays too little information per page so they feed out tons of adds).

At first when running the update, I was getting an error that has to do with the ports, and something called macports (all of these installs and updates are happening between the users computer and the computer hosting the software, which apparently happens via ports). I need to learn more about ports and I think I’m about to…

Currently in the process of 3rd or 4th attempt at running: rvm install ruby-1.9.2-p320, which is a time consuming process. It looks like it may be working. The most recent hurdle had been that I was getting the error in Terminal; Sudo: Port: command not found, which I solved via this tutorial by adding the line “export PATH=$PATH:/opt/local/bin” to my .bash_profile, for which I used the command line text-editor Vim (Vi, Eclipse and Nano are other options, Nano being the simpler choice). There’s a dope interactive Vim tutorial, which was useful getting started with Vim. Man thing was realizing the Two modes, insert and command.

What is happening in the terminal now is:

ruby-1.9.2-p320 &#8211; #applying patch /Users/mikekilmer/.rvm/patches/ruby/GH-488.patch.<br /> ruby-1.9.2-p320 &#8211; #configuring&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;<br /> ruby-1.9.2-p320 &#8211; #post-configuration.<br /> ruby-1.9.2-p320 &#8211; #compiling&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;|<br /> ruby-1.9.2-p320 &#8211; #installing&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;.

Looks like it worked. Now to see if Capistrano is happy…

Nope. System is still using Ruby 1.8. Need to logout and back in…

Okay, “which ruby” info (Run the command which ruby to make sure it’s pointing to somewhere in ~/.rvm/, and not to /usr/bin/ruby) looks good.

Capistrano is using the wrong version of Ruby – still looking in /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/

Reinstalling Capistrano:

gem install rvm-capistrano

Capify worked!

Multiple Column Responsive CSS – single or multiple text/data segments

A client wants a multiple column (responsive, of course, and three in this case) front page on a wordpress website. Not sure if this will best be achieved on a per-post basis or with a template. We also haven’t chosen a theme yet.

Came across a little post about it within a blog that also offers this article called Is Responsive Web Design Important. The Three column approach article states that, “This new 3 column design displays all columns on the largest screens as equal widths. As the screen gets smaller it will move the sidebar (third column) under the other two columns.  Instead of removing the sidebar (third column) from the smallest screen I displayed all 3 columns on top of one another.”

It can also be useful to display a single section of text in one or more columns as described in this article. check out the very sweet example toward the bottom of the page. He begins: ”

Multiple columns are a great way to make better use of your content canvas area, especially for the breakpoints at the larger viewports.

Working on a mobile first approach to responsive design you will often define the layout of the content in a linear format and then, as you add in additional breakpoints for the larger viewports, you can simply add in the multiple columns as shown in the example below…”

Linus Torvalds

The world wide web was created by a physicist who wanted to have an easier way for geographically spread out thinkers to collaborate.

linus-eff-you-640x363Git was created by this cat Linus Torvalds, who is a few months younger than me, and who created Linux, which is probably the worlds leading open source server software.

Here is a great introduction to Git, version control and repositories in general. I love socialists. Real ones, philosophically speaking.

Here’s the photo source.

Adventures in osX Environment

Working with a book from ever dependable O’Reilly Publishing on PHP, MySQL, JavaScript.

Installed Aptana Studio which is an Intergated Development Environment that works w/ php, HTML, css, javascript that runs on Snow Leopard OS 10.6.

Had to install Git in order to have access to Boilerplate HTML 5 – Git grants you access to online repositories of latest versions of available libraries.

Installed Composer and configured to work with MAMP with the help of this helpful tutorial. If you do this, remember to log in and out of Terminal when it says to so you won’t waste the time I did wondering why the changes in system hadn’t taken effect.

Then ran composer install from within the directory I’m developing the code in to pull in the necessary code based on the composer.json file in the same directory.

At the moment, Aptana is not importing the code successfully so seemed like a good time to document some of the process here for reference.

 


It’s all starting to make sense now. I hadn’t realized that the Composer application not only assembles your various libraries, it also downloads the referenced code, similar to the Git program. Both of them run on the command line, aka via Terminal. There might actually be a version of Git (from Github) that runs as an osX application.

I had initially had a ton of frustration trying to figure out why this library of Mindbody Online API code written in PHP wasn’t working. I had downloaded it from github, but none of the calls were working. After finally doing the composer install I see that it really is so f’n easy once you know what you’re doing. All you need to do (once composer is working – see above) is create the single composer.json file within the directory you want the code in and run the command line install command as posted above (which might actually be composer.phar install as opposed to simply composer install, depending on whether you have set composer for all users or just a single user) and it installs the whole thing for you. Nice. – Twenty hours later.

The initial problem had been that the damn “vendor” folder doesn’t seem to exist in the github repository as far as I can see.

I had created a “project” in Aptana prior to installing composer and things got weird so had to uninstall Aptana (I thought, anyway) and recreate the project using the import method described here. In fact I think I only would have needed to delete the .project and .metadata folders within their respective directories. But at one point Aptana was writing blank files over all of my files. Annoying.

So now I’m finally at the beginning. Or a beginning.