Most unusable technology award (my nomination - regular expressions)
-
I have to say, my tendency would be to have a list of the known postal codes and put that into an array. Then use a string compare to just look for matches to all known postal codes first. Then after that start doing evals to look for things that fit the known formats but aren't on the known list, if possible, presuming each entry is a separate line or item in an array, only putting the lines or items that haven't already matched into a separate array and checking those. Not sure if my solution is more or less complicated. It's probably colored by my experience as a LAMP dev though.
CaptJosh There are only 10 kinds of people in the world; those who understand binary and those who don't.
Use a trie instead of a list. The complete list of postal codes is long, you know. Or at least have it ordered, and employ a somewhat optimized search algorithm.
-
Use a trie instead of a list. The complete list of postal codes is long, you know. Or at least have it ordered, and employ a somewhat optimized search algorithm.
-
Yes, I've considered that too - and most of the XML-related stuff. But at least you have the option to make it halfway readable. It can be a real pain though if you have to delve in to other people's code and the original programmer took no care of naming conventions and formatting...
I second that, XML looks like it was designed by a committee. Schema ( huh why use latin words, why not use english words like plan or design or layout) DTD, XSD, XPath oh my god what a mess. Some guy from the Vatican whose first language was Latin must have gone beserk when designing XML.
-
I second that, XML looks like it was designed by a committee. Schema ( huh why use latin words, why not use english words like plan or design or layout) DTD, XSD, XPath oh my god what a mess. Some guy from the Vatican whose first language was Latin must have gone beserk when designing XML.
Schema, yes I like that. When I think about it, the whole system of *ML languages looks like a database schema. And maybe that's all it really is: a glorified text-based database schema, only that instead of a computer, the programmers are supposed to work their way through it. Me, I prefer SQL.
-
Every now and then I need to solve a problem for which regular expressions looks like it is the "perfect" answer. Today that happens to be validating and extracting UK postal codes from addresses. BUT Every time I try to use regular expressions I find that no-one (especially me) has a clue how to use them and that all "posted" solutions can be demonstrated as flawed and therefore dangerous to use. The sheer complexity of the expressions makes them virtually impossible to read and therefore understand. I post the wikipedia solution to demonstrate my case (GIR 0AA)|(((A[BL]|B[ABDHLNRSTX]?|C[ABFHMORTVW]|D[ADEGHLNTY]|E[HNX]?|F[KY]|G[LUY]?|H[ADGPRSUX]|I[GMPV]|JE|K [ATWY]|L[ADELNSU]?|M[EKL]?|N[EGNPRW]?|O[LX]|P[AEHLOR]|R[GHM]|S[AEGKLMNOPRSTY]?|T[ADFNQRSW]|UB|W[ADFNRSV] |YO|ZE)[1-9]?[0-9]|((E|N|NW|SE|SW|W)1|EC[1-4]|WC[12])[A-HJKMNPR-Y]|(SW|W)([2-9]|[1-9][0-9])|EC[1-9] [0-9]) [0-9][ABD-HJLNP-UW-Z]{2}) Can anyone think of a less usable technology?
www.it-workplace.com
"If a man speaks in a forest where there is no woman to hear him, is he still wrong?"I feel very lucky to only have 7 digits as postal codes.