Comment On PICKing Javascript

Originally posted to the Sidebar by "hulver"... [expand full text]
« PrevPage 1 | Page 2Next »

Re: PICKing Javascript

2008-07-09 08:08 • by fruey (unregistered)
The WTF here is obviously that you could just call the ASP file in a new window, which would Response.Write "email sent" on success, and then offer you a button to close it which would render the previous screen visible.

The second WTF, using AJAX to fix the problem. Totally a winning solution, to add more complexity to a screwed system to make it even more WTF.

The third WTF, why not just have the ASP code in the first place and refresh the page with detection of whether or not a form variable in the request object is set, and run an email.

OMFG.

Re: PICKing Javascript

2008-07-09 08:11 • by bitblit (unregistered)
TRWTF? ASP.

TRRWTF? Not being first.

Bah!

Re: PICKing Javascript

2008-07-09 08:16 • by ant (unregistered)
the fact that you're there would suggest that you can't get work with people that are less useless doing something more interesting than baby sitting a cobbled together crud application in classic ASP ..

my advice would be get out or shut up and deal with it ;)

Re: PICKing Javascript

2008-07-09 08:18 • by ParkinT
ASP with PICK. Now, that is the most disparate combination I could possibly think of!!

Re: PICKing Javascript

2008-07-09 08:34 • by Pick Me (unregistered)
This has nothing to do with PICK, and everything to do with the fact that people who code pop-up windows should have their fingers broken.

Re: PICKing Javascript

2008-07-09 08:39 • by JJK (unregistered)
I guess whenever you consider submitting a WTF you should consider your solution. Unfortunately smugness can get in the way of you seeing that you are just perpetuating the WTF.

You immediately saw the proper way of doing it but, due to insufficeint knowledge, went and hacked it in another way. This is one of the biggest crimes in development. And boy is this crime rife! There seem to be far to many people not willing to put up their hands up and say: "I don't know". There's nothing wrong with acknowledging the fact you don't know because then you have the opportunity to go and research it properly.

Anyway, the fact that old ASP was being used is not a WTF. You would be a very lucky developer indeed if you got to pick the technolgies you used for every project! In most cases it is not even dumb project managers who select the technologies, but the even dumber customers!

Re: PICKing Javascript

2008-07-09 08:42 • by anonnoob (unregistered)
Interesting. Someone is posting their own code here to get feedback.

Alex, maybe you should make a new category for that for fledgling developers.

Re: PICKing Javascript

2008-07-09 08:50 • by andrewbadera
205136 in reply to 205133
anonnoob:
Interesting. Someone is posting their own code here to get feedback.

Alex, maybe you should make a new category for that for fledgling developers.


+1

Lame "WTF".

Re: PICKing Javascript

2008-07-09 08:53 • by Mr Pedantic (unregistered)
Getting the asp file to remove itself? If one is not careful that could be a gaping security hole right there

Re: PICKing Javascript

2008-07-09 08:54 • by hulver
205139 in reply to 205133
anonnoob:
Interesting. Someone is posting their own code here to get feedback.

Alex, maybe you should make a new category for that for fledgling developers.

I don't need feedback on that code, I know it's a horrible solution.

However, it did the job of keeping a dead system limping along and made some the lives of some customers who have to use it easier.

It also did it without introducing any further problems.

Re: PICKing Javascript

2008-07-09 08:59 • by d000hg (unregistered)
205142 in reply to 205132
JJK:
You immediately saw the proper way of doing it but, due to insufficeint knowledge, went and hacked it in another way. This is one of the biggest crimes in development.
If you have the choice between a quick dirty fix, or a proper solution which will require a lot of work, it's idealistic to suggest you always do the latter. This is the real world, the bad code already exists, and has to be addressed appropriately.
If you find a wall has been built badly in your house, you would normally find a way to strengthen the wall rather than tear it down and rebuild.

Re: PICKing Javascript

2008-07-09 09:01 • by hulver
205143 in reply to 205132
JJK:
I guess whenever you consider submitting a WTF you should consider your solution. Unfortunately smugness can get in the way of you seeing that you are just perpetuating the WTF.

You immediately saw the proper way of doing it but, due to insufficeint knowledge, went and hacked it in another way.


Smugness? I was in no way proud of my code in this solution. I thought it was a horrible hack, but it kept the system going for a bit longer. TRWTF was that the fix was in some ways worse than the problem.

I've now had the time to re-write that bit of code properly and remove that particular WTF.

Re: PICKing Javascript

2008-07-09 09:01 • by Frunobulax (unregistered)
So, let me get this straight:

"Hmm... This code is causing something odd to happen."
"Oh, why didn't they use the built-in e-mail functions instead of creating a sub-par work-around?"
"I'm going to fix it by creating a needlessly complex work-around because I don't know the built-in e-mail functions either."

So, is this a self-realizing WTF?
"Hey guys! Look at this WTF I made! Post it on your site!"

Re: PICKing Javascript

2008-07-09 09:05 • by Marc (unregistered)
Oooh, I just got the PICK-shivers. Two years of my life I'll never get back...

===
http://nomagichere.blogspot.com

Re: PICKing Javascript

2008-07-09 09:10 • by DangerMouse9
From a debugging standpoint, wouldn't you want your error messages to be slightly different on why the email failed to send?

At least then you could go directly to the cause of the problem instead of having multiple places to check because they all have the same error message.

Re: PICKing Javascript

2008-07-09 09:12 • by akatherder
205148 in reply to 205128
ant:
the fact that you're there would suggest that you can't get work with people that are less useless doing something more interesting than baby sitting a cobbled together crud application in classic ASP ..

my advice would be get out or shut up and deal with it ;)


That's a huge assumption. I maintain a bunch of PHP applications, but once every month or so, someone comes up from the dungeon to complain about a bug in one of the old ASP apps we are phasing out. I merrily fix it as quickly and ugly as I can since we were told not to worry about any kind of future maintenance or code quality.

Re: PICKing Javascript

2008-07-09 09:14 • by Aaron
I think that the Ajax version is OK. It probably took all of 5 minutes to write, compared to what might have been several hours learning everything necessary about PICK to write and test an internal notification system. As long as the intent was to do it properly afterwards (i.e. book it as "technical debt"), then it's reasonable enough.

Having an ASP page delete itself, on the other hand... that's more than a little disturbing. How about just checking the user-agent or putting in a robots file?

Re: PICKing Javascript

2008-07-09 09:16 • by DL (unregistered)
Non-idempotent FTW!

Re: PICKing Javascript

2008-07-09 09:17 • by DylanW
OK, I'm going to sound like a complete noob here, but... what's PICK? This is the first time I've ever heard of it.

Re: PICKing Javascript

2008-07-09 09:17 • by hulver
205152 in reply to 205144
Frunobulax:
So, let me get this straight:

"Hmm... This code is causing something odd to happen."
"Oh, why didn't they use the built-in e-mail functions instead of creating a sub-par work-around?"
"I'm going to fix it by creating a needlessly complex work-around because I don't know the built-in e-mail functions either."

So, is this a self-realizing WTF?
"Hey guys! Look at this WTF I made! Post it on your site!"


Actually it was more that the method of sending email was hard coded into about 100 places in the application, and this was a quick fix that could be done in one place to keep things going until it could be done properly.

Re: PICKing Javascript

2008-07-09 09:20 • by Numeromancer
205153 in reply to 205146
PICK is its own WTF. And its inventor was a Dick.

I worked for two years on PICK Basic infested with WTFs; that language is to WTFs what soft wood is to termites.

I have a sharp, burning stick for the eyes of the first idiot who says "you can write bad code in any language."

Re: PICKing Javascript

2008-07-09 09:22 • by AnonyMOUS (unregistered)
The real WTF = alert ('Could not send email due to popup windows being blocked');

Re: PICKing Javascript

2008-07-09 09:23 • by JJK (unregistered)
205156 in reply to 205142
d000hg:
JJK:
You immediately saw the proper way of doing it but, due to insufficeint knowledge, went and hacked it in another way. This is one of the biggest crimes in development.
If you have the choice between a quick dirty fix, or a proper solution which will require a lot of work, it's idealistic to suggest you always do the latter. This is the real world, the bad code already exists, and has to be addressed appropriately.
If you find a wall has been built badly in your house, you would normally find a way to strengthen the wall rather than tear it down and rebuild.

I'm not talking about rebuilding a database, redesigning all the business logic and a code rewrite. I was talking about spending, lets be honest, a couple of hours research (google?) and then maybe another hour implementing the proper solution.

And by the way, if I had found a badly built wall in my house that could seriously effect the stability and safety of the house then yes, I would do the proper job and rebuild it. Even at a greater cost. Take some pride in your work.

Re: PICKing Javascript

2008-07-09 09:25 • by JJK (unregistered)
205157 in reply to 205153
Numeromancer:

I have a sharp, burning stick for the eyes of the first idiot who says "you can write bad code in any language."


Definitely not defending PICK. But I must say it:

"But you CAN write bad code in any language!"

Re: PICKing Javascript

2008-07-09 09:27 • by Quango (unregistered)
205159 in reply to 205126
bitblit:
TRWTF? ASP.

TRRWTF? Not being first.

Bah!


TRTRWTF: someone who instantly blames the technology in use when it's nothing whatsoever to do with the problem.

Re: PICKing Javascript

2008-07-09 09:29 • by SQB
205161 in reply to 205152
hulver:
... this was a quick fix that could be done in one place to keep things going until it could be done properly.

I agree with you. Yes, in an ideal world, we should fix this once and for all, the right way. Unfortunately, we live in a less than ideal world where we have to resort to these kinds of tricks. You did the right thing, first fixing the problem and then, when opportunity arose, fixing the code.

Re: PICKing Javascript

2008-07-09 09:30 • by Noob Cloo (unregistered)
205162 in reply to 205151
DylanW:
OK, I'm going to sound like a complete noob here, but... what's PICK? This is the first time I've ever heard of it.

No, the complete noob part is that you've never heard of Wikipedia.

http://en.wikipedia.org/wiki/Pick_operating_system

Re: PICKing Javascript

2008-07-09 09:30 • by ambrosen (unregistered)
205163 in reply to 205154
AnonyMOUS:
The real WTF = alert ('Could not send email due to popup windows being blocked');

Right: you do know the difference between a message box and a new browser window, don't you?

Re: PICKing Javascript

2008-07-09 09:38 • by Matt.C
205164 in reply to 205129
ParkinT:
ASP with PICK. Now, that is the most disparate combination I could possibly think of!!


ASP + PICK?

You could call it ASPIC, it's so slow.

Re: PICKing Javascript

2008-07-09 09:40 • by bitblit (unregistered)
205166 in reply to 205159
TRRRWTF: someone who doesn't realize that ASP is responsible for 99.999% of the worlds problems -- including world hunger, Rosie O'Donnell's pants, and the soon-to-arrive world war between behavioral scientists and militant vegans

Re: PICKing Javascript

2008-07-09 09:47 • by DylanW
I actually did google it, but didn't know if it was specifically a language, framework, or OS. Just searching for "PICK" is sort of generic.

Re: PICKing Javascript

2008-07-09 09:52 • by Dan (unregistered)
When you only have a hammer, everything looks like a nail.

Re: PICKing Javascript

2008-07-09 09:53 • by Dennis C. Fait (unregistered)
emails
emails
emails

How often to you check you mails at the Post Office? How long are you going to follow the fools who don't know how to equate mail with email and letter with eletter?

You all sound like toddlers trying to speak the language.

Re: PICKing Javascript

2008-07-09 09:55 • by Neil (unregistered)
205173 in reply to 205152
hulver:

Actually it was more that the method of sending email was hard coded into about 100 places in the application, and this was a quick fix that could be done in one place to keep things going until it could be done properly.


TRWTF: Going into these comments and trying to defend yourself against the nitpickers. That is a completely no-win situation.

Re: PICKing Javascript

2008-07-09 09:58 • by FredSaw
205177 in reply to 205144
Frunobulax:
So, let me get this straight:
*snip*
"I'm going to fix it by creating a needlessly complex work-around because I don't know the built-in e-mail functions either."
What he said was, "Not quite confident enough in my first month to refactor the code to call the internal email routine, I leveraged my knowledge of AJAX to solve the problem." My impression of this was, not that he didn't know the built-in functions, but that he didn't think that he in his n00bism to this job could presume to rip out a chunk of code that someone previously had written for some reason that was apparent to them, but not to him, and replace it with something completely different.

Re: PICKing Javascript

2008-07-09 09:58 • by Malcolm Parsons (unregistered)
> alert('An error occured while sending your email. Your email could not be sent');

Can nobody spell the word "occurred"?

Re: PICKing Javascript

2008-07-09 10:01 • by Matt.C
205179 in reply to 205162
Noob Cloo:
DylanW:
OK, I'm going to sound like a complete noob here, but... what's PICK? This is the first time I've ever heard of it.

No, the complete noob part is that you've never heard of Wikipedia.

http://en.wikipedia.org/wiki/Pick_operating_system


According to Wikipedia:

The Pick OS invites comparison with MUMPS.


*turns valve and fills cube with superheated steam*

Re: PICKing Javascript

2008-07-09 10:04 • by jimlangrunner
Buy a house
move in
It rains, and you notice the roof is leaking
Put a bucket under the leak
When it stops raining, inspect the roof.
Determine what all needs to be fixed and how to fix it.
Fix the darned roof.

Sounds like hulver did the right thing to me.

Re: PICKing Javascript

2008-07-09 10:08 • by Dave Ross (unregistered)
I spent the first couple years of my career working on Pick & Unidata systems (and it pretty much killed my career prospect until I got my SCJP cert). We never had any problems sending emails from a Pick system. In fact, all the confirmation emails from a certain online flower company with a three-letter name came from an HP-9000 running Pick D3 until a couple of years ago.

All this back & forth in the OP could have been fixed by running Pick on a Unix operating system instead of Windows. We just wrote our emails to temporary files and called sendmail using the Pick equivalent of system().

In a pinch, PickBASIC in D3 supports sockets. You could open a connection to port 25 & write your own SMTP client.

But, I have to agree with the previous poster who noted that most Pick systems are a mess of WTFs. You can write some really cool code in Pick if you know what you're doing. But, there's a lot of Pick developers out there who know how to write the same report 30 different ways and that's about it.

Re: PICKing Javascript

2008-07-09 10:11 • by Pyrtolin (unregistered)
205183 in reply to 205156
And by the way, if I had found a badly built wall in my house that could seriously effect the stability and safety of the house then yes, I would do the proper job and rebuild it. Even at a greater cost. Take some pride in your work.


And while you were researching how to rebuild it right, would you leave it alone to collapse on itself, or would you put in a quick brace to support it while you got everything you needed together to do it right?

Re: PICKing Javascript

2008-07-09 10:14 • by lImbus (unregistered)
omfg, you're my hero...

Re: PICKing Javascript

2008-07-09 10:26 • by JJK (unregistered)
205195 in reply to 205183
Pyrtolin:
And by the way, if I had found a badly built wall in my house that could seriously effect the stability and safety of the house then yes, I would do the proper job and rebuild it. Even at a greater cost. Take some pride in your work.


And while you were researching how to rebuild it right, would you leave it alone to collapse on itself, or would you put in a quick brace to support it while you got everything you needed together to do it right?


AND

jimlangrunner:
Buy a house
move in
It rains, and you notice the roof is leaking
Put a bucket under the leak
When it stops raining, inspect the roof.
Determine what all needs to be fixed and how to fix it.
Fix the darned roof.

Sounds like hulver did the right thing to me.


Hmm. I read the article through and could not see anywhere a statement saying that quick fix was needed. What I read was a solution was needed. Try this:

1. Code breaks because a server regional setting is changed which changes the format of a string being returned.
2. Customer complain, the boss gets on the phone and wants it fixed.
3. Developer hacks function that handles the date change.
4. Same developer then files issue saying that a code refactor is needed that uses integer timestamps or similar rather than date strings.

That would be closer to fixing the leak in the roof. Only in the comments did the author say a quick fix was needed. And as you will notice, his comments arrived after mine.

I still stand by attitude towards "hacks". If a solution is required then a solution should be provided. Too often kudos is wrongly given to someone who can hack code to get it working again. Writing bad code on top of bad code because "it's already bad" is not the attitude to have.

Re: PICKing Javascript

2008-07-09 10:35 • by dtech
What if the user has disabled javascript?

Re: PICKing Javascript

2008-07-09 10:37 • by pedant (unregistered)
205200 in reply to 205156
JJK:

And by the way, if I had found a badly built wall in my house that could seriously effect the stability and safety of the house then yes, I would do the proper job and rebuild it. Even at a greater cost. Take some pride in your work.


I find that it's _well-built- walls that effect the stability and safety of my house. Badly-built ones merely affect it.

Re: PICKing Javascript

2008-07-09 10:39 • by JJK (unregistered)
205201 in reply to 205200
pedant:
JJK:

And by the way, if I had found a badly built wall in my house that could seriously effect the stability and safety of the house then yes, I would do the proper job and rebuild it. Even at a greater cost. Take some pride in your work.


I find that it's _well-built- walls that effect the stability and safety of my house. Badly-built ones merely affect it.


Thank you for educating me Pedant :D

Re: PICKing Javascript

2008-07-09 10:48 • by CAPTCHA: BS (unregistered)
WTF is all you are thinking that Searching Engine will have javascript enabled

Re: PICKing Javascript

2008-07-09 11:08 • by Face Palm (unregistered)
205216 in reply to 205206
CAPTCHA: BS:
WTF is all you are thinking that Searching Engine will have javascript enabled

Did you miss the part where he said directory indexing was enabled?

Re: PICKing Javascript

2008-07-09 11:12 • by Face Palm (unregistered)
205217 in reply to 205182
Dave Ross:
All this back & forth in the OP could have been fixed by running Pick on a Unix operating system instead of Windows. We just wrote our emails to temporary files and called sendmail using the Pick equivalent of system().

In a pinch, PickBASIC in D3 supports sockets. You could open a connection to port 25 & write your own SMTP client.
Ahhhhh. That helps explain the inspiration for this horrid WTF. There's no easy way to send email in Pick, so they came up with this convoluted method of making asp do it.

Still a terrible, terrible hack, but now I understand why a novice might consider it.

Re: PICKing Javascript

2008-07-09 11:16 • by pglewis
205219 in reply to 205199
dtech:
What if the user has disabled javascript?


I WILL BRING THEM A SUITABLE TIE!

Re: PICKing Javascript

2008-07-09 11:32 • by jimlangrunner
205224 in reply to 205195
JJK:

Hmm. I read the article through and could not see anywhere a statement saying that quick fix was needed. What I read was a solution was needed. Try this:

1. Code breaks because a server regional setting is changed which changes the format of a string being returned.
2. Customer complain, the boss gets on the phone and wants it fixed.
3. Developer hacks function that handles the date change.
4. Same developer then files issue saying that a code refactor is needed that uses integer timestamps or similar rather than date strings.

That would be closer to fixing the leak in the roof. Only in the comments did the author say a quick fix was needed. And as you will notice, his comments arrived after mine.

I still stand by attitude towards "hacks". If a solution is required then a solution should be provided. Too often kudos is wrongly given to someone who can hack code to get it working again. Writing bad code on top of bad code because "it's already bad" is not the attitude to have.


How about this:
hulver:

Not quite confident enough in my first month(emphasis added) to refactor the code to call the internal email routine, I leveraged my knowledge of AJAX to solve the problem.

I suppose I read that differently.
« PrevPage 1 | Page 2Next »

Add Comment