10 ms·
Lines of code that changed everything
- thrownaway954 7y agopersonally i think the line of code that the today's internet owes it's thanks to is: $(document).ready(function(){}); If it wasn't for jQuery, no one would be programming web applications the way we do today. jQuery was THE single advancement in creating the modern web.
- sandinmyjoints 7y agoIt’s significant, for sure, but I’d probably go with XMLHttpRequest as even more significant for web apps.
- sli 7y agoI'd almost say jQuery pasting over the inconsistencies is what made XMLHttpRequest and AJAX in general the killer feature it became.
- Groxx 7y agoyea. swap out roomba routing (srsly?) and replace it with "jquery made dynamic websites economically feasible" which led to practically the entire internet becoming dynamic in some form.
- Antoninus 7y agoA big moment for me was seeing google maps for the first time around 2008. I had just finished school and knew that I had to write programs using this technology.
- HNLurker2 7y ago> knew that I had to write programs using this technology Well now you don't
- NullPrefix 7y agoI'd say jQuery forcing people to actually learn XMLHttpRequest by leaking memory on each request was a killer feature.
- NullPrefix 7y agoDownvote me all you want. https://bugs.jquery.com/ticket/10824 https://bugs.jquery.com/ticket/10824
- why_only_15 7y agoLooks like this is only in internet explorer and was clearly not a priority issue for anyone
- NullPrefix 7y ago>only in internet explorer Main advantage was unified experience across all browsers. >[memory leak on each request] not a priority issue for anyone Exactly my point.
- TurkishPoptart 7y agoYou're not wrong, but did this really require a throwaway account?
- thrownaway954 7y agowhy does that even matter?
- TurkishPoptart 7y agoBecause throwaway accounts are usually made by people who want to share something personal and don't want it tied to their public/internet/work persona. So it made me think you work for a FAANG where everyone has to pretend they love React/Angular/etc, and you didn't want to catch any flak for it.
- codingdave 7y agoIf you click on someone's name, it will show you their profile, and you can see that you are not talking to a throwaway account, even if the word is in their username.
- ljm 7y agoI'd go even further and say: document.write(...) The birth of Javascript in 10 days has fundamentally and permanently changed the nature of the web, in ways that nobody could anticipate. We now have technology where you can compile C++ down to a JS/HTML target, which in any other world would sound utterly mad.
- xxs 7y ago>If it wasn't for jQuery, =no one would be programming web applications the way we do today=. jQuery was THE single advancement in creating the modern web. Excellent!! You'd be surprised that not everyone agrees with the idea of browsers becoming their own micro-OS.
- handoff 7y agooh man that brings back memories... I think people nowadays vilify it just because it's cool to bash jQuery but without it, the web wouldn't be where it is now.
- WilliamEdward 7y agoI make webpages without JQuery... what's the big deal? Am I missing out on something serious?
- bootloop 7y agoThis is about history. Nowadays it's not a big deal as the browser engines and JS adapted.
- notzuck 7y agoSignificant but not in a good way. This was the start of the JS mess we have today. Simpler web pages was my hope for the web. I also quite like web pages which were an artistic expression which was way more common the early 2000's but of course the accessibility was terrible.
- davidjnelson 7y agoThat was important, sure, but cgi was way earlier.
- mitchtbaum 7y agodiff and patch time and uptime uuidgen and ping ...?
- imglorp 7y agoThe banner at the top is wrong. It should be simply while(*dest++ = *src++); And a fork bomb isn't a virus in any sense. Malware sure.
- AnimalMuppet 7y agoWell, it's a self-replicating bit of code. That's arguably a virus. Granted, it doesn't infect anything else, but it does self-replicate.
- minitech 7y agoIt’s not wrong, just not as short as it can be. Comparing things that aren’t booleans with zero explicitly is a common style choice.
- imglorp 7y agoWell, the article is about the historical context of the idiom, and they got the context wrong. The full context (K&R second edition at least) is working through pointers and trimming down strcpy(). The '\0' one is version 2, and the following is version 3. As the final abbreviation, observe that a comparison against '\0' is redundant, since the question is merely whether the expression is zero. So the function would likely be written as /* strcpy: copy t to s; pointer version 3 */ void strcpy(char *s, char *t) { while (*s++ = *t++) ; } Although this may seem cryptic at first sight, the notational convenience is considerable, and the idiom should be mastered, because you will see it frequently in C programs. https://rkvalley.files.wordpress.com/2010/04/kernighan_ritchie_language_c.pdf https://rkvalley.files.wordpress.com/2010/04/kernighan_ritch... page 88
- rstuart4133 7y ago> the notational convenience is considerable, You are right of course - but this is a moment in time thing. ++ and it's equivalents aren't so convenient now. One of the things that strikes me about modern languages is the disappearance of integers, and the associated integer arithmetic such as the s++ in this example. It turns out we were using integers as a poor mans iterator, and s++ simply meant "next item please". Once we starting using "for element in sequence" to access iterators many of the integers disappeared - they are only used to represent integer things in the real world now. Just about every instance of ++ also disappeared because "next item in iterator" was it's main use. Turns out integers modelling things in the real world rarely need incrementing. So much so that modern languages don't bother including ++ or the Pascal equivalent, succ().
- thiscatis 7y agoIn a way I feel the MP3 format and the digital music revolution in terms of both easy of releasing, sharing and cross-device listening was even more significant than what JPEG did for photos.
- Hitton 7y agoAlso "rm -rf /*". It taught generations of sysadmins and programmers not to run code they don't understand.
- 0x8BADF00D 7y agoMore generally, it taught us to be careful with string substitution and interpolation.
- Analemma_ 7y agoWell, "us" except Unix and Unix-like developers, where "rm -rf /*" still works like it always did, unless your rm added --no-preserve-root or some similar ugly hack.
- Izkata 7y agoThere's actually (at least) two versions of GP's comment - unsafe code/data, what you appear to be referring to: rm -rf $FOO/* And typos, which is what I first thought of upon reading it: rm -rf . /*
- magoghm 7y agoTo err is human, to really foul up requires the root password.
- aepiepaey 7y ago:(){:|:&};:
- city41 7y agoI thought they explained null terminated strings pretty well. But I feel they misled a bit on buffer overflows, which are more due to using raw pointers and not having a runtime that does bounds checking than anything else.
- saagarjha 7y agoOr more specifically, the lack of a length that accompanies a pointer that can be used for bounds checking.
- rabidrat 7y agoI enjoyed the stories, many were new for me, but this was a major foul: > But the RSA encryption algorithm—one of the basic building blocks of modern cryptography—is elegant enough that it can be written out in just four dense lines of Perl code … short enough to fit on a T-shirt. And of course it has nothing to do with the elegance of RSA, but the largeness of Perl.
- smartscience 7y agoTorrents/filesharing and ransomware would be possible additions to this list.
- city41 7y agoNapster predates torrents by a little bit, and seemed to be the real gateway for file sharing for most people IMO.
- deleted 7y ago[deleted]
- rkagerer 7y agoI'm surprised some form of Comet didn't make the list (early approaches for AJAX / XMLHttpRequest / Long Polling / etc).
- symplee 7y agoprint("".join(sorted("everything")))
- kaoD 7y agoeeghinrtvy? (No idea what language is that, just guessing the output)
- mc3 7y agoI'd add Garbage Collection (Lisp was first I think) which transformed how we write programs, allowing more focus on solving the real problem, and less on memory management. Also vms/containerization is worth a mention? The basis for the cloud.
- capableweb 7y agoMaybe lisp should have been mentioned in the list. Homoiconicity, macros, metacircular evaluation, conditionals, multimethods, and more I'm sure, all come from lisp.
- ydb 7y agoBrilliant suggestion. All my most proficient and excellent times while programming were among the purview of garbage collectors. They have assisted my career in more ways than any conference talk ever has. In fact, I'd say GC basically saved me from burnout. I wish I could garbage collect my ex the same way that D rocks my garbage for me!
- AnimalMuppet 7y agoI'd add telnet (not the same as telenet) and ftp.
- sxagoraris 7y ago#!/bin/sh (long-lived)
- polynomial 7y agoNitpick: hyperlinks don't work w/o name resolution, arguably the prior advancement that is oddly missing from this history. I'd also argue for the inclusion of Leonard Kleinrock's seminal paper on communication networks.
- cryptozeus 7y agoGreat article !
- nayuki 7y agoAs I scrolled through the article, I was surprised to see that they quoted a piece of my published code. Section "Introduction of the JPEG", function "NaiveDct_transform()".
- kazinator 7y agoAnother clueless rant against null-terminated strings. The flaw isn't the null termination but the lack of encapsulation. No string representation is error-proof, if the application programmer open-codes the manipulations of it, taking on the responsibility for maintaining all necessary invariants of the representation, including memory management. If applications take on the responsibility of constructing and maintaining length + data strings, there will be bugs. Null-terminated strings are actually a very good choice of string representation that is to be directly manipulated by programs, instead of just through opaque handles via library functions. Null-terminated strings allow for elegant tail recursion like: const char *my_strchr(const char *str, char c) { if (!str) return NULL; else if (*str == c) return str; else return my_strchr(str + 1, c); } Compare with: (defun findel (list el) (cond ((null list) nil) ((eql (car list) el) list) (t (findel (cdr list) el)))) This leverages the fact that if s is a non-empty string, then s + 1 is also a string, which is its suffix. This is super cool and has no equivalent in the length + data representation. Compilers can merge string literals that have a common suffix; if "pet" and "carpet" occur in the same program, they can share storage. Null terminated strings of byte-wide characters can be transmitted with no byte order issues. Not so when length fields are involved. Being able to split a null-terminated string in-place according to some delimiter characters, by overwriting them with null bytes, is also handy, and greatly simplifies some programs which open-code this logic rather than relying on string libraries. Null termination is nice for lexical scanning. Why? Because every string has an accessible byte that is one position past its last character, and has a unique value which can treated as a member of the input alphabet, and thus integrated into the pattern matching logic. Code which scans a null-terminated string for a lexical pattern doesn't have to do anything ugly and extraneous like checking an index against a maximum length; it just contains cases that handle zero as a part of the syntax. Stream scanning code that looks for and handles EOF return from getc can easily be turned into string scanning code if it just handles zero instead of EOF.
- talaketu 7y ago> The flaw isn't the null termination but the lack of encapsulation. > Null-terminated strings are actually a very good choice of string representation that is to be directly manipulated by programs, instead of just through opaque handles via library functions. You seem to be having it both ways. As I see it, "NULL" is a valid ascii character, but not a valid element of a C string - except as a terminator external to the string of characters being represented. It's fundamentally broken as an abstraction for managing variable length strings of ASCII. It is incapable of representing all strings of ASCII characters.
- est 7y agoI think the lines of code that changed everything is when a guy changed "utf8" from 6 bytes to 3 bytes somewhere in a commits of https://github.com/mysql/mysql-server https://github.com/mysql/mysql-server. I failed to bookmark it nor find it. Sorry.
- lilyball 7y agoWhat does MySQL have to do with this? It seems it was RFC3629¹ that restricted the domain of UTF-8 to cap at U+10FFFF and therefore remove 5- and 6-byte encodings. ¹https://tools.ietf.org/html/rfc3629 https://tools.ietf.org/html/rfc3629
- mtreis86 7y ago(loop (print (eval (read))))
- tln 7y agoIconic. A worthy addition
- AdieuToLogic 7y agoThe four "lines of code that changed everything" arguably could be: #!/usr/bin/env perl use strict; use warnings; use CGI; While no longer in vogue, nor applicable for many systems today, the web would not be what we know it now were those four lines of code never typed.
- mikorym 7y agoWhat is CGI?
- AdieuToLogic 7y ago> What is CGI? Common Gateway Interface. It's a specification for how web servers can process HTTP(S) requests dynamically. EDIT: If you are wondering what modern equivalents are, AWS Lambda[1] and Azure Functions[2] are Liskov substitutable[3] as they pertain to CGI programs. Both of these products provide benefits beyond what a "classic CGI system" could offer, of course. 0 - https://en.wikipedia.org/wiki/Common_Gateway_Interface https://en.wikipedia.org/wiki/Common_Gateway_Interface 1 - https://docs.aws.amazon.com/lambda/latest/dg/welcome.html https://docs.aws.amazon.com/lambda/latest/dg/welcome.html 2 - https://docs.microsoft.com/en-us/azure/azure-functions/functions-overview https://docs.microsoft.com/en-us/azure/azure-functions/funct... 3 - https://en.wikipedia.org/wiki/Liskov_substitution_principle https://en.wikipedia.org/wiki/Liskov_substitution_principle
- nostrademons 7y agoMan I feel old. :-/ Back when the web was young (before 1998 or so), webpages were generally static HTML files that you dumped in a directory and the webserver served up verbatim. There was no PHP, no Rails, no Django, and certainly no Node. If you wanted to do anything dynamic - like serving up content that you, the webmaster, did not write yourself - you had to write a custom webserver. Remember, this was back when C was the most popular programming language, Java was for hardware devices, Python was for academics, and Javascript didn't exist. Not many people wanted to write their own webserver. CGI was a specification that would allow the webserver to launch an external program - written in any language you wanted - in response to an HTTP request, send it the request data, run arbitrary code, and write the response back to the web browser. The query params and other information about the request (path, user agent, host, request method, etc.) would be passed in environment variables. POST data would be passed on STDIN. The program would write the output HTML to STDOUT, and the webserver would echo that directly back to the browser. It was slow, it was clumsy, it was insecure, and it was magical, because you simply couldn't do simple stuff like read from a database and dynamically generate a webpage otherwise, unless you wanted to write your own webserver. The lines that the grandparent posted would fire up a Perl script and then import the CGI module to parse all the input data (no such thing as JSON back then; if you wanted the actual query params, you got "/reply" in your $ENV['PATH'], and "id=21654788&goto=item%3Fid%3D21648568%2321654788" in your $ENV['QUERY_STRING'], and had to parse them yourself). It also enabled some warnings and error checks for Perl to avoid some of the worst security nightmares. This was even more magical, because Perl offered string parsing & construction utilities and database libraries that were much easier than C, and so you could quickly write useful websites that did stuff instead of hand-typing HTML into your editor.
- egfx 7y ago$scope
- ddmma 7y agoLike button counter evolved from what it was the RSS reader counter from blog post called Feedburner. Some things come from pure evolution not necesary revolution.
- 30f0fn 7y agoWeird that they went back to 1755 but skipped the universal Turing machine.
- abdulhaq 7y agoSurely the most influential line of code was written in Algol, let there = light
- thrownaway954 7y agoAnother one I can think of: rails new blog Think about how many frameworks over the years have copied or looked to Rails for inspiration. Rails pretty much changed what people expected from frameworks.