I’ve Created a Monster

JK model (30)Pretty sure I’ve helped create a monster, a leggings monster. For sometime now the ladies in our house have become very enthusiastic about leggings. It’s become one of the primary pieces of clothing in each of their wardrobes.

A few weeks ago Jen even hosted a leggings party at our house. An independent representative from JK Apparel brought her inventory of leggings over and Jen invited a bunch of people over to try them on and buy them. It was a successful party I’d say.

Last week I had the opportunity to work a bit answering some support questions for WooCommerce. I setup a few test sites so I could play and while digging in and learning things I really wanted to learn more. To motivate me I wanted to find something I could actually sell in a live store so I could set it up and maintain it a bit. It also could be anything that would take any real time and that’s when it hit me.

It took very little convincing to have Jen sign up to be a rep for JK Apparel as well. Her first shipment of leggings and other things are on their way. Since I put the idea in her head it’s taken up a lot of the conversations in the house. Jens been calculating, planning, and organizing getting ready to hit he ground running. There is no doubt in my mind that she’s going to do awesome in this venture and I love seeing her so excited about it.

It also makes me happy that I’ll get to play more with WooCommerce but not have to do any of the actual work involved with processing orders 🙂

Morning Walk at the Marsh

Jen had the day off today, well at least until after school, so we took a bit of time this morning and went for a walk around the marsh.

The water had a skim of ice on the top in some places. The grass and cat tails were shimmering with a bit of frost. Our faces were a little cold when we were done, but it was a really nice way to spend time together.

Car == Fixed

A couple weeks ago I wrote about how my car wouldn’t start, and since then it has been sitting in the drive way not going anywhere. We made out fairly well on one car, although it was challenging at times and we burned a lot more gas driving just the big SUV. Today that came to a change though. It is once again alive!

It took a couple weeks due to time, weather, and lack of tools. Weather has been cold and wet and I don’t have anywhere to do any work to the car except in the drive way. About a week ago after I had tried checking all the things I could with the tools I had I was pretty sure it was the starter itself on the car that as gone. Luckily all I needed was a new socket set and found one on sale for only $20. It’s a good set and I really should have had one ages ago.

After many YouTube videos for research and a pretty big scare one night I was ready to get to work. After the car had sat about a week I though it would be wise to take it for a drive so it wasn’t just sitting and things getting ceased up. So I went out and tried to push it and get it going by myself with a bump start. The only problem is our driveway is on a hill and I had to push up the hill. Didn’t quite have it in me by myself and so I ended up calling from my cell phone in a panic for Jen to come out and put the break on because I was just barely able to hold the car from rolling down the hill, across the yard, and into our shed.

Yesterday came and the weather was beautiful, so when everyone else was out in the morning I went out and took apart the car a bit so I could get to the starter. Pulled it out and right away saw what the problem was. There was a braided wire from one part of the starter to the other that had broken. Jen was thrilled with the picture I sent her with the starter on the kitchen counter.

2002 Honda Civic Starter
2002 Honda Civic Starter

After considering just trying to repair the connection a friend reminded me that there is lots of current that flows there and if it broke it could be because something else in the starter is not working right. Found a used one at a local salvage yard but they weren’t open until today. They have all their parts catalogued and organized so when I stopped by they went right to it and brought it to me, all tested and ready to go.

Today on a lunch break I went out and put the new starter on and everything else back together and it started the first turn of the key. This makes me a mechanic now right? I’m very excited that I was able to get this fixed for about $100 when the part itself was quoted at almost $300 not including labour.

Running Progress

In early November I set a new goal to hit 500km in running before the end of the year. That meant that I have to run 25km per week to get there. In the beginning I was doing very well, lately I seem to be making it to the end of the week and having to put in a longer run to make the 25km.

Even though I’m pushing it to close to the end, I’m still getting it done. Today I ran 10km and with the three other 5km runs I had this week I just barely hit my 25km. November I made it to 103km, which took me to just over 400km since July. That means just under 100km again for December and I’m there.

running-goal

I’ve quite enjoyed this goal as there’s no set number of runs or pace that I’ve given myself, just get in the distance. For the most part I’ve been enjoying the runs. I just need to get back ahead of things so I’m not feeling the pressure at the end of each week.

One Year Automattic Anniversary

Today marks my one year anniversary at Automattic! For most people that probably doesn’t seem like a very big deal but for someone like me it really is. My first “real” job was when I was 16 years old which was 20 years ago. Before that I had summer jobs, things like my paper route, and odd jobs around the neighbourhood. In that time I’ve worked for quite a few different companies. The longest time I’ve stayed in one position was fourteen months. Even though I really enjoyed that position and the people I worked with I was already looking for my next move about halfway through.

Automattic is different, at the year mark I’m not checking job banks every day or searching online for that next opportunity. In fact I really feel like I’m just getting started here. So much more to learn, so much further to grow, and so much more to contribute.

The year I’ve been here has been an exciting for Automattic as well. Building, launching, and just recently releasing, as open source, Calypso. It’s a whole new interface to work with your sites. When I started a year ago there were under 300 employees and now today we are over 400. That included the acquisition of Woo!

Automattic has given me so much. My first trip outside of North America to a team meetup in Barcelona. My home office setup is pretty amazing. My new wardrobe full of clothing with the WordPress logo on it. A trip to the Grand Meetup in Utah to spend a week with our entire company. This was an incredible experience. Freedom and flexibilty, being able to schedule my time off and days around the rest of my life has helped provide a great work / life balance. Endless learning, I’m still learning new things all the time and I’ve just barely scratched the surface of the different teams that I can rotate to and spend time learning and helping on. Confidence, it took a while to feel like I actually belonged with all the other smart, amazing co-workers and that I might be able to offer the support and help others had given me.

In this year I’ve started to give back as well. Since starting I’ve had thousands of interactions with the people who directly use our products. Helping them use and learn our products while also getting their feedback to help make things better. Watching Calypso being developed and being able to help test and troubleshoot features as they were being built was very rewarding. Probably the most rewarding though, as much as I never thought I’d get to this point, is the fact that I’ve been able to be a buddy to new employees starting out including helping with their training.

Fairly early on when I was doing a lot of live chat I built a tool that I could use to track my productivity. I found it useful so I made it available for others to use. It doesn’t get a lot of use, but there are still people who do use it. Along the code route I, with a lot of help, added a very small addition to an internal tool that was helps us communicate a bit better.

Currently I’m working on organizing a series of hang outs where developers can answer questions about key features or products so us Happiness Engineers can better support them and better understand how they work. We’ve had one so far with more to come.

There are still many things I have to improve and get better at, but I’m looking forward to it. With my co-workers and team mates there is so much I can take away from each one of them to make myself better and more productive. In this past year, and only spending very little time in person with them, I already consider many of them friends. Even though it is just here in my house I look forward to going to work and interacting with them.

Thank you to everyone that has made this past year one of the best of my life all around. To those who took a chance on hiring me, training me, mentoring me, and just being there for me in general, my hope is that you’re not disapointed in your decision and that I’ve been worthy of your efforts. If I have it my way, and if Automattic agrees, this will just the first of many anniversaries as I know there is still so much that I can learn and in return also contribute.

Christmas Tree

Our Christmas Tree from lot to decorated.

WordPress Menus and PHP max_input_vars

Yesterday I spent a bit of time becoming better familiar with how WordPress menus work. Particularily how they are stored in the database and how PHP’s max_input_vars setting can come into play.

While helping a friend try to troubleshoot and figure out some performance issues on her WordPress site I also went in to add an item to the main menu of the site. That’s when things took a turn for the worse. The menu is fairly large and uses a theme which includes a mega menu. So already there were over 100 menu items added to the main menu, but only main items and then many that fall in fancy drop downs. That’s why when I added the item, pressed save, and only about 60 menu items were left when the page refreshed I was a little paniced.

As it turns out it also neglected to save the theme location for the menu which caused the theme to display the default menu which is just a list of all pages all as main headers. As you can imagine over 125 menu items filling the screen didn’t look the best on a live site. I tried setting up the menu again and adding in the missing menu items, but when I saved the same thing happened. It’s like it made it to a certain part in the menu and just stopped saving. After some research that’s exactly what happened.

Luckily there as been a lot written about with tips on how to fix it. But before I got there I was just focused on how to get the menu working again and have the site look right. I found that in working with the menu from the Customizer instead of in WP Admin I was able to get all the menus to save. The only problem was the mega menu that was built into the theme added a setting where you enabled the mega menu drop down but it was only in WP Admin, the setting wasn’t there in the Customizer.  This led me looking through the database to see how the menus were stored to see if I could enable the setting there.

The following goes over how menus are stored by default in a fresh install of WordPress 4.3.1, default theme Twenty Fifteen with a simple menu I created. Things were different on the site I was working on because of some extra settings which were added by the theme, but the main concepts stand.

Simple Menu

Menus have settings saved in a number of tables in the database. In this example I used the default database table prefix of wp_ so that’s how all tables are named. We’ll start in wp_terms which holds the name of the menu. You can see the name, the slug and the term_id which will come into play.

wp_terms Table

Here are most of the main settings you can choose for a menu item.

Menu Item Settings

Each menu item is saved in the wp_posts table with the post type set as nav_menu_item. There are more fields in this table by default, but I’m only showing the ones we’re really interested in for menu items.

wp_posts Table

A number of the settings are stored here for a menu and you can see how the settings in WP Admin map over to the fields in the database table. Depending on the type of menu item the post_name and post_title will hold different settings. The rest of the settings are stored in the wp_postmeta table. Here is an image for just one menu item. This combined with the wp_posts table tells us that the menu item with post_id 8 which is the second item in the menu is a post_type menu item and it points to a page with the post_id of 4 and it has no parent item so it is a main heading in the menu.

wp_postmeta Table

Here is a look at more settings for other menu items as well.

wp_postmeta Table

You can see the rest of the settings here and differnt types like custom links which have a url, and the sub menu items which have a parent id showing which item the fall under in the menu. If you look back to the image of the menu, and the settings image you can see them all shown here.

It was in the wp_postmeta table where there was an extra setting for each menu item that could either be set to active or blank. That specified if a main heading item in the menu should format itself as a mega menu. Finding this I was able to go in and set it manually by editing the database field needed so that the appropriate ones had the mega menu setting active.

The one other table that menus live in is the wp_term_relationships. It takes the term_id from the wp_terms field and ties each of the menu items id’s to show that they are part of that menu.

wp_term_relationships Table

Now that I had the menu working and looking the way it should I could spend the time to find out what was causing all the menu items to save. It really comes down to php settings. There is a setting called max_input_vars in PHP. On my hosting provider the default value of this is set to 1000. What this means is that when you submit a form to PHP to handle it will only process a maximum of 1000 form fields. Once it gets there it just ignores the remaining. If your hosting provider has the PHP security feature suhosin installed there would be an additional two settings called suhosin.post.max_vars and suhosin.request.max_vars as well which essentially do the same thing.

In the image above you can see that visibly each menu item has seven form fields associated with it. There are also some hidden form fields. If you look at the source code generated for a single menu item you can see there by default 13 form fields.

Menu Item Form Fields

That means to reach the maximum of 1000 input variables it would only take 77 menu items. That doesn’t even include the other form fields that make up the menu page. It took even less than that in the site I was working on as the theme added extra fields to each menu item as well. This also explains why I was able to save the menu using the Customizer because it was only showing a few fields for each menu item, so it was still below the max_input_vars setting.

As my test menu in this example only has a few items to test I set the max_input_vars to be 50 and then saved the menu. This was the result. It only saved 4 menu items, and you can see it no longer has the theme location setting saved below either.

Cut Off Menu

Now knowing what the problem is I knew how to fix it and what I did to cause it to stop working on my friends site. As part of the performance enhancements I was trying to do I changed her server to use PHP version 5.6 instead of version 5.5. The max_input _vars had been set to 5000 for version 5.5 but was a lower default for version 5.6 and I didn’t notice. So making this change fixed things so I could once again save the menu.

To make the change it is just a matter of editing the php.ini file that holds all the settings. For me the setting wasn’t in the file so I just added it with the value of 5000 that I wanted. If the line was there you can just edit the number to be higher.

php.ini

Depending on your host there might be other ways to change this through a control panel, or you may need to contact them directly. Running the phpinfo() function you can see what the value is currently set to as well as the location of the php.ini file is so you can edit it if you have access.

phpinfo

As I mentioned before there is quite a bit written about this where people have run into problems saving menus, but in my reading I didn’t see an explanation of what that max_input_vars setting really means and why what seems like a lower number of menu items might trip that limit even if it seems high. Since I dug into the database I figured I would include that in here as well. Hopefully this is helpful to someone if they run across it in the future.

 

Getting in the Christmas Spirit

Today I started out a little bit on the cranky side. There was no real good reason for it except that I knew it was going to be a busy day and I was feeling rushed already. Before I had even finished my morning coffee I had to start hurrying so that we could get out the door to Noah’s basketball practise. Throughout the day though it didn’t take too long for my mood to start to turn. It’s hard to be cranky when you’re watching your son have a blast and trying hard at something he really enjoys.

When we were done we headed straight to what has become our traditional upick Christmas Tree lot. The weather was a little drizzly, but it wasn’t too cold and we were able to find the tree really quickly. Pretty sure we didn’t spend more than 5 minutes until we had one we all liked. In years past we’ve had some long adventures roaming through the trees in snow and cold weather. So coming across something we all agreed upon so fast was more of a treat than the hot chocolate and candy canes we enjoyed in the cabin with the wood stove keeping us warm.

Once the tree was in the house we figured we would leave it wrapped for a bit while it dried out. The rest of the family were having an early lunch before some of them headed off for a birthday party, I took the opportunity to go get a wet run in. The past couple weeks I pushed it to the last day of the week to hit my goal of 25km. Today I had to put in an almost 9km run to get there. Despite the rain, that at some points was feeling pretty hard, the run was very enjoyable. Such a good time to think and just clear my head.

While half the family as off at the birthday party Alexandria and Caile started decorating the artificial tree that we put up in the kids play room. Just the harder things like the lights and the sinamee. The rest the other kids will help with another day.

After supper Caile and Ella were in a Christmas parade with a bunch of other kids from their dance studio. We were able to get together with friends and family and watch the parade with my girls dancing past.

Once home we untied the tree and straightened it up a bit so Jen could get started decorating. The kids were drinking some hot chocolate, I put on my favourite Christmas album while having a sort of cafe mocha. Now sitting here with the Christmas lights, the smell of the tree, the sound of Meaghan Smith, and the taste of the warm drink there is no denying the Christmas spirit has arrived.

Old Car Problems

For a couple minutes today I thought I might be running home unexpectedly. Luckily after calming down a bit and thinking things through I figured out how to avoid that.

Previously I wrote about how I love my old car, and really I still do. However not sure I would trust it as our only vehicle anymore. It has some electrical issues and isn’t always reliable. When Caile and I came out to and hop in the car to go home it just wouldn’t start. Before I started thinking I immediately thought I had left the lights on again and killed the battery. This has happened a number of times since the buzzer stopped working to warn me when I leave them on. That didn’t end up being the case and we started noticing a slight electrical burning smell. That can’t be good.

At this point I figured it was something serious so I called Jen and asked her to turn around and come back for Caile and I would try to figure out what was going on and if I couldn’t I’d run home. After processing things for a bit I realized I was getting power no problem so I didn’t need a boost. The only thing was is the car wouldn’t turn over. I wasn’t even getting a click of the ignition when I turned the key. In my head I have it narrowed down to the starter or ignition switch neither of which I’m going to do anything about here in the parking lot.

When Jen got back she jumped behind the wheel, put it in gear with they key on and the clutch in. The kids got a big kick out of watching me push the car to get it moving. Jen let go of the clutch and it started right up. She followed me home just in case but it drove no problem. Now it’s home where I can figure exactly where the problem is and hopefully fix it up myself. It’s been a long time since I’ve bump started a car like that.

Since I last wrote about my car I’ve probably put around $1000 into repairs into it which is cheaper than a car payment, but I’ve also spent time without having the car which can be very inconvenient. If I could afford a new one right now I’d probably do it just for the reliability aspect. It would also make it easier to plan financially without havin unexpected repair cost pop up. But for now I’ll keep fixing it up until it gets to a point where the cost to repair is just to high to make sense.

Where Has The Time Gone?

For those of you not in Nova Scotia we have both a vehicle registration that has to be renewed every two years as well as a safety inspection by a mechanic every two years.

The end of November is when our registration was due to one of our vehicles. Today my wife went online and paid that fee shortly before she left to pick up the kids from school. On her way she called me, guess what I looked at our inspection sticker and it ran out in August. I questioned her about it and she responded, yeah it’s marked off as expiring in August 2016. I can’t believe we let it go this long.

My reply was well if that one is expired than so is my car. I knew the registrations were opposite years for the two, but the inspections were the same year. She called and booked an appointment to get it inspected for tomorrow.

Shortly after Jen arrived home I had to leave to pick up our oldest at school so I hopped in my car. Before I left I looked at the sticker and said to myself, wow she was right it does expire in 2016. Wait a second. Back into the house I went. Jen a couple of things, are you able to pass me my phone I forgot it on the counter? Thanks, next what year is it? She replied, 2015. Right. Slight pause.

Somehow we both managed to skip ahead a year. So instead of being really late for our inspections we would have been quite early instead. Luckily we had to get something done to the vehicle anyway so we just changed the appointment with the mechanic to cancel the inspection part.