- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
cat /dev/null
Admin
It doesn't break the alignment chart; it's Chaotic Stupid.
Admin
TRWTF is definitely a JS OS.
I get the impression that many amateur programmers learn JavaScript because it's the big thing, and then feel like they then have to write everything in JS. So many environments support JavaScript now; Unity is the first thing that comes to mind. Who would write for a 3D engine with JavaScript?!
Why is Node even a thing?
Admin
I don't mind writing small prototypes in node cause it's quick to set up. Not so keen on using it in production though.
Admin
What's the difference between empty e epmty? It would be fun to see also how and where that function is called ... wait, I already have nightmares for the code I see in my job.
this is wrong on so many levels ...
Admin
I find a lot of interesting open source projects around the web for a lot of situations and purposes. First of all, I go to the source code. If I see Node.js, project is immediately discarded as like as I did and still do when I find PHP projects.
Node.js is the new PHP
Admin
I love the comparison juggling:
if ($operator == '=') $operator = '==';
Admin
I've learned a new word.
"Can you come out tonight, bro?" "Sorry, no can do, I feel a bit im."
"Nope, you can't come in, your shoes are im."
"Wash your mouth out! I've had just about enough of your im language!"
And so on.
Admin
Node is a thing because...
No, wait. That doesn't work. No, Node is a thing because...
You know what? I'm going with your "amateur programmers". Node is such a fundamentally unjustifiable yet tempting idea that it could not possibly have been invented by a professional programmer, and so technologically woke that no manglers could've come up with the concept. It just smacks of "JavaScript is k3wl".
Admin
hmm: "compare(x,y,op)" Sounds like this physicist was too brillant to use boring old algebraic notation and wanted to shoehorn in RPN math instead.
Admin
The line between good and eval passes through each programmer's heart.
(With apologies to Aleksandr Solzhenitsyn.)
Admin
Ah yes, an old C refugee - the victim of an " if (x = y)" being true for non-zero values of y.
Admin
Sounds plausible.
Although I reckon this ... with the other things listed ... suggests he wanted to drive everything passed down from the UI and had (thankfully) not been introduced to "eval". Imagine a calulator where you type in the operator and operands and they just get POSTed into one of these functions of his.
Does appear to be a healthy spaffing of copypasta from google, that was always the problem with things like Javascript ... if I google "how do I do xyz in c#?" I'll likely land on a thread of coders having an intelligent (but protracted) flamewar about the merits of various valid solutions, whilst correcting each other with friendly epithets like "I can't believe you call yourself a programmer and you missed that!". Do the same for Javascript and you are more likely to find a bunch of newbies on a kewl forum thanking each other for really awful hacky lumps of codevomit.
Admin
Thank God node is single threaded.
Admin
Honestly, the PHP version is nowhere near the worst way this could have been handled. It has comments, proper indentation, it uses a sane method to compare dates (rather than a string compare shudder), it uses empty() calls to check the input, rather than the preferred beginners method of comparing against an empty string, it avoids superfluous return assignments and some superfluous breaks, it checks for type where logical and last but not least: you can even imagine this being somewhat useful.
It's easy enough to fix the return values to be consistent and logical, move the input validation up, and replace the eval calls. It's not perfect, but frankly hardly worthy to be considered a PHP WTF. I've seen so, so much worse...
Admin
I once wrote a library that does some kind of (very specific) processing over a file. I was asked to let users do that processing through a browser, so I wrote the library in JavaScript, to be included in a webpage.
And then I needed to do that kind of processing myself, but automated. And so I wrote a small 50-line node.js program that simply loads the JS library, evals the whole thing (it's my library, I know it doesn't contain malicious code), and invokes it on the file named in argv[0].
And that's the one useful use case I've found for node. The principle of being able to run JS code from a command line isn't wrong. The absolute abuse that JS suffers is the problem— but newbie coders are newbies in any language.
Admin
Why? That just means people are spawning hundreds of instances of it. At least if it were multi-threaded, all the n00bs might have been scared away 'cos it's "too hard" to do multi-threaded programming.
Admin
You mean, first calling isset() and then comparing to the empty string.
Yes, I know people who do that, and are unwilling to believe that empty() does the job reliably.
Admin
Umm… game engines usually have a (or multiple) script bindings. JavaScript isn’t the usual choice—that would probably be Lua or Python—but with how many people have at least a basic understanding of the language, it still makes sense. The bindings are usually used to allow the artists to set up small behaviour chains and stuff like that, where you want to be able to iterate quickly w/o recompilation (plus most artists are more comfortable with scripting languages).
Admin
It's starting to get embarrassing. Node is approaching 10 Years, so everybody could have learned the first thing about node if you call yourself a developer. It's about writing asynchronous services! Even today it's probably still the most convenient solution for that purpose. Being single threaded js always supported an asynchronous model, which is cumbersome in most other languages and Googles V8 became readily available around that time so it made perfect sense to base node on that. The emerging possibility of sharing code between client and server was a nice side effect but never the main purpose of node.
Admin
It is annoying when functional programming languages especially don't give you functions for operators, after all they are also functions. It's also always a sign on the inner platform effect though. I use dynamic code and meta code heavily. I've not had to have eval and operator functions except once in a blue moon. I'm not sure I've ever had to use eval outside of debugging/experimentation and one very odd edge case. I was processing custom annotations for PHP. Nothing too fancy, not required for running the PHP or compiling it to run, just being able to pull string literals for translation, detecting certain anomalies, etc.
PHP's tokeniser will read, isolated and validate tokens in a PHP string, including literally but wont parse them. You'll have what you know is a valid PHP string literally but not explicit means to parse it (well maybe if I look hard enough and in cases I've made an extention for things like this to expose hidden internal functions). In this case eval should be 100% safe to use, so long as the same PHP instance, settings and version (although it really doesn't change much) is used both for tokenise and eval. Those seeing this will be reminded of oldschool eval instead of JSON.parse, same problem here in PHP. There's no literal only parse mechanism that I know of (but there is var_export funnily enough).
There are slightly more more cases where having operator functions is convenient but in most cases it's inner platform with either someone going made with fluent interface (OOP, make literally everything a class and methods, even the language itself) or it's some functional programming madness (same thing, make everything a function and the functional equivalent of a fluent interface).
Admin
i agree, i am sick of node, but then again, biting the hand that feeds me. JS is neato for garnish, but it should never be the main course.
Admin
Do you know, I've looked all over node-os.com, even scanning the source code and hunting for hidden links, and I cannot for the life of my find anything answering the question of why?