Introducing the Mass Page Maker Pro WordPress plugin

Since starting this blog, some of my post popular posts have been about the WordPress plugins I’ve written. Built as I started learning about PHP, they’ve received hundreds of comments and often generate a spike of pageviews when new versions become available. The most practical of these plugins, Mass Page Maker, has seen multiple iterations as I learned more about the WordPress API. Many people were very happy about the ability to import data using a CSV file, but conversely that generated lots of comments about having difficulty getting the format right.

After many months of struggling to improve it, I’ve buckled down enough to offer a new version, called Mass Page Maker Pro that is now available for sale at $10 (Limited time only!).

There is a reason that I’m charging for this version. After I neglected the plugin for long enough, it was dropped from the WordPress plugin repository. When I approached the staff about getting it reinstated, I was told that the plugin could be abused and cause someone to import too many pages into a WP installation. This is true, but like most useful tools, there will always be a small subset of users who abuse its capabilities. After having an email conversation with one of the plugin users, I made the decision to offer a free and Pro version of the plugin, to hopefully earn a little money for the time I’ve invested in developing it. The free version will not allow CSV importing, and will be limited to 10 pages at a time, so hopefully those restrictions will allow it to be listed in again in the repository so that existing users can receive the update and learn about the situation.

Now that that’s out of the way, let me explain some of the new features in more detail.

duplicate content category

Customized CSV Format

As mentioned, a big problem with the original version was the stiff nature of the CSV format, making it difficult to match the required format the plugin is expecting. I decided to solve this by offering both the default format and allow a totally custom format to leaves out data that is not important. To create a custom format, choose “Custom” from the menu and click the Add Column button. From there, it’s easy to define the order of the columns you want to use. The nice part is that the plugin will merge your data against the default format, meaning you can concentrate on your data.

For example, if you define only a post title and post content column, properties like post type (post), comment status (open) and post date (current date) are added automatically. Drag and drop the columns as required. I think this will be a very well used feature.

CSV form screenshot

Improved Web UI

Since starting this plugin, I’ve learned a lot more about Javascript and jQuery technology and have incorporated a lot of that in this new version. It uses the jQuery UI accordion plugin to display either the CSV input or web form and makes it easy to add tags and custom meta values.

Duplicate and update existing posts with CSV data

Through some user feedback, I added a new column to the CSV format that allows you to update existing pages or duplicate them and overwrite the content. Choose the respective column in the dropdown, and supply either a post title or post ID and the plugin will overwrite that data with what you supply. For example, in the first photo above, that is the correct layout for duplicating pages, overwriting the post content and adding new categories. Those three values should be the first 3 columns in the CSV text.

I’m hoping that this version of the plugin contains all of the properties users might want when importing posts. I spent lots of time testing the plugin, but of course if you run into an issue, use one of these contact methods. There are also example CSV files on that page available for downloading. Please consider purchasing the plugin if you’ve been helped at all by the original version, and I’ll continue to offer new features and bugfixes.

Tagged with: ,

Troubleshooting a custom computer build

ASUS P8Z77-M Pro MotherboardRecently I decided to take some leftover computer parts and add them to a few new ones to create a small computer I can use for an upcoming projection project and also use later as a home theatre PC. I went to the local computer store and picked out the required items: Z77 motherboard, graphics card and case. It took part of a Saturday afternoon, and by the evening I had Windows 7 booted.

That’s where I ran into trouble.

Intel i5-3330 CPU and thermal pasteThere’s a delicate balance between hardware and software in a computer, and sometimes the two sides fight each other. That’s what started happening to me. After installing the motherboard drivers from the included DVD, I started getting freezes a few minutes after startup that would last anywhere from 30 seconds to 3 minutes. They would repeat again and again, and it was almost impossible to predict. After updating some software, and testing different applications, I had two breakthroughs: first was a blue screen of death that returned an anodlfx.sys error and the second was a taskbar notification that the graphics driver had halted but recovered again. Armed with those data points, I combed Google for information, but came up largely empty. So to find a solution, I began troubleshooting individual components and systems, which are documented below.

Remove/reseat RAM

Computer memory can sometimes cause random software behaviour under certain conditions. To try to pinpoint if any of the chips you’re using have problems, install only one DIMM at a time and boot the computer to check for an error. You have to make sure the slot used is the one the motherboard needs when only one chip is present. I swapped out the two chips I was using at the time, but the problem continued. Installing them both again, I ran MemTest86+ but that came back clean, so memory was not the problem.

Remove the dedicated graphics card

Since the popup warning seemed to indicate a graphics problem, I tried removing the dedicated graphics card. The Z77 chipset motherboard I’m using has support for integrated graphics, should the CPU support them, so I was running Intel HD2500 from the motherboard itself. Unfortunately the problem persisted, so yet again I had to go down a different road.

Change the hard drive

A problematic main storage unit can display problems in unique ways, so one of the things to try is to use a new drive. Originally I was using a 64GB OCZ Vertex 4 SSD, so I substituted in a spare 2.5″ HDD I had in another enclosure. After reinstalling Windows, along with the different hardware drivers, I continued to get the errors, so obviously that couldn’t be it.

Change out the motherboard

The original motherboard I used was an open box, so after going through each of the steps above, I decided that the only logical problem was the one part that had stayed the same throughout: the motherboard. Be warned this is not for the faint of heart, as it involves removing and collecting nearly every piece loaded into the case already. Nevertheless, I put everything into the box and replaced it with a brand new one. Reinstalling it into the case and booting up the same installation of Windows (it doesn’t care if the hardware model doesn’t change), I was rather frustrated to see that same graphics warning after a few minutes of use.

Use different drivers

At that point I decided to change things up completely and reinstall Windows, along with all of the drivers. This time, however, I went directly to the different manufacturer’s websites and downloaded the files directly. Incredibly, after multiple reboots from the installations, I didn’t get a freeze or blue screen. Somehow changing up the driver versions had aligned everything properly and the parts were playing nice together. Since the main errors were about the graphics driver failing, it’s not particularly surprising that changing up the software might fix the issues.

IMG_0824After getting gigabytes of software updates, the system continues to operate properly and I’m pretty happy with it. At this point most of the challenges I’ve experienced with computer setup deal with driver software; this computer POSTed every time. Hopefully by documenting my challenges here, it will help me in the future, and also anyone else who might have a similar problem.

Building a bench top power supply with a computer PSU

Electronic tinkering and building have become a bigger hobby for me as I finished my university degree. The Arduino development platform is quite a remarkable system, and the online community of users is growing every day. The problem with many of the projects that I do is that many systems require more power than the 50mA or so the Arduino can provide. You could use different AC-DC wall adapters, but that becomes unwieldy.

The DIY solution, as many Arduino users have discovered, is to repurpose a used computer power supply unit for cheap, regulated 3.3V, 5V and 12V DC power. I decided to build my own based on some other examples, while adding things that I need for my projects. I documented the procedure in an Instructable but thought I would expand on the design and build process here a little more.

Design Requirements

I did lots of planning before cutting any sheet metal because I wanted to follow the engineering procedure. The major requirement for this is to decide what features the final system needs to be successful. I chose the following:

  1. Ability to remove the 24 pin ATX cable to power other projects
  2. Access to all available PSU voltages (3.3V, 5V, 12V)
  3. Different connectors to make powering different components easy
  4. Fuses to prevent powered systems from breaking
  5. Keep some external cables for future expansion
  6. Connectors on the top of the PSU

Bill of Materials

With the requirements in hand, I started browsing for and collecting components. One of the things I noticed right away is that any power supply with a top mounted fan would not useable. This means that my system is limited to about 300W or less, which for desktop projects is completely fine. Older, cheaper and lower power units were the first place I looked, but I quickly discovered another requirement: a 24 pin ATX connector instead of the older 20 pin standard. This limitation meant that I had to build a new one from Newegg instead of on the used market. The cost worked out to be the same.

After waiting a few weeks for delivery, the following parts were on my table:

The ATX breakout board handles the operation of the PSU by properly shorting the on/off wire and providing indicator LEDs. It also breaks out each of the voltages on the cable to a useful screw terminal pad. If you choose to use a different method, turning the power supply on is as easy as shorting the green wire with a common ground. The other parts I found on eBay or various electronics retailers on the internet (try Adafruit, RobotShop, Sparkfun or OddWires).

Design Process

My first step was to measure and replicate each part as accurately as possible using a 3D CAD package. If you’re looking to do something similar, take a look at Solidworks, Autodesk Inventor, SketchUp or Pro/Engineer and decide which to learn. They all perform the same functions, although SketchUp is less about dimensions and more about sculpting 3D objects.

With the components in my system, I was able to lay out all of the holes on the PSU shell to confirm space. I was able to fit 5 2.1mm DC barrel jack connectors, the power distribution block and ATX board on the top surface, with the fuses moved to the side. The software made it very easy to print templates for the hole locations on each surface.

One of the things I needed to look out for was preventing interference between the barrel jacks on top and the internal heat sinks. That meant modelling additional components inside the shell, but doing that extra step prevented numerous hangups further down the process.

As a quick note, please keep in mind that this is a record of my procedure and by no means a complete step-by-step instruction manual for hacking power supplies. These units produce an evil amount of electricity and can be dangerous when misused. Remember that before breaking open the tool box and realize that it’s entirely your choice to void the warranty.

Drilling and installing the components

Cutting into the sheet metal container can’t be done by hand, of course, so here’s a list of tools I used:

  • Power drill
  • Assorted drill bits
  • Step drill (with 3/16″, 3/8″ and 1/2″ sizes)
  • Round file
  • Dremel deburring tool
  • Assorted screw drivers
  • Wire stripper
  • Diagonal cutters
  • Multimeter

If or when I build another unit, I’ll add a center punch to that list in order to accurately dent the material to start drilling. Without it, I needed a finishing nail and hammer, which reduced accuracy somewhat.

Start by ignoring the warranty labels and cracking open the PSU shell.

Inside you’ll find a semi-organized collection of wires, circuit boards, capacitors, MOSFETs and heat sinks.

Now is a good time to tape the hole template paper to the shell, if you’ve prepared one. For the most part the holes aren’t for accuracy relative to the shell, but more for proper spacing between the individual holes.

Drill the 1/2″ holes for the fuses with the step drill. The thin sheet metal will produce burrs on the underside that you’ll need to clean up for the fuse holder to sit flat.

Do the same for the 3/8″ holes for the DC barrel jacks. Both of those components can then be loaded into their respective locations because they’ll need to be installed in order to solder the wires.

Wiring and soldering the connections

Routing the cables from the bottom PCB to the fuses and on to the barrel jacks was somewhat of a challenge because of the arrangement of the heat sinks and bottom components. I cut the external connectors and passed the wires inside to test for length. The overall path for the positive cable of each voltage would be PCB – Fuse – barrel jack and the associated ground wire went directly to the barrel jack. Be careful not to pull too hard on the PCB because tracing the wire back to the soldering pad can be a real pain.

Generally the fuse to barrel jack wire was soldered first, because it was the easiest to trim and arrange. The fuse holder only has two pads, but the barrel jack has three, which means before soldering anything you’ll have to learn the pinout configuration. The most common barrel pinout is center positive, so that’s what I used. Finding which pad was which meant connecting a wire to the jack and checking continuity with a multimeter. Not difficult by any means, but it can be time consuming.

After reinstalling the shell, I soldered on the screw terminals to the ATX board and connected the 24 ATX cable. The brass standoffs are used on the ATX board to raise it from the metal shell, so those were installed next.

Testing the entire unit was a simple matter of connecting the multimeter to the screw terminals and barrel jacks.

After testing, how you use the power supply is completely up to you. The easiest way to incorporate the power is to feed lines from the screw terminals to a branch on a solderless breadboard. Saving the cut off internal wires is a great way to wire them together.

This was a great project for me to test design principles and following through with a project from start to finish. It now opens the doors to building systems with motors, thermoelectric coolers or any number of other sensors.

Tagged with: , , ,

Compiling C Programs on OS X 10.7+

One of the first posts I wrote for this blog, back in 2007, was about how to write and compile C programs using Mac OS X. That post was a result of me doing C programming in my first year of university, and since then plenty of things have changed. Not only have I finished university, but the basic procedure for installing Xcode has changed as well.

I thought I’d write a new tutorial updated for the more recent versions of OS X.

  1. Install Xcode from the Mac App Store
  2. Install the extra Command Line Tools from within Xcode by navigating to Xcode > Preferences > Downloads
  3. Create a new Xcode project by navigation to File > New > Project
  4. From the template list, under OS X, select Command Line Tool and choose Next
  5. Fill out the required forms, and under Type choose C
  6. Save the project to your computer
  7. Open main.c and write!

It’s possible that by default the toolbar won’t be shown to click Compile + Run, so you can press Cmd+R to do that directly.

The method in the original post continue to work, as long as Xcode installed as described above. Comments on that post provide additional information, like this one from mvdhoef:

instead of resorting to the default a.out you can use gcc the way it was meant to be used!!!
gcc -o -Wall name file.c
where name is the name of the program gcc will create,
file.c is the file and perhaps extension of the code you have created.

-o is to open new/rewrite in this case name (*if name already existed, it would overwrite without a second thought)
-Wall is another option which tells gcc to show all errors it encounters during compiling. (*this is optional)

Don’t forget to slack off while your code is compiling.

Tagged with: , ,

Fix missing media info and thumbnails in WordPress 3.4.x

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: , , ,