"We're had been using a manufacturer's web service, but started getting errors all of a sudden," wrote Peter Lindgren. "Something has really, really failed."

<StatusDescription>Internal Server Error</StatusDescription>
  <X-Backside-Transport>FAIL FAIL,FAIL FAIL,FAIL FAIL</X-Backside-Transport>

"Fortunately, a short time later, it started working again with this message."

  <X-Backside-Transport>OK OK,OK OK,OK OK</X-Backside-Transport>

"I'm not sure of the purpose of this," Jasmine wrote via the Submit to The Daily WTF visual studio extension, "maybe the stack was just too small or something?"

Public Function Save() As Boolean
    Catch ex As Exception
        Throw ex
    End Try
End Function


"I was asked to modify some simple web page used to generate an online store," Mihai Todor wrote, "here's a Javascript function that I found in it, which is used to validate the required fields."

function checkdata() {
    dataok = true;
    t1 = document.forms.signup.firstName.value;
    t2 = document.forms.signup.lastName.value;
    t3 = document.forms.signup.userName.value;
    t4 = document.forms.signup.password.value;
    t5 = document.forms.signup.passwordConfirm.value;
    t6 = document.forms.signup.email.value;
    t7 = document.forms.signup.url.value;
    t8 = document.forms.signup.adminFrontname.value;
    t9 = document.forms.signup.locale.options.selectedIndex;
    t10 = document.forms.signup.currency.options.selectedIndex;
    t11 = document.forms.signup.timezone.options.selectedIndex;
    t12 = document.forms.signup.packetType.options.selectedIndex;
    t13 = document.forms.signup.captcha_code.value;
    if(t1 == '' || t2 == '' || t3 == '' || t4 == '' || t5 == '' || t6 == '' || t7 == '' || t8 == ''){
        alert("Please fill-up all the fields");
        dataok = false; return(dataok);}
    if(t4 != t5){
        alert("Please enter the password again");
        dataok = false; return(dataok);}
    if(t9 == 0){
        alert("Please select a locale");
        dataok = false; return(dataok);}
    if(t10 == 0){
        alert("Please select a currency");
        dataok = false; return(dataok);}
    if(t11 == 0){
        alert("Please select a time zone");
        dataok = false; return(dataok);}
    if(t12 == 0){
        alert("Please select a packet type");
        dataok = false; return(dataok);}
    if(t13 == ''){
        alert("Please fill-up the code field");
        dataok = false; return(dataok);}


"I've seen these types of constants on The Daily WTF before and always questioned if they were real," wrote Sterge, "and then I saw these."

public static final String SLASH = "/";
public static final String PERCENT = "%";


"I'm on a team that maintains a pretty 'serious' banking application," Giga B wrote, "it's pretty serious about the number of parameters in functions."

public void WriteStep1Data(int LoanRequestID,
                           string InsertDate,
                           string OperatorID,
                           string FirstName,
                           string LastName,
                           string BirthDay,
                           int DocuemntTypeID,
                           int MaritialStatusID,
                           string DocumentIssueDate,
                           string DocumentExpireDate,
                           string DocumentIssuer,
                           string DocumentNo,
                           string PersonalNo,
                           int UniversityDegreeID,
                           string Address,
                           string Address2,
                           int RealAddressLivingPeriod,
                           int ChildrenCount,
                           int FamilyMembersCount,
                           decimal MonthlyIncome,
                           decimal MonthlyFamilyExpanses,
                           string HomePhoneNumber,
                           string MobilePhoneNumber,
                           string WorkPhoneNumber,
                           string EmailAddress,
                           string JobOrganizationName,
                           string JobOrganizationAddress,
                           string JobOrganizationActivity,
                           string JobOrganizationPhoneNumber,
                           string JobPosition,
                           string JobWorkingYears,
                           string JobBossName,
                           string JobBossPhoneNumber,
                           byte ClientSex,
                           decimal FinTotalProductsAmount,
                           decimal FinCommissionAmount,
                           int FinLoanPeriod,
                           decimal FinFirstPaymentAmount,
                           decimal FinLoanAmount,
                           decimal FinMonthlyPaymentAmount,
                           string GuarantorName,
                           string GuarantorLastName,
                           string GuarantorBirthDate,
                           string GuarantorPersonalNo,
                           int? GuarantorDocType,
                           string GuarantorDocumentNo,
                           string GuarantorDocIssuer,
                           string GuarantorDocIssueDate,
                           string GuarantorDocExpireDate,
                           string GuarantorTelHome,
                           string GuarantorTelMobile,
                           string GuarantorAddress,
                           string GuarantorAddressReal,
                           string GuarantorJobName,
                           decimal GuarantorIncome,
                           byte? GuarantorSex,
                           decimal HistoryPlaticAnnualTurnOver,
                           string HistoryDescription,
                           string MarketingQ1,
                           string MarketingQ2,
                           int StatusID,
                           string DateViewed,
                           string DateAnswered,
                           string BackOfficeUserID,
                           string RepaymentDate,
                           string ShopID,
                           string CalculationGroupID,
                           decimal RegFeeAmount,
                           int clientDeptNo,
                           int guarantorDeptNo,
                           int guarantorMaritialStatusID,
                           string AccountCodeWord,
                           string ClientFatherName,
                           string ClientBirthPlace,
                           string ClientCityAttendingToReg,
                           string GuarantorFatherName,
                           string GuarantorBirthPlace,
                           string GuarantorCityAttendingToReg,
                           string GuarantorJobActivity,
                           string GuarantorJobPosition,
                           string GuarantorJobContactPhone,
                           string GuarantorJobCodeWord,
                           string GuarantorEmailAddress
   ... snip a few hundred lines ...


"I learned a neat trick from our enterprise framework," Eli noted, "if you want to convert an int to a double, just do this!"

double d = Double.valueOf(new Integer(i).toString()).doubleValue();


"I had to look over some C# code written by a colleague of mine," notes John D, "the following lines represent just the tip of the iceberg of the pain that I had to go through while understanding the code."

bool true1 =true;
bool true12 = true;
.... snip ....
true1 = false;
true1 = false;


"I found this pattern in source code I have been working on," wrote Nas Nubian, "this is how some developer decided to open a new window for when users click on a links."

<a href="/the/path/to/the/url" 
  onclick="window.open(this.getAttribute('href'),'_blank');return false;">
  link text


"So," wonders Johnny B, "I guess GUID from our production db servers are better than local GUID?"

Function GetNewGuid()
    Dim cnGuid, rsGuid
    Set cnGuid = CreateObject("ADODB.Connection")
    Set rsGuid = CreateObject("ADODB.Recordset")

    cnGuid.Open = _
        "Provider=SQLOLEDB.1;" + 
        "Data Source=<production server>; " + 
        "Initial Catalog=<production DB> " +
        "user id = '********';" + 

    rsGuid.Open "SELECT newid() as Guid", cnGuid

    If Not rsGuid.EOF Then
        GetNewGuid = rsGuid("Guid").Value
    End If
End Function


"The comment says it all," wrote Michael.

 * Defines the value for none. Default is "none".
public static String NONE = "none";


"This is snippet of code I found in a large program I maintain," wrote Brian. "The original developers have long since moved on. Funnily enough, this particular code was properly mutexed, but I guess the paranoid programmer doesn't trust mutexes. I only wish the original developers were so 'paranoid' when it came to avoiding things like buffer overflows, memory leaks, and sql injection."

if ( resData.state() == RESOURCE_STATE_ACTIVE )
    elapsedTime.setBase( resData.startTime() );
    if ( elapsedTime.diff() >= maxDuration )
        // Do one more validity check, the paranoid programmer knows
        // the state may have changed since the last check.
        if ( resData.state() == RESOURCE_STATE_ACTIVE )
            resourceActiveTooLong( resData );


[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!