By The Clicking On My Thumbs

by in Error'd on

Music fan Erina leads off this week with a double contraction! "Who knew Tom Waits was such a gravelly-voiced Relational Database poet?" she Mused. "You'd've thought that SQL modes was more of an indy garage esthetic." You might've, Erina, but I wouldn't've.

waits


Where You At?

by in CodeSOD on

Validating email addresses according to the actual email specification is more complicated than you usually think. Most homebrew validation tends to just get something that's relatively close, because hitting all the rules requires some fancy regex work. And honestly, for most applications, "pretty close to correct" is probably fine. If you actually care about collecting valid email addresses, you'll need to actually send mail to the address and have the user confirm receipt to "prove" that the email address is real, valid, and actually accessible.

Still, some "close enough" solutions are better than others. Jon found this C# code:


Validate Freely

by in CodeSOD on

Validation highlights the evolution of a programmer as they gain experience. A novice programmer, when given a validation problem, will tend to treat the string like an array or use substrings and attempt to verify that the input is the correct format. A more experienced programmer is going to break out the regexes. A very experienced programmer is going to just find a library or built-in method that does it, because there are better ways to use your time.

Andrea provides a rare example of a developer on the cusp between regexes and built-in methods.


Putting the File Out

by in CodeSOD on

There's a lot of room for disagreement in technology, but there's one universal, unchangeable truth: Oracle is the worst. But a second truth is that there's nothing so bad a programmer can't make it worse.

Someone at Ben's company needed to take data from a database and write it to a file. That file needed to have some specific formatting. So they used the best possible tool for the job: a PL/SQL stored procedure.


The Hash Array

by in CodeSOD on

When Arbuzo joined a new team, they helpfully provided him some sample code to show him how to interact with their JSON API. It was all pretty standard-looking stuff. If, for example, they fetched a Customer object, it would have some fields about the customer, and an array containing links to orders that customer had made. One of the samples helpfully showed iterating across the orders array:

let i = 1; while(cust.orders[i]) { //do stuff with cust.orders[i] i++; }

Innocents Abroad

by in Error'd on

This week's opening Error'd submission required a bit of translation for the monoglots among us, but it was worth the work. Not speaking even een beetje of Dutch, I was forced to use Google's own translation service to see what it was that had so worried our friend Sebas. And it's a doozy.

"...seek help - Child abuse images are illegal" warns Google's AI, inferring lewd Low Countries Linux links. For his part, Sebas takes it in stride, "Just hoping I'm not flagged now." I'm afraid to ask what the Goog makes of tcl.

google


Just a Few Questions

by in CodeSOD on

Pete has had some terrible luck with the lead programmers he's worked with. He's had a few which are… well, they don't take feedback well. Like his current team lead, who absolutely doesn't let any of the other developers review or comment on his code. "Don't ask me questions, you should know this already," is a common refrain. Speaking of questions:

String q1 = form.getQ1()!=null?request.getParameter("question_" + form.getQ1().getId()):null; String q2 = form.getQ2()!=null?request.getParameter("question_" + form.getQ2().getId()):null; String q3 = form.getQ3()!=null?request.getParameter("question_" + form.getQ3().getId()):null; String q4 = form.getQ4()!=null?request.getParameter("question_" + form.getQ4().getId()):null; String q5 = form.getQ5()!=null?request.getParameter("question_" + form.getQ5().getId()):null; String q6 = form.getQ6()!=null?request.getParameter("question_" + form.getQ6().getId()):null; String q7 = form.getQ7()!=null?request.getParameter("question_" + form.getQ7().getId()):null; String q8 = form.getQ8()!=null?request.getParameter("question_" + form.getQ8().getId()):null; String q9 = form.getQ9()!=null?request.getParameter("question_" + form.getQ9().getId()):null; String q10 = form.getQ10()!=null?request.getParameter("question_" + form.getQ10().getId()):null; String q11 = form.getQ11()!=null?request.getParameter("question_" + form.getQ11().getId()):null; String q12 = form.getQ12()!=null?request.getParameter("question_" + form.getQ12().getId()):null; String q13 = form.getQ13()!=null?request.getParameter("question_" + form.getQ13().getId()):null; String q14 = form.getQ14()!=null?request.getParameter("question_" + form.getQ14().getId()):null; String q15 = form.getQ15()!=null?request.getParameter("question_" + form.getQ15().getId()):null;

A Parser Par Excellence

by in CodeSOD on

Jan's company has an application which needs to handle an Excel spreadsheet, because as I'm fond of pointing out, users love spreadsheets.

The JavaScript code which handles parsing the spreadsheet contains… some choices. These choices caused it to fail on any spreadsheet with more than twenty six columns, and it's not hard to see why.


Archives