<?xml version="1.0" encoding="utf-8" standalone="no"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" version="2.0"><channel><title>The Daily WTF</title><link>http://thedailywtf.com/</link><description>Curious Perversions in Information Technology</description><lastBuildDate>Mon, 08 Jun 2026 18:57:26 GMT</lastBuildDate><item><dc:creator>Remy Porter</dc:creator><title>CodeSOD: Check and Check</title><link>https://thedailywtf.com/articles/check-and-check</link><category>CodeSOD</category><pubDate>Mon, 08 Jun 2026 06:30:00 GMT</pubDate><guid>https://thedailywtf.com/articles/check-and-check</guid><description>&lt;p&gt;Today&amp;#39;s anonymous submitter sends us a React view that presents some admin options. Of course, it should only show us those admin options if the user is authorized to do that. So let&amp;#39;s see how they implemented it:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-javascript"&gt;{(isAdmin || canSeeResults) &amp;amp;&amp;amp; (
    &lt;span class="language-xml"&gt;&lt;span class="hljs-tag"&gt;&amp;lt;&lt;span class="hljs-name"&gt;div&lt;/span&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="hljs-tag"&gt;&amp;lt;&lt;span class="hljs-name"&gt;p&lt;/span&gt;&amp;gt;&lt;/span&gt;Admin Actions&lt;span class="hljs-tag"&gt;&amp;lt;/&lt;span class="hljs-name"&gt;p&lt;/span&gt;&amp;gt;&lt;/span&gt;
            {(isAdmin || canSeeResults) &amp;amp;&amp;amp; (
                &lt;span class="hljs-tag"&gt;&amp;lt;&lt;span class="hljs-name"&gt;div&lt;/span&gt;&amp;gt;&lt;/span&gt;
                    &lt;span class="hljs-tag"&gt;&amp;lt;&lt;span class="hljs-name"&gt;button&lt;/span&gt;&amp;gt;&lt;/span&gt; Show Results &lt;span class="hljs-tag"&gt;&amp;lt;/&lt;span class="hljs-name"&gt;button&lt;/span&gt;&amp;gt;&lt;/span&gt;
                &lt;span class="hljs-tag"&gt;&amp;lt;/&lt;span class="hljs-name"&gt;div&lt;/span&gt;&amp;gt;&lt;/span&gt;
            )}
    &lt;span class="hljs-tag"&gt;&amp;lt;/&lt;span class="hljs-name"&gt;div&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
)}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If they&amp;#39;re an admin or can see the results, we print out an &lt;code&gt;Admin Actions&lt;/code&gt; header, and then if they&amp;#39;re an admin or can see the results, we show them a &lt;code&gt;Show Results&lt;/code&gt; button.&lt;/p&gt;
&lt;p&gt;I once had a math teacher who claimed he didn&amp;#39;t trust anyone, and that&amp;#39;s why he always wore suspenders and a belt. I don&amp;#39;t think he&amp;#39;s still alive, let alone writing React code, but I see a &amp;#34;belts and braces&amp;#34; approach in play. Though in this case, I don&amp;#39;t think it adds any safety.&lt;/p&gt;
&lt;!-- Easy Reader Version: people complain about "Americanisms" so I used both the American "suspenders" and the more British "braces", as a sort of "belts and braces" approach to language. --&gt;&lt;div&gt;
	[Advertisement] &lt;b&gt;Plan Your .NET 9 Migration with Confidence&lt;/b&gt;&lt;br/&gt;Your journey to .NET 9 is more than just one decision.Avoid migration migraines with the advice in this free guide. &lt;b&gt;&lt;a href="https://inedo.com/support/whitepapers/dotnet-guide?utm_campaign=dotnet&amp;amp;utm_source=tdwtf-footer"&gt;Download Free Guide Now!&lt;/a&gt;&lt;/b&gt;
&lt;/div&gt;
&lt;div style="clear: left;"&gt; &lt;/div&gt;</description><slash:comments>9</slash:comments><wfw:comment>https://thedailywtf.com/articles/comments/check-and-check</wfw:comment></item><item><dc:creator>Lyle Seaman</dc:creator><title>Error'd: Bridge for Sale</title><link>https://thedailywtf.com/articles/bridge-for-sale</link><category>Error'd</category><pubDate>Fri, 05 Jun 2026 06:30:00 GMT</pubDate><guid>https://thedailywtf.com/articles/bridge-for-sale</guid><description>&lt;p&gt;&amp;#34;Scammer offers to buy Google&amp;#34; is certainly a new twist on a very old New York con.
&lt;strong&gt;Jan B.&lt;/strong&gt; explains
&amp;#34;Scammers have found a new way to steal money, scrap
LinkedIn profiles and then send out emails with fake offers
to buy people&amp;#39;s companies. I&amp;#39;m guessing suddenly they need some
fees paid just before the deal is finalised. However, they
may need to improve their filtering before sending out their
scams, I don&amp;#39;t even own Google!&amp;#34; I&amp;#39;m putting together a group of people
to buy it, do you want to get in the deal? I&amp;#39;ll just need you to transfer
two million to this SWIFT account...  
&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;&lt;a href="#5ecf5d704e7742b38d3467e98c8cc631"&gt;&lt;img itemprop="image" border="0" alt="5ecf5d704e7742b38d3467e98c8cc631" src="https://d3hvi6t161kfmf.cloudfront.net/images/2026/06/04/5ecf5d704e7742b38d3467e98c8cc631.png"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;/blockquote&gt;


&lt;p&gt;&amp;#34;But when?&amp;#34; queries
&lt;strong&gt;Hercules&lt;/strong&gt;
&amp;#34;I&amp;#39;ve always had difficulty understanding phone billing and payment cycles.
My phone company seems intent on making that harder...&amp;#34;  Strong, heroically good-looking... Bright?The gods don&amp;#39;t require it.
&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;&lt;a href="#bffc573e6abf42c694a6e8194f66f9a9"&gt;&lt;img itemprop="image" border="0" alt="bffc573e6abf42c694a6e8194f66f9a9" src="https://d3hvi6t161kfmf.cloudfront.net/images/2026/06/04/bffc573e6abf42c694a6e8194f66f9a9.png"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;/blockquote&gt;


&lt;p&gt;&amp;#34;Next update: 25 years 11 months ago&amp;#34; is some kind of reverse Y2K bug. 
&lt;strong&gt;Laurent&lt;/strong&gt; boggles
&amp;#34;It&amp;#39;s bad enough to have a power outage, but to
have to go back in time to get an update?&amp;#34;
&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;&lt;a href="#f700091cccad4fc4b0764fad047f3149"&gt;&lt;img itemprop="image" border="0" alt="f700091cccad4fc4b0764fad047f3149" src="https://d3hvi6t161kfmf.cloudfront.net/images/2026/06/04/f700091cccad4fc4b0764fad047f3149.jpeg"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;/blockquote&gt;


&lt;p&gt;&amp;#34;What is 30% of NaN?&amp;#34; asks 
&lt;strong&gt;Geoff O.&lt;/strong&gt; rhetorically.  However, the answer is well-defined and explicit.
&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;&lt;a href="#099fa3a714f8449fbf59e345e72caa9c"&gt;&lt;img itemprop="image" border="0" alt="099fa3a714f8449fbf59e345e72caa9c" src="https://d3hvi6t161kfmf.cloudfront.net/images/2026/06/04/099fa3a714f8449fbf59e345e72caa9c.png"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;/blockquote&gt;


&lt;p&gt;And finally, another &amp;#34;lost in translation&amp;#34; error from 
&lt;strong&gt;Martin K.&lt;/strong&gt;: 
&amp;#34;Not only have the store not changed the generic cookie
bar text, they apparently don&amp;#39;t have a fall back to
e.g. english, if the browser language isn&amp;#39;t found.&amp;#34;
&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;&lt;a href="#354cdc680a3e425f9ea752ae57c1da73"&gt;&lt;img itemprop="image" border="0" alt="354cdc680a3e425f9ea752ae57c1da73" src="https://d3hvi6t161kfmf.cloudfront.net/images/2026/06/04/354cdc680a3e425f9ea752ae57c1da73.png"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;/blockquote&gt;


&lt;div&gt;
	&lt;img src="https://thedailywtf.com/images/inedo/buildmaster-icon.png" style="display:block; float: left; margin: 0 10px 10px 0;"/&gt; [Advertisement] 
	&lt;a href="https://inedo.com/BuildMaster?utm_source=tdwtf&amp;amp;utm_medium=footerad&amp;amp;utm_term=2018&amp;amp;utm_content=Self_Service&amp;amp;utm_campaign=Buildmaster_Footer"&gt;BuildMaster&lt;/a&gt; allows you to create a self-service release management platform that allows different teams to manage their applications. &lt;a href="https://inedo.com/BuildMaster/download?utm_source=tdwtf&amp;amp;utm_medium=footerad&amp;amp;utm_term=2018&amp;amp;utm_content=Self_Service&amp;amp;utm_campaign=Buildmaster_Footer"&gt;Explore how!&lt;/a&gt; 
&lt;/div&gt;
&lt;div style="clear: left;"&gt; &lt;/div&gt;
</description><slash:comments>12</slash:comments><wfw:comment>https://thedailywtf.com/articles/comments/bridge-for-sale</wfw:comment></item><item><dc:creator>Remy Porter</dc:creator><title>CodeSOD: Build Up</title><link>https://thedailywtf.com/articles/build-up</link><category>CodeSOD</category><pubDate>Thu, 04 Jun 2026 06:30:00 GMT</pubDate><guid>https://thedailywtf.com/articles/build-up</guid><description>&lt;p&gt;If there&amp;#39;s one thing that seems to be a constant source of issues, it&amp;#39;s people constructing SQL queries through string concatenation. Even if you&amp;#39;re using parameters in the query, I&amp;#39;m opposed to handling raw SQL as strings in my programs. My solution is always &amp;#34;use a builder&amp;#34;- an API that constructs a syntax tree that it can then &lt;em&gt;render&lt;/em&gt; to SQL as needed. (Yes, a builder, not an ORM, that&amp;#39;s a whole &lt;em&gt;other&lt;/em&gt; discussion, I&amp;#39;m not dogmatically &lt;em&gt;anti&lt;/em&gt;-ORM, but it&amp;#39;s a leaky abstraction at best.)&lt;/p&gt;
&lt;p&gt;Many languages have such a thing, Java included. &lt;strong&gt;Lukasz&lt;/strong&gt;&amp;#39;s team was using Java, and they had a rule: &amp;#34;don&amp;#39;t do SQL strings, use a builder&amp;#34;. Unfortunately for Lukasz&amp;#39;s team, their guideline didn&amp;#39;t specify what &lt;em&gt;kind&lt;/em&gt; of builder.&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-java"&gt;    &lt;span class="hljs-type"&gt;StringBuilder&lt;/span&gt; &lt;span class="hljs-variable"&gt;builder&lt;/span&gt; &lt;span class="hljs-operator"&gt;=&lt;/span&gt; &lt;span class="hljs-keyword"&gt;new&lt;/span&gt; &lt;span class="hljs-title class_"&gt;StringBuilder&lt;/span&gt;();

    builder.append(&lt;span class="hljs-string"&gt;&amp;#34;where ID_BSNGP = ? &amp;#34;&lt;/span&gt;);
    builder.append(&lt;span class="hljs-string"&gt;&amp;#34;and ID_ITM = ? &amp;#34;&lt;/span&gt;);
    builder.append(&lt;span class="hljs-string"&gt;&amp;#34;for update&amp;#34;&lt;/span&gt;);

    &lt;span class="hljs-type"&gt;SQLQuery&lt;/span&gt; &lt;span class="hljs-variable"&gt;query&lt;/span&gt; &lt;span class="hljs-operator"&gt;=&lt;/span&gt; &lt;span class="hljs-keyword"&gt;new&lt;/span&gt; &lt;span class="hljs-title class_"&gt;SQLQuery&lt;/span&gt;();

    query.setQueryString(builder.toString());
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;A &lt;code&gt;StringBuilder&lt;/code&gt; is &lt;em&gt;a kind&lt;/em&gt; of builder. Technically correct and all that. It&amp;#39;s just concatenation with extra steps, but it&amp;#39;s a builder. Of course, the bonus point here is that this built query is… just wrong? &lt;code&gt;SELECT FOR UPDATE field FROM table WHERE condition&lt;/code&gt; would make sense, but we&amp;#39;re missing most of that syntax here.&lt;/p&gt;
&lt;p&gt;That this code was running in production without anyone noticing means that whatever errors this was triggering were getting swallowed or ignored, &lt;em&gt;and&lt;/em&gt; the fact that no good output ever came from it ended up not mattering. The real WTF is less the malicious compliance and more the fact that this obviously broken code wasn&amp;#39;t so broken as to be &lt;em&gt;noticed&lt;/em&gt;.&lt;/p&gt;
&lt;!-- Easy Reader Version: easy_reader.description("This sums up the article").expansion("by highlighting the absurdity of it").conclusion("let's not ever write SQL directly").build() --&gt;&lt;div&gt;
	&lt;img src="https://thedailywtf.com/images/inedo/buildmaster-icon.png" style="display:block; float: left; margin: 0 10px 10px 0;"/&gt; [Advertisement] 
	&lt;a href="https://inedo.com/BuildMaster?utm_source=tdwtf&amp;amp;utm_medium=footerad&amp;amp;utm_term=2018&amp;amp;utm_content=Confidence&amp;amp;utm_campaign=Buildmaster_Footer"&gt;Utilize BuildMaster&lt;/a&gt; to release your software with confidence, at the pace your business demands. &lt;a href="https://inedo.com/BuildMaster/download?utm_source=tdwtf&amp;amp;utm_medium=footerad&amp;amp;utm_term=2018&amp;amp;utm_content=Confidence&amp;amp;utm_campaign=Buildmaster_Footer"&gt;Download&lt;/a&gt; today!  
&lt;/div&gt;
&lt;div style="clear: left;"&gt; &lt;/div&gt;
</description><slash:comments>16</slash:comments><wfw:comment>https://thedailywtf.com/articles/comments/build-up</wfw:comment></item><item><dc:creator>Remy Porter</dc:creator><title>CodeSOD: Coerce the Truth Out of You</title><link>https://thedailywtf.com/articles/coerce-the-truth-out-of-you</link><category>CodeSOD</category><pubDate>Wed, 03 Jun 2026 06:30:00 GMT</pubDate><guid>https://thedailywtf.com/articles/coerce-the-truth-out-of-you</guid><description>&lt;p&gt;&lt;strong&gt;Frank&lt;/strong&gt; suspected something odd when he spotted a use of React&amp;#39;s &lt;code&gt;useMemo&lt;/code&gt; function in some JavaScript code. Now, there&amp;#39;s nothing &lt;em&gt;wrong&lt;/em&gt; with using that method, in and of itself. It watches some variables and recalculates a callback if they change for any reason. It&amp;#39;s a great tool for when you want to avoid recalculating expensive things over and over again.&lt;/p&gt;
&lt;p&gt;But in this case, the calculation in question was &lt;code&gt;isAuthorized&lt;/code&gt;, which wasn&amp;#39;t an expensive calculation; it was just checking if certain values are set. The code looked like this:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-javascript"&gt;  &lt;span class="hljs-keyword"&gt;const&lt;/span&gt; isAuthorized = &lt;span class="hljs-title function_"&gt;useMemo&lt;/span&gt;(&lt;span class="hljs-function"&gt;() =&amp;gt;&lt;/span&gt; {
    &lt;span class="hljs-keyword"&gt;return&lt;/span&gt; (session &amp;amp;&amp;amp; token &amp;amp;&amp;amp; !group) === &lt;span class="hljs-literal"&gt;false&lt;/span&gt;;
  }, [session, token, group]);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;session&lt;/code&gt;, &lt;code&gt;token&lt;/code&gt; and &lt;code&gt;group&lt;/code&gt; are all either going to be null, or be an object. To be authorized, all three must be set to non-null values. A rational person, knowing this, might choose to &lt;code&gt;return session &amp;amp;&amp;amp; token &amp;amp;&amp;amp; group&lt;/code&gt;, and exploit JavaScript&amp;#39;s truthiness. Or, if you really wanted to coerce it to a boolean, you could &lt;code&gt;return !!(session &amp;amp;&amp;amp; token &amp;amp;&amp;amp; group)&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;So why on Earth are they negating &lt;code&gt;group&lt;/code&gt;? How would this even work? If the check is &amp;#34;all three must be set&amp;#34; what is this doing?&lt;/p&gt;
&lt;p&gt;Well, if you do &lt;code&gt;a &amp;amp;&amp;amp; b &amp;amp;&amp;amp; c&lt;/code&gt;, JavaScript will return the last value you looked at. The &lt;code&gt;&amp;amp;&amp;amp;&lt;/code&gt; operator short circuits, so that means it either returns the first falsy value you encounter, &lt;em&gt;or&lt;/em&gt; the very last value in the chain.&lt;/p&gt;
&lt;p&gt;So in this scenario: &lt;code&gt;(session &amp;amp;&amp;amp; token &amp;amp;&amp;amp; !group)&lt;/code&gt;, if &lt;code&gt;session&lt;/code&gt; or &lt;code&gt;token&lt;/code&gt; is &lt;code&gt;null&lt;/code&gt;, the expression evaluates to &lt;code&gt;null&lt;/code&gt;. Otherwise, if &lt;code&gt;group&lt;/code&gt; is &lt;code&gt;null&lt;/code&gt;, then &lt;code&gt;!group&lt;/code&gt; will evaluate to &lt;code&gt;true&lt;/code&gt;. Because they use the &lt;code&gt;===&lt;/code&gt; operator, JavaScript won&amp;#39;t do any type coercion, and that means &lt;code&gt;null === false&lt;/code&gt; is false, as is &lt;code&gt;true === false&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;I can&amp;#39;t believe that this code works as &lt;em&gt;intended&lt;/em&gt;. I mean, it works, it gives the correct output, but I think that&amp;#39;s an accident. Happenstance of someone with no clue gradually throwing operators into an expression until it does what they want. Perhaps it&amp;#39;s LLM generated code- who can even guess anymore? It certainly seems like it was generated through a stochastic process; whether that&amp;#39;s a bumbling developer or a bunch of math, there&amp;#39;s definitely no &lt;em&gt;intelligence&lt;/em&gt; involved, artificial or otherwise.&lt;/p&gt;
&lt;!-- Easy Reader Version: (easy &amp;&amp; reader &amp;&amp; !false) --&gt;&lt;div&gt;
	&lt;img src="https://thedailywtf.com/images/inedo/buildmaster-icon.png" style="display:block; float: left; margin: 0 10px 10px 0;"/&gt; [Advertisement] 
	&lt;a href="https://inedo.com/BuildMaster?utm_source=tdwtf&amp;amp;utm_medium=footerad&amp;amp;utm_term=2018&amp;amp;utm_content=Confidence&amp;amp;utm_campaign=Buildmaster_Footer"&gt;Utilize BuildMaster&lt;/a&gt; to release your software with confidence, at the pace your business demands. &lt;a href="https://inedo.com/BuildMaster/download?utm_source=tdwtf&amp;amp;utm_medium=footerad&amp;amp;utm_term=2018&amp;amp;utm_content=Confidence&amp;amp;utm_campaign=Buildmaster_Footer"&gt;Download&lt;/a&gt; today!  
&lt;/div&gt;
&lt;div style="clear: left;"&gt; &lt;/div&gt;
</description><slash:comments>9</slash:comments><wfw:comment>https://thedailywtf.com/articles/comments/coerce-the-truth-out-of-you</wfw:comment></item><item><dc:creator>Remy Porter</dc:creator><title>CodeSOD: Blocked the Date</title><link>https://thedailywtf.com/articles/blocked-the-date</link><category>CodeSOD</category><pubDate>Tue, 02 Jun 2026 06:30:00 GMT</pubDate><guid>https://thedailywtf.com/articles/blocked-the-date</guid><description>&lt;p&gt;&lt;strong&gt;Volodya&lt;/strong&gt; sends us some bad date handling code in PHP. Which, I know, you&amp;#39;re just reaching for the close tab and yawning when you hear that. You&amp;#39;ve seen it before. But bear with me, this one still has some fun bits to it.&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-php"&gt;&lt;span class="hljs-variable"&gt;$monthes&lt;/span&gt; = &lt;span class="hljs-keyword"&gt;array&lt;/span&gt;(
        &lt;span class="hljs-number"&gt;1&lt;/span&gt; =&amp;gt; &lt;span class="hljs-string"&gt;&amp;#39;Января&amp;#39;&lt;/span&gt;, &lt;span class="hljs-number"&gt;2&lt;/span&gt; =&amp;gt; &lt;span class="hljs-string"&gt;&amp;#39;Февраля&amp;#39;&lt;/span&gt;, &lt;span class="hljs-number"&gt;3&lt;/span&gt; =&amp;gt; &lt;span class="hljs-string"&gt;&amp;#39;Марта&amp;#39;&lt;/span&gt;, &lt;span class="hljs-number"&gt;4&lt;/span&gt; =&amp;gt; &lt;span class="hljs-string"&gt;&amp;#39;Апреля&amp;#39;&lt;/span&gt;,
        &lt;span class="hljs-number"&gt;5&lt;/span&gt; =&amp;gt; &lt;span class="hljs-string"&gt;&amp;#39;Мая&amp;#39;&lt;/span&gt;, &lt;span class="hljs-number"&gt;6&lt;/span&gt; =&amp;gt; &lt;span class="hljs-string"&gt;&amp;#39;Июня&amp;#39;&lt;/span&gt;, &lt;span class="hljs-number"&gt;7&lt;/span&gt; =&amp;gt; &lt;span class="hljs-string"&gt;&amp;#39;Июля&amp;#39;&lt;/span&gt;, &lt;span class="hljs-number"&gt;8&lt;/span&gt; =&amp;gt; &lt;span class="hljs-string"&gt;&amp;#39;Августа&amp;#39;&lt;/span&gt;,
        &lt;span class="hljs-number"&gt;9&lt;/span&gt; =&amp;gt; &lt;span class="hljs-string"&gt;&amp;#39;Сентября&amp;#39;&lt;/span&gt;, &lt;span class="hljs-number"&gt;10&lt;/span&gt; =&amp;gt; &lt;span class="hljs-string"&gt;&amp;#39;Октября&amp;#39;&lt;/span&gt;, &lt;span class="hljs-number"&gt;11&lt;/span&gt; =&amp;gt; &lt;span class="hljs-string"&gt;&amp;#39;Ноября&amp;#39;&lt;/span&gt;, &lt;span class="hljs-number"&gt;12&lt;/span&gt; =&amp;gt; &lt;span class="hljs-string"&gt;&amp;#39;Декабря&amp;#39;&lt;/span&gt;
);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This creates a list of months.&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-php"&gt;&lt;span class="hljs-keyword"&gt;if&lt;/span&gt; ( &lt;span class="hljs-variable"&gt;$team&lt;/span&gt;-&amp;gt;&lt;span class="hljs-title function_ invoke__"&gt;have_posts&lt;/span&gt;() ) :
    &lt;span class="hljs-comment"&gt;// Start the Loop.&lt;/span&gt;
    &lt;span class="hljs-keyword"&gt;while&lt;/span&gt; ( &lt;span class="hljs-variable"&gt;$team&lt;/span&gt;-&amp;gt;&lt;span class="hljs-title function_ invoke__"&gt;have_posts&lt;/span&gt;() ) : &lt;span class="hljs-variable"&gt;$team&lt;/span&gt;-&amp;gt;&lt;span class="hljs-title function_ invoke__"&gt;the_post&lt;/span&gt;();
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Today, I have learned something about PHP. PHP has an &lt;em&gt;alternate syntax&lt;/em&gt; for blocks. Instead of &lt;code&gt;if { statements }&lt;/code&gt;, you can do: &lt;code&gt;if : statements endif&lt;/code&gt;. Just one more quirk of PHP to make the language more confusing.&lt;/p&gt;
&lt;p&gt;This block checks &lt;code&gt;have_posts&lt;/code&gt; in an &lt;code&gt;if&lt;/code&gt;, and then checks it again in a &lt;code&gt;while&lt;/code&gt;, meaning we don&amp;#39;t need the &lt;code&gt;if&lt;/code&gt; at all, but so it goes. We haven&amp;#39;t gotten to the date handling yet, so let&amp;#39;s look at that.&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-php"&gt;        &lt;span class="hljs-variable"&gt;$date&lt;/span&gt; = &lt;span class="hljs-title function_ invoke__"&gt;get_the_date&lt;/span&gt;();
        &lt;span class="hljs-variable"&gt;$d1&lt;/span&gt; = &lt;span class="hljs-title function_ invoke__"&gt;explode&lt;/span&gt;(&lt;span class="hljs-string"&gt;&amp;#34;.&amp;#34;&lt;/span&gt;, &lt;span class="hljs-variable"&gt;$date&lt;/span&gt;);

        &lt;span class="hljs-keyword"&gt;if&lt;/span&gt; (&lt;span class="hljs-variable"&gt;$d1&lt;/span&gt;[&lt;span class="hljs-number"&gt;1&lt;/span&gt;][&lt;span class="hljs-number"&gt;0&lt;/span&gt;]==&lt;span class="hljs-string"&gt;&amp;#39;0&amp;#39;&lt;/span&gt;)
            &lt;span class="hljs-variable"&gt;$m&lt;/span&gt; = &lt;span class="hljs-variable"&gt;$d1&lt;/span&gt;[&lt;span class="hljs-number"&gt;1&lt;/span&gt;][&lt;span class="hljs-number"&gt;1&lt;/span&gt;];
        &lt;span class="hljs-keyword"&gt;else&lt;/span&gt;
            &lt;span class="hljs-variable"&gt;$m&lt;/span&gt; = &lt;span class="hljs-variable"&gt;$d1&lt;/span&gt;[&lt;span class="hljs-number"&gt;1&lt;/span&gt;][&lt;span class="hljs-number"&gt;0&lt;/span&gt;];
        &lt;span class="hljs-meta"&gt;?&amp;gt;&lt;/span&gt;&amp;lt;div &lt;span class="hljs-class"&gt;&lt;span class="hljs-keyword"&gt;class&lt;/span&gt;=&amp;#34;&lt;span class="hljs-title"&gt;date&lt;/span&gt;&amp;#34;&amp;gt;&amp;lt;?&lt;span class="hljs-title"&gt;php&lt;/span&gt; &lt;span class="hljs-title"&gt;echo&lt;/span&gt; $&lt;span class="hljs-title"&gt;d1&lt;/span&gt;[0].&amp;#34; &amp;#34;.$&lt;span class="hljs-title"&gt;monthes&lt;/span&gt;[$&lt;span class="hljs-title"&gt;m&lt;/span&gt;].&amp;#34; &amp;#34;.$&lt;span class="hljs-title"&gt;d1&lt;/span&gt;[2]; ?&amp;gt;&amp;lt;/&lt;span class="hljs-title"&gt;div&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We get the date as a string, and then split it out into date parts. This is, of course, highly locale specific, but clearly they know what locale they&amp;#39;re in. Then they look at the array of date parts. The second element holds their &amp;#34;month&amp;#34; string, as two digits, so they look at the digits. If the month string starts with a &lt;code&gt;0&lt;/code&gt;, they grab the second character and put it in &lt;code&gt;$m&lt;/code&gt;. Otherwise, they grab the first character and put it in &lt;code&gt;$m&lt;/code&gt;. Then they use &lt;code&gt;$m&lt;/code&gt; to look up the &lt;code&gt;$monthes&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Unless there&amp;#39;s some substring weirdness going on that I don&amp;#39;t know about, this code… doesn&amp;#39;t work? Right? Since they&amp;#39;re grabbing only a single character out of &lt;code&gt;$d1[1]&lt;/code&gt; every time, for months later in the year, &lt;code&gt;$m&lt;/code&gt; is only ever going to hold &lt;code&gt;1&lt;/code&gt;, and thus we only output &lt;code&gt;Января&lt;/code&gt;, meaning we get four months of January, which just seems cruel, honestly, at least in the Northern Hemisphere.&lt;/p&gt;
&lt;p&gt;As with all bad date handling code, this could easily be fixed by &lt;em&gt;just using the built in&lt;/em&gt; functions, even in PHP. What I&amp;#39;m going to take away from this though is that PHP&amp;#39;s syntax lets you write in Visual Basic or Ruby if you&amp;#39;re determined enough. And you can mix and match, so enjoy a codebase that has &lt;code&gt;:/endif&lt;/code&gt; and &lt;code&gt;{}&lt;/code&gt; scattered throughout.&lt;/p&gt;
&lt;!-- Easy Reader Version: PHP is awful, but also beautiful in a weird way. Like a John Waters film. Ugly, offensive, but with a core that makes you want to watch. --&gt;
&lt;style&gt;.comment { border: none; }&lt;/style&gt;&lt;div&gt;
	[Advertisement] &lt;b&gt;Plan Your .NET 9 Migration with Confidence&lt;/b&gt;&lt;br/&gt;Your journey to .NET 9 is more than just one decision.Avoid migration migraines with the advice in this free guide. &lt;b&gt;&lt;a href="https://inedo.com/support/whitepapers/dotnet-guide?utm_campaign=dotnet&amp;amp;utm_source=tdwtf-footer"&gt;Download Free Guide Now!&lt;/a&gt;&lt;/b&gt;
&lt;/div&gt;
&lt;div style="clear: left;"&gt; &lt;/div&gt;</description><slash:comments>17</slash:comments><wfw:comment>https://thedailywtf.com/articles/comments/blocked-the-date</wfw:comment></item><item><dc:creator>Ellis Morning</dc:creator><title>Let's Be Facebook!</title><link>https://thedailywtf.com/articles/let-s-be-facebook</link><category>Feature Articles</category><pubDate>Mon, 01 Jun 2026 06:30:00 GMT</pubDate><guid>https://thedailywtf.com/articles/let-s-be-facebook</guid><description>&lt;p&gt;The real WTF is that our long-time friend and submitter &lt;b&gt;Argle&lt;/b&gt; failed to dissuade all three of his sons from pursuing IT careers of their own:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Back circa 2012, my three sons all got jobs at a company that had a brilliant web project. So brilliant that it had the support of a Disney VP, the mayor of the city, and other VIPs. At one point, my sons asked to borrow money to invest in the project. They are good boys (one is now a senior developer with Proctor &amp;amp; Gamble), so I backed them.&lt;/p&gt;

&lt;p&gt;A year later, the project was released late, over budget, and not fully functional.&lt;/p&gt;

&lt;p style="float:right; padding-left:10px; padding-bottom:10px;"&gt;&lt;a title="Root-ioc, CC BY-SA 4.0 &amp;lt;https://creativecommons.org/licenses/by-sa/4.0&amp;gt;, via Wikimedia Commons" href="https://commons.wikimedia.org/wiki/File:Facebook_dislike.jpg"&gt;&lt;img itemprop="image" width="300" alt="Facebook dislike" src="https://upload.wikimedia.org/wikipedia/commons/thumb/3/3a/Facebook_dislike.jpg/330px-Facebook_dislike.jpg"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;My boys convinced the CEO to bring me in to fix things. I fixed things. In that time, I found out they had taken bids on the project. Bids were nominally $15,000, some higher, some lower, of course. All but one group that had bid $5,000. Their plan? Hire some programmers in India for $8/hour and pocket the money without having to do work themselves. &lt;/p&gt;

&lt;p&gt;Costs had shot well over $35,000 before I was brought in.&lt;/p&gt;

&lt;p&gt;After I got the system working, I went to one of the weekly general standups for the company. The CEO walked in and said something like, &amp;#34;I just learned that Facebook was written in PHP. I think we should rewrite the whole project in PHP. That&amp;#39;s what we really need to do.&amp;#34;&lt;/p&gt;

&lt;p&gt;And thus the decision was made.&lt;/p&gt;

&lt;p&gt;A meeting was held the next day to discuss how long it would take to remake the project in PHP instead of C#. Bear in mind, a year and a half had been thrown into making the project thus far.&lt;/p&gt;

&lt;p&gt;Going around the table, everyone said between 2 and 3 weeks. There was one other programmer in the company who had exactly 2 months of work experience; he simply parroted what the others had said before him. There was also the general contractor who leased the building to the company. He was involved with the project, and was second-to-last to speak. I fully expected this contractor to have more sense. He came in at 3 to 4 weeks.&lt;/p&gt;

&lt;p&gt;My mouth dropped open.&lt;/p&gt;

&lt;p&gt;It was my turn. You know those psych tests where you get someone who acts sensibly when alone, but conforms with the rest of the crowd when there&amp;#39;s more than one? I&amp;#39;m simply &lt;em&gt;not&lt;/em&gt; that guy. I said, &amp;#34;Those are absurd estimates! This will take a minimum of 5 months before it&amp;#39;s in beta stages and not ready for public consumption for another couple more months.&amp;#34;&lt;/p&gt;

&lt;p&gt;The next day, I got a call telling me my services were no longer needed because &amp;#34;I wasn&amp;#39;t forward-thinking enough for the company.&amp;#34; &lt;/p&gt;

&lt;p&gt;My boys stayed on another year, so I got regular reports on the &amp;#34;upgrade.&amp;#34; Sure enough, just shy of 8 months later, the new system went live.&lt;/p&gt;

&lt;p&gt;As they say, the most experienced person will be the one to accurately tell everyone that it will take longer and cost more than everyone else says.&lt;/p&gt;

&lt;/blockquote&gt;

&lt;p&gt;&lt;b&gt;Anyone else have their own intergenerational WTFs? Please share in the comments!&lt;/b&gt;&lt;/p&gt;&lt;div&gt;
	&lt;img src="https://thedailywtf.com/images/inedo/proget-icon.png" style="display:block; float: left; margin: 0 10px 10px 0;"/&gt; [Advertisement] 
	Keep all your packages and Docker containers in one place, scan for vulnerabilities, and control who can access different feeds. ProGet installs in minutes and has a powerful free version with a lot of great features that you can upgrade when ready.&lt;a href="https://inedo.com/proget?utm_source=tdwtf&amp;amp;utm_medium=footer&amp;amp;utm_content=PlebsFooter"&gt;Learn more.&lt;/a&gt;
&lt;/div&gt;
&lt;div style="clear: left;"&gt; &lt;/div&gt;
</description><slash:comments>49</slash:comments><wfw:comment>https://thedailywtf.com/articles/comments/let-s-be-facebook</wfw:comment></item><item><dc:creator>Lyle Seaman</dc:creator><title>Error'd: Super SEO Strategies</title><link>https://thedailywtf.com/articles/super-seo-strategies</link><category>Error'd</category><pubDate>Fri, 29 May 2026 06:30:00 GMT</pubDate><guid>https://thedailywtf.com/articles/super-seo-strategies</guid><description>&lt;p&gt;It&amp;#39;s ironic -- this site gets absolutely inundated with blogspam from people trying to improve their SEO ranking, and yet the only requirement to get your website linked is one dumb little typo in the right menu.&lt;/p&gt;

&lt;p&gt;Faithful 
&lt;strong&gt;Michael R.&lt;/strong&gt; is still job hunting, now even farther afield.
&amp;#34;I shall try the gigs in United Kingsom. https://electronicmusicopenmic.com/&amp;#34;
&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;&lt;a href="#43d63150fa7d48d3a7998e14e111c211"&gt;&lt;img itemprop="image" border="0" alt="43d63150fa7d48d3a7998e14e111c211" src="https://d3hvi6t161kfmf.cloudfront.net/images/2026/05/28/43d63150fa7d48d3a7998e14e111c211.png"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;
&lt;strong&gt;B.J.H.&lt;/strong&gt; is getting hot undeh the collah.
&amp;#34;Weather.com is an endless source of WTF. Today the high
temperature will be 53F, unless you care about any hour
after 8:00 AM. (And why don&amp;#39;t they have enough room
to spell out &amp;#34;hour&amp;#34;?)&amp;#34;
&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;&lt;a href="#561594f875db486085450afbb4f65a4e"&gt;&lt;img itemprop="image" border="0" alt="561594f875db486085450afbb4f65a4e" src="https://d3hvi6t161kfmf.cloudfront.net/images/2026/05/28/561594f875db486085450afbb4f65a4e.png"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;
&lt;strong&gt;Jake W.&lt;/strong&gt; isn&amp;#39;t storming about like BJ. He just wants us to know there&amp;#39;s an opening at Durmstrang. No stress. 

&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;&lt;a href="#8eefa2a1182146b3b595a3fbbfef5012"&gt;&lt;img itemprop="image" border="0" alt="8eefa2a1182146b3b595a3fbbfef5012" src="https://d3hvi6t161kfmf.cloudfront.net/images/2026/05/28/8eefa2a1182146b3b595a3fbbfef5012.png"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;
&lt;strong&gt;Martin K.&lt;/strong&gt; reveals 
&amp;#34;The resignation of the Microsoft Denmark CEO broke more than news, 
it also broke the date.&amp;#34;
&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;&lt;a href="#73c8b26e71ed4518bbdfeacc9850629f"&gt;&lt;img itemprop="image" border="0" alt="73c8b26e71ed4518bbdfeacc9850629f" src="https://d3hvi6t161kfmf.cloudfront.net/images/2026/05/28/73c8b26e71ed4518bbdfeacc9850629f.png"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;&amp;#34;confirmation.message.text&amp;#34; incoming from
&lt;strong&gt;Totty&lt;/strong&gt;
&amp;#34;Snarky comment. Snarky comment. Snarky comment.&amp;#34;
&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;&lt;a href="#d0e6feb93e324e509946643027ddbc5e"&gt;&lt;img itemprop="image" border="0" alt="d0e6feb93e324e509946643027ddbc5e" src="https://d3hvi6t161kfmf.cloudfront.net/images/2026/05/28/d0e6feb93e324e509946643027ddbc5e.png"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;/blockquote&gt;

&lt;div&gt;
	[Advertisement] &lt;b&gt;Plan Your .NET 9 Migration with Confidence&lt;/b&gt;&lt;br/&gt;Your journey to .NET 9 is more than just one decision.Avoid migration migraines with the advice in this free guide. &lt;b&gt;&lt;a href="https://inedo.com/support/whitepapers/dotnet-guide?utm_campaign=dotnet&amp;amp;utm_source=tdwtf-footer"&gt;Download Free Guide Now!&lt;/a&gt;&lt;/b&gt;
&lt;/div&gt;
&lt;div style="clear: left;"&gt; &lt;/div&gt;</description><slash:comments>24</slash:comments><wfw:comment>https://thedailywtf.com/articles/comments/super-seo-strategies</wfw:comment></item><item><dc:creator>Remy Porter</dc:creator><title>CodeSOD: What Condition is This</title><link>https://thedailywtf.com/articles/what-condition-is-this</link><category>CodeSOD</category><pubDate>Thu, 28 May 2026 06:30:00 GMT</pubDate><guid>https://thedailywtf.com/articles/what-condition-is-this</guid><description>&lt;p&gt;&lt;strong&gt;Untodesu&lt;/strong&gt; sends us this submission, with this comment:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Literally no idea what kind of drugs the guy was taking but nonetheless we&amp;#39;ve rewritten it to be just a two-liner&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Well, that doesn&amp;#39;t tell us a lot about what to expect from the code, but let&amp;#39;s take a look.&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-cpp"&gt;&lt;span class="hljs-function"&gt;QStringList &lt;span class="hljs-title"&gt;TableViewAssembly::parametersFilter&lt;/span&gt;&lt;span class="hljs-params"&gt;(ProbePart::Type type, &lt;span class="hljs-type"&gt;int&lt;/span&gt; pos, QList&amp;lt;ProbePart&amp;gt; probeDesign)&lt;/span&gt; &lt;/span&gt;{
    QString to, from;

    &lt;span class="hljs-keyword"&gt;if&lt;/span&gt;(pos == &lt;span class="hljs-number"&gt;-1&lt;/span&gt;) {
        &lt;span class="hljs-keyword"&gt;if&lt;/span&gt;(probeDesign.&lt;span class="hljs-built_in"&gt;length&lt;/span&gt;() == &lt;span class="hljs-number"&gt;0&lt;/span&gt;) {
            to = &lt;span class="hljs-string"&gt;&amp;#34;*&amp;#34;&lt;/span&gt;;
            from = &lt;span class="hljs-string"&gt;&amp;#34;AutoJoint&amp;#34;&lt;/span&gt;;
        } &lt;span class="hljs-keyword"&gt;else&lt;/span&gt; {
            to = probeDesign.&lt;span class="hljs-built_in"&gt;at&lt;/span&gt;(&lt;span class="hljs-number"&gt;0&lt;/span&gt;).&lt;span class="hljs-built_in"&gt;fromMounting&lt;/span&gt;();;
            from = &lt;span class="hljs-string"&gt;&amp;#34;AutoJoint&amp;#34;&lt;/span&gt;;
        }
    } &lt;span class="hljs-keyword"&gt;else&lt;/span&gt; &lt;span class="hljs-keyword"&gt;if&lt;/span&gt;(pos == &lt;span class="hljs-number"&gt;0&lt;/span&gt;) {
        &lt;span class="hljs-keyword"&gt;if&lt;/span&gt;(probeDesign.&lt;span class="hljs-built_in"&gt;length&lt;/span&gt;() == &lt;span class="hljs-number"&gt;1&lt;/span&gt;) {
            &lt;span class="hljs-keyword"&gt;if&lt;/span&gt;(probeDesign.&lt;span class="hljs-built_in"&gt;at&lt;/span&gt;(pos).&lt;span class="hljs-built_in"&gt;type&lt;/span&gt;() == ProbePart::Type::Stylus) {
                to = probeDesign.&lt;span class="hljs-built_in"&gt;at&lt;/span&gt;(pos).&lt;span class="hljs-built_in"&gt;fromMounting&lt;/span&gt;();
                from = &lt;span class="hljs-string"&gt;&amp;#34;*&amp;#34;&lt;/span&gt;;
            } &lt;span class="hljs-keyword"&gt;else&lt;/span&gt; {
                to = &lt;span class="hljs-string"&gt;&amp;#34;*&amp;#34;&lt;/span&gt;;
                from = probeDesign.&lt;span class="hljs-built_in"&gt;at&lt;/span&gt;(pos).&lt;span class="hljs-built_in"&gt;toMounting&lt;/span&gt;();
            }
        } &lt;span class="hljs-keyword"&gt;else&lt;/span&gt; {
            to = probeDesign.&lt;span class="hljs-built_in"&gt;at&lt;/span&gt;(pos + &lt;span class="hljs-number"&gt;1&lt;/span&gt;).&lt;span class="hljs-built_in"&gt;fromMounting&lt;/span&gt;();
            from = probeDesign.&lt;span class="hljs-built_in"&gt;at&lt;/span&gt;(pos).&lt;span class="hljs-built_in"&gt;toMounting&lt;/span&gt;();
        }
    } &lt;span class="hljs-keyword"&gt;else&lt;/span&gt; &lt;span class="hljs-keyword"&gt;if&lt;/span&gt;(pos == probeDesign.&lt;span class="hljs-built_in"&gt;length&lt;/span&gt;() - &lt;span class="hljs-number"&gt;1&lt;/span&gt;) {
        &lt;span class="hljs-keyword"&gt;if&lt;/span&gt;(probeDesign.&lt;span class="hljs-built_in"&gt;at&lt;/span&gt;(pos).&lt;span class="hljs-built_in"&gt;type&lt;/span&gt;() == ProbePart::Type::Stylus) {
            &lt;span class="hljs-keyword"&gt;if&lt;/span&gt;(probeDesign.&lt;span class="hljs-built_in"&gt;length&lt;/span&gt;() &amp;lt;= &lt;span class="hljs-number"&gt;1&lt;/span&gt;) {
                from = &lt;span class="hljs-string"&gt;&amp;#34;*&amp;#34;&lt;/span&gt;;
                to = probeDesign.&lt;span class="hljs-built_in"&gt;at&lt;/span&gt;(pos).&lt;span class="hljs-built_in"&gt;fromMounting&lt;/span&gt;();
            } &lt;span class="hljs-keyword"&gt;else&lt;/span&gt; {
                from = probeDesign.&lt;span class="hljs-built_in"&gt;at&lt;/span&gt;(pos - &lt;span class="hljs-number"&gt;1&lt;/span&gt;).&lt;span class="hljs-built_in"&gt;toMounting&lt;/span&gt;();
                to = probeDesign.&lt;span class="hljs-built_in"&gt;at&lt;/span&gt;(pos).&lt;span class="hljs-built_in"&gt;fromMounting&lt;/span&gt;();
            }
        } &lt;span class="hljs-keyword"&gt;else&lt;/span&gt; {
            from = probeDesign.&lt;span class="hljs-built_in"&gt;at&lt;/span&gt;(pos).&lt;span class="hljs-built_in"&gt;toMounting&lt;/span&gt;();
            to = &lt;span class="hljs-string"&gt;&amp;#34;*&amp;#34;&lt;/span&gt;;
        }
    } &lt;span class="hljs-keyword"&gt;else&lt;/span&gt; {
        from = probeDesign.&lt;span class="hljs-built_in"&gt;at&lt;/span&gt;(pos).&lt;span class="hljs-built_in"&gt;toMounting&lt;/span&gt;();
        to = probeDesign.&lt;span class="hljs-built_in"&gt;at&lt;/span&gt;(pos + &lt;span class="hljs-number"&gt;1&lt;/span&gt;).&lt;span class="hljs-built_in"&gt;fromMounting&lt;/span&gt;();
    }

    &lt;span class="hljs-keyword"&gt;return&lt;/span&gt; { to, from };
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;QStringList&lt;/code&gt; and&lt;code&gt;QList&lt;/code&gt; tell me that this is a Qt-based application. The goal of this function seems to be to take some inputs about a &amp;#34;probe part&amp;#34; and construct a pair of strings. Let&amp;#39;s trace through it.&lt;/p&gt;
&lt;p&gt;Let&amp;#39;s just walk through the conditions, quickly, without worrying too much about the inside. We look at &lt;code&gt;pos&lt;/code&gt;, and check for three cases: either &lt;code&gt;pos&lt;/code&gt; is &lt;code&gt;-1&lt;/code&gt;, &lt;code&gt;0&lt;/code&gt;, or &lt;code&gt;probeDesign.length() - 1&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Inside each of those branches, we &lt;em&gt;also&lt;/em&gt; check the length of the list, testing if it contains no elements, exactly one elemnet, or more than one element. We &lt;em&gt;also&lt;/em&gt; check if the part in question is a stylus.&lt;/p&gt;
&lt;p&gt;With that in mind, let&amp;#39;s see if we can summarize the conditions here. If &lt;code&gt;pos == -1&lt;/code&gt;, we do some automatic stuff, using the first element in the list if there is one. If &lt;code&gt;pos == 0&lt;/code&gt; &lt;em&gt;and&lt;/em&gt; there&amp;#39;s exactly one element in the list, we grab the first element and link it to &lt;code&gt;*&lt;/code&gt; (the to/from order depends on the stylus question). If there&amp;#39;s &lt;em&gt;more&lt;/em&gt; that one element in the list, we pair the current &lt;code&gt;pos&lt;/code&gt; with &lt;code&gt;pos+1&lt;/code&gt;; notably, in this branch, &lt;code&gt;pos&lt;/code&gt; is definitely zero. If &lt;code&gt;pos&lt;/code&gt; is the last element in the list, we follow the same logic, but pair with &lt;code&gt;pos-1&lt;/code&gt;, with a side branch for checking against the length of the list.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;It&amp;#39;s all bounds checking&lt;/em&gt;. That&amp;#39;s all this code is. Bounds checking that&amp;#39;s gotten out of hand. The main branch here is actually the final &lt;code&gt;else&lt;/code&gt;: that&amp;#39;s where most of the code is going to pass through. All the other branches are just handling edge cases.  &lt;em&gt;Literal&lt;/em&gt; edge cases, as in &amp;#34;the edge of the list&amp;#34;.&lt;/p&gt;
&lt;p&gt;Untodesu didn&amp;#39;t supply the two line version, but based on the fact such a version exists, I also suspect that &lt;em&gt;many of these branches weren&amp;#39;t actually used&lt;/em&gt;. Or, at least, based on the actual business rules, could be combined.&lt;/p&gt;
&lt;!-- Easy Reader Version: Conditionals considered harmful --&gt;&lt;div&gt;
	&lt;img src="https://thedailywtf.com/images/inedo/buildmaster-icon.png" style="display:block; float: left; margin: 0 10px 10px 0;"/&gt; [Advertisement] 
	&lt;a href="https://inedo.com/BuildMaster?utm_source=tdwtf&amp;amp;utm_medium=footerad&amp;amp;utm_term=2018&amp;amp;utm_content=Confidence&amp;amp;utm_campaign=Buildmaster_Footer"&gt;Utilize BuildMaster&lt;/a&gt; to release your software with confidence, at the pace your business demands. &lt;a href="https://inedo.com/BuildMaster/download?utm_source=tdwtf&amp;amp;utm_medium=footerad&amp;amp;utm_term=2018&amp;amp;utm_content=Confidence&amp;amp;utm_campaign=Buildmaster_Footer"&gt;Download&lt;/a&gt; today!  
&lt;/div&gt;
&lt;div style="clear: left;"&gt; &lt;/div&gt;
</description><slash:comments>13</slash:comments><wfw:comment>https://thedailywtf.com/articles/comments/what-condition-is-this</wfw:comment></item><item><dc:creator>Remy Porter</dc:creator><title>CodeSOD: Are There Files Yet?</title><link>https://thedailywtf.com/articles/are-there-files-yet</link><category>CodeSOD</category><pubDate>Wed, 27 May 2026 06:30:00 GMT</pubDate><guid>https://thedailywtf.com/articles/are-there-files-yet</guid><description>&lt;p&gt;Are there any files to send? That&amp;#39;s the question that &lt;strong&gt;Chris C&lt;/strong&gt;&amp;#39;s predecessor had. So they asked it. Again. And again. And &lt;em&gt;again&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;Chris writes:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;I&amp;#39;m occasionally called upon to troubleshoot an ecommerce application that was built in the PHP 5.x days and has been running largely untroubled by maintenance or modernity (aside from the backported security patches to its binaries) ever since.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre&gt;&lt;code class="language-php"&gt;&lt;span class="hljs-keyword"&gt;if&lt;/span&gt;(&lt;span class="hljs-title function_ invoke__"&gt;sizeof&lt;/span&gt;(&lt;span class="hljs-variable"&gt;$files&lt;/span&gt;) &amp;gt; &lt;span class="hljs-number"&gt;0&lt;/span&gt;){
		&lt;span class="hljs-keyword"&gt;if&lt;/span&gt;(&lt;span class="hljs-title function_ invoke__"&gt;sizeof&lt;/span&gt;(&lt;span class="hljs-variable"&gt;$files&lt;/span&gt;) &amp;gt; &lt;span class="hljs-number"&gt;0&lt;/span&gt;){
				&lt;span class="hljs-keyword"&gt;foreach&lt;/span&gt;(&lt;span class="hljs-variable"&gt;$files&lt;/span&gt; &lt;span class="hljs-keyword"&gt;as&lt;/span&gt; &lt;span class="hljs-variable"&gt;$file&lt;/span&gt;){
						&lt;span class="hljs-variable"&gt;$mime&lt;/span&gt;-&amp;gt;&lt;span class="hljs-title function_ invoke__"&gt;addAttachment&lt;/span&gt;(&lt;span class="hljs-variable"&gt;$file&lt;/span&gt;);
		}
		}
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Indentation as per the original.&lt;/p&gt;
&lt;p&gt;If the files array contains items, then if the files array contains items, then we iterate across the files array, which hopefully contains items, and add them as an attachment to an email.&lt;/p&gt;
&lt;p&gt;I feel like the way this got indented, the developer responsible knew, deep down, that this was wrong. They lacked the reading comprehension to understand why, but deep down in their spleen, something was screaming at them. And thus those stacked curly brackets at the end there.&lt;/p&gt;
&lt;p&gt;Of course, none of the conditionals are needed: a foreach on an empty object just does nothing.&lt;/p&gt;
&lt;!-- Easy Reader Version: Probably a copy/paste error, but like, *that's why you read your code*. This code predates LLMs, but I have also seen LLMs make this kind of mistake- my dabbling with them, they like to try and solve compile errors by opening and closing namespaces at random, and get into a loop of "add a namespace, remove a namespace, add a namespace…" --&gt;&lt;div&gt;
	&lt;img src="https://thedailywtf.com/images/inedo/buildmaster-icon.png" style="display:block; float: left; margin: 0 10px 10px 0;"/&gt; [Advertisement] 
	&lt;a href="https://inedo.com/BuildMaster?utm_source=tdwtf&amp;amp;utm_medium=footerad&amp;amp;utm_term=2018&amp;amp;utm_content=Confidence&amp;amp;utm_campaign=Buildmaster_Footer"&gt;Utilize BuildMaster&lt;/a&gt; to release your software with confidence, at the pace your business demands. &lt;a href="https://inedo.com/BuildMaster/download?utm_source=tdwtf&amp;amp;utm_medium=footerad&amp;amp;utm_term=2018&amp;amp;utm_content=Confidence&amp;amp;utm_campaign=Buildmaster_Footer"&gt;Download&lt;/a&gt; today!  
&lt;/div&gt;
&lt;div style="clear: left;"&gt; &lt;/div&gt;
</description><slash:comments>16</slash:comments><wfw:comment>https://thedailywtf.com/articles/comments/are-there-files-yet</wfw:comment></item><item><dc:creator>Ellis Morning</dc:creator><title>Whales Ahoy!</title><link>https://thedailywtf.com/articles/whales-ahoy</link><category>Feature Articles</category><pubDate>Tue, 26 May 2026 06:30:00 GMT</pubDate><guid>https://thedailywtf.com/articles/whales-ahoy</guid><description>&lt;p&gt;The waters are even more dangerous than we imagined. Have a look at some of the &lt;a href="https://thedailywtf.com/articles/a-whale-of-a-problem"&gt;crazed whales&lt;/a&gt; our brave submitters and commenters have encountered in the wild.

&lt;/p&gt;&lt;p&gt;First comes an &lt;b&gt;Anonymous&lt;/b&gt; tale of woe:&lt;/p&gt;
&lt;p style="float:right; padding-left:10px; padding-bottom:10px;"&gt;&lt;a title="Callan Carpenter, CC BY-SA 4.0 &amp;lt;https://creativecommons.org/licenses/by-sa/4.0&amp;gt;, via Wikimedia Commons" href="https://upload.wikimedia.org/wikipedia/commons/thumb/6/66/Killer_Whales_Hunting_a_Seal.jpg/330px-Killer_Whales_Hunting_a_Seal.jpg"&gt;&lt;img itemprop="image" width="300" alt="Killer whales (Orcinus orca) spyhopping to locate a crabeater seal (Lobodon carcinophaga) on an ice floe in Antarctica." src="https://upload.wikimedia.org/wikipedia/commons/thumb/6/66/Killer_Whales_Hunting_a_Seal.jpg/330px-Killer_Whales_Hunting_a_Seal.jpg"/&gt;&lt;/a&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Our company makes apps for businesses.  We have 1 MAIN client whose CEO can make or break our company, and his wish is our command. He sent a priority email on a Friday night saying the app was slow and needed to be fixed.&lt;/p&gt;

&lt;p&gt;The client CEO is so important that he works directly with our CEO, who decided to PM this huge issue.&lt;/p&gt;

&lt;p&gt;All weekend, we were trying out tons of different things to optimize this &amp;#34;slow&amp;#34; app that &amp;#34;wasn&amp;#39;t loading or refreshing.&amp;#34; We deployed the app Monday night after a weekend of unpaid overtime (darn salary). On Tuesday, the account manager made a bug card to officially represent the work we did, and they posted a previously-unseen video of the slowness.&lt;/p&gt;

&lt;p&gt;There is a refresh icon that spins when clicked. The video was of the refresh icon, and it was spinning for an extra second after the data loaded (and jumping 2 pixels from padding styling).&lt;/p&gt;

&lt;p&gt;That is what was high priority.&lt;/p&gt;

&lt;p&gt;I mean, we all hate the system, but sometimes the system is actually there to protect us.&lt;/p&gt;

&lt;/blockquote&gt;

&lt;p&gt;Next, we have &lt;b&gt;Daniel&amp;#39;s&lt;/b&gt; ongoing peril:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;We do digital flyers/circulars/ads. Eight years ago, that meant we got PDFs from retailers and turned them into digital content. One huge retailer (hundreds of stores) wanted a dynamically-created flyer that would have up-to-date pricing twice a day. We didn&amp;#39;t have time to build out a full digital solution (which would have made sense), so instead we spent six months banging together a solution with spit and duct tape which baked out hundreds of PDFs every morning and afternoon. This one retailer was responsible for about 40% of our processing power.&lt;/p&gt;

&lt;p&gt;We&amp;#39;re finally getting somewhat closer to phasing this out, but &amp;#34;it worked&amp;#34; for this long ...&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Finally, let&amp;#39;s be grateful &lt;b&gt;Brian&lt;/b&gt; escaped with his life!&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Worked for a company that was building a component of a high-profile weapons platform for one of the major military suppliers. We had taken over the project from another company that was under-performing, so we were already behind schedule from the minute the contract was signed. Of course this company saw fit to treat us more as a subsidiary than a subcontractor. Including, for a time, sending one of their own managers to sit in our lab and observe (read: babysit) us. On Saturdays. Then they demanded we start working shifts to make more use of the lab equipment, and I got the bad draw: 3 AM - noon. Never mind that I had just gotten married (they actually called to tell me this while I was on vacation the week after my wedding) and would like to actually spend some time with my wife ...&lt;/p&gt;

&lt;p&gt;That experience soured me on the whole military-industrial complex for a long time. To this day I still get headhunters pinging me to work for that megacorp; I just chuckle and delete their messages.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;b&gt;Have these tales knocked loose any foul memories that your brain tried to repress? &lt;a href="https://thedailywtf.com/submit-wtf"&gt;Send them to us!&lt;/a&gt;&lt;/b&gt;&lt;/p&gt;&lt;div&gt;
	&lt;img src="https://thedailywtf.com/images/inedo/proget-icon.png" style="display:block; float: left; margin: 0 10px 10px 0;"/&gt; [Advertisement] 
	ProGet’s got you covered with security and access controls on your NuGet feeds. &lt;a href="https://inedo.com/proget/private-nuget-server?utm_source=tdwtf&amp;amp;utm_medium=footer&amp;amp;utm_content=GotYouCoveredFooter&amp;amp;utm_campaign=Cyclops2020"&gt;Learn more.&lt;/a&gt;
&lt;/div&gt;
&lt;div style="clear: left;"&gt; &lt;/div&gt;
</description><slash:comments>10</slash:comments><wfw:comment>https://thedailywtf.com/articles/comments/whales-ahoy</wfw:comment></item><item><dc:creator>Jake Vinson</dc:creator><title>CodeSOD: Classic WTF: One-and-a-Half-Tiered Application Design</title><link>https://thedailywtf.com/articles/classic-wtf-one-and-a-half-tiered-application-design</link><category>CodeSOD</category><pubDate>Mon, 25 May 2026 06:30:00 GMT</pubDate><guid>https://thedailywtf.com/articles/classic-wtf-one-and-a-half-tiered-application-design</guid><description>&lt;blockquote&gt;It&amp;#39;s a holiday in the US today, so we&amp;#39;re reaching back into the archives. What we really need is a single function that can do it all, and by &amp;#34;it&amp;#34; we mean &amp;#34;ruin your life.&amp;#34; &lt;a href="https://thedailywtf.com/articles/OneandaHalfTiered-Application-Design"&gt;Original&lt;/a&gt; --&lt;strong&gt;Remy&lt;/strong&gt;&lt;/blockquote&gt;

&lt;p&gt;There are several types of bad code; there&amp;#39;s lazy code, frantic code, unaware-of-a-better-way code, and aware-of-a-better-way-but-too-apathetic-to-do-it code, to name a few. Then there&amp;#39;re amalgamations of different types of bad code.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Môshe&lt;/strong&gt; encountered such an amalgam when his company was trying out a new delivery service. Môshe spent some time evaluating the IE-only web interface, and was curious about some JavaScript errors he was getting. Strangely, he noticed variables named dateSQL, newSQLTag, and modeSQL.&lt;/p&gt;
&lt;p&gt;Môshe dug a little deeper, probably thinking that his suspicions couldn&amp;#39;t possibly be correct, only to find sendLinkVal() in the page&amp;#39;s code:&lt;/p&gt;
&lt;pre&gt;function sendLinkVal(theDate,theStatus,MainTitle,PageTitle){
  var dateSQL = &amp;#34; AND J.JBDeliveryDate=&amp;#39;&amp;#39;&amp;#34; + theDate + 
    &amp;#34;&amp;#39;&amp;#39;&amp;#34;
  var status = &amp;#34;&amp;#34;
  var newSQLTag =&amp;#34;&amp;#34;
  var PageTitle = PageTitle
  var MainTitle = MainTitle
    //alert(dateSQL)
      switch (theStatus){
        case &amp;#34;Confirmed&amp;#34;:
          dateSQL= &amp;#34;&amp;#34; 
          var modeSQL = &amp;#34;&amp;#34;
          modeSQL = &amp;#34; AND (J.JBCompanyID=31337) &amp;#34;
          status = &amp;#34; GlobalJobStatusView AS J WHERE J.JBCollectDate=&amp;#39;&amp;#39;
	    &amp;#34; + theDate + &amp;#34;&amp;#39;&amp;#39; AND J.JBConfirmed=&amp;#39;&amp;#39;Yes&amp;#39;&amp;#39; AND 
	    J.MIStatusCode&amp;lt;&amp;gt;5&amp;#34; + modeSQL + &amp;#34; AND 
	    (ISNULL(J.JBCancelled, 0) &amp;lt;&amp;gt; 1) ORDER BY 
	    Convert(int, J.MIJobID)&amp;#34;
        break;
        case &amp;#34;Unconfirmed&amp;#34;: 
          dateSQL= &amp;#34;&amp;#34;
          var modeSQL = &amp;#34;&amp;#34;
          modeSQL = &amp;#34; AND (J.JBCompanyID=31337) &amp;#34; 
          status = &amp;#34; GlobalJobStatusView AS J WHERE J.JBCollectDate=&amp;#39;&amp;#39;
	    &amp;#34; + theDate + &amp;#34;&amp;#39;&amp;#39; AND J.JBConfirmed=&amp;#39;&amp;#39;No&amp;#39;&amp;#39;&amp;#34; + 
	    modeSQL + &amp;#34; ORDER BY Convert(int, J.MIJobID)&amp;#34;
        break;
        case &amp;#34;Complete&amp;#34;:
          dateSQL= &amp;#34;&amp;#34;
          var modeSQL = &amp;#34;&amp;#34;
          modeSQL = &amp;#34; AND (J.JBCompanyID=31337) &amp;#34; 
          status = &amp;#34; GlobalJobStatusView AS J WHERE J.JBCollectDate=&amp;#39;&amp;#39;
	    &amp;#34; + theDate + &amp;#34;&amp;#39;&amp;#39; AND J.MIStatusCode=5&amp;#34; + 
	    modeSQL + &amp;#34; ORDER BY Convert(int, J.MIJobID)&amp;#34;
        break;
        case &amp;#34;Unconformed&amp;#34;: 
          dateSQL= &amp;#34;&amp;#34;
          var modeSQL = &amp;#34;&amp;#34;
          modeSQL = &amp;#34; AND (J.JBCompanyID=31337) &amp;#34; 
          status = &amp;#34; GlobalJobStatusView AS J WHERE J.JBCollectDate=&amp;#39;&amp;#39;
	    &amp;#34; + theDate + &amp;#34;&amp;#39;&amp;#39; AND (J.MIConformance IS NOT NULL 
	    AND J.MIConformance&amp;lt;&amp;gt;&amp;#39;&amp;#39;&amp;#39;&amp;#39;) &amp;#34; + modeSQL + &amp;#34; 
	    ORDER BY Convert(int, J.MIJobID)&amp;#34;
        break;
        case &amp;#34;NoDelDate&amp;#34;:
          dateSQL= &amp;#34;&amp;#34;
          var modeSQL = &amp;#34;&amp;#34;
          modeSQL = &amp;#34; AND (J.JBCompanyID=31337) &amp;#34; 
          dateSQL =&amp;#34; GlobalJobStatusView AS J WHERE J.JBDeliveryDate 
	    IS NULL &amp;#34; + modeSQL + &amp;#34; ORDER BY Convert(int, J.MIJobID)
	    &amp;#34;
        break;
        case &amp;#34;Collections&amp;#34;:
          // the dateSQL is not required so set it to nothing so that it 
          // doesn&amp;#39;t interfere with the sql being generated at the end of 
          // the function.
          dateSQL= &amp;#34;&amp;#34; 
          var modeSQL = &amp;#34;&amp;#34;
          modeSQL = &amp;#34; AND (J.JBCompanyID=31337) &amp;#34;
          status = &amp;#34; GlobalJobStatusView AS J WHERE J.JBCollectDate=&amp;#39;&amp;#39;
	    &amp;#34; + theDate + &amp;#34;&amp;#39;&amp;#39;&amp;#34; + modeSQL + &amp;#34; ORDER BY 
	    Convert(int, J.MIJobID)&amp;#34;
        break;
        case &amp;#34;Deliveries&amp;#34;:
          // the dateSQL is not required so set it to nothing so that it 
          // doesn&amp;#39;t interfere with the sql being generated at the end of 
          // the function.
          dateSQL= &amp;#34;&amp;#34; 
          var modeSQL = &amp;#34;&amp;#34;
          modeSQL = &amp;#34; AND (J.JBCompanyID=31337) &amp;#34;
          status = &amp;#34; GlobalJobStatusView AS J WHERE J.JBDeliveryDate=&amp;#39;&amp;#39;
	    &amp;#34; + theDate + &amp;#34;&amp;#39;&amp;#39;&amp;#34; + modeSQL + &amp;#34; ORDER BY 
	    Convert(int, J.MIJobID)&amp;#34;
        break;
        case &amp;#34;ColAndDel&amp;#34;:
          // the dateSQL is not required so set it to nothing so that it 
          // doesn&amp;#39;t interfere with the sql being generated at the end of 
          // the function.
          dateSQL= &amp;#34;&amp;#34; 
          var modeSQL = &amp;#34;&amp;#34;
          modeSQL = &amp;#34; AND (J.JBCompanyID=31337) &amp;#34;
          status = &amp;#34; GlobalJobStatusView AS J WHERE ((J.JBDeliveryDate=&amp;#39;&amp;#39;
	    &amp;#34; + theDate + &amp;#34;&amp;#39;&amp;#39;) OR (J.JBCollectDate=&amp;#39;&amp;#39;&amp;#34; + 
	    theDate + &amp;#34;&amp;#39;&amp;#39;))&amp;#34; + modeSQL + &amp;#34; ORDER BY 
	    Convert(int, J.MIJobID)&amp;#34;
        break;
        case &amp;#34;Subcontractor&amp;#34;:
          // the dateSQL is not required so set it to nothing so that it 
          // doesn&amp;#39;t interfere with the sql being generated at the end of 
          // the function.
          dateSQL= &amp;#34;&amp;#34; 
          var modeSQL = &amp;#34;&amp;#34;
          modeSQL = &amp;#34; AND (J.JBCompanyID=31337) &amp;#34;
          status = &amp;#34; JobAndLoadView AS J WHERE (J.JBDeliveryDate=&amp;#39;&amp;#39;
	    &amp;#34; + theDate + &amp;#34;&amp;#39;&amp;#39;) &amp;#34; + modeSQL + &amp;#34; 
	    ORDER BY Convert(int, J.MIJobID)&amp;#34;
        break;
        case &amp;#34;Cancelled&amp;#34;:
          // the dateSQL is not required so set it to nothing so that it 
          // doesn&amp;#39;t interfere with the sql being generated at the end of 
          // the function.
          dateSQL= &amp;#34;&amp;#34; 
          var modeSQL = &amp;#34;&amp;#34;
          modeSQL = &amp;#34; AND (J.JBCompanyID=31337) &amp;#34;
          status = &amp;#34; GlobalJobStatusView AS J WHERE (J.JBCollectDate==&amp;#39;&amp;#39;
	    &amp;#34; + theDate + &amp;#34;&amp;#39;&amp;#39;) &amp;#34; + modeSQL + &amp;#34; AND 
	    ISNULL(J.JBCancelled, 0) = 1 ORDER BY Convert(int, J.MIJobID)&amp;#34;
        break;
        default : status =&amp;#34;&amp;#34;;
      }
        newSQLTag = dateSQL + status;
        document.all.hiddenForm.linkVal.value = newSQLTag;
        document.all.hiddenForm.PageTitle.value = PageTitle
        document.all.hiddenForm.MainTitle.value = MainTitle
        document.all.hiddenForm.submit();  
    //alert(newSQLTag)
  }&lt;/pre&gt;
&lt;p&gt;Môshe could replace his customer ID with any other and access customer data, and for that matter, to modify or delete whatever he wanted. He could add or remove columns to tables. He could possibly even change permissions, add his own database user and deny all other users access.&lt;/p&gt;
&lt;p&gt;Shocked, Môshe called the delivery service, who got him in touch with the developer of the system. This developer was &lt;em&gt;equally&lt;/em&gt; shocked to learn that it was even possible to view a web page&amp;#39;s JavaScript code, let alone that his architecture was open to SQL injection attacks from virtually any angle. He took immediate and decisive action; all queries were moved to the .NET backend.&lt;/p&gt;
&lt;p&gt;Of course, the queries still didn&amp;#39;t use parameters and are therefore still open to SQL injection, but now it takes &lt;em&gt;slightly&lt;/em&gt; more effort to hack.&lt;/p&gt;&lt;div&gt;
	&lt;img src="https://thedailywtf.com/images/inedo/proget-icon.png" style="display:block; float: left; margin: 0 10px 10px 0;"/&gt; [Advertisement] 
	Keep the plebs out of prod. Restrict NuGet feed privileges with ProGet. &lt;a href="https://inedo.com/proget/private-nuget-server?utm_source=tdwtf&amp;amp;utm_medium=footer&amp;amp;utm_content=PlebsFooter&amp;amp;utm_campaign=Cyclops2020"&gt;Learn more.&lt;/a&gt;
&lt;/div&gt;
&lt;div style="clear: left;"&gt; &lt;/div&gt;
</description><slash:comments>7</slash:comments><wfw:comment>https://thedailywtf.com/articles/comments/classic-wtf-one-and-a-half-tiered-application-design</wfw:comment></item><item><dc:creator>Lyle Seaman</dc:creator><title>Error'd: April is Special, and so are you</title><link>https://thedailywtf.com/articles/april-is-special-and-so-are-you</link><category>Error'd</category><pubDate>Fri, 22 May 2026 06:30:00 GMT</pubDate><guid>https://thedailywtf.com/articles/april-is-special-and-so-are-you</guid><description>&lt;p&gt;&amp;#34;April is special,&amp;#34; writes
&lt;strong&gt;Elwin&lt;/strong&gt;.  It is, but take heart May, every month is special at TDWTF.

&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;&lt;a href="#ef33dacc82c1495bbc2c68cf30461f3c"&gt;&lt;img itemprop="image" border="0" alt="ef33dacc82c1495bbc2c68cf30461f3c" src="https://d3hvi6t161kfmf.cloudfront.net/images/2026/05/21/ef33dacc82c1495bbc2c68cf30461f3c.png"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;/blockquote&gt;


&lt;p&gt;
&amp;#34;Admiral Ackbar is pinterested,&amp;#34; punned
&lt;strong&gt;The Beast in Black&lt;/strong&gt;
&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;&lt;a href="#0b5ff0ba77cc480cb3c0a6ca91ef10b6"&gt;&lt;img itemprop="image" border="0" alt="0b5ff0ba77cc480cb3c0a6ca91ef10b6" src="https://d3hvi6t161kfmf.cloudfront.net/images/2026/05/21/0b5ff0ba77cc480cb3c0a6ca91ef10b6.jpeg"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;/blockquote&gt;


&lt;p&gt;
&lt;strong&gt;Manuel H.&lt;/strong&gt; clocked something off on this website.
&amp;#34;Noon seems to be very late in Lithuania, or maybe
only in this hotel restaurant in Vilnius.&amp;#34; 15H AM must be on some planet with a 32H day.
&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;&lt;a href="#18d8b28ac37243708f1f4711be97cebf"&gt;&lt;img itemprop="image" border="0" alt="18d8b28ac37243708f1f4711be97cebf" src="https://d3hvi6t161kfmf.cloudfront.net/images/2026/05/21/18d8b28ac37243708f1f4711be97cebf.png"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;/blockquote&gt;


&lt;p&gt;&amp;#34;Amazon can&amp;#39;t make up its mind!&amp;#34; ranted an anon.
&amp;#34;Do I need to wait 2 business days or 3?
Make up your mind Amazon!&amp;#34;
&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;&lt;a href="#abc72aa0987b4e84816906e2b598dc11"&gt;&lt;img itemprop="image" border="0" alt="abc72aa0987b4e84816906e2b598dc11" src="https://d3hvi6t161kfmf.cloudfront.net/images/2026/05/21/abc72aa0987b4e84816906e2b598dc11.png"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;/blockquote&gt;


&lt;p&gt;
&lt;strong&gt;Duston&lt;/strong&gt; decided to close us out with a pun. 
&amp;#34;Looks like they have a problem, but it&amp;#39;s trivial.&amp;#34; Well done.
&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;&lt;a href="#a821a18e000c4152a327d79dd2a05744"&gt;&lt;img itemprop="image" border="0" alt="a821a18e000c4152a327d79dd2a05744" src="https://d3hvi6t161kfmf.cloudfront.net/images/2026/05/21/a821a18e000c4152a327d79dd2a05744.jpeg"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;/blockquote&gt;

&lt;div&gt;
	&lt;img src="https://thedailywtf.com/images/inedo/proget-icon.png" style="display:block; float: left; margin: 0 10px 10px 0;"/&gt; [Advertisement] 
	Keep the plebs out of prod. Restrict NuGet feed privileges with ProGet. &lt;a href="https://inedo.com/proget/private-nuget-server?utm_source=tdwtf&amp;amp;utm_medium=footer&amp;amp;utm_content=PlebsFooter&amp;amp;utm_campaign=Cyclops2020"&gt;Learn more.&lt;/a&gt;
&lt;/div&gt;
&lt;div style="clear: left;"&gt; &lt;/div&gt;
</description><slash:comments>12</slash:comments><wfw:comment>https://thedailywtf.com/articles/comments/april-is-special-and-so-are-you</wfw:comment></item><item><dc:creator>Remy Porter</dc:creator><title>CodeSOD: In the Know</title><link>https://thedailywtf.com/articles/in-the-know</link><category>CodeSOD</category><pubDate>Thu, 21 May 2026 06:30:00 GMT</pubDate><guid>https://thedailywtf.com/articles/in-the-know</guid><description>&lt;p&gt;&lt;strong&gt;Delilah&lt;/strong&gt; works in a Python shop. Despite Python&amp;#39;s &amp;#34;batteries included&amp;#34; design, that doesn&amp;#39;t stop people from trying to make their own batteries from potatoes. For example, her co-worker wrote this function:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-python"&gt;&lt;span class="hljs-keyword"&gt;def&lt;/span&gt; &lt;span class="hljs-title function_"&gt;key_exists&lt;/span&gt;(&lt;span class="hljs-params"&gt;element, key&lt;/span&gt;):
    &lt;span class="hljs-keyword"&gt;if&lt;/span&gt; &lt;span class="hljs-built_in"&gt;isinstance&lt;/span&gt;(element, &lt;span class="hljs-built_in"&gt;dict&lt;/span&gt;):
        &lt;span class="hljs-keyword"&gt;try&lt;/span&gt;:
            element = element[key]
        &lt;span class="hljs-keyword"&gt;except&lt;/span&gt; KeyError:
            &lt;span class="hljs-keyword"&gt;return&lt;/span&gt; &lt;span class="hljs-literal"&gt;False&lt;/span&gt;
        &lt;span class="hljs-keyword"&gt;return&lt;/span&gt; &lt;span class="hljs-literal"&gt;True&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Python, of course, has an &lt;code&gt;in&lt;/code&gt; operator. &lt;code&gt;key in dictionary&lt;/code&gt; is an &lt;em&gt;extremely&lt;/em&gt; common idiom. There&amp;#39;s no reason to implement your own. Certainly, there&amp;#39;s no reason to re-implement it by catching and throwing exceptions.&lt;/p&gt;
&lt;p&gt;This is ugly, stupid, and bad. It gets worse, though, when you see how it gets used.&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-python"&gt;&lt;span class="hljs-keyword"&gt;for&lt;/span&gt; key &lt;span class="hljs-keyword"&gt;in&lt;/span&gt; old_yaml_data:
    &lt;span class="hljs-keyword"&gt;if&lt;/span&gt; key &lt;span class="hljs-keyword"&gt;in&lt;/span&gt; new_yaml_data:
        &lt;span class="hljs-keyword"&gt;if&lt;/span&gt; old_yaml_data[key] != new_yaml_data[key]:
            temp = new_yaml_data[key]
            new_yaml_data[key] = merge(new_yaml_data[key], old_yaml_data[key])

            &lt;span class="hljs-keyword"&gt;if&lt;/span&gt; key_exists(new_yaml_data[key], &lt;span class="hljs-string"&gt;&amp;#39;image&amp;#39;&lt;/span&gt;) &lt;span class="hljs-keyword"&gt;and&lt;/span&gt; key_exists(old_yaml_data[key], &lt;span class="hljs-string"&gt;&amp;#39;image&amp;#39;&lt;/span&gt;):
                new_yaml_data[key][&lt;span class="hljs-string"&gt;&amp;#39;image&amp;#39;&lt;/span&gt;] = temp[&lt;span class="hljs-string"&gt;&amp;#39;image&amp;#39;&lt;/span&gt;]
            &lt;span class="hljs-keyword"&gt;elif&lt;/span&gt; key == &lt;span class="hljs-string"&gt;&amp;#34;databases&amp;#34;&lt;/span&gt;:
                revert_db_tags(new_yaml_data[key], temp)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This code is attempting to upgrade &amp;#34;old&amp;#34; YAML data with &amp;#34;new&amp;#34; data. So it&amp;#39;s basically merging dictionaries, which is a great case for the &lt;code&gt;in&lt;/code&gt; operator.&lt;/p&gt;
&lt;p&gt;And &lt;em&gt;they use the correct idiom&lt;/em&gt; on the second line there! This was written by one developer! They do the standard &lt;code&gt;key in new_yaml_data&lt;/code&gt; check. And they &lt;em&gt;also&lt;/em&gt; use &lt;code&gt;key_exists&lt;/code&gt;. I can only assume that they had a stroke between starting and finishing this script, which I&amp;#39;ll note is, in total, 48 lines long.&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s the whole short script, which is just generally a &lt;em&gt;mess&lt;/em&gt;. Slapped together Python code that&amp;#39;s trying to be a &amp;#34;smarter&amp;#34; shell script, but is definitely written with the elegance of hacked-together-bash.&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-python"&gt;&lt;span class="hljs-keyword"&gt;import&lt;/span&gt; sys
&lt;span class="hljs-keyword"&gt;import&lt;/span&gt; yaml
&lt;span class="hljs-keyword"&gt;from&lt;/span&gt; jsonmerge &lt;span class="hljs-keyword"&gt;import&lt;/span&gt; merge

appHomePath = sys.argv[&lt;span class="hljs-number"&gt;1&lt;/span&gt;]
oldValuesYAML = appHomePath + &lt;span class="hljs-string"&gt;&amp;#34;values.yaml&amp;#34;&lt;/span&gt;
newValuesYAML = appHomePath + &lt;span class="hljs-string"&gt;&amp;#34;/upgrade_version/values.yaml&amp;#34;&lt;/span&gt;
&lt;span class="hljs-keyword"&gt;with&lt;/span&gt; &lt;span class="hljs-built_in"&gt;open&lt;/span&gt;(newValuesYAML, &lt;span class="hljs-string"&gt;&amp;#39;r&amp;#39;&lt;/span&gt;) &lt;span class="hljs-keyword"&gt;as&lt;/span&gt; f:
    new_yaml_data = yaml.load(f, Loader=yaml.loader.FullLoader)
&lt;span class="hljs-keyword"&gt;with&lt;/span&gt; &lt;span class="hljs-built_in"&gt;open&lt;/span&gt;(oldValuesYAML, &lt;span class="hljs-string"&gt;&amp;#39;r&amp;#39;&lt;/span&gt;) &lt;span class="hljs-keyword"&gt;as&lt;/span&gt; f:
    old_yaml_data = yaml.load(f, Loader=yaml.loader.FullLoader)
&lt;span class="hljs-keyword"&gt;def&lt;/span&gt; &lt;span class="hljs-title function_"&gt;key_exists&lt;/span&gt;(&lt;span class="hljs-params"&gt;element, key&lt;/span&gt;):
    &lt;span class="hljs-keyword"&gt;if&lt;/span&gt; &lt;span class="hljs-built_in"&gt;isinstance&lt;/span&gt;(element, &lt;span class="hljs-built_in"&gt;dict&lt;/span&gt;):
        &lt;span class="hljs-keyword"&gt;try&lt;/span&gt;:
            element = element[key]
        &lt;span class="hljs-keyword"&gt;except&lt;/span&gt; KeyError:
            &lt;span class="hljs-keyword"&gt;return&lt;/span&gt; &lt;span class="hljs-literal"&gt;False&lt;/span&gt;
        &lt;span class="hljs-keyword"&gt;return&lt;/span&gt; &lt;span class="hljs-literal"&gt;True&lt;/span&gt;

&lt;span class="hljs-keyword"&gt;def&lt;/span&gt; &lt;span class="hljs-title function_"&gt;revert_db_tags&lt;/span&gt;(&lt;span class="hljs-params"&gt;old_yaml_data, new_yaml_data&lt;/span&gt;):
    dbList = [&lt;span class="hljs-string"&gt;&amp;#34;mongoDB&amp;#34;&lt;/span&gt;, &lt;span class="hljs-string"&gt;&amp;#34;postgresDB&amp;#34;&lt;/span&gt;]
    mongoDbTagsToRevert = [&lt;span class="hljs-string"&gt;&amp;#34;mongoRestore&amp;#34;&lt;/span&gt;]
    mongodbKeysToDelete = []
    postgresDbTagsToRevert = []


    &lt;span class="hljs-keyword"&gt;for&lt;/span&gt; db &lt;span class="hljs-keyword"&gt;in&lt;/span&gt; dbList:
        old_yaml_data[db][&lt;span class="hljs-string"&gt;&amp;#39;image&amp;#39;&lt;/span&gt;] = new_yaml_data[db][&lt;span class="hljs-string"&gt;&amp;#39;image&amp;#39;&lt;/span&gt;]
    &lt;span class="hljs-keyword"&gt;for&lt;/span&gt; mongoDbTag &lt;span class="hljs-keyword"&gt;in&lt;/span&gt; mongoDbTagsToRevert:
        old_yaml_data[&lt;span class="hljs-string"&gt;&amp;#39;mongoDB&amp;#39;&lt;/span&gt;][mongoDbTag][&lt;span class="hljs-string"&gt;&amp;#39;image&amp;#39;&lt;/span&gt;] = new_yaml_data[&lt;span class="hljs-string"&gt;&amp;#39;mongoDB&amp;#39;&lt;/span&gt;][mongoDbTag][&lt;span class="hljs-string"&gt;&amp;#39;image&amp;#39;&lt;/span&gt;]
    &lt;span class="hljs-keyword"&gt;for&lt;/span&gt; mongoDbTag &lt;span class="hljs-keyword"&gt;in&lt;/span&gt; mongoKeysToDelete:
        &lt;span class="hljs-keyword"&gt;del&lt;/span&gt; old_yaml_data[&lt;span class="hljs-string"&gt;&amp;#39;mongoDB&amp;#39;&lt;/span&gt;][mongoDbTag]

    &lt;span class="hljs-keyword"&gt;for&lt;/span&gt; postgresDbTag &lt;span class="hljs-keyword"&gt;in&lt;/span&gt; postgresDbTagsToRevert:
        old_yaml_data[&lt;span class="hljs-string"&gt;&amp;#39;postgresDB&amp;#39;&lt;/span&gt;][postgresDbTag][&lt;span class="hljs-string"&gt;&amp;#39;image&amp;#39;&lt;/span&gt;] = new_yaml_data[&lt;span class="hljs-string"&gt;&amp;#39;postgresDB&amp;#39;&lt;/span&gt;][postgresDbTag][&lt;span class="hljs-string"&gt;&amp;#39;image&amp;#39;&lt;/span&gt;]

&lt;span class="hljs-keyword"&gt;for&lt;/span&gt; key &lt;span class="hljs-keyword"&gt;in&lt;/span&gt; old_yaml_data:
    &lt;span class="hljs-keyword"&gt;if&lt;/span&gt; key &lt;span class="hljs-keyword"&gt;in&lt;/span&gt; new_yaml_data:
        &lt;span class="hljs-keyword"&gt;if&lt;/span&gt; old_yaml_data[key] != new_yaml_data[key]:
            temp = new_yaml_data[key]
            new_yaml_data[key] = merge(new_yaml_data[key], old_yaml_data[key])

            &lt;span class="hljs-keyword"&gt;if&lt;/span&gt; key_exists(new_yaml_data[key], &lt;span class="hljs-string"&gt;&amp;#39;image&amp;#39;&lt;/span&gt;) &lt;span class="hljs-keyword"&gt;and&lt;/span&gt; key_exists(old_yaml_data[key], &lt;span class="hljs-string"&gt;&amp;#39;image&amp;#39;&lt;/span&gt;):
                new_yaml_data[key][&lt;span class="hljs-string"&gt;&amp;#39;image&amp;#39;&lt;/span&gt;] = temp[&lt;span class="hljs-string"&gt;&amp;#39;image&amp;#39;&lt;/span&gt;]
            &lt;span class="hljs-keyword"&gt;elif&lt;/span&gt; key == &lt;span class="hljs-string"&gt;&amp;#34;databases&amp;#34;&lt;/span&gt;:
                revert_db_tags(new_yaml_data[key], temp)

&lt;span class="hljs-keyword"&gt;with&lt;/span&gt; &lt;span class="hljs-built_in"&gt;open&lt;/span&gt;(newValuesYAML, &lt;span class="hljs-string"&gt;&amp;#39;w&amp;#39;&lt;/span&gt;) &lt;span class="hljs-keyword"&gt;as&lt;/span&gt; f:
    data = yaml.dump(new_yaml_data, f, sort_keys=&lt;span class="hljs-literal"&gt;False&lt;/span&gt;)
&lt;/code&gt;&lt;/pre&gt;
&lt;!-- Easy Reader Version: That's a lot of strings that probably shouldn't be bare literals --&gt;&lt;div&gt;
	[Advertisement] &lt;b&gt;Plan Your .NET 9 Migration with Confidence&lt;/b&gt;&lt;br/&gt;Your journey to .NET 9 is more than just one decision.Avoid migration migraines with the advice in this free guide. &lt;b&gt;&lt;a href="https://inedo.com/support/whitepapers/dotnet-guide?utm_campaign=dotnet&amp;amp;utm_source=tdwtf-footer"&gt;Download Free Guide Now!&lt;/a&gt;&lt;/b&gt;
&lt;/div&gt;
&lt;div style="clear: left;"&gt; &lt;/div&gt;</description><slash:comments>7</slash:comments><wfw:comment>https://thedailywtf.com/articles/comments/in-the-know</wfw:comment></item><item><dc:creator>Remy Porter</dc:creator><title>CodeSOD: Find a Bar for This One</title><link>https://thedailywtf.com/articles/find-a-bar-for-this-one</link><category>CodeSOD</category><pubDate>Wed, 20 May 2026 06:30:00 GMT</pubDate><guid>https://thedailywtf.com/articles/find-a-bar-for-this-one</guid><description>&lt;p&gt;A depressing quantity of software is what I would call a &amp;#34;data pump&amp;#34;. I have some data over here, and I need it over there. Maybe I&amp;#39;m integrating into a legacy app. Or into an &lt;abbr title="Enterprise Resource Planner"&gt;ERP&lt;/abbr&gt;. Or into a 3rd party API. At the end of the day, I have data in one place, and I want it in another place.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sally&lt;/strong&gt; has a Java application written in the Quarkus framework, which has a nightly batch that works to keep a table of &lt;code&gt;Bar&lt;/code&gt; entities in sync with a table of &lt;code&gt;Foo&lt;/code&gt; entities. (This anonymization comes from Sally) These exist in the same database. There is also a &lt;code&gt;Bar&lt;/code&gt; webservice, which provides information about the &lt;code&gt;Bar&lt;/code&gt; entities. The workflow, such as it is, is that the software needs to find all of the &lt;code&gt;Foo&lt;/code&gt; entities that do not currently have associated &lt;code&gt;Bar&lt;/code&gt; entities, and then call the &lt;code&gt;Bar&lt;/code&gt; webservice to get the required information to create those &lt;code&gt;Bar&lt;/code&gt; entities.&lt;/p&gt;
&lt;p&gt;Let&amp;#39;s see how that works.&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-java"&gt;&lt;span class="hljs-meta"&gt;@Inject&lt;/span&gt; UserTransaction transaction
&lt;span class="hljs-comment"&gt;// If this is annotated with @Transaction the usage in the Message function down below will have some Thread exception&lt;/span&gt;
&lt;span class="hljs-keyword"&gt;public&lt;/span&gt; List&amp;lt;FooData&amp;gt; &lt;span class="hljs-title function_"&gt;getAllFoos&lt;/span&gt;&lt;span class="hljs-params"&gt;()&lt;/span&gt; {
  &lt;span class="hljs-keyword"&gt;try&lt;/span&gt;{
    &lt;span class="hljs-keyword"&gt;return&lt;/span&gt; fooDataRepository.findAllFoos();
  } &lt;span class="hljs-keyword"&gt;catch&lt;/span&gt; (Exception e) {
    &lt;span class="hljs-keyword"&gt;throw&lt;/span&gt; &lt;span class="hljs-keyword"&gt;new&lt;/span&gt; &lt;span class="hljs-title class_"&gt;RuntimeException&lt;/span&gt;(e);
  }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We&amp;#39;ll worry about that comment in a second, but this function returns a list of all of the &lt;code&gt;Foo&lt;/code&gt; objects in the database. It does &lt;em&gt;not&lt;/em&gt; return a list of &lt;em&gt;all the &lt;code&gt;Foo&lt;/code&gt; objects without associated &lt;code&gt;Bar&lt;/code&gt; entities&lt;/em&gt;. It&amp;#39;s just the whole giant list of everything. The underlying database is a standard relational database; it&amp;#39;d be trivially easy to write that query, even going through the &lt;abbr title="Object Relational Mangler"&gt;ORM&lt;/abbr&gt;.&lt;/p&gt;
&lt;p&gt;Well, that&amp;#39;s bad, but it&amp;#39;s all pretty minor. How does the actual update go?&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-java"&gt;&lt;span class="hljs-comment"&gt;// Can&amp;#39;t be annotated with @Transaction because Oracle DB can handle the given Amount of dataEntities in one Transaction &amp;#39;\._./&amp;#39;&lt;/span&gt;
Message &lt;span class="hljs-title function_"&gt;updateBarsWithFoos&lt;/span&gt;&lt;span class="hljs-params"&gt;()&lt;/span&gt; {
  List&amp;lt;FooData&amp;gt; foos = getAllFoos();
  &lt;span class="hljs-keyword"&gt;if&lt;/span&gt;(!foos.isEmpty()){
    foos.forEach(foo -&amp;gt; {
      &lt;span class="hljs-keyword"&gt;try&lt;/span&gt;{
        transaction.begin();
        &lt;span class="hljs-keyword"&gt;if&lt;/span&gt;(barRepository.findByName(foo.getName()) == &lt;span class="hljs-literal"&gt;null&lt;/span&gt;){
          &lt;span class="hljs-keyword"&gt;if&lt;/span&gt;(barDataService.searchByName(foo.getName()) != &lt;span class="hljs-literal"&gt;null&lt;/span&gt; &amp;amp;&amp;amp; barDataService.searchByName(foo.getName()).marker() != &lt;span class="hljs-literal"&gt;null&lt;/span&gt;){
            barRepository.createBar(barDataService.searchByName(foo.getName()));
          }
        }
        transaction.commit();
      } &lt;span class="hljs-keyword"&gt;catch&lt;/span&gt; (Exception e) {
        &lt;span class="hljs-keyword"&gt;try&lt;/span&gt; {
          transaction.rollback();
        } &lt;span class="hljs-keyword"&gt;catch&lt;/span&gt; (Exception ex) {
          &lt;span class="hljs-keyword"&gt;throw&lt;/span&gt; &lt;span class="hljs-keyword"&gt;new&lt;/span&gt; &lt;span class="hljs-title class_"&gt;RuntimeException&lt;/span&gt;(ex);
        }
      }
    });
  }
  &lt;span class="hljs-keyword"&gt;return&lt;/span&gt; &lt;span class="hljs-keyword"&gt;new&lt;/span&gt; &lt;span class="hljs-title class_"&gt;Message&lt;/span&gt;(MessageLevel.INFO, &lt;span class="hljs-string"&gt;&amp;#34;Created bars&amp;#34;&lt;/span&gt;)
};
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Ah, the &lt;em&gt;real&lt;/em&gt; WTF is that it&amp;#39;s an Oracle database. That&amp;#39;s always a WTF.&lt;/p&gt;
&lt;p&gt;But let&amp;#39;s trace through this code.&lt;/p&gt;
&lt;p&gt;We get all of our &lt;code&gt;Foo&lt;/code&gt; entities. We check for emptiness and then do a &lt;code&gt;forEach&lt;/code&gt;, which seems to make the empty check superfluous: a &lt;code&gt;forEach&lt;/code&gt; on an empty list would be a no-op anyway.&lt;/p&gt;
&lt;p&gt;We start a transaction, then check the database: if there are no &lt;code&gt;Bar&lt;/code&gt; objects that link to &lt;code&gt;Foo&lt;/code&gt;, then we call into the &lt;code&gt;barDataService&lt;/code&gt; to find data. If there is, we call into the service &lt;em&gt;again&lt;/em&gt;, to see if the &lt;code&gt;marker&lt;/code&gt; property is not null. If it is, we call into the service &lt;em&gt;again&lt;/em&gt; to get the actual data we&amp;#39;re putting into the database. Then we close the transaction. If anything goes wrong, we rollback the transaction and chuck an exception up the chain.&lt;/p&gt;
&lt;p&gt;That is &lt;em&gt;three&lt;/em&gt; web service calls inside of a database transaction. Three calls which could easily be &lt;em&gt;one&lt;/em&gt;, and that call could easily also happen &lt;em&gt;outside&lt;/em&gt; of a transaction if you&amp;#39;re mindful about confirming your constraints. And of course, because they&amp;#39;re &lt;em&gt;not&lt;/em&gt; mindful at all, they need to manage the transaction directly, and can&amp;#39;t use the &lt;code&gt;@Transaction&lt;/code&gt; annotation provided by their framework, which would at least cut down on some of the boilerplate.&lt;/p&gt;
&lt;p&gt;Now, I&amp;#39;m sure you&amp;#39;ll be shocked - &lt;em&gt;shocked&lt;/em&gt; - to learn that the webservice is actually a bit flaky, and thus times out from time to time. And this isn&amp;#39;t the &lt;em&gt;only&lt;/em&gt; batch job running, which means the long-lived transactions cause all sorts of contention and terrible performance across the various batches. &lt;em&gt;And&lt;/em&gt; this app doesn&amp;#39;t have its connection pool properly configured, so the entire software stack can exhaust all of its database connections surprisingly quickly, causing yet more failures.&lt;/p&gt;
&lt;p&gt;The root of the WTF, of course, is doing this as a batch job. A well engineered application would do everything it could to &lt;em&gt;not&lt;/em&gt; create data in the database that isn&amp;#39;t referentially sound. There, Sally gives us the one bit of good news:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;My current project will do away with the batch processing altogether, so we can say, &amp;#34;RIP, transactional wholesale triple caller!&amp;#34;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;!-- Easy Reader Version: Batch jobs are easy to reason about when you're planning them, and impossible to reason about once they've lived in the wild for any amount of time. --&gt;&lt;div&gt;
	&lt;img src="https://thedailywtf.com/images/inedo/proget-icon.png" style="display:block; float: left; margin: 0 10px 10px 0;"/&gt; [Advertisement] 
	Keep all your packages and Docker containers in one place, scan for vulnerabilities, and control who can access different feeds. ProGet installs in minutes and has a powerful free version with a lot of great features that you can upgrade when ready.&lt;a href="https://inedo.com/proget?utm_source=tdwtf&amp;amp;utm_medium=footer&amp;amp;utm_content=PlebsFooter"&gt;Learn more.&lt;/a&gt;
&lt;/div&gt;
&lt;div style="clear: left;"&gt; &lt;/div&gt;
</description><slash:comments>12</slash:comments><wfw:comment>https://thedailywtf.com/articles/comments/find-a-bar-for-this-one</wfw:comment></item><item><dc:creator>Remy Porter</dc:creator><title>Three Digit Acronyms</title><link>https://thedailywtf.com/articles/three-digit-acronyms</link><category>Feature Articles</category><pubDate>Tue, 19 May 2026 06:30:00 GMT</pubDate><guid>https://thedailywtf.com/articles/three-digit-acronyms</guid><description>&lt;p&gt;&lt;strong&gt;JB&lt;/strong&gt; has a database table that, at first glance, looks like one of those data warehouse tables that exists to make queries performant. You know the sort, the table that contains every date between 1979 and 2050, or every number out to 1,000,000 or something. It looks dumb, but it helps make certain joins and queries performant.&lt;/p&gt;
&lt;p&gt;The database table is called &lt;code&gt;three_alpha_numerics&lt;/code&gt;. It has two columns: &lt;code&gt;digit&lt;/code&gt;, which contains three characters, and &lt;code&gt;is_numeric&lt;/code&gt;, which is a a single character: &amp;#39;Y&amp;#39; or &amp;#39;N&amp;#39;. It looks roughly like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;+-------+------------+
| digit | is_numeric |
+-------+------------+
| 009   | Y          |
+-------+------------+
| 00A   | N          |
+-------+------------+
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So, for example, if you wanted all the possible numeric triples, you could &lt;code&gt;SELECT digit FROM three_alpha_numerics WHERE is_numeric = &amp;#39;Y&amp;#39;&lt;/code&gt;, which is obviously the easiest thing one can imagine.&lt;/p&gt;
&lt;p&gt;So what is this &lt;em&gt;for&lt;/em&gt;? Well, it&amp;#39;s used by a stored procedure that generates unique IDs. That stored procedure does a left join against another table to find all the unused &lt;code&gt;digit&lt;/code&gt;s. And here&amp;#39;s the real gotcha: that stored procedure only ever uses the rows where &lt;code&gt;is_numeric&lt;/code&gt; is &lt;code&gt;Y&lt;/code&gt;, meaning the vast majority of the data in this table is never used.&lt;/p&gt;
&lt;p&gt;Unique IDs, of course, are an incredibly difficult task for databases to do, so it absolutely makes sense that we create a system that allows us to only have 1,000 unique IDs. That&amp;#39;s more than 640, which should be enough for anyone. Having many thousands of unusable alphanumeric triplets is just the cost we have to pay.&lt;/p&gt;
&lt;!-- Easy Reader Version: Three digits you shall meet: https://www.youtube.com/watch?v=Hk9uevsHvAE&amp;list=RDHk9uevsHvAE&amp;start_radio=1&amp;pp=ygUVdGhlIHN3b3JkIHRyZXMgYnJ1amFzoAcB --&gt;&lt;div&gt;
	&lt;img src="https://thedailywtf.com/images/inedo/buildmaster-icon.png" style="display:block; float: left; margin: 0 10px 10px 0;"/&gt; [Advertisement] 
	&lt;a href="https://inedo.com/BuildMaster?utm_source=tdwtf&amp;amp;utm_medium=footerad&amp;amp;utm_term=2018&amp;amp;utm_content=Self_Service&amp;amp;utm_campaign=Buildmaster_Footer"&gt;BuildMaster&lt;/a&gt; allows you to create a self-service release management platform that allows different teams to manage their applications. &lt;a href="https://inedo.com/BuildMaster/download?utm_source=tdwtf&amp;amp;utm_medium=footerad&amp;amp;utm_term=2018&amp;amp;utm_content=Self_Service&amp;amp;utm_campaign=Buildmaster_Footer"&gt;Explore how!&lt;/a&gt; 
&lt;/div&gt;
&lt;div style="clear: left;"&gt; &lt;/div&gt;
</description><slash:comments>13</slash:comments><wfw:comment>https://thedailywtf.com/articles/comments/three-digit-acronyms</wfw:comment></item></channel></rss>