More progress...
Jul. 17th, 2002 08:56 pm![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
...though there appear to be some weird behavior (bugs, perhaps) in phpMyAdmin, and some little 'gotchas' when working with MySQL.
* * * I feel much better today. It took a little effort, but I really, really tried to mellow out today. I think I succeeded pretty well... I'd give myself a B+.
* * * OpenOffice's Calc spreadsheet program runs slowly on 'alice', which is powered by a Pentium II and not anywhere nearly enough RAM, I suspect. Drew today added his thumbs-down to Galina's with regard to using this application. I can use it, but then again, I'm used to putting up with a lot of crap. <grin!>
Both the UPS and FedEx tables are populated in my MySQL database. I separated the two to make it easier to update either service should/when they change their rates (UPS generally does this early in the year, or at least it has for the past two years straight; FedEx threatened to raise rates in February, but hasn't yet to the best of my knowledge). The Priority Mail table is not all that important, but it won't take long to create and populate.
So the pseudo-code for my web page looks a little like this:
Required info:
Then, I take the leftmost three characters of the Zip Code and hit the 'zones' table to determine the UPS, FedEx, and USPS delivery zones (more complicated than it sounds: UPS alone offers Next Day Air, Next Day Air Saver, 2nd Day AM, 2nd Day, 3-Day Select, and Ground services, each of which has its own delivery zone ID).
For each such zone, I use the zone and the weight and hit the 'ups', 'fedex' and 'usps' tables to determine the rates for each service. Store the results.
The insurance, if any, is a simple math equation.
The code should then output the original input, along with rates for each service.
There are a number of wrinkles involved. Shipping stuff by air involves something called "dimensional weight." Imagine you are sending a very valuable ping-pong ball by air to Hawaii. If you pack it in the center of a box that measures 24 inches on a side and surround it with styrofoam peanuts, the package won't weigh more than a few pounds.
As this doesn't bode well for the courier, who only has so much volume aboard the plane going to Hawaii, it multiplies the length, width, and height of the package and divides by 194, and the transportation charge is based on the resulting number. (The box with the ping-pong ball now weighs 72 pounds, as far as shipping it by air is concerned. What a deal!)
As you might expect, if you ship a 75-pound barbell in the same box, you of course are charged for the actual weight of the entire package, which will be a tad more than 75 pounds.
If someone is intent on sending a package via air, the dimensions must be supplied. If someone is intent on sending a package via UPS Ground, the dimensions only matter if the sum of the long dimension plus the girth exceeds some magic number.
But I'm sure I'm boring everyone to tears. Sorry.
I'm not at all sure I can hack this out in one night. Nor am I sure I want to.
* * * The sci-fi book I read the other day was the latest in the StarFIST series: Kingdom's Swords. Like all the rest of the books in the series, I enjoyed it, but I most certainly did not enjoy the cliffhanger at the end. I don't mind a little obvious foreshadowing, as happened in the previous volume, Hangfire, but I sort of resent being left holding my breath until the next volume appears.
But there's nothing to be done about it now. I've read the book and now duly sit on the edge of my chair, waiting for the next one, and hoping that the authors enjoy a particularly healthy and creative season.
I will not, however, allow it to become the focus of my universe. There are things to do (and eBay auctions to check up on).
Cheers...
- I never checked the documentation (I am, after all, a programmer :^), but it would appear that while phpMyAdmin lets you give fields names such as '102', MySQL will subsequently not let you do anything with them.
- The 'mysqlimport' utility will allow you to populate single columns, but when I tried to populate a second column, instead of adding values to existing records, the new columns would be populated in new records. It is entirely possible I am missing a big caveat with the use of this utility, but I got around the obstacle by creating import files that populate the entire table at once.
- When specifying columns to populate using 'mysqlimport', I found that unless I separated the columns with a comma and a space, all values on a line of comma-delimited values would be stuffed into the first column specified.
Both the UPS and FedEx tables are populated in my MySQL database. I separated the two to make it easier to update either service should/when they change their rates (UPS generally does this early in the year, or at least it has for the past two years straight; FedEx threatened to raise rates in February, but hasn't yet to the best of my knowledge). The Priority Mail table is not all that important, but it won't take long to create and populate.
So the pseudo-code for my web page looks a little like this:
Required info:
- weight of package, rounded up to the next pound
- 5-digit destination Zip Code
- either the package dimensions or a checked box indicating:
- the package is a carrier "letter" (e.g., FedEx or UPS letter)
- the package is in some other carrier packaging (e.g., FedEx Pak, UPS box)
- the package is certainly small (i.e., obviously not oversized)
- the package is a carrier "letter" (e.g., FedEx or UPS letter)
- the amount of insurance coverage desired by the customer
Then, I take the leftmost three characters of the Zip Code and hit the 'zones' table to determine the UPS, FedEx, and USPS delivery zones (more complicated than it sounds: UPS alone offers Next Day Air, Next Day Air Saver, 2nd Day AM, 2nd Day, 3-Day Select, and Ground services, each of which has its own delivery zone ID).
For each such zone, I use the zone and the weight and hit the 'ups', 'fedex' and 'usps' tables to determine the rates for each service. Store the results.
The insurance, if any, is a simple math equation.
The code should then output the original input, along with rates for each service.
There are a number of wrinkles involved. Shipping stuff by air involves something called "dimensional weight." Imagine you are sending a very valuable ping-pong ball by air to Hawaii. If you pack it in the center of a box that measures 24 inches on a side and surround it with styrofoam peanuts, the package won't weigh more than a few pounds.
As this doesn't bode well for the courier, who only has so much volume aboard the plane going to Hawaii, it multiplies the length, width, and height of the package and divides by 194, and the transportation charge is based on the resulting number. (The box with the ping-pong ball now weighs 72 pounds, as far as shipping it by air is concerned. What a deal!)
As you might expect, if you ship a 75-pound barbell in the same box, you of course are charged for the actual weight of the entire package, which will be a tad more than 75 pounds.
If someone is intent on sending a package via air, the dimensions must be supplied. If someone is intent on sending a package via UPS Ground, the dimensions only matter if the sum of the long dimension plus the girth exceeds some magic number.
But I'm sure I'm boring everyone to tears. Sorry.
I'm not at all sure I can hack this out in one night. Nor am I sure I want to.
But there's nothing to be done about it now. I've read the book and now duly sit on the edge of my chair, waiting for the next one, and hoping that the authors enjoy a particularly healthy and creative season.
I will not, however, allow it to become the focus of my universe. There are things to do (and eBay auctions to check up on).
Cheers...
no subject
Date: 2002-07-17 10:30 pm (UTC)no subject
Date: 2002-07-18 09:28 pm (UTC)Cheers...
Re:
Date: 2002-07-18 10:04 pm (UTC)no subject
Date: 2002-07-19 12:27 pm (UTC)Cheers...
no subject
Date: 2002-07-18 12:20 am (UTC)LOL. My job involves getting information from people who don't read documentation and providing it to people who don't read documentation. Nothing like feeling needed -;)
no subject
Date: 2002-07-18 09:38 pm (UTC)The cash went unclaimed, but just about everyone on the distro list gave me all sorts of feedback.
It reminds me of a story I heard about young fellow who worked in Henry Kissinger's office during the Nixon era.
It seems the young man was asked to prepare a backgrounder on some subject, so he did. The morning after he submitted it, he gets the document back with Henry's scrawl on the cover page: "You can do better than this!"
So he works all the rest of the day and all night and submits a new, expanded report the following morning.
Late that afternoon, the report comes back. Henry'd written "Is this
really
the best you can do?"So he works all night, all the next day, and the following night. The next morning, he personally barges into Kissinger's office and slams the report (which is now about five times the size of the original) on Henry's desk. He turned to Kissinger and said "Here you go, Mr. Secretary. This is absolutely everything I could find on the subject. I can't do anything more."
"Fine," says Kissinger. "I suppose now, I should read it."
Cheers...