Pete Ware

Tech, NYC & Politics

Tag: Technology (page 2 of 2)

A better output_iterator

I was using the std::stream_iterator, for example:

It has the “,” after the last item.

So here’s an implementation that doesn’t append the seperator after the last one:

And here’s the corresponding code to use it:

Closer to a new car?

It’s one step closer to happening! Getting a new car based on a trade in might actually happen. It hasn’t passed the House yet (much less the Senate) but the leadership of both parties agree on doing it.

From House Reaches a Deal on ‘Cash for Clunkers’ Program:

Under the House plan, a car trade-in that improves fuel efficiency by at least 10 miles per gallon would qualify for a $4,500 voucher, as would the trade-in of a small truck that improves efficiency by 5 miles per gallon. The new vehicle must have a minimum fuel efficiency rating of 22 miles per gallon for cars and 18 miles per gallon for small trucks.

Setting the timezone

I’ve gotten pretty careful about keeping time in UTC and then converting it to localtime for the user to understand. For the first time, I actually had to find the localtime in a non-local timezone. It’s ugly. It seems you have to mess with the TZ environment variable. Here’s what I wrote:

And here’s a code fragment that uses it:

Cars and Batteries

Fascinating profile of
Shai Agassi who’s introducing replaceable batteries for the auto industry. Part of his theory is that selling the “energy” is very profitable.

>But Agassi realized he needed one more breakthrough: some way to rapidly charge a vehicle. No drivers, he knew, will tolerate a two-hour wait to recharge when they’re on a 500-mile haul. Then one day, he and an automotive engineer were chewing over an impractical method for quickly replenishing batteries. The engineer wondered aloud: Wouldn’t the fastest way to charge an electric car be to simply replace the battery?

Newer posts

© 2017 Pete Ware

Theme by Anders NorenUp ↑