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
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 ( and 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 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


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

Wednesday, September 24, 2014

Inexpensive and Powerful VPSs

Major Cloud Services

Whenever I look around online at premium cloud services, such as Amazon's AWS or Microsoft's Azure, I always feel like a kid at a candy store. All the cool stuff like cloud computing, cloud storage, media services, and more are there. I have experimented with both of these major cloud services and found them very fast and very powerful.  However, these services do cater to the corporate world, so the prices are more like what you would find in a more expensive department store than in a candy store. So, as an individual, I am like a kid in that department store, turning out his pockets but not finding quite enough change to buy that desired toy.

The Dime Store

When I was a kid, there were stores called "dime stores". They were "mom and pop" stores that were like a general store, or a convenience store that stocked many necessities, but they also had an aisle full of cool stuff for kids. Need a sling shot or engines for your model rocket? You could find it at the dime store. They had a lot of neat things that didn't cost that much. You could bring your change that you've been saving up to the dime store and come home with treasure.

Now days, the dime store is extinct. Sure, we have "dollar stores" today, but they are not the same. Dollar stores are essentially chain stores full of industrial waste from China.


There are VPS and cloud services out there that do cater more to the "little guy". One of my favorites is DreamHost. DreamHost has had VPS offerings for a while now and they are reasonably priced as long as you keep your memory allocation small. It makes it possible to run decent higher performing websites and web applications without breaking the bank.

However, one disappointment I have with DreamHost VPS is the uplink speed (in relation to the server). My most recent uplink speed test with my DreamHost VPS showed that I was only getting about 30 Mb/s. This can be a limiting factor where scalability is concerned and for certain types of applications, including broadcasting.

There are some new VPS stores on the block however, and one of those is VPSDime (ah, the dime store is back!). For very low prices, they offer high memory VPS solutions. As long as you choose their Dallas or Seattle data center locations, you can also take advantage of SSD storage and a 10 Gb/s Internet connection. It almost seems to be too good to be true. However, I checked for online reviews and all seemed to be good, so I decided to try them out. So, for $14 per month, I got a VPS in the Seattle data center with a whopping 12GB of memory and 60GB of SSD storage. I also added a free "add on" called "Offloaded MySQL", which means your MySQL databases do not use up your SSD storage.

VPSDime does offer the CentOS 7 template that I am interested in, so I selected it for my VPS. Within a few minutes, my VPS was ready. One of the things I noticed right away was the SSD speed. Installing updates using YUM was extremely fast. Running "TOP" showed the available memory that I was expecting. So far so good.

The next test I ran was the speed test. I wanted to see that 10 Gb/s connection in action. I ran the speed test a few times and I was getting uplink speeds between 300 and 400 Mb/s, which is more than 10 times of what I get with my DreamHost VPS. Very impressive, indeed.

One thing to keep in mind however with VPSDime VPS is that it is un-managed. This means that you are not going to have those "one-click" installs that you have with a managed server, like you would have with DreamHost. You can opt for some managed capabilities with VPSDime if you pay more per month for one of the control panels that they offer. However, I am going to set up everything manually and save some cash.

Stay tuned for my next blog post when I start setting up this VPSDime server for running some Joomla websites. I can't wait. :)