New Backend, Part II

I have been busy at work, so I haven’t been able to sneak away to really knock this stuff out. The topics manager is now complete, and it’s been AJAXified, but only partly. There are some things that are simply not well suited for AJAX. It’s interesting, because as slick and fast and powerful as it is, javascripting is actually a much more meticulous process than PHP. It’s much less forgiving and the errors are much less descriptive.

I have also removed a lot of the password prompts. Every single admin page load, including the AJAX requests, require your cookie for authentication, and even the cookie is just random data. I’m fairly certain we haven’t sacrificed much in the way of security by only forcing the login once. Even Gmail doesn’t ask for a password with every session.

That said, the backend is now mostly complete. I do need to add one more feature, which is image uploads, a portion sorely lacking. This has been needed for some time, as when I need an image, I need to FTP it up, which is lame. So I will incorporate image uploads shortly, and then break for the wedding and honeymoon. Then I’ll come back and release Small Axe 0.4 and get cooking on the next batch of features!

New Backend

The first parts of the new backend are written and in place! I’m very excited to get rid of some of the legacy code that powered this blog. As I replace the old crufty code, I’m taking out all of the tables, all of the old HTML, many of the CSS classes have been replaced with more powerful styles.

When I get back from the honeymoon, I’ll be packaging a new release of Small Axe, which will be, by far, the best one so far.

Enhancements, enhancements.

At some point, after the honeymoon, I’m going to take a nice, stable snapshot of firsttube.com and turn it into the next release of Small Axe. I’ve added several new features in the last few days. Last night I fixed the related stories to be a config switch, as detailed here. As you may have noticed, I redid the entire stylesheet for the site too.

Today I added a new AJAX backend for the admin section and you can now edit topics via AJAX. If this is Small Axe 0.4, 0.5 will have to have a backend rewrite. It’s just ancient. There are several things that need to be fixed to prevent future bugs.

I also changed the RSS feed to obey the “related” switch. If you’re set up to use tags instead of topics as your related basis, then the RSS feed will display the first tag instead of the topic as the “category.” So all posts in my RSS feed as now going to be using tags instead of topics. I don’t know what I will do about topics in Small Axe or on firsttube.com right now. On smallaxesolutions.com, the topics mean something. Here, they are completely random. So, for now, not entirely sure. Read on for more.
Continue reading

Related posts.

Small Axe (at least, the firsttube.com build) has had “related posts” displayed on each entry’s page for some time. However, since the “topics” I use are all random and unrelated to the post, the related posts weren’t… uh… related.

So, I added a new configuration option. Now you can choose in the backend whether or not you want related posts to be “related” by topic or by tag. By toggling the option, suddenly, related posts were — get this — actually related! This is entertaining the hell out of me, and because of that, I will be forced to tag THIS post “Nerd.” Sigh.

Tag Soup

I’ve really struggled with the challenge of implementing tags efficiently. Basically, I wanted to preserve the basic tag rule: as many tags as you like per post. But if I do that, I need another table in the database. However, to do this, I need an additional query for each story. Since Small Axe loads in just FOUR queries on the main page, this was a HUGE hit. It went up to 24 queries, albeit 24 simple, basic, efficient, FAST queries.

So I wrote it to use a single query, and guess what I found? The implementation sucked. It was slow. It was dirty. It meant editing tags was a precise business. And searching was lame. So, I rewrote tagging (while preserving links, etc) and – boom! – fast. Yes, it added a query for every story on the front page, but dammit, it works, it’s clean, it’s easy to read, and best of all, I’m going to implement some flickr-style tag editing on the backend. So, that’s cool.

I guess we’ll see what happens in the next week or two.

New Feature. Yip di frickin doo.

So, I recently added a new feature to firsttube.com, one that is largely useless and mostly for my own amusement: tagging.

Although it has been awhile since I’ve updated Small Axe, I have pretty faithfully updated firsttube.com, added new features, cleaned up the code A LOT, and gotten this thing pretty stable. The admin section has been largely overhauled. The queries are better and the code is clean. Unfortunately, I haven’t backfilled most of that code into Small Axe yet.

All of which is to say, I’m not very happy with HOW I’ve implemented tags. It’s kind of sloppy, and it may change. For now, I’m leaving it, but I may be changing the way it works.

If I do change how it works, it will be invisible – meaning the links in place will still work.

Development, dude.

I spent some time over the last few days updating some code in my blog. Some new things now:

1. Each story now displays a “related stories” link. This will fetch up to five items of the most recent items tagged with the same topic. Since all of my “topics” are complete nonsense, this is a useless feature, but it’s still fun.
2. The documents section of the website was completely rewritten and it’s now MUCH faster and less useless than before. Old code dies hard, or something.
3. I changed the URLs from blog.php?page=2 to /blog.php/page/2. It looks so much nicer to have pretty URLs.
4. I’ve cleaned up several dirty nags in the admin section.
5. I fixed the stupid 404 redirect.
6. Although not completed, I hope to have image uploads built in soon.
7. I’ve added a stylesheet to both my RSS and Atom feed, so if you view them, they both look pretty now, even without an RSS reader. This was mostly just for fun.

SMALL AXE

Can I just carry on for a second about some development stuff? I began writing Flip in 2002, when I was a relatively newbie to web programming. Sure, I’d been doing HTML and Javasacript since ’99, and I had been playing with PHP for 6 months or so, but I was a novice, plain and simple. Flip 2 and 3 were both steady evolutions, but sometime in between, whether it was writing a helpdesk app for work, or rewriting osnews.com, learning about 0bject Orientation and classes, MySQL, whatever… I believe I learned a lot of cool tricks.
When I finally got around to writing Flip 4 – which by the way, will not be called Flip 4, since it’s really not even close to the same code, nor is it a “flatfile” PHP Weblog anymore – I started from ground zero. Flip 4 is now mostly functional, I’m going to be testing and packaging the first beta, and dammit, I am PSYCHED. This blog is so much better than anything I’ve ever written. Pure HTML templates, auto-location, some great JS/CSS tricks for visibility, and the latest acheivement – a great installation script that can build Small Axe for you. There, I said it. After much deliberation – Blueberry, Green Violin, Peanut Head, etc – the next blogging tool I release will be “Small Axe.”
Why “Small Axe?” Bob Marley once wrote a song, and the lyrics are “If you are the big tree, we are the Small Axe.” The Small Axe, the people of Jamaica, were oppressed by the government, the so-called “big tree.” I like Small Axe because it conveys a sort of intimidation by the small guys, and my application is certainly a “small guy.”
Anyway, I’m very excited to be rolling the first beta and I’m really hoping for feedback. It’s going to be hard, since Flip has got to appear to be a dead or abandoned project at this point. Hopefully, some Flip users will consider upgrading to Small Axe when 1.0 comes out.