Pizazz 1.2.0

Hey there! Long time no type. How’s it been going with you? It’s time for a new release of Pizazz. I’ve been distracted lately, so a lot of these improvements are overdo. Let’s see…

I added a new shortcode that allows you to embed Pizazz into your posts and pages, which will allow you to make store pages and advertise your products where they’re relevant. Are you blogging about asparagus? Then why not embed a Pizazz product feed with a bunch of asparagus T-shifts and mugs? Just type in [pizazz store=asparagus rows=8 columns=3] into your post and you’re ready to go! For the full documentation on Pizazz’s shortcodes, go to Settings->Pizazz and scroll down.

There is also a few more customizations. You can now change the alignment of text or just make it disappear and links can be made to open in new windows and the prices can be displayed right next to your products! This should give you a bit more flexibility while designing your website.

Lastly, the associate ID used to get referrals has been moved from the widget properties into Settings->Pizazz. I was worried that people would have to copy and paste their ID into all of their shortcodes and it would become too difficult to maintain. A dialog box will appear at the top of your administrative control panel after the update to remind you, so don’t fret!

The new release is up at the WordPress plugin repository. I recommend you update and check out these cool new features. Tell me what you think in the comments below and if you need help, check out the support area at WordPress!

Advertisements

Pizazz 1.1.1 Released

Ah…the feeling of fixing bugs. It’s very satisfying, but not as satisfying as releasing those fixes to the world. Now is one of those wonderful times for Pizazz.

The first thing I wanted to deal with is that the thumbnail-size property stopped working. Previously, I had used PHP’s str_replace function to change “_125.jpg” to “_theCustomThumbnailSize.jpg”. As it turns out, Zazzle automatically generates the images based on the last number in the filename, hence I was able to implement this nice little feature. However, for some incomprehensible reason Zazzle changed the default number to 152. I’m pretty sure that’s a typo, because the five and two have been switched and that’s it. Generally this would be dangerous for everybody who relies on this default size to use the feed in any of their products.

The fix for this is pretty simple, but I had to fix something else, first. I installed Pizazz on my fresh, new test server and it didn’t work. At all, or at least at all by default. If you chose the lucky tags then it would work perfectly. After awhile I figured out what was wrong: the RSS feed was broken (or, better put, malformed). The titles of the products in some areas contained ampersands (“&”). Normally this is fine, except that they were just ampersands. Under XML (from which RSS derives), the ampersand has a special meaning. It is used to identify special characters; for instance, “>” indicates the greater-than sign (“>”). So, an ampersand on its own is erroneous, and should actually be “&”. Sadly, the XML parser I was using — SimpleXML — isn’t forgiving, and would abort on such lines. Most XML parsers break on these types of things, even Internet Explorer failed to read these feeds (though that browser fails on a lot of things). However, since Pizazz was made for Zazzle, and Zazzle always does things like this, SimpleXML had to go.

I rewrote the parser to use PCRE — Perl-Compatible Regular Expressions — to extract data from the text file without parsing it as true XML. So instead of running the XML parser and pulling out the data from a specialized PHP data structure, I just asked PHP to give me the text in between each “<item>” and “</item>”, then from there pull out the title from “<title><![CDATA[” and “]]></title>”, etc. This also removed the need for a number of verifiers that I wrote in to handle when Zazzle only produces bad RSS every-other request (that happens sometimes). In combination, this results in faster feed-caching and much more forgiving RSS parsing. The number of times that Pizazz abruptly fails due to XML parsing errors has been greatly reduced if not eliminated. Even when Zazzle returns its home page surrounding the RSS data the proper fields can still be extracted!

Great, now I could get back to the bug that I initially wanted to fix: the thumbnail sizer. Well, I could have just changed the parameter for str_replace from 125 to 152, but I’m absolutely sure that Zazzle will change this number again and I’ll have to change that again. So, instead, I just got PCRE to replace “_anyNumberAtAll.jpg” with what I want. That fixed it for now, and should prevent anything like this from happening again.

Then I got a bug report from one of my clients using multisite. Specifically, Pizazz didn’t work on multisite (well, it sort of did). Before, she activated Pizazz on each sub-blog individually, which circumvented the problem where “Network Activate” would crash WordPress’s network dashboard with a E500 Internal Server Error. I was going to fix Network Activate but, considering that there was a way around it and I had other stuff on my mind, I deprioratized it and ended up forgetting about it. Well, she got around to enabling it on the main site, and ended up breaking the network dashboard again. There was no way around this one, so I had to go working on it.

During the first day I successfully fixed the undefined-function error PHP was spewing out by moving Pizazz’s initialization code into a WordPress init-hook, as I technically should have from the beginning. This resulted in a different error: “function get_current_screen is not defined in /…/wp-admin/network/settings.php.”

This one took me 36-hours to debug. I painstakingly scoured the blogs, the WordPress codex, the forums, anywhere Google would take me and never found anything that would solve my problem. Worse off, PHP doesn’t give tracebacks unless you install a debugging plugin, which wasn’t a viable option. I kept on trying new things, including rewriting the settings page entirely. Albeit, the rewrite resulted in a cleaner script and moved the settings into their own page, which was nice, but it was (is) still frustrating.

I ended going onto my client’s server and just putting in a bunch of die calls throughout the source code, trying to pinpoint where everything went wrong. I knew it was in settings.php, and the die calls didn’t help any further. That error kept cropping up in the network dashboard, and I couldn’t figure it out!

Finally, I commented out the code that loaded settings.php because I just wanted to remember what the network dashboard looked like. Then, carelessly, I hovered over and past the Network Settings tab. I froze, then moved my mouse back. I noticed that the Network Settings didn’t have any plugin fields listed. I looked back at the main site dashboard and hovered over the settings there and saw the plugins again. I un-commented the lines that loaded settings.php and looked back. The network dashboard stopped working, but the settings field worked perfectly in the main site dashboard. I wanted to scream.

You can’t register options pages in the network dashboard! As opposed to WordPress raising an error when this was attempted, it prevented the function from being created in the assumption that plugin developers would know what the “undefined function” error meant. They don’t say that you can’t define option tables ANYWHERE in the documentation! I checked, it isn’t there. No wonder so many plugins don’t work in multisite, they don’t document these incompatibilities! All I had to do was change ( is_admin() ) to ( is_admin() and ( ! is_network_admin() ) ) and it worked again. Who the hell manages the codex!

There was much internal screeching, pacing and (for some unhealthy reason) eating that came afterwards. This has to be one of the most frustrating things I have ever had to deal with. One line, one problem that I wouldn’t have had if they had just documented it!

Eh…anyway, here’s the new plugin. All these bugs have been fixed and there are some minor code clean-ups. I don’t remember at which point it was but I rewrote the cache manager to use opendir instead of glob when iterating through the files, because for some reason glob doesn’t always work when opendir does, so that should help any users who had or would of had a problem with this.

Now, I’m going to play with writing a little TinyBASIC compiler to cool off, and when I’m back to Pizazz I’ll implement shortcodes to embed Pizazz product inventories into your posts and pages. Keep tuning in!

Pizazz is available here.

Back

I’ve been away from programming my projects for awhile. I’m not going to disclose why, ’cause I like to keep some mystery surrounding my microscopic internet presence. Or maybe I’m just paranoid, how are you to know? Anyway…

Since I’ve been away for so long, some cob webs have cropped up. CANINE is still just a basic little rendering engine (still entertains me, though!) and Pizazz has some bugs due to incompatibilities with a slight (SLIGHT!) change in the Zazzle RSS feed. Also, I should give Secret Maryo Chronicles some love…that game helped me get through a week of nothing-to-do (or a month? I can’t remember…) and I want to ensure its continued development. So, here’s my game plan:

  1. Fix the bug in Pizazz where image resizing stopped working. Make a hotfix release.
  2. See if I can get my secret TinyBASIC compiler to a little more than just tokenize source code.
  3. Add in a way to embed Zazzle product feeds into WordPress pages with Pizazz via shortcodes. [pizazz-listing query=asparagus store=HolidayBug]
  4. Hack on the secret platformer I’ve been working a bit on with a new friend of mine.
  5. Get some basic scripting going in CANINE so we can get some interactivity out of the billboards. (Exploding barrels here I come! Later.)
  6. Add in a script editor to Secret Maryo Chronicles to help out Quintus’s new scripting subsystem.
  7. Hack a bit more on CANINE to get some bullets and enemies going.
  8. Get that TinyBASIC compiler I mentioned to output something that I can compile with Netwide Assembler (hence marking my first successful attempt at a compiler).
  9. Work a bit on that beat-em-up I made some mock-up-graphics for.

I’m going to try and stick to this as much as possible, only diluting it with Team Fortress 2. (Why must I have friends to play Mann vs. Machine? I don’t have enough! I don’t need Valve’s social pressure. >:[) If anybody gives me compelling reason, though, this order may be subject to change. It has to be really compelling, though.

Thanks to anybody who’s still interested in my projects,

– Luiji Maryo

Pizazz 1.1.0 Released

Lo and behold, Pizazz 1.1.0 has been released! After much work, I’m proud to introduce a version that is up to 0.75 seconds faster and won’t brutally fail whenever Zazzle is running slow. Caching has been implemented and can be configured under Settings->General. Furthermore, that pesky bug introduced with 1.0.1 where “See More” was broken has been fixed, and product results are now more variant.

Download it or install/upgrade it through your WordPress dashboard and get monetizing!

Great Strides in Pizazz

Not too long ago I released a WordPress plug-in I call Pizazz, which you can read more about here. It aggregates a Zazzle feed based on a few query terms and produces a randomized product display in a widget. It is highly configurable with options such as row/column count, thumbnail background and thumbnail size (a thumbnail size of zero will completely result in a text-only listing) and allows you to set the associate referral identifier (hereby “associate ID”).

The associate ID allows you to earn 15% of all purchases made through a click on one of the widget’s links, which means you can make money even if you’re expanding past your own gallery. With the right audience, this could make you gobs of money. Sadly, some of my competitors choose to switch out your ID with the widget author’s half the time (sometimes without telling you), and some now even use the widget author’s exclusively! This is the primary reason I wrote the widget. I have no intention of trying to make money in such a sneaky fashion, and at this time I’m not even asking for donations. It was mainly intended for a friend of mine, but is extensible enough in which I found it might be helpful to others. Users, in turn, provide me useful bug reports, which I greatly appreciate.

In a bit of a rocky start, I got a bug report in the first day caused by a PHP exception. It was a syntax error referring to a goto statement. It turned out that goto has just been added to PHP 5.3 — the version I tested with — and there are plenty of people still using 5.2. It was a simple fix, and many goto-haters will be satisfied to know that the code is now goto-less (many call it the bulldozer of computing — it’s a hideous way to go but can occasionally be a good choice). I now used multiple functions and return in its place, which is, admittedly, cleaner.

That fix caused the release of Pizazz 1.0.1. Sadly, I didn’t test as well as I should and a new bug found its way through the gaps. It was caused by my small bit of code restructuring. The See More link was broken (it only went to http://zazzle.com/+gifts?rf=). *Sigh*

I threw the fix to the code repository — well tested, of course — but then found myself hesitant to release 1.0.2. After such a short amount of time, I needed something more to post. Something that would push Pizazz onwards and upwards…a new feature.

Then it hit me: I was getting a lot of reports of Pizazz reporting that Zazzle was unavailable or that there was a problem parsing the RSS feed. Zazzle doesn’t have the fastest servers pushing out the feeds, and during the “Day of </rss></body></html>“, as I like to call it, Zazzle’s code was screwing up the feed.

The solution popped into my mind from examining how other people chose to implement their Zazzle feed aggregation: caching. If the feeds are cached, then when Zazzle connections are spotty or the RSS being returned is malformed, there will still be a backup stored locally on the user’s server.

Well, it took a few days to complete, but it’s now in. It’s the whole point of this post. It’s the thing that will push us on to 1.1.0. Caching has been implemented, and not only does it fix all those Zazzle connection issues, but it also made my test website load ~0.75 seconds faster!

It’s now available in the development branch of Pizazz, downloadable at WordPress.ORG. I’m waiting until I can enlist some testers and try it out on a few of my other local server setups, but 1.1.0 should be coming soon, ready for your monetization!

Remember, I run on bug reports. If you encounter a problem, please tell me! I can’t fix it, otherwise. I also don’t have any access to the Zazzle Pro forums, so any posts there would be routed through my friend, which is not too efficient. I appreciate every single one of your posts like they’re delicious candies.

– Luiji