Wednesday, October 23, 2019

Laugh at the Thought of "Range Anxiety"


Maybe there is an unexpected trip I have to take, or maybe I forgot to plug in the night before. But in either case, the range indicator is near or maybe even below the required distance I need to travel. But, do I cower with fear? Am I paralyzed by this "Range Anxiety" that I read about online so frequently? My answer is a resounding "No." I laugh at the thought. Ha ha ha ha! Can you hear me laughing?
Yes, I am a seasoned EV (electric vehicle) driver. I know how to double my available range, or sometimes increase it even greater than a factor of two. I will share my strategy on how I take on this challenge.

The Heater is NOT your friend

Turn that heater off. Turn off the blower. If you are having trouble with window fog, run the defrost intermittently when needed and set it to a lower temperature to minimize power draw. If it is not raining, opening the window will get rid of window fog. Keep a blanket or two in the back for passengers' comfort. Many EVs have heated seats and sometimes a heated steering wheel. These are much more efficient, but only use if required.

Headlights

If it is broad daylight, turn off the automatic headlights. If it is dawn or early evening, just have your running lights on. Obey local headlight law minimums and be aware of any special safety conditions. Only use the headlights as required.

Speed VS Distance

High speed is also your enemy. I use Waze navigation app to help me with this. Under navigation settings, select "avoid freeways." Usually taking the back roads is a shorter distance, but not always. Driving closer to 35 MPH instead of 60 or 70 MPH greatly increases your range. Slow moving heavy traffic also increases your range. As a side benefit, you may also see some scenic views that you have never seen before.

Radio/Console

Turn off your radio to save a small bit more power. Some EVs have the ability to turn off the console display (the one that shows non-essential items, such as the time and what station you are tuned to). Turn down dash display brightness.

Elevation

Drive with a 3-D mindset. What is the general elevation of your current location? What is the elevation of your destination? If you are driving to a lower elevation, GREAT! You are going to get some "free" distance. If your destination has a higher elevation, keep in mind that it is going to take more energy to climb to that elevation.

Charging Stations

Have accounts with several charging station networks, like ChargePoint, Semaconnect, Blink, etc. I make note of those charging stations where I can catch a cup of coffee and cop a kWh or two. Places like hospitals and park & rides can also have charging stations. Tell your representatives that you want more charging stations available to the public. The Koch brothers have a lot to do with the limited availability of charging stations that we see today. Talk to your electric utility company about EV charging station projects that they may have in the works. Let them know that you want to see them plan or finish those projects. It helps them to know that there is a demand.

What if I do run out of energy?

Don't panic! It's not that big of a deal if you have AAA or other auto club membership. When you request a tow truck, ensure that you request a flat bed tow truck. You want your EV loaded onto the bed of the truck, not towed behind. Towing an EV with its wheels on the road can damage your EV. Have the tow truck deliver your EV to a place where you can charge. The tow truck driver will help you push your car into position to charge.

Wednesday, December 12, 2018

Did ya ever reset your router and discover you've lost your static IP configuration info?

The Problem

I just did that recently for a business client of mine. I was working on decommissioning a server, an old domain controller running the obsolete Windows Server 2003. The problem was that the DHCP service (which hands out IP addresses to computers on the local network) was running on this server. So, in order to decommission this server, I had to enable DHCP somewhere else on the network. The obvious choice is to turn on the DHCP service on the router.
After a few failed attempts to log into the router (the password for that was missing as well), I was left with having to perform a factory reset on the router. After I was able to log into the router using the default, out-of-the-box credentials for the router, I came to realize that the router needed static IP configuration information for the Internet connection. Then, there is a moment of panic when I discovered that the business client no longer has the paper that with the scribbled IP configuration information on it.
The ISP in this case is Frontier, which provides internet service for this business complex where my client occupies a small space in. There is at least one central router in the building that provides service to subscribers within the complex. Each subscriber has an Ethernet cable running into their office that connects to the business's router. But, without knowing your assigned IP address block and gateway address, the router is pretty much useless for connecting to the internet. So, my first thought was to contact Frontier and get the IP configuration from them.
Well, that turned into hours on the phone getting information that was not useful at all in this scenario. They tried hard to find the information for me, but apparently the installer didn't record the static IP configuration information either. Frontier technicians tried to check their gateway to try to figure out the information to no avail. Well, that was very discouraging.

The Solution

However, all was not lost. I unplugged the Frontier Ethernet wire from the router and plugged it directly into my laptop. The network interface, seeing no DHCP service, sets a default IP configuration, which is not useful for meaningful communication on the network. However, it doesn't matter when using a tool like Wireshark. I launched Wireshark, selected my network interface where the network cable was plugged in, and clicked the "Start capturing packets" button. That is when I saw the ARP packets coming from the gateway.
The gateway sent an ARP packet to each of the IP addresses that is included in the local network sub-net configuration. Obviously there weren't devices at those IP addresses, but Wireshark still captured the ARP packets that were sent to the IP addresses configured for the client's address block. So, right away, I knew the IP address of the gateway. Also, seeing the number of IP addresses that the gateway sent ARP packets to, I could calculate the sub-net mask. There were 6 addresses plus the address for the gateway, so that requires 3 bits of the 32 bit IP address to be variable and the remaining 29 bits will be the same for all these IP addresses. Therefore 29 bits are the mask, which translates to 255.255.255.248.
So, with that information, I could successfully configure the router. I didn't have Frontier's DNS IP addresses handy, so I just used Google's public DNS addresses (8.8.8.8 and 8.8.4.4). The client was back in business. And of course, I took note of the static IP configuration in a safe place so that this issue wouldn't happen again.

Monday, July 3, 2017

How to block those dang "stay at our resort" spam calls

The problem

In the last couple months or so, I have been receiving spam calls from an automated caller that claims that I have stayed at one of their resorts. The recording is made to sound like a live person, but you cannot interrupt the caller no matter how loudly you yell for them to stop. They annoyingly call my cell phone at least once per week. The incoming call comes from a spoofed semi-random number.
At first, it seemed that it would be difficult to block the calls given that it is from a random number. However, their is a pattern to the number. The spoofed number always shares the first 6 digits of my cell number. The last four digits are the ones that are randomized. The purpose of this is to make it look like it is a "local" call.

The Solution

After doing a bit of research, I settled on an app called "Should I Answer?". This app has a nice wild card feature for blocking ranges of phone numbers. So, the trick is to install the app, and then add a "private rating" for a phone number that is the first 6 digits of your phone number plus a "*". This will block these phony numbers. If there is a number that is in this range that you do want to receive calls from, just add it to your contacts.

This solution is working great for me and I thought it was well worth sharing.

Wednesday, November 9, 2016

Why I like good old fashioned SQL

Every election year I work on the election portal at https://pacific.nwportal.info/. This year, instead of storing the election data that I retrieve from state and county sources in cache as JSON, I stored it in a SQLITE3 database. This added tremendous flexibility in dealing with election data.

One of the new features of the election portal is the Balance of Power chart that shows which party, given current real-time election results, will be in control of the Washington State Senate and the Washington State House. This is where SQL comes in and helps eliminate the need for a bunch of code. For example, this is the SQL I created to determine how many candidates from each party are ahead in the election for the WA State House:
Select Party, count(Party) Winning, MaxVotes from (select max(TotalVotes) MaxVotes, Party, Candidate, Race from (select rc.Name Race, c.Name Candidate, c.Party, sum(rs.votes) TotalVotes from races rc, candidates c, results rs, feeds f where f.ID = rc.FeedID and f.FeedType = "WAXML" and rs.CandidateID = c.ID and c.RaceID = rc.ID and rc.Name like "%State Rep%" group by c.Name) group by Race) group by Party;
This statement returns a record set that looks like this:
Party              Winning       MaxVotes
Democratic           52            21822
Republican           46            22407 
With this, it is easy to determine in code which party will control the house. I only use the "MaxVotes" value to know when the election reporting has started. If the value is 0, I know that the reporting has not begun yet and can set up my programming logic accordingly.

Tuesday, November 8, 2016

Is your Drupal 8 site crashing on PHP 7?

I ran into this problem on a Drupal 8 site running on bleeding edge technology. The site would not come up and it would display an error coming from Symfony "Request.php".
It turns out that PHP 7 has some cool performance features including a feature where PHP will not create the standard global variables (like $_SERVER) if it doesn't see any references to them in the PHP code. The problem was that there were references to the global variables in Symfony, but there were no references within "index.php", so Symfony would crash the drupal site when it tried to access the $_SERVER global variable.
A quick fix was to add this line to index.php: "$server = $_SERVER;" and the site was up and running.

Wednesday, June 1, 2016

Determining the Age of Bing Maps Imagery

Context

At work, we use Bing Maps to provide users a way of visualizing their home and aiding them to select where their roof is for the purposes of calculating roof dimensions for the potential installation of solar panels. We don't use the image itself for this calculation; we use the location. The map just provides a visual aid so that the user can say "this is where the roof of my house is."
Why do we use Bing Maps instead of Google Maps? In a word - price.

The Problem

Bing provides different imagery sets with the main ones being "Aerial" and "Birdseye" where "Birdseye" has the advantage of providing different "oblique-angle" images for each area. The problem is that not all Bing Maps images are created equal. In some areas of the US, the Birdseye image can be much older than the Aerial image, or vice versa. Depending on where a customer's address is, one image set could be much older than the other. This can result in the user looking at a map of trees or a desert with their house nowhere in sight. The user would have to guess which cactus is closest to where they think their roof-line might be.

Bing to the Rescue (or not)

Bing provides an API where you can retrieve the age of the imagery for a given imagery set. You can do this by using the API to retrieve the Imagery Metadata. The idea would then be to get the metadata of both the Birdseye and Aerial imagery and use the newest one to determine which map to display to the user. However, there is another problem. Although Bing provides this nice API to retrieve the metadata which includes the imagery age by way of two properties: "vintageStart" and "vintageEnd", these properties are not returned for the Birdseye imagery. So, the imagery metadata is completely useless for trying to programmatically determine which imagery set is newer. Thanks, Microsoft!

The Solution

Well, we didn't find a solution, other than to add a configuration setting to determine which imagery set to use. However, a colleague of mine did suggest a solution. The only problem now is to somehow implement this flowchart using C#.
Map Age Guide
Map Age Guide