Doing Things Wrong

More Bad Programming II

Audiovox Gibson-style Bass
Audiovox 736 Replica Bass
Audiovox Gibson-style Guitar
Audiovox Danelectro-style Bass
Audiovox Fretless Bass
Audiovox Electric Upright Bass
Audiovox Strat-style Guitar
Audiovox 12-string Guitar
Audiovox Ukulele Bass
Audiovox Mandolin
BC Rich "Osprey" Bass
Brownsville Violin Bass
Cowbell Bass
Danelectro Pro-1 Bass
Danelectro "Super-63" Guitar
Danelectro Silvertone 1457 Rescue Guitar
Danelectro Longhorn Guitar
Danelectro Silvertone U-1 Guitar
Danelectro Companion Guitar
Danelectro Silvertone 1443 Bass
Danelectro '67 Hornet Guitar
Fender Jazzmaster Bass 1
Fender Jazzmaster Bass 2
Fender Jazzmaster Bass 3
Fender Stratocaster Bass 1
Fender Stratocaster Bass 2
Fender Stratocaster Micro Bass 1
Fender Stratocaster Micro Bass 2
Fender Stratocaster Fretless Bass
Fender Stratocaster Bass VI
Fender Stratocaster Bass IV
Fender Stratocaster 12-string Guitar
Fender Stratocaster Uke Bass
Fender Squier Stratocaster Guitar
Fender Telecaster Bass
SX Precision Bass
Gibson Fenderbird Bass 1
Gibson Fenderbird Bass 2
Gibson Reverse Fenderbird Bass
Kubicki Bass
Schwinn Stingray Bass
Mosrite Bass
Rickenbacker 325 Guitar
Rickenbacker 325 Bass 1
Rickenbacker 325 Bass 2
Rickenbacker 325 Bass 3
Rickenbacker 4001 Bass 1
Samick SG450 Guitar
Danelectro Pro-1 Guitar
Danelectro Silvertone 1448 Guitar
Danelectro '63 Guitar
Danelectro Silvertone 1457 Guitar
Harmony H617 Bobkat
Danelectro Silvertone 1450 Guitar
Harmony Silvertone 1478
Danelectro Silvertone 1472 Amplifier
Danelectro Longhorn Bass

A while ago I said I couldn't find where the new Nivo Slider slideshow plugin (above) keeps its data. That's because it doesn't keep it anywhere. It generates each slideshow on the fly from scratch, with lord-knows how many database calls. I suspected that it was grossly inefficient, and I was right.

Since the original author has abandoned it, and I have already made changes, I decided to make it a lot better by adding my caching functionality to it. This was actually relatively easy. It is now lightning-fast after the first access. You have to wonder why they didn't do this in the first place, they already had a perfect place staked out to store the data, that was just wasting space in the databass. ** I even retained the capability for a random start slide, by changing that one line from server-side PHP to client-side javascript.

** Ha ha ha - databass! Get it? Get it? Awww ...

The quality of most computer programming is so bad, it's a wonder the whole world doesn't go up in flames. And what these poor kids get taught in universities is scary and sad. They teach how to write tricky code, but they don't teach how to write GOOD code. I know, I went back and went through it, after already working as an engineer for a few years. I honestly couldn't work up a lot of respect for most of my CompSci professors, let alone the awe that they are used-to from the kiddies. I think, most of them, if you gave them a broom and a dirty room, and came back in an hour, you'd have a fine theory on optimal sweeping patterns, and a dirty floor.

I also smartened up the caching logic so it doesn't blow out the whole cache over a little page edit. For a cache to be useful, you have to actually fill it up, otherwise, it is just more useless overhead.

Update:

To see what the cache is actually doing, I added a convenient debugging log that I can display in the control panel. As long as the site is actually running, I can view it right in the Dashboard. I should have done that a long time ago. The cache now only invalidates what it needs to when it needs to, not everything all the time. In a few days, it should fill up and become very useful. That was a little bit tricky, and the debugging log made it much easier.

Update:

I finally worked out all the details of cache filling and invalidation.

I had to make some compromises on the blog side for efficiency. If each blog post had its own cache, you would have to clear them all every time you add a new post. That defeats the purpose of caching. So instead, each blog post uses the cache of the main blog page. That one cache can be very easily cleared and refilled, and it has the side effect of making the blog caching blistering fast. The downside is that I can no longer light-up selected entries in the menu for the blog. What the hell am I talking about? Exactly - so what?

There are still some rare cases where caches that should be cleared are not. The best way to handle that is probably to empty the entire cache periodically and start over, which is probably not a bad idea in any case. I can also do it manually from the back end. Speaking of which, during all this caching business, I added some nice features to the back end for managing large numbers of pages and posts, which WordPress does rather clunkily.

Another University CompSci memory:

I was forced to take a graduate-level class that was a requirement because the university had just hired a big name and had to fill his classes, despite the fact that there was little interest in his specialty, and he didn't actually teach anything himself ( his English was marginal. ) His algorithm was a breakthrough at the time and widely publicized, but was quickly supplanted by better ones.

Out of curiosity, I decided to code-up his famous algorithm ( that nobody uses. ) I got to a tricky part, and went to the lesser prof who was actually teaching the class to see if he could help. He was taken aback, and finally admitted that he had never actually programmed the algorithm he was teaching! Never, not even out of curiosity! ( Although he had published theoretical papers on the subject. ) I was shocked. It was not that hard, I figured it out on my own.

Now I understand that at the PhD level, you are not going to be in the nitty-gritty of coding much. But if you're not going to keep one foot in the real world, you could at least dip your toe in once in a while. I could count the number of CS professors I've had, that I could hire and expect to do real work, on the fingers of one hand. ( There were a few that really were sharp, but just a few. ) I've had enough school, I never want to go back, except maybe for wood shop.

Sadly, the big professor died at a very young age. On the plus side, that may spare future generations from being forced to take a completely useless class.


image

Here's a little gadget that I finally got around to finishing, that should save me a lot of bother in the future. It is a template for laying out screw holes for various bridges, both guitar and bass.

Printed from luthierylabs.com