Does your WordPress media library look like this photo? Maybe you don’t have the same affinity for the BMW 1M that I do, but if you’re missing thumbnails, I might be able to help.

After upgrading an important installation to WordPress 3.4, I suddenly noticed that many thumbnails had disappeared, specifically the earlier uploads. After posting to WP support forum and WP StackExchange group and receiving minimal response, I decided to take a look at the database myself.

I ended up finding the problem in the wp_postmeta table. It turns out that prior versions of WordPress didn’t insert the _wp_attached_file meta key when uploading a photo, and the latest version requires it. Since this key doesn’t exist for some uploads, the system defaults to showing the media icon, and refuses to display resized images in other posts.

The solution is to run through the list of attachments and insert this meta key where it doesn’t exist. I wrote code to do so, and it worked for me, but when another user requested it in a more useable format, I wrapped it in a basic WordPress plugin.

Download it here

I can’t provide much in the way of support for it, but if it fixes your problem, leave a comment.

Tagged with: , , ,

I’m an inquisitive person. Maybe it’s because I’m an engineer, but I like learning about new things, whether they’re related to cars, computers or technology in general. So recently when looking through the logs of my Ubuntu server, I discovered many, many failed login attempts for users that didn’t exist. Since my system is accessible via the internet through SSH port 22, I get lots of attempts from bots, or less likely, real people.

In the past I’ve looked up the recorded IP address on the internet and found the offending location (or at least an approximation) but now, with my recent affinity for Python, I decided to automate the process and start a log. Using the free API service from, I wrote a Python script that runs hourly and parses the log file, looks up the location online, then stores everything in a MySQL database. Then I wrote a small PHP page to output the data to a browser in the form of the pretty maps and charts you see on this page. Now I can check the site occasionally and see where the activity is.

What does it all mean?

By looking at the map at the top, you’ll notice that most of the logins are centralized in the United States and eastern Asia. I can’t really say I’m that surprised.

The sample is made up of 352 attempts since February 2nd. You’ll see in the chart that the top 5 countries are:

  • China – 126
  • United States – 77
  • Republic of Korea – 32
  • Turkey – 18
  • India – 13

It’s an interesting list, and I’m curious to see how the numbers will change over time.

Additionally, here is a chart of the top usernames that the attempts had. Not really a surprise here, either. Obviously “attackers”, for lack of a better word, want to gain full access to a machine by using the root username, and most of the other names are for services that typical servers have running (eg. Oracle, mysql, postgres, etc.). What I found most interesting are the one-off attempts: brian, richard, fluffy, stud, gnats and taylour to name a few (really!). Top 5 once again are:

  • root – 255
  • bin – 21
  • nagios – 14
  • oracle – 9
  • test – 4

So what can you do?

If you must have an open SSH connection to the internet, there are a few things you can do to protect your system. There are lots of websites that describe the steps in more details (like this one, or this one or even this one. All of those sites share a few simple tips:

  1. Disable root access
  2. Use keys to access the system instead of passwords
  3. Drop the connection after x login attempts
  4. Use a non-standard port for SSH
  5. Enforce secure passwords

I follow a few of those, mostly because my system isn’t important enough to warrant super hardened measures. Even by disabling root access, you remove 99% of the threats, and requiring a key to log in removes the remaining 1%. I”m not particularly worried about users actually accessing my computer, and by following some of the measures above, that possibility is basically elimininated.

Update — September 23, 2012
A commenter requested the source code for the above system, so I’ve attached it as a zip file. It contains the Python script and web front end. I’ve written instructions as best I can, but please remember it’s a bit of a hack and therefore I can’t provide much support. Follow the readme and it should make sense.

Tagged with: , , ,

Wow. It’s been almost 12 full months since I wrote on these pages. Partly this is down to laziness, and partly a result of having too many cool things to do. Since I do enjoy writing and describing interesting things here, I want to make a point of writing on a more regular basis.

So what was I doing during the last year?

Here is a list of things I hope to write about in future posts.

Writing iPhone applications

Since the start of 2011, I’ve been working full time at a small mobile software company in Ottawa. We build mobile applications for iOS primarily, and are edging our way into Android to follow the rise of that platform. Applications are generally a mix of website companion apps, utilities and games, with a nearly even split between developing for clients and ourselves.

Our latest title, Tanks of Fury (win a Samsung Galaxy Tab!), is a colourful shooter with excellent graphics, hilarious sound effects and intuitive game play. Built with the Cocos2D framework, it was a excellent learning experience for combining graphics, efficient development processes and sound effects with the iPhone platform.

Despite not having any Objective-C and iOS developer experience prior to starting work, I was delighted at how easily I was able to pick up the language. Since I’m always looking for new ways to learn more, I decided to write my own apps and put them into the store. I previously wrote about one, and have had a moderate usage of about 1000 users. Shortly after, I came up with an application that would have been useful for my engineering studies, called Equation Library. By compiling many common equations into a directory and allowing users to solve for individual variables, I hoped to make it easier to do boilerplate math equations (engineering has a lot of that). Despite rushing the app into the store, I was shocked to see about 18,000 downloads in the first 48 hours! Part of this is likely down to its free price, but part could be that other people see value in it. Like this blog, I’ve somewhat neglected that app since releasing it, and hope to have a new, more useful version out when I have some time.

Overclocking my PC

Since having a little extra cash to put towards electronics, I’ve really taken an interest in DIY computer builds and tweaking. In fact, I’m writing this post on the computer that was the subject of my last post, building a watercooled PC. Since that post, I’ve made some changes to the setup of the computer, including overclocking it to 4.0 GHz. Although not strictly necessary, overclocking is somewhat of a badge of honour among computer enthusiasts, and is now gaining mainstream attention thanks to Intel’s latest chipsets and improved cooling solutions. I decided to leverage the superior cooling power of my custom fluid loop and bring the chip to a nice round number. So far so good.

Additionally I did things like adding a second GTX470 video card, more RAM, an SD card reader and added a third Reserator. That last part exemplifies overkill, but the way I see it, I’m futureproofing! Replacing my single 25″ ASUS monitor with dual 28″ HannsG screens has really made the space easy to work in. Maybe some screenshots and photos of the screens in action will be in a future post. In the mean time, check out this related post from Jeff Atwood on the benefits of using multiple monitors.

Adding MythTV to the Ubuntu Server

As a perennial digital tinker, I like to investigate and experiment with all of the interesting software available to a computer on 24/7. One of the most complex, but also most rewarding, applications is MythTV, the open-source DVR. I mentioned previously how getting it set up was a real pain, and the good news is that I’ve sorted through that. Now I have a MythTV setup where I can browse listings, schedule recordings and see system status from within a simple browser, using MythWeb and watch videos on a separate computer running XBMC. Using a simple coat-hanger-based antenna, I get one good channel in perfect HD, and a number of others if the wind is right. If I moved up to a commercial antenna, I bet I could get more. Right now, though, it’s nice to just be able to watch live and local TV whenever the mood strikes.

WordPress websites

Over the last few months, I’ve started doing some additional website work with my sister, who resides at Through various channels, we have 4 or 5 projects ongoing, which are visible in the above image. To take a look at one of the currently live websites, visit, and look for more links in coming posts.

Each website so far has been based on the WordPress platform, which has allowed me to become more efficient at building administration panels and custom themes. In fact, the more I’ve used it, the more I’ve come to appreciate its simplicity and adjustability. Hopefully I can apply this new knowledge of the WordPress API to updating my plugins in the very near future.

GoPro Camera

I’m a big fan of the GoPro camera. Not necessarily because I’m an adrenaline junkie, but more for the way it does a single job exceptionally well, and packs a lot of tech in a very small footprint. Once you recognize them, it becomes a game to point them out in regular TV shows, sporting events and online videos.

I bought the GoPro HD Hero camera in the summer of 2011, with the intention of using it for driving videos mounted to my windshield and for snowboarding. So far I’ve captured some cool time lapses while driving across Ontario and interesting pool footage. Recently, however, I was able to put it to a stiffer test, where I used it while snowboarding at Mt. Tremblant, QC. In fact, here’s a YouTube video my sister put together about it. Most of the video was recorded while the GoPro was mounted to a custom camera pole mount (read: wooden dowel with a cable loop) so I’d like to write a future post about how to make your own, along with a fishing line camera tether. Hopefully I don’t ever really need to test the tether, but it’s at least a bit of piece of mind.

3DConnexion SpacePilot PRO

This device brings me back to engineering. The present and future of product design and testing is done inside a computer, using design suites that handle full 3D representations and analysis. To work more efficiently, many engineers swear by left-handed 3D mice. Built by Logitech subsidiary 3DConnexion, the SpacePilotPRO includes the largest feature set of any similar mouse. I purchased it for developing my skills in CAD programs like SolidWorks, AutoDesk Inventor and even Google SketchUp. It also works in applications like Google Earth, which allows it to provide a unique interface for zooming in and out through space.

So far it has proven its worth while helping me learn about SolidWorks’ analysis components. The control knob provides fantastic 3D manipulation and the buttons are laid out smartly to provide instant access to any application more common features. It’s true that it takes some time getting used to, but it can provide a 20-30% productivity boost once integrated in the workflow.

So that’s what has happened in my last year, relating to technology. Look for more detailed posts in the coming weeks!

Tagged with: , ,

I’ve been looking forward to writing the post for this project. It may seem that I’m exclusively a Mac user, but my time inside operating systems is probably split 60, 30 and 10 in Mac OS X, Ubuntu and Windows environments, respectively. Mac OS X is obviously my primary platform, but I use the other systems in the area of their strengths. For Ubuntu, that means running my 6.75TB file server and Windows 7 is running some engineering applications and games.

The proportion of the second two OSes will increase dramatically with this project.

Back in September I decided that I wanted to build a super powerful desktop computer running Windows 7, and maybe even Ubuntu. So over the last 4 months I’ve been steadily buying parts to facilitate the goal, and the computer has finally booted. What follows is a description of the process I took, which you can also follow on this [H]ard|Forum thread.

Choosing the Parts

I choose this motherboard on the recommendation of a friend, who has been using the same one for a number of months. In addition, I liked the USB3.0 connectivity, compatibility with Intel’s upcoming 6 core CPUs and triple SLI for the future. So far I have yet to be disappointed.

I choose to go European for my waterblocks. These are from Slovenia, by a company called EK. They are well regarded in the water cooling community for their high quality. These blocks cool the chips on the motherboard surrounding the CPU, and reduce fan requirements for the case to essentially zero.

For the CPU and VGA blocks I chose Germany. AquaComputer makes all of their blocks in house, and ship worldwide. If you ever decide to order from them, try to find a local friend who can split the shipping, because it is a flat rate regardless of order size.

Choosing the graphics card is a super important step for building custom PCs. It has to provide the power to do whatever you want in the near term, but also give you room to grow into whatever application you need later. For those reasons, I bought what, at the time, was the second most powerful graphics card NVIDIA produced (they’ve since released the GTX5xx line that has rendered my choice obsolete). Hearing horror stories about power requirements and temperatures under load, I was relieved that I would be watercooling this chip, which should prevent it from burning through my case.

Speaking of cases, the Corsair Obsidian 700D provides an expansive space to insert every computer related gadget you’d ever need. In fact, the case is so large it hardly fit inside my car. The 700D is the slightly less expensive brother of the super awesome, and similarly sized Obsidian 800D. That case primarily adds a side window and 4 hot swap bays on the front faceplate. I decided on the 700D because I needed that front real estate for my fluid filter. Currently I’m looking for an 800D side window so I can gaze at the work I put into plumbing the internal system.

Not shown are the rest of the parts that are required when building a custom PC.

  • Intel i7 950 Socket 1366 CPU
  • 6GB G.Skill DDR3 RAM
  • 120GB OCZ Vertex 2 SSD
  • OCZ 850W Power Supply
  • 500GB Western Digital Caviar Black 3.5″ Hard drive
  • Generic ASUS DVD-RW

I chose these parts while searching for the best value available at the time. They should provide enough power for any application I might want to run in the upcoming years.

Modding the 700D

Installing the fluid filter into the case required opening a hole in the front aluminum faceplate and steel chassis structure. So I pulled the Dremel from the closet and went at it. It’s a loud, dirty job, but persistence paid off as I slipped the filter into place.

With the aluminum cover in place, the mod is complete.

From the other side, however, the job is slightly less clean. The tolerance was such that I had to use elbow fittings from Koolance to direct the tubing away.

Final Assembly

With the motherboard installed in the case, I ran tubes from the in hole in the case, to the filter, and out through all the blocks on the motherboard. Inside the case the loop runs filter to CPU to graphics card to Northbridge to mosfets and out. I used standard Koolance barbs and fittings on the G1/4 threads installed in each of the blocks. The tubing is 3/8″ ID 0.5″OD tubing from Home Depot. This diameter provides plenty of flow and is easy to connect to the variety of parts in the loop.

For measuring vital stats about in and out temperature as well as flow rate I bought and installed an Aquaero v4.00 from AquaComputer. Connected to it is a collection of sensors including 2 thermocouple water temperature sensors and this high-flow flow meter. It is calibrated to tick at a precise rate for each litre of fluid passing through, and the calculated flow rate is displayed on the Aquaero LCD screen.

I swapped the air cooling heatsink on the GTX470 for the waterblock and installed it into the chassis. It adds weight to the card, but slims the profile down significantly. It is definitely an improvement over the regular air system.

The motherboard blocks were next. The ASUS board used 4 individual heat sinks connected via heat pipe to cool the voltage regulators and associated chips. Those were replaced by 2 mosfet blocks and a single northbridge/southbridge block.

To cool the water flowing through the system requires a radiator and reservoir. I decided to use a now out of date product from Zalman called a Reserator. As shown by the name, this is a combination of reservoir and radiator. Essentially an extruded aluminum cylinder with fins, it has a 2.5L capacity and cools the fluid as it flows from top to bottom. I used two because of the significant heat my computer would be putting out. Both were sourced online from eBay and Kijiji. Interestingly, the Kijiji model was the only one available on the site, and was 10 minutes from where I was at the time. By buying used, I saved approximately $350 combined, which is the cost of a single brand new unit.

Pushing the fluid through these blocks is a generic aquarium pump that was bought primarily for being available at the time I was in the pet store. Rated for 350GPH at zero head, my system produces 50L/hour, which means together the loop has a head of approx. 10-11ft, based on the pump chart. I started with a 24 hour leak test, and the pump has been running perfectly since then.

Not mentioned a lot here is the choice of coolant. I’m using Feser One dielectric fluid instead of water with additives. The Reserators I bought were both encrusted in a blue film as a result of using these additives, and dielectric fluid presents fewer risks to the electrical components in the immediate vicinity. Originally I had 4L in the system, but immediately learned that was not enough when air bubbles were flowing through. I added another 2 and the air bubbles have stopped.


So what have I gained from all this and why bother watercooling in the first place? First, this is a very powerful computer system. In the brief bit of testing I’ve done so far, frame rates in StarCraft 2 hover at about 100 during most of the game, and any other FPS game I’ve played has done so without pause. For gaming and eventual 3D CAD work, it will be a capable machine at least for the next 3 to 4 years. For that power, and the ability to upgrade parts as they require, this has been a great success.

This screenshot I think captures most of the success. I have very little place to go before I reach that magic 7.9 peak. The best part is that with all of this power, the system itself is nearly silent. The case fans I do have are near 35% power to slowly cool the single platter-based drive I have inside, but for the most part I hear nothing. That is the payoff to watercooling. Though getting the parts together and in the same room was rather costly and annoying, once everything is set up there is minimal maintenance and system I’m using should give me room to overclock and upgrade equipment down the road.

For most people, however, watercooling is maximum overkill. In fact, I’m fairly certain watercooling remains popular in maybe 5% of the computer using population. The cost is often a prohibiting factor, but time and energy are key as well. For a custom system like this, you’re looking at spending an additional $400-$500 above whatever you spend on processing parts. Though out of the box systems like Corsair’s H70 can make cooling a CPU more cost effective, you’ll still need to think through every other part to get the results you need. As an engineering graduate, I enjoyed the research into parts as much as putting everything together, so I’m curious what other performance I can get out this setup.

Part 2 I will be sharing more results of experimenting with cooling parameters and overclocking. Would you consider watercooling? Let me know in the comments.

Tagged with: , , , ,

Towards the end of school in April, I got in contact with a classmate who was connected to iPhone development, and in September I started working full time for them. It’s been really cool to see how apps actually progress from ideas to real products, because so many people use them, but only a small percentage actually understand the mechanics of how the apps get onto their phones.

I mostly did some feature additions to existing apps to get to know Objective-C and the iOS environment, but during a recent road trip, I created an app that has just entered the App store. A small utility, it serves a need that I could have used many times on the trip.

It’s called Here’s My Location and it gives you the ability to alert friends and family to your exact GPS location through email and SMS. There are similar applications out in the store already, but I think this one has the right combination of simplicity and utility that many people like.

To use the app, open it and wait for the GPS accuracy indicator to go green. This little badge changes based on the accuracy of the phone’s current location: red for inaccurate, yellow for moderate, and green for accurate to approximately 5-10m (the iPhone’s limit). You can send a message using the top two blue buttons, or copy the formatted Google Maps link to the pasteboard to use in another application.

It’s really a simple start, but I hope that through user feedback I can add other requested features in the future.

Tagged with: , , , , , ,