• (disco) in reply to Keith

    SRSLY, when was any post ON topic?

  • (disco) in reply to Nutster
    Nutster:
    About 10 years ago, the province of Newfoundland was renamed to Newfoundland and Labrador. The abbr. was changed from NF to NL. I was in the middle of a big (at least for me) database project when this happened, so I had to change the name and abbreviation, which I had used as a primary key for the "Province" table. I just had to make one change and let the UPDATE relationships convert all those NF codes to NL. I am actually glad I put the province/state information in the database, rather than hard-coding it.

    I also noticed that code for Newfoundland in the look up is still NF, even though that changed 10 years ago. This could cause bad times for your mail getting to its destination in St. John, NL. I think TRWTF is not updating your list of constants when circumstances change. That is why they are there; so you only have to update them in one place, but you still have to update them.

    I get the feeling that Canada Post would be wise enough to know where to deliver mail marked for St. John, NF.

  • (disco)

    Also, this:

    derp
  • (disco) in reply to chubertdev
    chubertdev:
    I get the feeling that Canada Post would be wise enough to know where to deliver mail marked for St. John, NF.
    Not necessarily. Imagine: postal worker 1: NF doesn't exist. Could it be Newfoundland? postal worker 2: No, that's NL. postal worker 1: Hmmmm... postal worker 2: Do something! postal worker 1: Ok, I'll google. Oh, NF is a county in Germany! postal worker 2: See? Told you it wouldn't be Newfoundland!

    German mail did something like this once when somebody got two numbers in the postal code wrong (21 instead of 12 or something like that). "Hmmm, this is not in the list of german postal codes" "Well, let's do a global search for it!" "Found it!!! It's in Australia!!!" So the letter went to Australia. Australian postal services couldn't deliver it because the address didn't exist, so it went back to Germany. Only then did someone have the brilliant idea to look at the written address instead of the postal code.

  • (disco) in reply to Onyx
    Onyx:
    "uber nerd" contest

    uber nerd contests are trickey, because there are so many potential fields of battle.

  • (disco) in reply to abarker

    Maybe we need a category for that. Call it... ForumWarz!

  • (disco) in reply to faoileag

    And something like a postal code that starts off A1E wouldn't be enough?

    (you're also using the term "postal code" when I belive that you want "postal abbreviation")

  • (disco) in reply to faoileag
    faoileag:
    Not necessarily. Imagine:postal worker 1: NF doesn't exist. Could it be Newfoundland?postal worker 2: No, that's NL.postal worker 1: Hmmmm...postal worker 2: Do something!postal worker 1: Ok, I'll google. Oh, NF is a county in Germany!postal worker 2: See? Told you it wouldn't be Newfoundland!

    I'm guessing this is similar logic to what Singapore Post used when they sent my package (addressed to Canada) to Norway.


    Filed under: Discourse helpfully stripped out all the line breaks in that quote | probably a known issue

  • (disco) in reply to chubertdev
    chubertdev:
    And something like a postal code that starts off A1E wouldn't be (you're also using the term "postal code" when I belive that you want "postal abbreviation")
    The NF / NL is a postal abbreviation; the example from Germany was for postal codes that consist of 5 digits over here.
  • (disco) in reply to faoileag

    caffeine hasn't hit yet. I read that entire comment as one example, not two.

  • TSA (unregistered)
    faoileag:
    Oh, and the next bug with "invisible topics" is: as soon as anyone posts a reply to an invisible topic, that "reply" will be visible in the "replies" list of the user creating the invisible topic. Also making it more or less public.
    As we told you in yesterday's topic, everything already is public, and we have the videos to prove it.
  • (disco) in reply to Onyx
    Onyx:
    obscure game references

    Come on, I think it was even in AVGN once.

  • (disco) in reply to Maciejasjmj
    Maciejasjmj:
    Come on, I think it was even in AVGN once.

    Is that somehow not obscure?

  • (disco)

    Of course there might be other "optimizations" that one could do. Since the curent code uses a linear search, one could put the two letter abbreviations in a "frequency" order (most populous state first, etc..). Lacking that, since the comparison uses 'short' for the test, if the list is in alphabetical order, if the test is '<' then it won't compare any further, and the loop could be exited. But in most cases, a 58 (isn't that how many states there are?) step loop given caches and modern CPUs isn't going to be much of a deal breaker, and given alternatives with calling overhead and the like might be the best solution out there. All of this begs the question: How many times IS this called? if it isn't that many, I'd leave it be and look for other WTFs (which I suspect are many, given the experience of this site).

  • (disco) in reply to herby
    herby:
    58 (isn't that how many states there are?)

    Only if you're the President. For everyone else, there are 50.


    Filed Under: Unsure if joke attempt, or just not American

  • (disco) in reply to mott555
    mott555:
    there are 50

    Note that DC has a "state code". As do various territories. Both were included in list in the article.

  • (disco)

    Ah well, I pretty much TL;DR'd the article.

    Can we go all pedantic dickweed about the meaning of "state" now? :smile:

  • (disco) in reply to mott555

    Especially about some countries that aren't states but bend over backwards sufficiently that they might as well be. See: United Kingdom.

  • (disco) in reply to faoileag
    faoileag:
    Australian postal services couldn't deliver it because the address didn't exist, so it went back to Germany.

    Bonus points if the address was waßer St or something.

    My wife ordered something from the US to Australia and it looks like this task really confused the usps workers. The tracking put it going into three different states and Canada before being returned to NY before dropping off tracking for weeks. The seller was good and replaced it but we ended up with two

  • (disco) in reply to faoileag

    Australia uses 4 digit post codes though. So the German postal workers are an even bigger WTF

  • (disco)

    If only there existed a data structure with constant lookup time.

  • (disco) in reply to Spencer

    Better than the UK's.

  • (disco) in reply to Arantor

    Yeah, the UK's does look a bit of a mess (my main exposure to it has been from early Top Gear episodes, where not even Clarkson, Hammond and May can get it right). But apparently they're specific enough that postal workers don't need to look at much else in the address for sorting to be extremely accurate?

  • (disco) in reply to Spencer

    Correct, a post code is specific enough to a single road - or sometimes even one side of a road, meaning that invariably one only needs the house name/number (or additionally an apartment number if the building is a block of flats or something) plus post code to get delivered.

    You could scrape a 'valid form' with regex if you were brave or insane, depending on the specificity of accuracy. There's a 1 or 2 alpha code indicating region, e.g. B for Birmingham, L for Liverpool, M for Manchester. (London has several, based on geographic regions within the Greater London area), followed by a 1 or 2 digit number, representing an area within that district. For very densely populated areas, there may be a letter after it.

    For example, Brighton is not crazy-densely populated, so it has BN and a number indicating regions in the Brighton and Hove area, while west London is WxY where W is west London, x is a number within west London and Y is an optional letter which extends the number range (as I understand it)

    Then it's an optional space, followed by a digit and one or (usually) two letters.

    The list of regions is fixed, so you could just shove that into a regex, you could even go to the trouble of identifying what numbers or number/letter combinations would be valid per region but it's an awful mess.

  • (disco) in reply to Arantor

    I guess that's the tradeoff - messy but extremely narrow, or simple but broad.

    The first of the 4 digits in Australian post codes indicates which state, and the second will help you narrow down the area somewhat - capital cities are 0* (with the exception of Perth, which is 68**), then expands out (again, with exceptions, like Petrie, 4502, which is a suburb of Brisbane, capital of Queensland).

    But an individual post code can cover a suburb, several suburbs/towns, or just a fraction of a suburb. There are even more exceptions, where the nearest post office is across a state border (Murray Downs has 3585, indicating the post office is in Victoria, but Murray Downs itself is in New South Wales), but then that causes further fun when you combine a post code covering several towns with one of those towns being across the border (4377 covers Maryland, NSW, Glen Niven, Qld and The Summit, Qld).

    That's just the human readable system. There's another, 12 digit (maybe) system that's used for machine sorting that employs an orange barcode, or the Rapid Addressing Tool System (called RATS) that prints a different barcode for the DPID; Delivery Point ID, a delivery point being, well, i'm not sure (the Wiki page is light on this) but I assume a unique address, meaning that the DPID barcodes cover every single mailbox (street, building and PO Box) in the country.

  • (disco) in reply to Arantor
    Arantor:
    Correct, a post code is specific enough to a single road - or sometimes even one side of a road, meaning that invariably one only needs the house name/number (or additionally an apartment number if the building is a block of flats or something) plus post code to get delivered.

    US Zip®+4 (9 digits total) is specific enough to get within a group of four apartments in my old apartment complex. However, if you are sending mail to Austria or Australia, don't be surprised if it takes a scenic vacation to the other country on its way, since USPS workers (and USians in general) are known being clueless about foreign geography.

  • (disco) in reply to Spencer
    Spencer:
    with the exception of Perth, which is 68**

    Uh, Perth cbd postcode is 6000. Each state has a unique initial digit with the territories using with 0 or whatever is convenient. Check wiki. 68** is for post boxes in WA only, not general delivery.

    General delivery post codes do generally increase as they get further away from the capital city: but it's not a given that n+1 is further than n. FTR Petrie is not a suburb of Brisbane but just outside.

  • (disco) in reply to HardwareGeek
    HardwareGeek:
    However, if you are sending mail to Austria or Australia, don't be surprised if it takes a scenic vacation to the other country on its way, since USPS workers

    So they just keep putting it on a boat or plane until they luck onto the correct one or someone else takes responsibility?

    "This package is going to Foreign, this vehicle is leaving the united states, put it on that!"

  • (disco) in reply to Zemm
    Zemm:
    Uh, Perth cbd postcode is 6000. Each state has a unique initial digit with the territories using with 0 or whatever is convenient. Check wiki. 68** is for post boxes in WA only, not general delivery.
    Whoops, I misread the table on the wiki page, that was under the GPO box heading (I thought Perth's CBD postcode being 68** was a little off). It was still unusual that other capital cities use *001 for GPO boxes, yet Perth uses 6837-6848. My (attempted) point was still that despite some attempted rulesguidelines, there are many exceptions/anomolies that break away from them.
    Zemm:
    FTR Petrie is not a suburb of Brisbane but just outside.
    The entire of the Morton Bay area is still considered part of Brisbane (though not part of the Brisbane City Council), rather than part of the Sunshine Coast. The boundary is somewhere near Burpengary or Deception Bay.

    Interesting trivia I just discovered, the state identifier in the post codes was adopted from what was used for radio call signs (I'm surprised I hadn't picked up on that sooner, though I had only known call signs in Queensland).

  • (disco) in reply to HardwareGeek
    HardwareGeek:
    However, if you are sending mail to Austria or Australia, don't be surprised if it takes a scenic vacation to the other country on its way, since USPS workers (and USians in general) are known being clueless about foreign geography.

    Pfft.. all foreign states can easily be classified into "liberated", "soon to be liberated" and "liberation unlikely--decapitation imminent".

  • (disco) in reply to morbiuswilters

    Wouldn't disagree.

    Apparently watching the video of the decapitation of that journalist is possibly illegal in the UK. But only possibly.

    http://www.theregister.co.uk/2014/08/20/met_police_reg_hack_is_not_a_terrorist_hes_not_even_a_naughty_boy/

  • (disco) in reply to Spencer
    Spencer:
    . It was still unusual that other capital cities use *001 for GPO boxes, yet Perth uses 6837-6848.

    I only recently imported the update postcode list into our system. AFAIR, 6001 is still for Perth GPO boxes but other postcodes for other PO boxes and high volume receivers. Queensland has 9*** postcodes for this. For example I used to work on the Gold Coast and we had a PO box at the mail centre: postcode 9726: normal postcode for the office was 4217 which was less than 1km away.

    Spencer:
    My (attempted) point was still that despite some attempted rulesguidelines, there are many exceptions/anomolies that break away from them.

    Mostly for the convenience of Australia Post. Like phone numbers: Tweed uses 07 numbers despite being in NSW.

    Spencer:
    The entire of the Morton Bay area is still considered part of Brisbane (though not part of the Brisbane City Council), rather than part of the Sunshine Coast.

    I live in "Logan" but it could be "Brisbane" or "Gold Coast" depending who you talk to. I have a 42** postcode rather than a 41** that the northern half of Logan has because the mail centre is over the border in Yatala.

    Spencer:
    Interesting trivia I just discovered, the state identifier in the post codes was adopted from what was used for radio call signs (I'm surprised I hadn't picked up on that sooner, though I had only known call signs in Queensland).

    And Australian radio stations officially begin with VL, so Brisbane's ABC radio station should really be VL4QR. But it was dropped because it is redundant.

  • (disco) in reply to Arantor
    Arantor:
    Apparently watching the video of the decapitation of that journalist is possibly illegal in the UK. But only possibly.

    Saw that. Couldn't detect any reasonable law mentioned that could be broken by either (1) being in possession of said video or (2) viewing it.

    http://www.independent.co.uk/news/uk/home-news/james-foley-beheading-met-police-warn-public-watching-murder-video-could-be-criminal-offence-9681316.html

    Scotland Yard has warned people in the UK that watching, downloading or disseminating the video purporting to show the beheading of American journalist James Foley could be treated as a criminal offence.

    The Metropolitan police said on Wednesday that it is investigating the contents of the video under its counter terrorism command, indicating that its public use or its being shared online could be seen as a criminal offence under the UK’s terrorism legislation, the Guardian reported.

    I'd like to see that stand up in court, given the actual content of the video.

    Text only but probably NSFL: [spoiler]Not that, it was particularly gory. (1) Desert shot with James on knees in orange jumpsuit with hands tied behind back, Black clothed and hooded bloke standing next to him blathering on. This is the majority of the video - or the version I watched (2) Bloke makes to start cutting throat by pulling James' head back. Never actually see the act. Cut scene to (3) body chest-down on ground with decapitated head resting on the back of the body.

    Given the length of the video I saw, I don't think there's been much put out between (2) and (3)

    To be honest I've seen worse in horror flicks.

    Nick Berg's was worse.[/spoiler]

  • (disco) in reply to PJH

    I found the video on liveleak. Instantly regretted watching it. I'm glad they didn't show the gory stuff. Very considerate of ISIS (I know, I know, whoever released the video probably censored it)...

    Hey, don't you guys in UK have a bunch of crazy laws where sites are blocked left and right and you basically have to register yourself with the police if you want to watch porn on the internet? Seems like laws like that are pretty much around the corner...

  • (disco) in reply to cartman82
    cartman82:
    Hey, don't you guys in UK have a bunch of crazy laws where sites are blocked left and right and you basically have to register yourself with the police if you want to watch porn on the internet?

    Slightly over-egging the pudding, but there was talk of having a 'by default, for everyone regardless of whether you have children' porn-filter in place and you would have to go begging to your ISP to allow you to unsubscribe from their filter to allow you to view porn (and by the power of slipper slope, anything the government of the day deemed 'inappropriate.')

    Arguments left, right and center about how this was an opt-out/opt-in about the whole thing.

    Nowt's been put in place, by law anyway, yet.

  • v (unregistered)

    what ordered lists? all i see is arrays.

Leave a comment on “Misguided Optimization”

Log In or post as a guest

Replying to comment #:

« Return to Article