Winter riding secrets

Any one who knows me knows that I love to ride my bike, I have been riding to work year round for about 4 years. On average I will ride 20km or 12mi a day, it usually takes me any where from 35-45 min, vs the 60-90 min bus ride or 25 min by car.
A bus pass here in Edmonton is $80 a month or $6 a day, Parking is $7-11 a day or $150-$170 a month.
Bike maintenance is around $250 a year, and I ride an expensive bike. It would cost less for most.
I go through a drive train every year, with an average of 5,200km or 3,231mi of commuting ( not counting pleasure rides ).
Environement
Living in Canada poses some challenges in the winter, the biggest challenge being the temperature.
The average winter temperature is probably -20 Celsius or -4 Fahrenheit, the coldest temperatures I rode in -45c that’s -49f! Surprisingly enough the cold is not the problem so much as keeping cool.
Dressing for the cold is hard to do with a high output sport, you fingers, toes and face will be freezing but your core is burning.
Clothing
I ware a Keen mid height winter boot, good wool socks, preferably Marino wool, A quality shell for me I use a Whittaker hard shell, hard shell pants, and a perm-aloft mid weight coat, when its super cold out I add-on a thin fleece layer. For my hand I use a GorTex down clove, and on the warmer days ( -15c ) a windproof fleece. In all conditions I ware a merino wool toque.
During the mild winter days I will ware a thin fleece under soft shell or hard shell depending on wind.
Terrane
The next factor in riding is snow, lots of fluffy snow is not a big deal unless it falls on top of ice.
Wet heavy snow is painfully slow to ride in, pretend your riding uphill. There is no coasting and it never lets up.
My favorite riding conditions would be hard backed snow at about -17c.
Taking care of my bike
Winter might be all nice and white in most places, but when you ride its nothing but sand, gravel and salt. Its filthy.
I oil my chain about every 4 days, cleaning off the excess. There is not a lot that can be done about the salt unless you haul your bike into the shower with you.
If I want to get my bike nice and clean I will use Clean Streak for the greasy stuff, Muck Off for the Frame bits, and Bike Lust to help shed dust and grime. Obviously you need you need to make sure your chair is nice and lubricated, For this I use Finish Line Cross country.
Why do I do it?
Most of all riding is fun and feels good, I enjoy the slower pace and being able to explore my surroundings.
Riding lets me clear my mind, I sit all day so the activity wakes me up and gets me motivated and alert.
PHP Event API
Events
I tried a couple of existing plugin solutions most did 95% of what I needed and the other 5% was next to impossible to force.
After wasting days I decided I would write my own, what follows is an overview of Tentacle event API.
Contact me if you have any questions.
Registering an event:
[sourcecode language="php"]
function method_one (){
echo ‘one ‘;
}
function method_two (){
echo ‘two ‘;
}
event::on(‘event_trigger’, ‘method_one’, 2);
event::on(‘event_trigger’, ‘method_two’, 1);
event::trigger(‘event_trigger’);
[/sourcecode]
Turning events off:
[sourcecode language="php"]event::off(‘event_trigger’);
event::off(‘event_trigger’, ‘method_two’);
event::off(null, ‘method_one’);[/sourcecode]
Test if an event exists:
[sourcecode language="php"]var_dump(event::exists(‘event_trigger’));
[/sourcecode]
boolean true
Trigger an event:
[sourcecode language="php"]function method_name ( )
{
echo ‘my method name’;
}
event::on(‘event_name’, ‘method_name’);
event::trigger(‘event_name’);[/sourcecode]
my method name
Trigger an event and pass data to it:
[sourcecode language="php"]function method_data ( $text = ” )
{
echo ‘ 1 my method data is ‘.$text;
}
function method_data_two ( $text = ” )
{
echo ‘ 2 my method data is ‘.$text;
}
event::on(‘event_data’, ‘method_data’, 1);
event::on(‘event_data’, ‘method_data_two’, 2);
event::trigger(‘event_data’, ‘this’);[/sourcecode]
1 my method data is this 2 my method data is this
Triggering a class and passing data to the method
[sourcecode language="php"]class my
{
static function method_name ( $text = ” )
{
echo ‘my class method name is ‘.$text;
}
}
event::on(‘event_class’, ‘my::method_name’);
event::trigger(‘event_class’, ‘Lary’);[/sourcecode]
my class method name is Lary
Event chaining
[sourcecode language="php"]function method_sad ( $text = ” )
{
return str_replace(‘blah’, "sad", $text);
}
function method_happy ( $text = ” )
{
return str_replace(‘sad’, "happy", $text);
}
event::on(‘event_mood’, ‘method_sad’, 1);
event::on(‘event_mood’, ‘method_happy’, 2);
echo event::filter(‘event_mood’, ‘I am blah!’);
[/sourcecode]
I am happy!
A big leap for Tentacle
Previously the Tentacle blog was powered by WordPress, A few months ago I had spent a lot of time working on the ability to import the WordPress WXR files.
For the moment this only includes posts, tags, categories, and media. No comments or pages.
This could change in the future.
This for me was actually a big deal, and to make it happen a number of things had to be considered.
- The category and tag relations had to be kept
- Media needed to be transferred to the new site
- Media links in the post content also needed to be remapped
- Media needed to be reprocessed
The only Issue that I came across was a memory error while resizing a rather large PNG image.
Today tentaclecms.com/blog/ is totally powered by Tentacle its self. It is lacking pagination but that’s in the works!
One problem that I noticed right off the start was how would the URLs be managed.
When you build an application using MVC there are routs, and those routs need to match a pattern. The problem was that I did not want to create a bunch of controllers. So I built a special version of routs that would specifically handle blog related requests, mapping requests for tags, categories, pages, and posts possible.
My next problem was dealing with content and how plugins could interact with it.
I will go into more detail later on about how plugins and events are created, but at the core Tentacle will do a few nice things for you out of the box.
- It will automatically wrap lines with <p> tags if they are not already there.
- It will convert links and email addressed to clickable items.
- Rendering using SmartyPants
- An event call for [shortcode]
A lot of work went into making this happen, and Tentacle is that much closer to a beta release!
Making of the Tentacle upgrade script
The best scenario for keeping Tentacle up to date is using to use Git.
If for some reason you can not use git then for the majority of users we have you covered.
Tentacle updates are powered by the Serpent API. Serpent is designed to allow developers to continue their normal workflow and control when Updates are made available.
By creating a version git tag I can publish an archive file that is ready for public use.
Tentacle will have a look at its own internal version and compare it with what is available over the API at http://api.tentaclecms.com/get/core/
Implemented Bcrypt to Hash Stored Passwords
I made a large improvement to the way we hash our user passwords.
Originally Tentacle was using the default method of hashing passwords used in Dingo, This was a SHA1 hash. Still decent but not really up to newer standards.
When a log in is processed the username and password are submitted and the password is hashed.
password turns into something like 5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8 and is actually stored in the database this way.
It is then possible to use brute force to gain access to a site.
The a advantage of using Bcrypt and specifically phpass is that the passwords are all salted and the salt is random. That means that any hash of password will never be the same.
This method is commonly used in WordPress, Modules for Drupal, and Typo3.
Here is a great Info graphic on password security.
Recursive Glob
While building the upgrade script for tentacle I knew that the file I was going to work with would be a zip, and would contain many sub folders.
PHP has a function called glob that finds files pathnames matching a pattern.
It works really well but only goes one level deep, using the recursive_glob() function lets you return a folders file structure.
