Twitter Bot: Magic 8 Ball
April 22nd, 2008 at 7:24 PM by Matt FreedmanOn the Weekend, Gary Jones from BlueFur (Twitter: bluefur) came up with the idea of a Twitter robot that would act as a Magic 8 Ball. He asked me if I wanted to help make it, I accepted, and development began.
What we came up with was a small script that would automatically reply with a Magic 8 Ball-type answer when it was “replied” to. To use it, all you have to do is write a “tweet” replying to magic_8ball with a yes or no question. Which would look like this “@magic_8ball <yes or no question>”.
This little “Twitter Bot” uses the Twitter API to receive the replies to it, and then send out replies with a randomly selected answer. We quickly found out that the Twitter API is quite restrictive. As outlined in Gary’s post, Twitter only allows 70 authenticated API requests an hour, which not only inconveniences developers while testing their Apps, but also users using Twitter Apps. Also, Twitter restricts API calls for replies and such to the latest 20, which can create quite a few problems.
We’ve decided to make this application Open Source, so that other developers looking to develop with the Twitter API can hopefully learn from our code. Feel feel to use, modify, hack and learn from this code to create your own Twitter Applications. The code is release under the GNU General Public License version 3 (or, at your option, any later version). You can get the code here (or in txt format here).
If you have any questions about the code, feel free to let me know.
I’m on Twitter under mattfreedman, feel free to follow me.
Make the WordPress Admin Section Full Width
April 12th, 2008 at 9:02 PM by Matt FreedmanOne of the most debated and annoying thing in WordPress 2.5 is that the Admin pages have a max-width on them, which is set to about 980 pixels. Resulting in quite a bit of useless whitespace on the right side of the page, if you have a large monitor.
I have a 22″ monitor with my resolution set to 1680×1050. My browser window is almost always maximized, which meant that about 40% of the screen was being wasted with whitespace. It’s particularly annoying on the Write page, when writing a post felt claustrophobic.
Luckily, Dion Hulse wrote a small plugin, called Remove Max Width, which removes the max-width attributes, and allows the Admin pages to be liquid/fluid width, and use up the entire width of the browser window.
Personally, I now find the Admin section much easier to use, and makes writing a post more of a pleasurable experience. Try the plugin out, if you don’t like it, you can always deactivate it and the Admin section will return to it’s default max-width.
Speed Up Your Blog Using ZLIB
April 7th, 2008 at 8:50 PM by Matt FreedmanWith the release of WordPress 2.5, there is no longer an option to enable GZIP compression. This option was axed for the reason that it’s better to enable compression on the server, rather than through WordPress. GZIP is basically a compression “tool” that compresses files before sending them to the browser, if the browser states that it can handle GZIP compression. All modern browsers support GZIP compression, and send the appropriate header to the server to tell it that it can handle compression.
However, there is another compression library that is generally preferred over GZIP, called ZLIB. It’s essentially the same as GZIP, and is initiated by the same gzip header that browsers send.
We’ll be using ZLIB to speed up your blog. We’re using ZLIB because using GZIP causing TinyMCE (in WordPress) to be double compressed, and to stop working properly, using ZLIB works around the issue. Also, since ZLIB is preferred, we might as well use it.
Before enabling ZLIB compression, you’ll want to check with your host to ensure that PHP has been compiled with ZLIB support. I can confirm that BlueFur has it enabled on most (if not all) of their servers.
Now that you’ve made sure that your host can support ZLIB compression, let’s actually enable it. First of all, open your blog’s root .htaccess file. Then, you’ll want to add the following line to the file, above the WordPress code (# BEGIN WordPress):
php_flag zlib.output_compression On
Save the file, and reupload it. You should now notice improved speed in the execution time of your blog. On my blog, page execution has, on average, been reduced by 50%. However, your results may vary.
It’s important to note that, if you’re currently using any other compression or caching systems, you cannot use this in conjunction with them; you’ll have to choose between them or ZLIB compression.
This compression method will also work on any fairly dynamic site, it’s not limited to blogs.
April Fools: Michael Kwan Gets Hired By The New York Times
April 1st, 2008 at 5:39 PM by Matt FreedmanMichael Kwan announced today that he would cease to be a Freelance Writer, and would become a writer at The New York Times. He had this to say about his future work at the NYT:
As much as I enjoy the relative freedom of being a freelance writer, the opportunity was just too much to turn down. The New York Times has offered me a permanent full-time position as a technology columnist, focusing primarily on consumer electronics like the Apple iPhone, Asus Eee PC, and Nintendo Wii. I guess it helps when you leverage your reputation, because the NYT found me through my work on such sites as The TechZone, Mobile Magazine, and FutureLooks.
Sounds believable enough, but the NYT would never hire Michael I don’t think Michael would stop doing Freelance Writing for a newspaper job.
April Fools: Web Standards Project – Tagging People Who Hurt the Web
April 1st, 2008 at 12:46 AM by Matt FreedmanThe Web Standards Project has announced a new initiative to tag people who may be harming the web, through old knowledge, or just holding onto the old web.
Following on the heels of the highly successful Street Team bookmark initiative, The Web Standards Project is pleased to announce a new opportunity for you to spread the good word of Web standards to the people around you. It occurs to us that books don’t build crappy Web sites; people who read crappy books build crappy Web sites. While marking books was a great first step, we need to move beyond that to get at the root cause of the problems in our industry.
Now, leveraging the very latest in hyper-localized social tagging, you can help alert others to the people around you who are hurting the Web. Simply download the official WaSP Warning Labels, print them out, and you will be ready to tag the people around you who have yet to see the light. Whether it’s the stuffed shirt in your project meetings who keeps putting off talking about accessibility because, “No blind people use our site,” or that developer who still refers to a dog-eared copy of Teach Yourself Web Publishing with HTML 3.2 in 14 Days, you’ll be able to tag them all.
You can download the labels here and start tagging people that may be harmful to the web.
Nice April Fools joke. It’s actually original, too!