thedailywtf.com Open in urlscan Pro
2606:4700:3035::6815:2cc7  Public Scan

Submitted URL: http://worsethanfailure.com/
Effective URL: https://thedailywtf.com/
Submission Tags: tranco_l324
Submission: On May 06 via api from DE — Scanned from DE

Form analysis 0 forms found in the DOM

Text Content

 * Feature Articles
   * Most Recent Articles
   * Two Pizzas for ME
   * Taking Up Space
   * Check Your Email
   * A Stalled Upgrade
   * A Bit About the HP3000
   * A Laboratory Upgrade
   * A Continental Divide
   * Contracting: Enterprise Edition
 * CodeSOD
   * Most Recent Articles
   * Spaced Out Replacement
   * Totally Valid
   * Metaception
   * Finding the Right Size
   * Article tF7q2
   * Unaccountable Counting
   * Query Query Query
   * An Obsolete Approach
 * Error'd
   * Most Recent Articles
   * Testing 1,2,3,4,5
   * Enterprising Michael
   * Believe It Or Not
   * Paycheque
   * Past Imperfect
   * Good Enough Friday
   * You Can Say That Again!
   * Can't Be Beat
 * Forums
 * Other Articles
   * Random Article
   * Other Series
   * Alex's Soapbox
   * Announcements
   * Best of…
   * Best of Email
   * Best of the Sidebar
   * Bring Your Own Code
   * Coded Smorgasbord
   * Mandatory Fun Day
   * Off Topic
   * Representative Line
   * News Roundup
   * Editor's Soapbox
   * Software on the Rocks
   * Souvenir Potpourri
   * Sponsor Post
   * Tales from the Interview
   * The Daily WTF: Live
   * Virtudyne

 * feature articles
 * codesod
 * error'd
 * forums
 * other articles
 * random article


WTF is the Daily WTF

Founded in 2004 by Alex Papadimoulis, The Daily WTF is your how-not-to guide for
developing software. We recount tales of disastrous development, from project
management gone spectacularly bad to inexplicable coding choices.

Remy Porter is the editor-in-chief and needs to read your story or see your bad
code.

Submit Your WTF

Contents

Random Article

--------------------------------------------------------------------------------

Classic Articles

 * The Brillant Paula Bean
 * What Is Truth?
 * Web 0.1
 * get_words_from_a_number_which_is_passed_as_a_perimeter_into_this_function
 * Special Delivery
 * Radio WTF: Make It Work
 * ITAPPMONROBOT
 * The Call of Codethulhu
 * The Big Red Button
 * Happy Merge Day!
 * The Indexer
 * The Speed-up Loop
 * No, We Need a Neural Network
 * Poke a Dot
 * We Use BobX
 * Add your favorite...

--------------------------------------------------------------------------------

Article Archives


Sidebar WTF
 * Hacking News
 * Azure bites
 * Unit of Measurement WTF
 * Aviation Antipatterns Thread
 * I, ChatGPT

Sponsors

These fine folks make it possible to run The Daily WTF.




SPACED OUT REPLACEMENT

by Remy Porter in CodeSOD on 2024-05-06

You have some text, and need to replace every sequence of spaces with a single
space. E.g., My text becomes My text. Now, if you're most of us, you ignore the
famous quote and reach straight for regexes.

But Samuel's co-worker isn't most of us.

--------------------------------------------------------------------------------

2 comments - Last comment @ 06:42


TESTING 1,2,3,4,5

by Lyle Seaman in Error'd on 2024-05-03

An anonymous friend sent us our frist test in prod for this week. And then there
will be more, and more, and more. "This came up in Kaspersky's Blog's RSS. If
you're lucky they might still have the error up in the original URL." I don't
know if "chron" is just how "cron" translates to Russian and back, but the test
appears to have succeeded.

> 

--------------------------------------------------------------------------------

11 comments - Last comment @ 07:06


TOTALLY VALID

by Remy Porter in CodeSOD on 2024-05-02

Greg's co-worker really wanted to make sure that a variable was correctly set to
true or false. So they did this:

if (isValid == true)
{
	isValid = true;
}
else
{
	isValid = false;
}


--------------------------------------------------------------------------------

26 comments - Last comment @ 02:14


METACEPTION

by Remy Porter in CodeSOD on 2024-05-01

Meta-programming- programs which generate programs- is a delightful hobby, but
usually shouldn't be used in production code. Usually. I mean, if you're working
in LISP, 90% of your program is going to be macros.

But if you're using PHP and JavaScript, there's good odds that someone you work
with has decided to combine these two tastes together to create something nobody
wants to taste.

--------------------------------------------------------------------------------

25 comments - Last comment @ 2024-05-03


FINDING THE RIGHT SIZE

by Remy Porter in CodeSOD on 2024-04-30

Zeke sends us a C# snippet from an extract-transform-load process his company
uses. It's… special.

private void ResizeColumn(string table, string column, int minSize)
{
    if(null == _connection) return;

    string sqlReadSize = "SELECT DATA_LENGTH,DATA_TYPE,DATA_PRECISION,DATA_SCALE FROM USER_TAB_COLS WHERE TABLE_NAME = '" + table.ToUpper() + "' AND COLUMN_NAME = '" + column.ToUpper() + "'";
    string data_length = "";
    string data_type = "";
    string data_precision = "";
    string data_scale = "";
    string sizeInfo = minSize.ToString();
    
    IDataReader r = null;

    try
    {
        r = _connection.DbAccessor.ExecuteSqlText.ExecuteReader(sqlReadSize);
        if(null != r && r.Read())
        {
            if(!r.IsDBNull(0)) data_length = Convert.ToString(r[0]);
            if(!r.IsDBNull(1)) data_type = Convert.ToString(r[1]);
            if(!r.IsDBNull(2)) data_precision = Convert.ToString(r[2]);
            if(!r.IsDBNull(3)) data_scale = Convert.ToString(r[3]);

            r.Close();
            r = null;

        }
    }
    catch(Exception ex)
    {
        System.Diagnostics.Debug.WriteLine(ex.Message);
        return;
    }
    finally
    {
        if(null != r)
        {
            r.Close();
            r = null;
        }
    }
    if(data_type == "NUMBER")
    {
        return;
    }

    if(data_type == "DATE")
    {
        return;
    }

    if(data_type == "CLOB")
    {
        return;
    }

    if(data_type == "BLOB")
    {
        return;
    }
    
    if(minSize <= Convert.ToInt32(data_length))
    {
        return;
    }

    string sqlAlterSize = "ALTER TABLE " + table + " modify " 
        + column.ToUpper() + " " + data_type + "(" + sizeInfo + ")";


    try
    {
        _connection.DbAccessor.ExecuteSqlText.ExecuteScalar(sqlAlterSize);
    }
    catch(Exception ex)
    {
        System.Diagnostics.Debug.WriteLine(ex.Message);
        return;
    }
}


--------------------------------------------------------------------------------

24 comments - Last comment @ 01:43


ARTICLE TF7Q2

by Remy Porter in CodeSOD on 2024-04-29

When I first saw Nick L's submission, I thought to myself, "This is just
decompiled code, so of course the names are bad."

 Public Function tF7q2() As String
     Dim SelectedtF7q2 As String = Request.QueryString("tF7q2")
     tF7q2 = SelectedtF7q2
 End Function


--------------------------------------------------------------------------------

16 comments - Last comment @ 2024-05-03


ENTERPRISING MICHAEL

by Lyle Seaman in Error'd on 2024-04-26

Faithful Michael R. is good for a chuckle today. "I am using the free tier
Infura right now but think I will go enterprisey straight away." Can't turn down
a deal like that, eh?

> 

--------------------------------------------------------------------------------

12 comments - Last comment @ 2024-04-28


UNACCOUNTABLE COUNTING

by Remy Porter in CodeSOD on 2024-04-25

Ulvhamne sends us some bad code that, well, I think at this point we should
really coin a name for this particular anti-pattern.

    @Override
    public int getNumOfItemsInDataContainer(int parDataId)
    {
        int numberOfItems = 0;
        for (Integer x : myTransactionDataContainerMap.keySet())
        {
                numberOfItems ++;
        }
        return numberOfItems;
    }


--------------------------------------------------------------------------------

25 comments - Last comment @ 2024-04-28

Archives

Contact Privacy Policy RSS

--------------------------------------------------------------------------------

Copyright © 2024 Inedo Publishing - v2023.2

Monitored by Panopta • Deployed with BuildMaster