Just a Taste

by in Error'd on

I'm fresh out of snark this week, so I'm relying on the rest of you to carry the load for me. Tote that barge, etc.

First up is a timely comment from an anonymous reader: "Even Kronos admits their software is a pain."


Time for Oracle

by in CodeSOD on

Many a time, we've seen a program reach out into the database for date times. It's annoying to see, but not entirely stupid- if you can't rely on your web servers having synchronized clocks, the centralized database may very well be the only place you can get a reliable date/time value from. This ends up meaning you get a lot of date formatting happening in the database, but again- if it's the only reliable clock, you can't do better.

Unless you aren't even looking at a clock. Mendel sends us this C#:


Maximizing Code Quality

by in CodeSOD on

One of the nice things about Git is that it makes it very easy for us to learn the steps that went into a WTF. It doesn't mean it explains the WTF, as many are just inexplicable, but it's at least something.

Like this example, from Aoife.


I saw the Vorzeichen

by in CodeSOD on

Chilly inherited a VB .Net application which generates an "IDoc" file which is used to share data with SAP. That's TRWTF, but the code has some fun moments:

If ldCashOut < 0 Then 'CashOut
    loE2WPB06002.vorzeichen = " "
Else
    loE2WPB06002.vorzeichen = " "
End If
If liTRANSTYPE = 2 Then 'Refund is always Positive
    loE2WPB06002.vorzeichen = "+"
End If

loE2WPB06002.summe = Math.Abs(ldCashOut).ToString     'CashOut  
loE2WPB06002.zahlart = "PTCS"                           'CashOut
loE2WPB06002.vorzeichen = "-"                           'CashOut

A Type of Alias

by in CodeSOD on

Joe inherited some C code that left him scratching his head.

It doesn't start too badly:


Beer and Peanuts

by in Error'd on

We got a lot of good submissions this week, including some examples of test-in-prod we're saving for a special edition. Not too many of the usual NaN/Null/Undefined sort, but we did also get a small rash of time failures.

But frist, Henk highlights the curious case of QNAP's email subscription management page (which appears to be outsourced). "QNAP surely does not want to lose me!" he hoped.


Structure is Structure

by in Feature Articles on

Back in the heady days of the DotCom Bubble, startups were thick on the ground, and Venture Capital money was a flood- lifting startups atop a tsunami only to crash them back into the ground a short time later. Taliesyn once worked for one such startup.

Taliesyn's manager, Irving, was an expert in AI. In the age of the DotCom Bubble, this meant Irving knew LISP. Knowing LISP was valuable here, because their core product was a database system built on LISP- specifically the Common LISP Object System, an object-oriented bolt-on for LISP.


A Serial Offender

by in CodeSOD on

Michael has a confession. Once upon a time, a very long time ago, he needed to write some JavaScript to serialize data and send it as part of a request. The challenge for Michael is that he didn't actually know JavaScript or what its built in functions could do and the task was already past the deadline by the time it got assigned to him.

function objectPrepareSave()
{
    for(var _a = 0; _a < aEditfields.length; _a++)
    {
        try
        {
            tinyMCE.execCommand('mceRemoveControl', false, aEditfields[_a]);
        }
        catch(err)
        {
        }
    }

    /* Basic Data */
    var _out = "DATA:{";
    _out += 'online="'+escape(getElementById("objOnline").checked)+'"';
    _out += ';;ref="'+escape(getElementById("objRefnum").value)+'"';
    _out += ';;name="'+escape(getElementById("objName").value)+'"';
    //_out += ';;parent="'+escape(getElementById("objParent").value)+'"';
    //_out += ';;rubric1="'+escape(getElementById("objRubric1").value)+'"';
    //_out += ';;rubric2="'+escape(getElementById("objRubric2").value)+'"';
    //_out += ';;rubric3="'+escape(getElementById("objRubric3").value)+'"';
    _out += ';;category="'+escape(getElementById("objCat").value)+'"';
    _out += ';;stars="'+escape(getElementById("objStars").value)+'"';
    //_out += ';;isle="'+escape(getElementById("objIsle").value)+'"';
    _out += ';;municipio="'+escape(getElementById("objMuni").value)+'"';
    _out += ';;city="'+escape(getElementById("objCity").value)+'"';
    //_out += ';;desc="'+escape(getElementById("objDesc").value)+'"';
    _out += ';;sDesc="'+escape(getElementById("objSDesc").value)+'"';
    //_out += ';;extra="'+escape(getElementById("objXtra").value)+'"';
    _out += ';;addition="'+escape(getElementById("objAdd").value)+'"';
    _out += ';;gifs="'+escape(getElementById("objPicList").innerHTML)+'"';
    _out += '}';
   
    /* Detail Data */
    _out += "::DETAILS:{";
    _out += 'null="null"';
   
    var _tbl = getElementById("detailTable");
    for(var _i = 1; _i < (_tbl.rows.length-1); _i++)
    {  
        var _row = _tbl.rows[_i];
        _out += ';;' + (_i - 1) + '="' + escape(_row.cells[1].textContent + ';' + _row.cells[2].lastChild.value) + '"';
    }
   
    _out += '}';
   
    /* Price Data */
   
    _out += '::PRICE:{';
    _out += 'null="null"';
   
    _tbl = getElementById("priceTable");
    for(var _i = 0; _i < _tbl.rows.length; _i++)
    {
        var _row = _tbl.rows[_i];
        if(_row.cells.length == 1)
        {
            _out += ';;' + _i + '="' + escape(_row.cells[0].textContent) + '"';
        }
        else
        {
            _out += ';;' + _i + '="';
            var _o = "";
           
            for(var _h = 0; _h < _row.cells.length; _h++)
            {
                _o += _row.cells[_h].textContent + ';';
            }
            _o = substr(_o, 0, strlen(_o) - 1);
            _out += escape(_o) + '"';
        }
    }
   
    _out += '}';
   
    _out += '::TPL:{';
    _out += 'null="null"';
   
    _tbl = getElementById("tplTable");
    var _index = 0;
    for(var _i = 0; _i < _tbl.rows.length; _i++)
    {
        var _row =_tbl.rows[_i];
        if(_row.cells.length == 1)
        {
            _out += ';;' + _index + '_' + _row.id + '="';
        }
        else
        {
            var _o = '<'+escape(_row.cells[0].textContent)+'>=<';
            if(_row.cells[1].childNodes[0].tagName)
            {
                if(_row.cells[1].childNodes[0].tagName == "INPUT" || _row.cells[1].childNodes[0].tagName == "TEXTAREA")
                {
                    _o += escape(_row.cells[1].childNodes[0].value);
                }
            }
            else
            {
                _o += escape(_row.cells[1].childNodes[0].nodeValue);
            }
           
            _o += '>';
            _out += escape(escape(_o));
        }
        _index++;
    }
   
    _out += '"}';
   
    aEditfields = new Array();
   
    return _out;
}

Archives