Monday 1 July 2013

Crafting Tools

No, this isn't a post about Minecraft. I just liked the sound of the title. This is about coding. I could be wrong, but I often get the feeling people underestimate the value of programming. It's not just for making games or programs for other people. It's not even about making full-fledged programs at all. I write code for everything. Little scripts let me use my time more efficiently and ignore the things I don't care about. They're fun, short projects that can sometimes be very interesting challenges. They're also usually easy to finish and the end product is always worthwhile.

Aggregators

My most-used script looks like a simple web-page with a bunch of boxes on it that each contain text. What's special about it is that it draws articles from every website I used to frequent, filtering out the ones I know I won't be interested in and marking the ones I haven't seen yet. It also grabs tweets from my favourite twitter feeds and posts from my favourite forums. In addition, it uses YouTube's RSS feature to get the latest videos from my favourite YouTube users. Everything I used to browse the Internet for, wasting time and bandwidth, is now in one place. That's not to say I don't find new and interesting things, because I do. I added a couple of sites that I never used to read that often, and now I can skim their articles without having to wade through their sites. It's really convenient and I use this page every single day.

I had an early version that used AJAX to refresh parts of the page separately, but considering I usually refreshed the entire page at once, I removed that feature. The current version uses PHP with cURL to grab data from RSS feeds and HTML sources. It takes a few seconds (and it's longer now that Twitter has removed its RSS support), but it's not too terrible. It was very easy to make.

To anyone concerned that by not visiting sites, I'm throwing off statistics and avoiding the ads that support those websites, know that I do actually visit the sites. The aggregator page only shows RSS summaries for the articles. I still visit the sites to view any articles that grab my attention.

Desktop Software

While I've used a wide variety of languages, I really love using PHP. The problem? Browsers limit access to the user's computer. I recently got an old program called WinBinder (made for older versions of Windows, but it works perfectly in Windows 7). By executing PHP files through WinBinder, I can run my programs without a browser and can access files on my computer through code. I used this to make something similar to my website aggregator which, in this case, lets me open any games, files, programs or folders that I use often. I set it to run at startup and now I don't have to use large numbers of shortcuts or navigate through the folders on my computer very often. It's pretty useful.

Other Tools

As I said, I really like PHP, so I use it for everything.
  • I wrote a script to simplify the creation of invoices for my programming contract work.
  • I wrote a page for keeping score in a trivia game with a Trivial Pursuit book we have. My friends and I just navigate to the IP of my Apache server on our phones/iPods and it keeps track of how many points we have in each Trivial Pursuit category, skipping over ones that we've already gotten the preset number of points in. It randomly spits out a page number for the current category so we can get random questions from the book.
  • I made a small script that read ID3 tags from my music library. I wanted to use it instead of iTunes because I could integrate it into my aggregator, but I didn't do much with it in the end.
  • I made a page that read my video library and let me stream videos from my computer in a browser so that I could avoid the need for a video-streaming app


Libraries

There are so many options. Practically anything you do on a computer can be done more easily if you feel like making a tool for it. As far as PHP goes, there are libraries for so many things. You can convert video and audio files or read ID3 tags, for example. With basic PHP, you can automate downloads, grab links from websites, grab RSS feeds, etc. If you throw JavaScript into the mix, you can do all of this with AJAX. Use something like WinBinder and you suddenly have access to batch files that can work with the file system on your computer.

Final Words

Tools don't have to be released to the public (although that's always nice). Sometimes they're worth producing just to make life a bit easier and learn something in the process. I can't put much of what I've made into a portfolio, because it's all too customized and certain things seem to be blocked by web hosts, but I'm still glad I worked on all these projects. Every project is a chance to learn and grow as a programmer while also having some fun.