Version 1 or Nike+PHP has been out for a while and earlier this month I released v1.2.1.
The code has been downloaded over 100 times and I'm extremely proud of that fact! I would love to see how people are using the code, so please add to the Examples page on the wiki.
I also changed the branding for the project a little bit, but need time to work on the site, something I might do in March. The site is a little bright, something I wanted it to be, but I'll be toning it down a bit in the next refresh.
The old logo was dark, plain and, well, just boring!

The new one is lighter, has a bit of depth and contains the Nike logo (hope I don't get into any trouble for that!).

So I am a lover of Nike+ and have had a Nike+ stat widget on the side of my blog for quite a while now. The project can be found at http://nikeplusphp.org.
It came to my attention that the method used wasn't the easiest and certainly wasn't up to date. Looks like something changed on Nike's end and that has broken the API I was using.
Looking around for an alternative, I was inspired to build my own class and am now firmly at version 0.7 with it. I've created a small website for the project where you can grab the code and there's some documentation to help you get started.
The project is called Nike+PHP and all you need is a Nike+ account, PHP5 and SimpleXML installed.
[ read more... ]
I had an issue where I couldn't delete cookies today. Turns out, adding the path works.
<?php
setcookie('name', 'value', time()+3600);
?>
The above would set a cookie for one hour into the future.
<?php
setcookie('name', 'value', time()-3600);
?>
The above should set a cookie for one hour into the past, making it expire and effectively deleting it. Today, this wasn't the case, but adding a path did the trick.
<?php
setcookie('name', 'value', time()+3600, '/');
?>
The above sets it for an hour and for the whole domain. Adding the '/' to both the setting and expiring did the trick!
Via a Derek Sivers post on O'Rielly, which was found via a blog post on Getting Things Done by Nina Richards.
Getting Things Done is a concept I've heard about before and I will be researching more.
Sivers' blog post introduced a really cool bit of code I may use in the future which allows you to add other PHP files to your script without ever using the include and require functions!
<?php
function __autoload($class_name) {
require_once $class_name . '.php';
}
$obj = new MyClass1();
$obj2 = new MyClass2();
?>
The function launches when ever a class is initiated, from what I can tell. Not sure how it would work with files held in multiple folders, as I like to do, but certainly a beautiful piece of kit... Also, not sure if the piece of code has to be written into each file or if you (ironically) have to include it! I'll be giving it a go and will report back.
Some great user examples on the PHP.net page too.
If you set a cookie that covers all of the sub-domains of your site, you can't just unset the cookie in a casual way, you'll have to specify that the cookie set for all sub-domains should go.
You can set a cookie for all sub-domains by specifying the domains as .domain.com - a period before the top level domain.
I thought you could just unset the cookie by specifying the cookie's name, but that's not the case
In my quest to get a little fitter and shed a bit of weight, I got myself a Nike+ SportBand which I've been using on and off for a while now.
I just happened to check Zach Holman's blog the day he changed his layout and added some Nike+ functionality. It's a great feature and one I hadn't really considered. Turns out there's a Wordpress plugin and a great PHP script that gives you a decent amount of info from your Nike+ account.
If I'm honest, I don't run as much as I could/should but hopefully making the info a little more public will give me a bit of a spur to take it more seriously. I decided to take a similar route to the Arrested Development quotes I took and add a basic bit of info fed through this unofficial API.
You can see my total runs, distance and last run info in my Nike+ sidebar area. If you need a hand with getting the API to work, feel free to leave a comment.
[ read more... ]
IMDBPHP is a wonderful bit of PHP that delves deep into the world of IMDB.
As you may know, I am a big fan of Arrested Development, and really wanted to feature a quote script from bluthfamily.com but the resulting layout didn't really fit into the layout of my own blog.
I did write to the author/owner of bluthfamily.com, but as soon as I pressed send, I wondered if there was an IMDB API. It turns out there isn't, but IMDBPHP does exactly what I wanted.
[ read more... ]
This is really here for my own benefit, but maybe it will help you to remember the differences between the include and require functions in PHP.
The names are descriptive, but I would assume that a lot of people don't really give their naming much thought or even know what the differences are.
The include functions include a file that your request. The file that you request may not exist at the path you've specified, but this won't necessarily fail your document.
The require functions, literally requires the file you've asked for. If this file is not found, the document will stop loading and processing where it is.
The require functions are what I use most of the time, they help to ensure that your code is up to scratch and nothing, no matter how small or insignificant it may be, is missing.
Both of these functions are have two variations, include and include once or require and require_once.
The '_once' part of the function name basically limits the file to being loaded just once, whereas using just include or require, you could load the same file again and again and again, at various places throughout the document.
[ read more... ]
I thought I'd blog a bit about web development tools, more specifically, the ones that I feel are essential for web development on a Mac. I'll be trying to cover both Tiger and Leopard versions of OS X.
First up;
Text editors
Among the most important tools you'll need for web development, unless of course you plump for using Dreamweaver. Personally, I find Bare Bones' selection of software to be the best. Text Wrangler is an awesome, free, tool and is now compatible with another piece of software that was previously only compatible with BBEdit, Bare Bones' flagship product
[ read more... ]
After some time using a blogging platform to keep the content fresh on a few of my personal projects, I finally decided to setup my own blog to let the world know about my thoughts.
I made a decision early on to build my own blogging platform, giving me a chance to really put my all into making something that I may be able to pass on to any friends or family that require a simple setup. I also thought it would also be a very good opportunity to get stuck into some OOP (PHP5) as well as some MySQL.
I've worked with a number of CMS' and blogging platforms, but very few impress me. Wordpress is the only one I'd really recommend to anyone, especially after being completely underwhelmed by Joomla. I've recently come across a few companies that role out Drupal as 'their' CMS, branding and modding to their customers needs, but for me that wasn't an option.
At the end of the day, this is a personal project that may evolve into something more, but there's a very real possibility that in two years time I may actually be the only person using the system I've built! I made the bold decision to build just for my needs, but to also leave enough scope to allow for future expansion.
From the beginning
After spending some time planning my database structure, I wanted to make a decision early on about how content would be entered. I've got some experience in working with the TinyMCE WYSIWYG, but I'm not a big fan of the tools in general. TinyMCE can actually be very simple with the most basic options, or it can be scaled up to include a large number of features. The basic version appealed to me, but I prefer to write in code so that I have complete control over how the content I produce is formatted.
I decided that the first build of the CMS would feature a text area with some custom BBCode functionality, but for others that may take up my 'system', I'd give them the option for using the WYSIWYG, which should be a fairly painless changeover. Ultimately, I'd like that to be configurable as it is in Wordpress' admin area, but that's something for the future.
[ read more... ]