Tag Archives: programming

Digging through the past – my early programming.

I have been on a mission this year to simplify my life. Part of that includes disposing of once ‘possibly useful’ stuff. One such pile of ‘possibly useful’ included over 200 3.25″ floppy discs, circa 1995.

Not wanting to throw away anything that might be useful, I had to see what was on those disks. The original plan was to use an old PC that I used for LINUX development (and has a 3.25″ drive) to mount the disks and read the contents. That plan slowly devolved into a realization that things would be not be that simple. After trying to mount several disks, only to have the mount time out and fail, I came the the realization that I’d have to find a USB floppy disk drive to plug into my MAC, or (gak.. gag.. snarl) I’d have to construct a Windoze box to read those disks. As much as I found the entire concept utterly revolting, it was my only sane solution. If anyone could possibly consider intentionally installing any Micro$oft operating system as ‘sane’. So be it, that was the goal for a Friday night.

Having access to a Dell Optiplex mini-case Pentium III machine (that I bought at a computer store across town for $25 about 2 years ago), with a 3.25″ disk I decided to give it a try. Sadly, the 10GB disk drive inside was dead… so, I needed to find another old ISA drive. Such antiques are not so easy to find, EXCEPT, in my collection of stuff that would be ‘possibly useful’. This consisted of a stack of 8 drives in size from 8GB to 500GB in size.

Next hurdle was the OS. What was I going to install? Clearly a Pentium III is NOT going to run Win7, or XP for that matter. I’d have to find an OLD OS. So, that’s what I did. Being the pack rat I am, I found my old MSDN (yes, you read that right, back in the 90’s I was a registered Windows developer.. more on that below). I no longer had the full 30 DC catalog of stuff, but I did, for some reason, retain my Windoze NT MSDN install image with developer license. This… was going to be my conduit to the archive of my programming history.

I’ll save you the 1 day odyssey of dealing with the ancient and inexplicable Windoze limitations on hard drive size. Even with the cylinders and heads and a translation formula.. I ended up with only one drive that would work. And to top it off, despite Windoze complains that the max Partition size would be about 8 GB (my iPhone has more storage!), that MAXIMUM partition size the NT would install on was a 2048MB section of disk. This discovery through trial and error cost me several hours and I’m guess at least 1 year off my life.

Finally, I was able to start going through the disks. This is when I came to the realization that my LINUX box just *might* have been able to read the disks all along. Out of the 200 or so disks, only a handful were usable. Most were either un-formatted, or so badly degraded that the CRC errors (you remember CRC errors… I do, except now I’ve suddenly developed a slight tick.. the costs of Windoze can’t be measured in dollars alone.. oh now.. oh no indeed.). Odds are, ever disk I tried to use was junk anyway. This is something I need to follow up on later this week.

In the end, the Dell Optiplex Pentium III was brought to live running Windoze NT. I nightmare of an OS if ever there was one. In fact, I recall in my 1st stint at Hewlett-Packard (mid 90’s) we were forbidden to even mention Windoze NT in our workgroup. The fear of NT vs. HP-UX 9.0 in the market place was great. In retrospect, the comparision is laughable. HP-UX was a real UNIX system, with a real UI, Windoze was.. well.. garbage. The really sad part was that NT won the market share war. There is no accounting for intelligence within IT management.. this is an axiom proven again and again. Digressing….

Most of the stuff I found on the floppies that I could read was worthless. I did have some old 90’s website content that some day I might pull off and do a way-back machine sort of look at my very early web development work when Netscape 1.0 was king and there was no such animal as Internet Exploder. Really, and sadly, I suspect many people cannot even image that… tsk tsk.. sorry for you, I truly feel).

I did manage to find one good working bit of code, and I’m including a screen shot of it here.

This is a bit of code that I wrote using Borland (10,000 points if you remember Borland and know where their headquarters were… 1,000,000 points if you have a photo of it, that you took!) Borland C++. Having had the choice of using the MS Frameworks or buy my own compiler, I bought my own (and it was not cheap I can assure you) full blown compiler. I was even part of their developer and Beta tester network. I had some early releases of BladRunner (a DB precursor to Paradox) in floppy, but I tossed those out during the purge. Shoot.. digressing again….

When I was working at HP, we had a set of very crude batch scripts that performed the very critical task of monitoring our telemarketing PC’s located across town in Santa Clara (the data center where I worked was in Sunnyvale). The batch script ran on a dedicated PC in our data center. It was a fragile concern at best. While working grave yard baby-sitting multi-million dollar equipment, I took it upon myself to take some C and C++ programming classes at the local college, and use my time in the data center to get my homework done. While writing code, it was quite clear to me that this fragile batch file system would be released with a proper Windows program, that would be more robust, provide more information and not require the PC to site there running a single program that would crash if anyone touched the keyboard (it would interrupt the batch file.. whom ever came up with the idea should have been fired on the spot!)

I took a couple of nights to re-write the entire thing in C++, as a Windows application. Here is a picture of the screen with the ‘About’ dialog. Since the constellation of PC’s it monitored were of course not on my home network (there were tossed in the trash at HP around 1997), there was not much else to show.

Telos Vision - Download Monitor

It sure did bring back some memories and let me to think back about the extensive amount of programming experience I have on a wide variety of platforms and languages… sometimes I get so focused on my current objectives, I forget how much programming experience I bring to the table, well over 20 years worth.

I also found a couple of command line and basic text windowing programs that I actually sold for $6.00 a copy back in the late 80’s. Yes, I’ve been writing and selling software for nearly 30 years. Yes, you read that right 30 years. It’s even hard for me to think about that.

Thinking back, to my first experience with a computer, it was at UC Berkley back in 1976. At that time, the computers were all timeshare machines, and time on them was not cheap. There were no monitors, or terminals. Interaction with the computers was via binary status boards (recall all those blinky lights on computers in old movies.. yeah.. that’s what I’m talking about) and the rare interaction with teletype style printer terminals. People allowed to directly interact with computers were highly trained individuals, no mere mortal was allowed to come in contact with a computer. Quite the contrast to today, where even those with the least of ability are allowed to not only touch them, but they can OWN then! And worse yet they are allowed to connect them to world wide networks. The concept of this so foreign and frightening to those early computer scientists.. the thought of it every happening was simply an impossibility. Who would be so stupid to allow that sort of thing to happen? Well, I think that history on that is documented well enough I need not even attempt to cover it here.

Now, I wonder if I can fix those disks with the CRC errors? Where is the old dial-up BBS that kept that fixdisk.exe. program I loved so much?

CIDR notation – Living in Net Block Hell

CIDR… what is CIDR? No, it’s not something you drink. Although, given enough exposure to it, It’s something that makes me want to drink (hard) cider. Be that as it may, it’s an important part of my job, de-cidering, I mean, deciphering these cute little buggers.

So.. just what does a typical CIDR notation IP block look like? Well, it looks like this:

67.213.31.0/26

Now, you might be asking yourself, what, why and who cares? So, to answer your questions:

What:
Well, it’s a CIDR block dumba**, that’s what we’re talking about here. Oh.. what does it mean you might really be asking me. It means: Classless Inter Domain Routing. Or, in layman’s terms, it’s like a sort of Internet Zip Code, a method of sub-organizing the massive worldwide IPv4 addressing system (which amounts to approximately 4,000,000,000 addressable ‘systems’, not counting those massive blocks that are set aside for private network use, such as the infamous 192.0.0.0/24.

Why
Well, there is a good question. In the early 90s it became apparent that the number of free IP addresses would be depleted. The total number of IPs was large enough then, but because of routing issues, they could only be used in blocks. Now, those that are even slightly in the know, know, (heheh) that that entire pool of IPs is projected to be exhausted in early 2011. Yeah… that’s right, NEXT YEAR! But, IPv4 and the new IPv6 that supersedes it is another discussion for another time. Right now, were talking about Cider!, uh CIDR! So, trying to get back on point, the use of these CIDR blocks was a way for routing tables (in those things they call routers, imagine that) to store and organize large pools of IPs, or small pools of IPs as one might see fit.

Who Cares?
Anyone that deals with internet IP infrastructure cares. Now, since it’s my business (what I’m paid to do) is watch the ENTIRE Internet to make sure that:

  • DNS (oh.. dont’ get me started) works for corporations large and small. And yes, DNS hijacking is real, it happens, but not only that sometimes they are corrupted accidentally, and people like me designed the software the keeps track of that.
  • I’m able to do other things with this data that I can’t talk about, period. So don’t ask.
  • And, last but certainly not least, it’s just how us geeks communicate. So be it.

Now, why is it a pain in the ass? Well, simply, I need to accurately decode these CIDR blocks into IP ranges (what I do with them is a classified trade and operational secret, so don’t ask, I just need to do this). And to do so requires MATH!. Math… nothing wrong with Math, but it’s math that is to computationally intense for me to do it in my head. Primarily because it’s based on bits, 32 to be exact. Bits are those nasty little binary components of the real numbers the rest of you common mortals pretend you know what you are doing with.

I’m not going to try to explain why routers care about CIDR, I’m only going to say ONE of the things I care about most, re: CIDR blocks is getting the actual (true) IP range values from that short-hand notation.

So, let’s take the fictitious example I displayed before (67.213.31.0/26). I don’t know whom off the top of my head (I have databases to do that sort of stuff for me) that CIDR block might belong to (and it might belong to more than one organization), but let’s pretend that CIDR (the one I picked out of thin air) is relevant.

First things first.. we need to know what the block notation of 26 means, so we’ll start there. This part is called the ‘Network Prefix’. It signifies the number of bits (from the left) that identify the starting point of that network block. In this case, the first 26 bits determine the NETWORK and the last 6 bits ( 32 – 26 = 6 ) the HOSTS that are within that NETWORK.

So.. taking that number, 67.213.31.0 :

  • 01000011.11010101.00011111.00000000
  • and knowing we need the first 26 bits, which would be:

  • 01000011.11010101.00011111.00------
  • The starting address point is.. ta, da! 67.213.31.0
    uh.. OK.. so that’s not super illustrative.. but do the math anyway.

    OK.. next.. we know that we have a block of 6 bits to play with, starting at ‘0’. so the range is:
    .00000000 to .00111111

    Now.. doing that big of math we get (drum roll please…)

    0 (where we started in that net block) up to 63 (which is what 111111 binary means in base-10.

    THUS:

    The IP range calculation for this 67.213.31.0/26 is:

  • 67.213.31.067.213.31.63

    Now.. don’t you feel a little enlightened?

    Maybe next week, if I’m in a good mood, I’ll write a CIDR translator program and post it to my blog, but don’t hold your breath, unless you want to PayPal me a a $1000, then I’ll do it this weekend.

  • Setting up a custom ‘Weather Reader’ (Part 2)

    <-- PART 1

    Locating Suitable Data Sources

    The process of finding the desirable data sources, can be a challenge. I already know which of the 5 day forecast sources I want to use.

    Bremerton, WA

    Tacoma, WA

    Seattle, WA

    Maybe I’ll add this one too, just to so I’m reminded of what I’m missing in CA:

    Campbell, CA

    Next is a page that contains the CURRENT and HIGH / LOW temps. In the past I have located some text based data files on the NOAA.GOV website. I’ll have to dig up my notes one this. From time to time NOAA moves those files and changes the format, so those notes might not end up being that helpful. It is somewhere to start.

    This page here, has a pile of nice detailed information (see compressed screen shot) but does not contain everything I’m looking for:

    Recent WX from Bremerton National Airport.

    XML DATA!. XML is something I know more about, than I really care too, but it is a portable, easily parsable and text data format. I’ve not yet investigated the contents here, but it does look promising!

    Washington State WX XML Feeds

    TO BE CONTINUED TODAY

    Part 3 –>

    Setting up a custom ‘Weather Reader’ (Part 1) – Product Plan

    What is a “Weather Reader”? Well, it’s like a “News Reader”, but it’s purpose is to check the web for local weather conditions and display them on a computer screen. For this project I’ve revived an old Averatec laptop, installed Ubuntu 9.10 on it and started to write some PERL.

    Beat up old Averatec AMD64 laptop, only 1/2 the keyboard works and the battery is shot.

    Weather Data

    Where to get the weather data? Personally, I like to go to the source. The public source at NOAA.gov. This is a government agency, paid for by my tax dollars (and yours too if you’re a US tax payer.. of which only 53% of working people in the US are, but that’s another story. So, free for the taking as far as I can tell, and am concerned. Which is good, because the real heavy work is up to me. Finding a URL is one thing, using it for something productive is another thing.

    To see what I’m looking at as a source without clicking a bunch of links, here is a screen shot of my indented HTML victim:

    Seattle Weather from NOAA website.

    Now, the only part that I’m interested in is this one:

    I’m sure some of you are asking, “WHAT’S THE POINT!?!?!?”. Well, I have several, not all atop my head. As an avid motorcyclist, weather is almost as import to me as mariners and aviators. Weather might look good for the moment, but around here anything can happen. It’s good to know what the forecast is. And not just in one location. Since I transit two area micro-climates commuting to work, knowing that weather will be at the end points of my journey are are a minimum requirement. Plus, I’m lazy. Not so lazy I won’t write a program to do this, but lazy in the larger sense, of I just want to hit a button and see all the data I want, not have to wait for the Weather Chanel to decided it’s ready to dispense it’s forecast, or hunt around on various local news sites. Nor, frankly, have to click on TWO hyperlinks to see what weather will be like HERE and THERE. Nope, I’m just too lazy for that, so I’ll spend 8-32 hours figuring out a way to save myself 2-3 minutes a day (I didn’t say I’m always smart, but always lazy). Remember; “Laziness is the father of invention!”. Digressing….

    The Plan

    The plan is to use PERL, run every 30 minutes from 5 AM-> 1 AM, and grab the weather page shown above. Parse out only that which I want, and then re-construct my own page on my own server. It’s a basically a mashup page of what I want to see.

    Checking the source code of the page, I see that, ugh, NOAA did not supply and useful DIV markers that I can use. So, this will be a rel brute-force process to detect, select, extract and re-construct the page of my dreams. Yes, I can be easily entertained.

    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr valign ="top" align="center">
    <td width="11%"><b>Tonight<br></b><br><img src="/images/wtf/nshra50.jpg" width="55" height="58" alt="Scattered Showers Chance for Measurable Precipitation 50%" title="Scattered Showers Chance for Measurable Precipitation 50%" ><br>Scattered<br>Showers<br>Lo <font color="#0033CC">45 &deg;F</font></td><td width="11%"><b>Tuesday<br></b><br><img src="/images/wtf/shra50.jpg" width="55" height="58" alt="Scattered Showers Chance for Measurable Precipitation 50%" title="Scattered Showers Chance for Measurable Precipitation 50%" ><br>Scattered<br>Showers<br>Hi <font color="#FF0000">54 &deg;F</font></td><td width="11%"><b>Tuesday<br>Night</b><br><img src="/images/wtf/nshra30.jpg" width="55" height="58" alt="Scattered Showers Chance for Measurable Precipitation 30%" title="Scattered Showers Chance for Measurable Precipitation 30%" ><br>Scattered<br>Showers<br>Lo <font color="#0033CC">44 &deg;F</font></td><td width="11%"><b>Wednesday<br></b><br><img src="/images/wtf/bkn.jpg" width="55" height="58" alt="Partly Sunny" title="Partly Sunny" ><br>Partly<br>Sunny<br>Hi <font color="#FF0000">57 &deg;F</font></td><td width="11%"><b>Wednesday<br>Night</b><br><img src="/images/wtf/hi_nshwrs30.jpg" width="55" height="58" alt="Chance Showers Chance for Measurable Precipitation 30%" title="Chance Showers Chance for Measurable Precipitation 30%" ><br>Chance<br>Showers<br>Lo <font color="#0033CC">46 &deg;F</font></td><td width="11%"><b>Thursday<br></b><br><img src="/images/wtf/shra30.jpg" width="55" height="58" alt="Chance Showers Chance for Measurable Precipitation 30%" title="Chance Showers Chance for Measurable Precipitation 30%" ><br>Chance<br>Showers<br>Hi <font color="#FF0000">59 &deg;F</font></td><td width="11%"><b>Thursday<br>Night</b><br><img src="/images/wtf/nshra30.jpg" width="55" height="58" alt="Chance Showers Chance for Measurable Precipitation 30%" title="Chance Showers Chance for Measurable Precipitation 30%" ><br>Chance<br>Showers<br>Lo <font color="#0033CC">46 &deg;F</font></td><td width="11%"><b>Friday<br></b><br><img src="/images/wtf/shra.jpg" width="55" height="58" alt="Chance Showers" title="Chance Showers" ><br>Chance<br>Showers<br>Hi <font color="#FF0000">59 &deg;F</font></td><td width="11%"><b>Friday<br>Night</b><br><img src="/images/wtf/nshra.jpg" width="55" height="58" alt="Chance Showers" title="Chance Showers" ><br>Chance<br>Showers<br>Lo <font color="#0033CC">46 &deg;F</font></td></tr>
    </table>

    Snagging that out of the documents for 2-3 locations will get me what I want. It should look something like this, but the example here does not have any stylesheets applied, it’s a direct rip and mash.

    Sample mashup, this was done manually. It at least proved the concept.

    There are a couple of problems with that page though, it’s going to take up too much real estate on the final page. Here, it’s almost too large to view on my laptop’s main screen. So, some embedded CSS is in order. This hear overloads the td type, making any text found within anytd rendered at 80% of the normal size. This also overloads creates a style named headish that I is applied to the section titles:

    <style>
    .headish { 
      font-weight:bold; 
      background-color:#CCC; 
      font-size: 1.2em;}
    td { font-size: 0.8em; }
    </style>
    

    The result of that very small change, gives me a smaller visual footprint, and formatting at little more pleasing to my sensibilities:

    A little more hammering around in the stylesheet, and adding a CURRENT and High/Low temps forecast for the day. A little closer to the desired mockup. I still need to locate a suitable news feed to process:

    A little closer to the desired mashup page.

    PART 2 –>