Programmers should strive to Expand their Knowledge Bases

With a title like “Programmers should strive to Expand their Knowledge Bases” you’d think I was referring to things like OOP, DRY, and other acronyms. However, I am not.  I’m not referring to learning additional programming languages or algorithms.  I’m talking about learning things from other domains entirely.  For example: science, knitting, cat photography, cat photograph captioning and so on.  Honestly it’s a little bit of a weak point for me as well.  My grammar is a sore example.  Of course, I’m a mediocre-self-taught-programmer, so that is to be expected anyway.  First off there’s knowledge you can apply directly to programming problems.

Having knowledge about other fields allows you to more readily solve programming problems that involve those fields.  There’s even a term for this: domain knowledge or domain-specific knowledge.  You don’t necessarily need to be an expert either.  For example, with a base level of knowledge it become easier to get input from experts in a particular domain This is because you already have a base understanding.  There are two less-obvious benefits though, and I think they are more important.

First, having a broad base of knowledge to pull from enhances problem solving skills. I don’t have solid numbers to back this statement up though. (This is a blog, not a peer-reviewed paper.) Usually, when confronted with a problem in different domains the manner in which you come to a solution differs based on the domain at hand.  More specifically: you think differently.  Being able to solve problems in programming often requires you to shift your way of thinking and having more experience approaching problems from different angles can be very beneficial.  It can even apply to learning new programming paradigms.  I didn’t fully grasp OOP until I considered things in terms of chemistry.

Second, having a broad knowledge base can make it easier to communicate with people of different backgrounds.  Much like dealing with experts above, but often a little more general.  This is also somewhat tied to the problem solving mentioned previously.  When you can shift thinking readily, it becomes far easier to think like the person you are communicating with and explain things with terms or analogies that that person can understand.  As a personal example of this: I’ve explained the Linux boot process almost entirely with car analogies to a car guy.  I’m pretty certain that had i never taken auto shop, this would have been impossible.

tl;dr version: Learn stuff. It makes you a better problem solver and communicator.  Soft skills for the win.

Now I remember why I hate HP’s website

Not entering a valid part number is not a crime.

So I go off to search for a part (specifically a replacement battery for a laptop) but I don’t have the thing with me since it’s not mine, I’ve just been tasked with finding a replacement.  (So, no stickers for me!)  As a last ditch effort before contacting the owner, I go googling and grab a random part number and decide to try to plug it into the part search and hope that it happens to match with HP’s all-knowing database, knowing full well it would probably say something like “Invalid Part Number” or something.  Plug in: SFB-HPDV7_56157 and I’m met with a much more condescending message:

A potentially dangerous input was detected from the client browser. This incident is reported to Support team. Please click ‘Home’ link to continue.

Really?  It’s always such a pain to use HP’s website to find… umm… anything, but this is a first I have to admit.  I wasn’t aware that dashes and underscores could be dangerous.  Couldn’t be polite and just say “that part number isn’t valid.”</rant>

That out of the way, why do manufacturers go through such lengths to avoid parting us from our money?  If I cannot, with ease, find a replacement part from you, I will not be able to buy it from you. For those who don’t know, with HP, to find anything you need both the product number and serial number to even begin your search. (Alternatively run their HP support assistant program on the laptop itself.)

Zombinanza 2 now in progress

It was mentioned that a sequel to Zombinanza has long been missing, and as a consequence Zombinanza 2 shall be attempted to be started to be made. Harass me if it doesn’t.

PHP: Get zipcode for an Address

I needed a small php function that could take an address (which lacked a zip code) and fetch a best guess postal code for it. I had a database full of addresses with city and state, but no zip code. Thankfully, if you have enough information in your address to locate it with the Google maps geocoding service, you have enough information to get the zip code. If not the correct zip code, it should pull one that’s relatively close assuming you’ve specified the correct city and state in your address.

This is possible because the geocoding service will return matches with full address data available. If we assume that the first match is most likely the correct match, we can just extract it’s postal code. I’ve only tested this with US addresses, but it may work in other countries where Google can geocode an address.

Continue reading “PHP: Get zipcode for an Address”