RSS
 

Archive for the ‘Programming’ Category

USPS Shipping XML API Testing Idiosyncrasies

20 May

If you’re a web developer and happen to develop software for use in e-commerce, chances are, somewhere along the lines you’ll need or want to integrate with the big 4 shippers’ (UPS, USPS, FedEx, DHL) APIs.  You’ll find right off the bat that they all offer rather robust APIs, so your options are sufficient.

Then you’ll get to programming and realize that the documentation is pretty crappy, but specifically I want to address the idiosyncrasies of the USPS “test” environment.  Effectively, what USPS means when they say “test” is not a test of robustness of your application, but simply whether or not your application can build a sample request (an EXACT sample request), and send it to their server.  Yeah — it’s like asking a math teacher to write the numbers 1 to 30 on a sheet of paper (in order) before he/she can get hired.

The problem is, the USPS docs don’t tell you this, nor do they show you the sample request.  So, for others who are about to embark on a few hour journey finding these details on Google (or worse, emailing USPS directly …eeek) I’m going to sum up a few facts here.

The most laborious for me so far is the one I already mentioned above.  For a rate request, the docs show you a RateV3Request, but in testing you can only use a RateV2 request (which does not support package dimensions).  Also, you must use the zip codes 10022 and 20008 for origination and zip, as well as 10 lbs. 5 oz. for the weight, and “LARGE” for the size.  Everything else (LAUGH) you have leeway with.

If you don’t use these exact values, you’ll get responses like “Please enter a valid zip code for the sender” (which of course makes you think you wrote the XML incorrectly) or “The package size must be ‘Regular’, ‘Large’, or ‘Oversize.’” (even though you have “regular” quite clearly in the request.

The advice is to get to production as soon as possible, though why USPS would design things this way is beyond me, but them’s the cards, you gotta play ‘em.

I will add more here as I find them obstaclicious enough (yeah I just made up that word).

Amendment 1:  I should add that the issues about the documentation not mentioning the “canned” requests is only applicable to the PDF documentation.  It is stated quite clearly in the HTML versions.  Go figure …

 

WORDPRESS HOW-TO: Ignore/Hide A Category On Your Home Page

28 Feb

Sometimes you don’t want a particular category to appear on your WordPress home page.  For me, I create weekly Twitter digests, and I’d rather they not be part of the page welcome.

The process of hiding them actually took me a little bit to figure out, so I thought I’d share.  It’s rather simple, so don’t blink!  :)

Simply edit “index.php” in the wp-content/themes/<your_theme_here>/ directory.

Between the lines:

<?php if (have_posts()) : ?>

and

<?php while (have_posts()) : the post(); ?>

Insert the line:

<?php if (is_home()) { query_posts("cat=-XXX"); } ?>

Be sure to replace “XXX” with the unique numeric ID of the category you want to ignore.  To find the ID, log into your admin, navigate to your categories, and select the one you want to ignore.  The number will then appear in the URL.

NOTE: Make sure you don’t delete the “-” before the “XXX” or else you will ONLY show entries from the category.

If you update your theme, you will probably have to repeat this procedure.

If you want to hide multiple categories simply append the other categories to the string with a comma: (Example: “cat=-12,-82,-4″)

It also follows, then, that this technique can also be used to hide tags, posts, etc.

 

Coffee Cup Half Moons now has an official URL Shortener!

27 Oct

http://cchm.us/

Based on the same engine as http://abv8.me/ and http://ihrt.it/ (developed by my web company, geeXmedia).

I plan soon to launch URL shorteners on http://tharp.me/ and http://tharp.us/

 

Day 1 of eBay DevCon 2009 plus a little tour of Northern California!

16 Jun

Corresponding pictures for this blog are available here:    http://abv8.me/2Q.

My business partner Chris and I have made our 3rd voyage to eBay DevCon, this year in wonderful San Jose in northern California (where the girls are warm so I could hear my sweet baby say … ).

We flew in last night, Jet Blue flight 317 direct from Washington Dulles to Oakland International.  Oddly enough, Chris’ neighbor Tooland happened to be the pilot, and he hooked us up with a free Heineken — yeah baby.  Anyway, it was a very long 6 hour flight (it was only 6 hours 23 minutes in the air when I flew to Paris from Philly), and we had some rocky air with a little detour as there were t-storms and tornadoes in Kansas.

We touched down at around 9pm local time (12am EST) and headed over to Budget Rental where we picked up our awesome Kia compact POS.  :)   Actually, it’s not too bad — good turning radius and small — hard for all the crazy California drivers to smash into.  We got to the hotel at 10:30 or so and proceeded to pass out.

So here we are in beautiful San Jose.  Well, cities are just cities, and, being the tree fanatic that I am, we had to visit the redwoods.  We got up early this morning — 6:30 or so, and decided to make our way to the Big Basin Redwoods State Park.  Now, for whatever reason, we put “shortest distance” into the GPS instead of “fastest time,” and we ended up on California route 35 — heading across the mountains on one of the steepest, windiest, but most scenic roads, I could have ever imagined.  I got some awesome pics of northern California vegetation, and, finally, about 2 hours later, we got to the park.

Now let me tell you, the coastal redwoods surprised me.  For all that they are huge, in the grand scheme of things, they really don’t seem all that large.  Really, a 300ft tall tree is only as tall as a football is long.  Gargantuan for a tree, yes, but in the grand scheme of things, they just feel like another tree — just ones that dwarf any big tree we have back east.  That being said, they are so tall and straight, they are kind of modest.  If a broad, bushy oak grew 300ft tall with a 200ft wide crown, I doubt I could relate to the perspective of such a tree being so modest.

From the park, we made our way to Santa Cruz so we could at least see the Pacific ocean.  We spent a little time at Seabright beach http://abv8.me/2R, and ate at a nice little place on the wharf named Aldo’s.  Apparently Guy Fieri ate there once.  The burger was delicious, and we had a little European Starling join us for a bite.  We named him Fred, and we were the best of buds.

From there, we headed back up route 17 to the eBay campus here in San Jose to listen to Madhu Gupta and company present the basic ins and outs of the new eBay selling manager pro applications platform.

General high points:

  • eBay items trade at a velocity of $2000/second
  • Some eBay sellers might put more trust in third party apps if they appeared to be hosted by eBay
  • eBay decided to make a platform where third party developers could integrate with eBay in a smart iframe or in hosted HTML
  • They will use the open gadgets specification
  • This will launch in August

Now, we have already developed our first application for this platform.  It is eZ labelZ for eBay, and it is a variation on our site ezbarcodez.com — geared to provide great integration with the already present eBay APIs so that sellers can print functional labels for their items.

Since we have been involved in the project since the alpha, most information was nothing new, but it was good to get a concrete overview.

Afterwards was “Happy Hour” with free beer and hors-d’oeuvres, and some networking.  We had some great chats with some eBay personnel, especially the documentation team, and well, what can I say?  Free beer.

So now we’re back at the hotel and I have hundreds of pics to parse through.  Hopefully they will appear on Facebook tonight and I will link them here.

 

Linaque — The game of unweaving that will twist your mind into knots

05 Jun

http://linaque.com

This game is addictive, and very challenging.  It’s a grid of squares that when you click a square, it changes the colors of all the squares in the same row and column.  It seems straightforward enough, but it surely gets tricky.

In the higher levels, you rotate through as many as 4 different colors trying to unweave a randomly generated puzzle.

It can be frustrating, but keep in mind, all puzzles are solvable.  Since puzzles are generated by the computer “clicking,” you simply have to undo what the computer did.  Simple right?  Go ahead — give it a shot!

Linaque (pronounced lin – ack).

 

Quickly duplicate a barcode!

04 Jun

Fairly often in inventory circles, you just need to take a barcode  label you have and duplicate it to put on another item.  The quickest way to do so is on the Instant Barcode Duplicator by geeXmedia!  Just navigate to http://duplicator.ezbarcodez.com and scan the barcode into the box.  You can even add a title.

It currently supports 2″x1″ and 3″x1″ labels as well as label rotation.  And, if you need further barcode abilities, there is a full featured WYSIWYG label/barcode creator at http://www.ezbarcodez.com.

Currently only 128-B 1D style barcodes are supported, as it supports both numbers and letters, as well as some symbols, but it’s quick, and it will work for almost any application.

 

Abbreviate Me! URL Shortener With A Splash!

03 Jun

Ok so the universe is full of URL shorteners. Does it need another one? No, but as a programmer, it was a fun project to build. Now I’m making it available to the public. It’s called Abbreviate Me! and it’s located at http://abv8.me/.

It’s free, it’s got a bookmarklet, it’s got stats, and it’s got an API.  And, in a move that is sure to blow your mind, it’s got a random color scheme!!  Awesome right?

Check it out.

 

CSS Vertical Centering on Variable Dimensions!

11 Feb

So maybe you’ve asked yourself, how in the HECK do I do vertical centering with variable width objects inside variable width objects?  It is insanely impossible.  Maybe you haven’t asked yourself the question, but you’re about to learn the answer.

Many people who wrote HTML back in the day remember the valign=”middle” tag from tables.  It was always easy to handle centering in tables.  In divs and boxes, however, it’s not so straight forward.  In face, the only somewhat relevant css tag is “vertical-align.”

Of course, many many people completely misunderstands what the vertical align tag is for.  It has nothing to do with vertical centering within an object.  It refers to how side-by-side objects center related to one another.

This article really has nothing to do with what vertical-align means, but it is certainly relevant to the above solution.  If you’re having trouble with vertical-align, google it and you’ll find a bajillions explanations.

So, the little snippet of brilliance I want you to see here is that, in fact, CSS DOES provide a way to do vertical centering.  What?  Didn’t you just say that it doesn’t?  I did.  But there is a pretty easy exploit, thanks to vertical-align.

So without any further buildup, here is the solution:

1.)  Use a strict doctype, because if you don’t, you’re an idiot.  ;)   j/k — if you don’t understand, check google.  I personally prefer HTML 1.0 strict, but use as you wish.

2.) Create a “div” element — any size, but definitely use a set width and height (px, em, % — it’s irrelevant).  It should have the css style “text-align: center; white-space: nowrap;” (I’m presuming, of course, that you want horizontal centering as well.  If not, substitute left or right — it makes no difference.)

3.) Create an element inside the div with the following style:  “vertical-align: middle”  Woohoo we’re done right??  No … not yet.  The object now has to be vertically centered to something.  And, intuitively, if somehow there were an object that is 100% in height and we were vertically centered to that, we’d be in business.

HEY WAIT A MINUTE!!!

4.) Now create a div inside your element with the following css style:  “display: inline-block; height: 100%; width: 0px; vertical-align: middle;”.

<div style="width: 150px; height: 90px; position: relative; text-align: center; background-color: pink; white-space: nowrap;">
<div style="display: inline-block; height: 100%; width: 0px; vertical-align: middle"></div>
<div style="width: 22%; height: 11%; background-color: skyblue; vertical-align: middle;"></div>
</div>

That will give you a blue box horizontally and vertically centered inside the main div.

You may ask yourself how it’s any better than just using margin-top: 44%; — and it’s not for a fixed width object, but it will work for a VARIABLE WIDTH OR HEIGHT object. (Think images!)

So there you go. That’s the solution. Exploit the one little vertical align ability CSS gives you — vertical align with the adjacent object that is 100% tall, bam — fluid vertical centering with variable dimension.