Need someone to lead product or development at your software company? I lead product and engineering teams and I'm looking for my next opportunity. Check out my resume and get in touch.

Recent Comments bug fix

Freshness Warning
This blog post is over 18 years old. It's possible that the information you read below isn't current and the links no longer work.

If you’re using MT’s Recently Commented On feature and you notice that some entries don’t appear there that should, I may have a solution for you. Over at the MT support forums we discovered that at least two of the people experiencing this problem were using MySQL 3.23.45 as their database. Users of later versions of MySQL weren’t having the problem, so it appeared to be a MySQL problem.

A little troubleshooting revealed the culprit. MT uses a temporary table to gather the list of recent comments and that table wasn’t being sorted correctly by MySQL. It took some serious trial and error to figure out how to make it work correctly.

The fix requires that the records be inserted into the temporary table in the order you will want to retrieve them. So a simple ORDER BY statement in the table creation SQL was needed.

To fix the problem, you’ll need to make the following changes. This assumes you are running MT 2.21. Other versions might have different line numbers and code.

Go to <mt>/lib/MT/ObjectDriver/DBI and open mysql.pm. (Replace <mt> with wherever your copy of Movable Type can be found.)

Line 116 reads my $dir = $j_args->{direction} eq 'descend' ? 'desc' : 'asc';. Move it to before line 97, which reads my $ct_sql = "create temporary table tempTable\nselect ";.

Now go down to line 106 where it says $ct_sql .= "where " . join ' and ', @$ct_terms if @$ct_terms;. Right after that line, add a line that reads $ct_sql .= "ORDER BY ${j_tbl}_$j_args->{'sort'} $dir";

That’s it. Upload your newly changed script and rebuild your templates. The usual disclaimer applies. It works for me, it might not work for you. Back everything up before you start and don’t blame me if your computer begins speaking in tongues or emits a foul odor.

Recently Written

Developer Relations as Developer Success (Oct 19)
Outreach, marketing, and developer evangelism are a part of Developer Relations. But the companies that are most successful with developers spend most of their time on something else.
Developer Experience Principle 6: Easy to Maintain (Oct 17)
Keeping your product Easy to Maintain will improve the lives of your team and your customers. It will help keep your docs up to date. Your SDKs and APIs will be released in sync. Your tooling and overall experience will shine.
Developer Experience Principle 5: Easy to Trust (Oct 9)
A developer building part of their business on your product needs to believe that you're going to do the right thing for them and their customers.
Developer Experience Principle 4: Easy to Get Help (Oct 8)
The faster you can unblock a stuck developer, the better their experience will be.
Developer Experience Principle 3: Easy to Build (Oct 5)
A product makes it Easy to Build by focusing on productivity for developers building real-world applications.
How to understand your product and your market (Sep 30)
A customer development question you can ask to find out who your product is best for and why they'll love it.
Developer Experience Principle 2: Easy to Use (Sep 28)
Making it Easy to Use means letting the developer do everything without involving you.
Developer Experience Principle 1: Easy to Understand (Sep 25)
To create a great developer experience, you must strive for a product that is Easy to Understand. Reduce the amount of thinking that someone needs to do. Make their first encounter with your product clear and easy.

Older...

What I'm Reading

Contact

Adam Kalsey

+1 916 600 2497

Resume

Public Key

© 1999-2020 Adam Kalsey.