Code Design

I wrote my first computer program in a data processing class at Merritt College in Oakland, CA, taught by Mr. Wilson Price, in 1969. It was in Fortran and I was hooked.

Over the years I’ve learned many more computer languages, some of which I made a great living with, and there always seemed to come a point in the process where I ended up developing techniques that made the language logical and simple.

That’s happened recently in my long web coding learning process involving HTML, CSS, Javascript, JQuery and PHP, and it’s very cool so I thought I would share it here.

The normal way to approach an interactive app is to define elements in HTML, give them a name in the form of an ID, define the visual properties of each ID using CSS and then determine what actions to take with each using Javascript and JQuery.

I won’t dwell on my old way of doing this here, instead I’d like to show you how I do it now, so let’s dive right in!

First we define the elements in the HTML page:

div class="tool" data-switch="g" data-title="GeoSearch On/Off">GeoSearch
div class="tool" data-switch="s" data-title="Satellite View">Satellite
div class="tool" data-switch="m" data-title="Google Map">Google Map
div class="tool" data-switch="w" data-title="Current Weather">Weather

The tool class provides a means to handle each one using JQuery and the data-switch and data-title are HTML5 attributes that you can access with javascript, like this:

$('.tool').on("mouseenter", function() {
  tooltip.html( $(this).data('title') ) // Set tooltip content
  tooltip.show(); // Activate tooltip
  // Whatever else you need on mouseenter...
}).on("mousemove", function(e) {
  tooltip.css({ // Handle tooltip position as the user moves his mouse
   top: e.pageY - top: e.pageY - Math.round((th2.height()/2)+5),
   left: e.pageX - (container.width()-274)
  });
}).on("mouseout", function(){
  tooltip.hide();
}).on("click", function() {
  tooltip.hide();
  switch( $(this).data('switch') ) {
   case "g":
   ... Geosearch on/off code here
   break;
   case "s":
   ... Satellite view code here
   break;
   case "m":
   ... Google map code here
  break;
  case "w":
  ... Current weather code here
  break;
  default:
  }
});

This is my new code magic and I plan on using it from now on. Obviously the tooltip needs CSS styling and other stuff but hopefully you can get how it works.

btw… My new app that puts it all to work is called GLHip.

Published
Categorized as Site Stuff

ZypFly

My latest app: zypfly.com

Published
Categorized as Site Stuff

CountyFly

Here’s my latest: countyfly.com. It’s a jápnou (just ánother program no one uses…)

Published
Categorized as Site Stuff

GovSort

http://www.govsort.com/

Published
Categorized as Site Stuff

TetonPost

Ahhh, the saga of tetonpost. Just for the heck of it I recently looked back in time at my very first gmail email at tetonpost, in November of 2007. The signature link pointed to my current website at the time, tetonpost.com, which disappeared around 2008 due to a flaky relationship with a shady character named Harry.

Harry Hayes was a computer wheeler and dealer from Bellingham, WA whose claim to fame was taking over an up and coming Flash company from a bunch of naive geeks. I worked with him for a bit, saw his dungeon office and inhaled his cigarette smoke. He had a hosting service and provided me a free domain name for the new site I was starting after moving here to Teton Valley.

One day he dropped dead from a heart attack and I was never able to regain that domain, so when I saw the link in that first gmail, I clicked on it. Wow, it appeared it might be available again so I rushed to my web hosting site Bluehost, brought up the domain checker and there it was! They’ve got a sale going on so I reclaimed it once again for $7.99. I then whipped up some basic HTML5 and now it’s back: tetonpost.com.

Published
Categorized as Site Stuff

StateVu

Here’s my newest app, StateVu. It’s based on Microsoft’s latest Bing Maps V8 platform and uses my U.S. Cities database along with custom GeoJson units for Counties within each State. It’s simple to use and quite informative, so dive on in if you like…

Published
Categorized as Site Stuff

City Totals

Here’s the current status of my U.S. Cities database:

Total Records: 26,462 U.S. Cities.

No Zip Code: 6,866 records (25%).

No GNIS Code: 6,512 records (24%).

No FIPS Codes: 3,312 records (12%).

No County Name: 0 records.

No Lat/Lng: 0 records.

I am attempting to achieve 100% in each category, at which point I would have a database of caliber. Right now it’s pretty bad-ass for coding projects like BMap8.

Oh btw, did I mention that I am officially on Summer Vacation!!! Yesterday I had dispatchers wishing me a nice summer, over the radio. That’s good, everybody’s on the same page and they ain’t going to put no rides on me come Monday. Which is really good because I’m out of here on Tuesday :-)

Published
Categorized as Site Stuff

New Code

I wrote some new code today that analyzes the fecal droppings pattern of the Hairy Nosed Wombat while engaged in sexual posturing with the same sex. It’s fascinating data and I would love to share the results with you but I’ve determined that nobody looks at my code, so, why bother.

btw: There’s only 163 left in the world, and they’re mostly male. Just sayin…

Published
Categorized as Site Stuff

Nearby Donuts

Do you need a donut in The City? Actually, decades ago, I did. We didn’t have the tools we have now, back then you had to find a payphone, hope the book hadn’t been ripped out, look up “Bakery” in the yellow pages, write the address down, find it on our San Francisco paper map, and then go there, following the map as it lay in your lap.

Now you can just bring up my Bmap8 app, type “San” (just enough to auto search…), select the City, select Nearby and then Bakery. Take your pick, clicking on any of those names will give you everything you need, including their website if they have one.

Click the map below, click Nearby, and find something else…

Published
Categorized as Site Stuff

County Polygons

If you’re interested in Polygons, click the image below, then click anywhere on the Bing Map and select the Counties option. Click on a county name to explore it…

Update: Microsoft’s new Bing Maps Version 8 has no way of naming a polygon when it’s created, so that I know what to do with it when it’s clicked, like the name of the County in my case. So I invented my own technique. The API lets you set the RGB color value fillColor: rgba(255, 255, 255, 1.0) for each Polygon, and detect it on a click, so I set the blue value to a sequentially incrementing number from 0-255 and the opacity value to 0.0 so you don’t see the color change, and then use the blue value as an index into an array of county names. Pretty cool huh! Fortunately, Texas only has 254 counties, otherwise, it wouldn’t work…

Update 2: (5/19/16) Map god Ricky from Microsoft showed me today how to do it, via the Forum:

You can add custom information to any shape in Bing Maps. Pushpins, Polylines, and Polygons all derive from a common interface called IPrimitive. You can add custom data to any IPrimitive classes using the metadata property. For example:

var polygon = ... (Jim here, won't bore you with this stuff :-)

polygon.metadata = {customProperty: "custom value"};

map.entities.push(polygon);

Aha! How come my faithful readers (who have probably bailed on me by now) didn’t know this? Anyway, I implemented it and it works great!

Except perhaps Alaska, Hawaii, and California, the polygons are a bit messed up.

Hey, if you’re interested in exploring the home pages of Cities and Counties in the United States, click below. Otherwise, wait until I get my ass in gear and create a more fluffy post with pictures from the bus, or family shit, or whatever…

Published
Categorized as Site Stuff

You Again?

Hey, thanks for dropping by! I’m sorry my content has been sparse lately. I’ve been feeling blog uninspired, working on map code, and driving my bus up and down the Valley, up and down the Valley, up and down the Valley… Like I have been for the last ten years. Summer is right around the corner, so hang with me, just not so often :-)

Published
Categorized as Site Stuff

Bmap8 Places

I’ve just created some pretty cool code. The Bmap8 program now shows surrounding entities when you click the Zip Code in the slide-in box. Just run the app, type in a place and select or click anywhere, and then click the Zip Code.

What you get depends on where you are. If you’re in a major metropolitan area, the items that show up on the map, when clicked, will probably take you to the website for that place! If the item has no website you’ll get a Wikipedia article, or something more.

Below are overlayed linkable places on a map of San Francisco:

Explore your own area! Bmap8!

Published
Categorized as Site Stuff

Code

Here’s a list of my latest code creations:

  • Bmap8
    Uses Microsoft’s recent preview version of Bing Maps V8.
  • TetonValleyMap
    Teton Valley addresses by city.
  • DahMap
    Just a cool eclectic map app.
  • ZipDown
    Find places surrounding a location.
  • Freq
    Tech news presented as you choose.
  • Symegry
    The latest news from around the world.
Published
Categorized as Site Stuff

Coverage

Ahhh, the things I find interesting that other people might not… I put my new Bing Maps V8 program into Aerial mode at the U.S. level, turned off labels, and then turned on Streetside view. The “blue” areas represent coverage.

It clearly illustrates that Microsoft has a lot of work remaining to photographically map the entire United States. They’re obviously playing catch-up to Google Street View, but the image quality is much better! It also appears that the focus is the U.S. while Google is mapping the Earth and beyond.

I wonder if Microsoft is hiring people to drive the camera trucks this summer?

Published
Categorized as Site Stuff

Bmap8.com

I was so impressed by Microsoft’s new Bing Maps V8 that I created a new domain this morning called bmap8.com. On one hand it’s another five letter domain name to entice the spammers that want to develop a website for me, and on the other it’s a nice short reference to the API without the word bing.

I’ve been working hard on the code today and it’s ready to be previewed if you’re interested. Enter a place into the input area, and submit it. The place can be anything from a full address, a city, or a zip. Once the map is presented, click the Map Type button upper right and select Streetside. Click anywhere to explore the images. That’s all the program does now, so have fun looking at high-quality imagery. Click below to go…

Published
Categorized as Site Stuff