Battery Life

The battery life on my new Sony Vaio Pro 13 ultrabook is pretty damn good:

Battery Life

Okay, to be fair that was with the extra battery attached to the bottom of it which doubles the battery life as well as the screen turned down all the way and the laptop sitting idle for about 15 minutes. I also suspect its estimate may be a bit off but I fully expect to get over 10 hours of battery life with more normal usage. Still, as I’m writing this with the brightness up all the way, the battery is still at 100%.

I love it.

UPDATE: Okay, this is getting silly. Maybe Windows 8.1 preview just can’t accurately read my battery levels?

More Battery Life

UPDATE #2: Okay, the second battery finally dropped to 99% after having the brightness on full and surfing the web for a while. The time left estimate seems a lot more realistic now. 🙂

Proper Battery Life

Date Queries In WordPress 3.7+

Earlier today, a patch for WordPress that I’ve been working on got committed to WordPress trunk. “Trunk” is the in-development version of WordPress and will eventually become the next version of WordPress, in this case 3.7.

My patch introduces the ability to do complex date-based queries for fetching both posts and comments from the WordPress database. In the past, you could select posts that had a specific value for year, month, etc. but there was no way to do things like selecting all posts before (or after) a certain date or selecting all posts between two different dates. With my patch, this and more is now easily possible.

Here’s some examples:

[code lang=”php”]// Get the 10 most recent posts made
// between 9AM and 5PM on weekdays
$some_posts = new WP_Query( array(
‘date_query’ => array(
array(
‘hour’ => 9,
‘compare’ => ‘>=’,
),
array(
‘hour’ => 17,
‘compare’ => ‘<=’,
),
array(
‘dayofweek’ => array( 2, 6 ),
‘compare’ => ‘BETWEEN’,
),
),
‘posts_per_page’ => 10,
) );

// Get all posts from this summer
// June 1st to August 31st, inclusive
// Note that strtotime()-compatible strings can be used
$some_posts = new WP_Query( array(
‘date_query’ => array(
array(
// String via strtotime()
‘after’ => ‘June 1st, 2013’,
// Or if you want, an array
‘before’ => array(
‘year’ => 2013,
‘month’ => 8,
‘day’ => 31,
),
‘inclusive’ => true,
),
),
‘posts_per_page’ => -1,
) );

// Any posts made over a year ago
// but modified in the past month
$some_posts = new WP_Query( array(
‘date_query’ => array(
array(
‘column’ => ‘post_date_gmt’,
‘before’ => ‘1 year ago’,
),
array(
‘column’ => ‘post_modified_gmt’,
‘after’ => ‘1 month ago’,
)
),
‘posts_per_page’ => -1,
) );[/code]

It works for comments too:

[code lang=”php”]// All comments from post ID 123
// that are within the past week
$some_comments = get_comments( array(
‘post_ID’ => 123,
‘date_query’ => array(
array(
‘after’ => ‘1 week ago’,
),
),
) );[/code]

As you can see, the possibilities and combinations of cool things you can do are endless.

Here’s all of the possible arguments:

[code lang=”php”]’date_query’ => array(
‘column’ => ‘optional, column to query against, default is post_date’,
‘compare’ => ‘optional, see WP_Date_Query::get_compare()’,
‘relation’ => ‘optional, OR or AND, how the sub-arrays should be compared, default is AND’,
array(
‘column’ => ‘see above’,
‘compare’ => ‘see above’,
‘after’ => ‘string or array, see WP_Date_Query::build_mysql_datetime()’,
‘before’ => ‘string or array, see WP_Date_Query::build_mysql_datetime()’,
‘inclusive’ => ‘boolean, for after/before, whether exact value should be matched or not’,
‘year’ => ‘4 digit int’,
‘month’ => ‘int, 1-12’,
‘week’ => ‘int, 0-53’,
‘day’ => ‘int, 1-31’,
‘hour’ => ‘int, 0-23’,
‘minute’ => ‘int, 0-60’,
‘second’ => ‘int, 0-60’,
),
array(

),
..
),[/code]

Additionally, all of the old-school date and time arguments for WP_Query are now handled by my code as well. They will continue to work as before and you only need to use the date_query parameter if you want more advanced control of your results.

Questions? Anything you want me to clarify? Leave a comment below. 🙂

The Bad Luck Continues: A Rock Cracked My Viper’s Windshield

First a cone, now a rock. My Viper can’t catch a break.

Driving home from a business trip in Vancouver, Canada, a semi-truck threw a rock and it hit the bottom of my windshield, below the windshield wiper blade. Not a big deal but unfortunately it turned into a crack before I even got home. 🙁

Viper Windshield Crack

I’ve put in a claim with my insurance company and hopefully they can either fix it or replace it. If it can be fixed rather than replaced, supposedly they’ll do it for free with no insurance impact. Fingers crossed.

UPDATE: They had to replace the windshield. My non-collision deductible was $500 (oops) and the new windshield cost $550 so it was all out of pocket. Ow. Super clear now though!

Attack Of The Cones: The Story Of How I Broke My Viper

On July 19th, I took my Viper for a HPDE track event at The Ridge race track hosted by Hooked on Driving.

For the first four sessions of the day, an instructor rode along with me while providing input on how to do a better job driving around the track. By the end of the day they were confident enough in my quick progress that they signed off for me to solo drive.

The fifth session of the day was a mixed session with both group A (beginners like me) and group B (people who had a few events under their belt, I would have been B at the next event). I considered skipping it as it was the end of the long day, but decided not to since I wanted to make sure to get the most out of all of the money that I had spent in order to be there. This turned out to be my first mistake.

The second mistake was going out solo instead of continuing to have an instructor ride along with me. I was overconfident in my skills when clearly I was still a major novice who was just making good progress.

The third mistake was lifting off of the gas in the middle of a small corner in order to begin getting ready to start braking for an upcoming sharp corner. This turned out to be the critical mistake and I paid for it.

I was recording the day with two GoPro video cameras and caught the mistake from two angles:

One of those three cones I hit jammed up under my bumper, breaking it and pushing up far enough to actually bend my air conditioning condenser and break my power steering cooler, spraying power steering fluid all over the front of my car. While it could have been worse (I was headed for that barrier before I caught the slide), it still majorly sucks.

Even worse is that while I bought insurance for the day ($300! ouch), I found out today that the deductible is 15% of the total insured value which is in this case $7500. That means that the insurance won’t cover this $3000-4000 worth of damage. Ouch.

So while I had a ton of fun at the track before the accident, this turned out to be a really shitty two weeks. 🙁

I’m done taking this car to the track as I just love it too much to risk further, and expensive, damage to it. I’d rather just have a bit less fun with it on the street instead. If I do get the track bug again, then I’ll look into buying a cheap track car and drive that instead.

20,000 Miles

I just passed 20,000 miles on the Viper’s odometer today when I went out for lunch:

20,000 Miles

When I bought the car in March 2012, it only had 9299 miles on it. Here’s a graph of the number of miles I’ve put on the car so far:

Graph loading...

The plateau is from storing it over the winter when it wasn’t exactly Viper driving weather.

Here’s to the next 20,000!