The Coding Lounge

dequadin

Expert Member
Joined
May 9, 2008
Messages
1,434
Thread hijack, not bothered to create a new one.

Courtesy of the daily wtf
What Fundamental Underpinning? said:
Sascha was at wit's end. "It's a fundamental underpinning of the web! Server-side code cannot interact with the user's web browser and tell it to close the window. You have to do it in JavaScript!"

"Okay," Sascha's coworker smiled wryly, "not only can it be done, but I've done it! How's that for your 'fundamental underpinning'?"

"Fine," he conceded, "just show me how you closed the web browser window without using JavaScript!"

The coworker quickly pulled up an ASP.NET code-behind file and scrolled to the following function, which was called by a button handler.
Code:
        Private Sub closePage(ByRef page As System.Web.UI.Page)
            Dim s As String
            s = "<SCRIPT LANGUAGE='JavaScript'>" & vbCrLf
            s &= "<!--" & vbCrLf
            s &= "window.close();" & vbCrLf
            s &= "//-->" & vbCrLf
            s &= " </SCRIPT>"
            page.RegisterClientScriptBlock("tjsClosePage", s)
        End Sub
"Well," Sascha said, "congratulations."

Best site ever :)
 

dequadin

Expert Member
Joined
May 9, 2008
Messages
1,434
This thread is now about The Daily WTF.../

http://thedailywtf.com/Articles/Desperate-Times.aspx
Desperate Times said:
Code:
'This Subroutine is used to add entries to the system log file
Public Sub [b]LogEntry[/b](strFunction As String, strMsg As String)    
Dim strLogFileName As String
Dim strPathAndFileName As String    
'Set up error handling
    [b]On Error GoTo ErrorHandler[/b]
'Check that System Logging is enabled
    If Form1.chkLogEnabled.Value = 1 Then        
'Create the file name for the current day
        strLogFileName = "Logs\" & CStr(Year(Now)) & CStr(Month(Now)) & CStr(Day(Now)) & "_Log.txt"        
'Create the full path name
        strPathAndFileName = SYSTEM_FOLDER & strLogFileName        
'If the Log File exists then
        If FileExists(strPathAndFileName) Then            
'Append to the end of the file - open for append
            Open strPathAndFileName For Append As #1
        Else            
'Otherwise open a new file and add the new message - Open for output
            Open strPathAndFileName For Output As #1        
'End if system log file exists
        End If        
'Write the new line to the system log file
        Print #1, Format(Date, "mm/dd/yyyy") & "  " & Format(Time, "hh:mm:ss") & "  " & strFunction & "  " & strMsg        
'Close the system log file
        Close #1    
'End if system logging is enabled
    End If    
'Exit subroutine
    GoTo EndSub
'Error Handling Section
ErrorHandler:
'Get Windows Error Description
    strError = Err.Description
'Write the System Log
    [b]Call LogEntry("LogEntry: ", strError)[/b]
'Resume
    Resume Next   
EndSub:
End Sub

That's some serious error handling fail....
 

semaphore

Honorary Master
Joined
Nov 13, 2007
Messages
15,195
section .data
haha: db 'wtf are you people trying to achieve here btw?',0x0a
dlen: equ $ - haha

section .text
global _wtfisthis

_rofl:
int 0x25 ;
ret ;

_wtfisthis:
push dword haha;
push dword dlen;
push dword 0x01 ;
mov eax,0x03 ;
call _rofl

add esp,0x12 ;
push dword 0x00 ;
mov eax,0x3f ;
call _rofl
 

foozball3000

Executive Member
Joined
Oct 28, 2008
Messages
5,827
section .data
haha: db 'wtf are you people trying to achieve here btw?',0x0a
dlen: equ $ - haha

section .text
global _wtfisthis

_rofl:
int 0x25 ;
ret ;

_wtfisthis:
push dword haha;
push dword dlen;
push dword 0x01 ;
mov eax,0x03 ;
call _rofl

add esp,0x12 ;
push dword 0x00 ;
mov eax,0x3f ;
call _rofl

:confused:
 

Other Pineapple Smurf

Honorary Master
Joined
Jun 21, 2008
Messages
14,593
section .data
haha: db 'wtf are you people trying to achieve here btw?',0x0a
dlen: equ $ - haha

section .text
global _wtfisthis

_rofl:
int 0x25 ;
ret ;

_wtfisthis:
push dword haha;
push dword dlen;
push dword 0x01 ;
mov eax,0x03 ;
call _rofl

add esp,0x12 ;
push dword 0x00 ;
mov eax,0x3f ;
call _rofl


Code:
#include <iostream>
using namespace std;
int main()
{
  cout << "Bummer" << endl;
  cout << "You beat me to it!!!" << endl;
  cout << endl;
  exit 0
}
 

dequadin

Expert Member
Joined
May 9, 2008
Messages
1,434
Code:
public class Employee : Slave
{
    public override void Work(string DayOfWeek)
    {
        if (DayOfWeek != "Friday"
        {
            base.Work();
        }
        else
        {
            Forum myForum = new Forum("MyBroadBand");
            myForum.TrollForInterestingThreads();
            if (myForun.InterestingThreads.Count > 0)
            {
                foreach (Thread t in myForum.InterestingThreads)
                    t.Post();
            }
            else if (this.DurationSinceLastCoffe > 30)
            {
                this.MakeCoffee();
            }
            else 
            {
                 this.BashKeybordRandomly();
            }
        }
    }
}

void main()
{
    Employee me = new Employee("dequadin");

    while (me.Boss.Status == BossStatus.StillAtWork) 
    {
         me.Work();
    }
}
 

guest2013-1

guest
Joined
Aug 22, 2003
Messages
19,800
Code:
public class Employee : Slave
{
    public override void Work(string DayOfWeek)
    {
        if (DayOfWeek != "Friday"
        {
            base.Work();
        }
        else
        {
            Forum myForum = new Forum("MyBroadBand");
            myForum.TrollForInterestingThreads();
            if (myForun.InterestingThreads.Count > 0)
            {
                foreach (Thread t in myForum.InterestingThreads)
                    t.Post();
            }
            else if (this.DurationSinceLastCoffe > 30)
            {
                this.MakeCoffee();
            }
            else 
            {
                 this.BashKeybordRandomly();
            }
        }
    }
}

void main()
{
    Employee me = new Employee("dequadin");

    while (me.Boss.Status == BossStatus.StillAtWork) 
    {
         me.Work();
    }
}

That won't compile, you misspelled myForum in your if statement.... :)
 

evilsee

Senior Member
Joined
Sep 12, 2003
Messages
563
Code:
while (thisThread.isRunning) {
  try {
    Socket s = new Socket(yourBoss);
    SocketWriter sw = new SocketWriter(s);

    sw.connect();
    sw.sendText("I see coders with too much time on their hands!");

    sw.disconnect();
  } catch (AnyDamnExcpetion e) {
  }

while (1>0) {
echo "lol";
}
 

rwenzori

Honorary Master
Joined
Feb 17, 2006
Messages
12,360
Code:
BTW    LOLCode 
BTW
HAI
    VISIBLE "O HAI! IM IN UR THREDZ!"
    I HAS A VAR
    LOL VAR R 5
    IM IN YR LOOP
        VISIBLE " YOU PROGRMRS IZ WUSSIEZ! "!
        NERFZ VAR!!
        IZ VAR LIEK 0?
            YARLY
                VISIBLE " TIMEZ 2 GO NOW "!
                GTFO
            NOWAI
                VISIBLE " NYAH NYAH NYAH "!
        KTHX
    KTHX
    VISIBLE "KTHXBAI!"
KTHXBYE

;)
 

dequadin

Expert Member
Joined
May 9, 2008
Messages
1,434
Daily wtf dosage:

CodeThatDocumentsItselfSoWellItDoesNotNeedComments said:
“When I first met the lead developer at my new job, we had a very long and very good conversation about code quality,” Ben Stilgar wrote. “He and I just seemed to click, especially when it came to self-documenting code: architecture should balance functionality and understandability, program flow should be optimized only after performance problem, and code should be clear and understandable, even if it takes longer to write.”

“You can imagine my excitement when it came time to opening The System, which was the lead developer’s masterpiece and culminated over a decade of design and development experience into a clean, almost-perfect application. You can also imagine my disappointment when I finally dived in and learned exactly what he meant by self-documenting code.”

Code:
    switch (mIntegrationDirection)
    {
       case InventoryIntegrationDirection.DoTheSameChangeInShop:
          DoTheSameChangeInShop(GetChangedDataFromInventory(mLastSynchDate));
          break;

       case InventoryIntegrationDirection.DoTheSameChangeInInventory:
          DoTheSameChangeInInventory(GetChangedDataFromShop(mLastSynchDate));
          break;

       case InventoryIntegrationDirection.DoTheSameChangeInShopThenDoTheSameChangeInInventoryForNotChangedDataInInventory:
          DoTheSameChangeInShopThenDoTheSameChangeInInventoryForNotChangedDataInInventory(
    	   GetChangedDataFromInventory(mLastSynchDate), 
    	   GetChangedDataFromShop(mLastSynchDate));
          break;

       case InventoryIntegrationDirection.DoTheSameChangeInInventoryThenDoTheSameChangeInShopForNotChangedData:
          DoTheSameChangeInInventoryThenDoTheSameChangeInShopForNotChangedData(
    	   GetChangedDataFromShop(mLastSynchDate), 
    	   GetChangedDataFromInventory(mLastSynchDate));
          break;

       default:
          break;
    }

Ben added, “when the lead developer asked for my feedback, I gritted my teeth and smiled, doing my best to compliment-but-not-compliment the design. He responded, ‘and the best thing is, with code like this, there is no need to write a single comment, anywhere.’ I’m not sure if there wasn’t a need to have comments… but I can say that there wasn’t a single comment, anywhere.”

fullArticleCanBeFoundByFollowingTheURLHere (Notice my correct use of camel case)

EDIT: Anyone know what happened to the Russian spammer earlier?
 
Top