Google+ Followers

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. :)

Tuesday, January 21, 2014

New "Worst Passwords" and Keeping Your Strong Passwords Safe

In the new list of 25 worst passwords, "password" moves from #1 to #2. The new #1 worst password is "123456". It is sound advice to not only use strong passwords (which contain a combination of letters, numbers and symbols), but to use different passwords for different websites.
Another really good reason to have different passwords for different websites is that you will know exactly what got hacked. Once a while back, I had the same password on Skype and GMail. It was a password that wasn't real strong, but I thought it was strong enough because it contained both letters and numbers. I was wrong. It was somehow hacked and posted on some website in another country. Fortunately, I was tipped off by a warning from a fellow software engineer in that other country before any major damage could be done. Having the same password for both, I could not know which site was the source of the hacking. Was my password hacked on Skype first, or was it GMail?
As computers get faster and more sophisticated, it is more important than ever to keep passwords unique and strong. Of course, SplashData recommends their product, SplashID Safe, to keep track of your passwords so that you don't have to rely on your "wet computer" to remember all those strong passwords. However, I also recommend KeePass which allows you to categorize your passwords. It also works well with having the password file saved in your cloud space and shared among more than one device. For instance, if you add a password on one device while you have your password file open on another device, you can still add a password on that other device and save it. It detects that the file was modified and merges the changes made by both devices so that you don't lose any added passwords.
It also has another nice feature where you can double click to copy your password to the clipboard and paste it into the password field of a website or application without revealing what your password is. It automatically removes the password from your clipboard after a specified number of seconds (default is 12 seconds).  This comes in very handy when you are doing online presentations and need to copy/paste a password without revealing it to your audience.

Stay safe.