The format of the article, and it's unwillingless to go to the point made me quit reading half way. Even in reader mode the flow of reading is interrupted every 2 lines by a large useless image or some snarky comment from the author.
Looks like I missed a sed command or two. I usually write out "underscore" in the script so I read it literally during recording: https://i.imgur.com/j3RdHA5.png
I write out punctuation like underscore so that I know that is what I am literally saying to the camera. I usually edit that out. Apparently I missed out on that this time. Oops! Sorry. I'll put that on the checklist for next time (half considering making tests fail if I forget to do it).
Of all your pictures the actual useful ones are three:
Drawbacks of PAM
Lessons Learned
Credits
Presentation != blog post. Different formats. I could read that only after sticking the browser to the side of the screen with 25% width and reader mode. Reading your post on the desktop is like trying to watch a 10-minute episode interrupted for an ad every 10 seconds.
Perhaps you can split your 'visual aids' to 'essential' (liek those three I listed up there) and 'non-essential', which could be skipped in the blog post.
At least with this I can work out what your primary points are. The most important takeaway seems to be that OpenSSH sshd doesn't really use PAM unless you enable "ChallengeResponseAuth" config option, so if you want your custom PAM module to work with sshd, you need to turn that on.
Another important point you make is, on Ubuntu, you need to download the debug symbol packages for systems libraries if you want gdb to give you meaningful backtraces.
The suggestion of putting a breakpoint on dlsym also seems helpful.
This meme-laden presentation style, I seem totally incapable of consuming or producing it, and I don't really get it. I don't know if it is a generational thing or something.
For reference, I liked your format. It was different and fun. Every highly technical conference would be infinitely more fun if all speakers were given an avatar like that haha. I especially loved the graphic with Anya pointing at Anya pointing at Anya :thumbsup: .
It was obvious you were going for an entertainment format rather than merely cramming as much information in as tight a space as possible (which is typical for 'conf talks). Hacker News geeks probably aren't the ideal judges for that sort of thing. As a member of this group most of us have forgotten what it means to "not be super busy" all the time and being "forced" to watch something highly technical slowed down into an entertainment-focused story telling format can feel wrong and a little frustrating. Just know that there's at least a few people out there that appreciated it :)
It's a presentation in blog form. The images are the slides from presentation, the text is what Xe says. Perhaps you don't like this style of presentation?
For me (windows, chrome or ff), it works only on the blue markers, but zooming on the map does not make it more details, and the switch to street view leaves a blank canvas.
* Conditions apply. Use the comment in the context of the HN bubble, and ignore that a huge part of the industry is still deploying wordpress on VPS, using excel spreadsheets for database and gmail for bug tracking.
The GP was talking about data centres. I’ve worked in data centres and thus replied with the same context as the GP was discussing.
Also people deploying Wordpress on a VPS and using Excel are categorically NOT doing any form of distributed computing, which is what this discussion is about. So it’s correct to discount those contexts.
What I’m noticing here is a lot of people are confused about the terms “distributed” and “data centre”.
from itertools import product
for x, y in product(a1, a2):
if test(y):
break
Not only you get the behavior you want, but you get an easier to read code with one less level of indentation. Bonus, you can now use "else" (which most people don't know can be used with "for" and not just "if").
Why introduce a new syntax when a library does the job? A new syntax is a huge bar to pass for a language, and nested loops are rare.
Itertools is a gem, and any python dev will benefit greatly from mastering it.
EDIT: made a mistake, see my next comment bellow. I won't update this comment so that other readers can see the code for the 2 use cases.
Python has itertools.product and unpacking for this case:
from itertools import product
space = product(enumerate(table.rows), enumerate(row))
for (r, row), (c, cell) in space:
if search_query.matches(cell.value):
logger.info("Found cell: (%s,%s)", r, c)
return (r, c)
Note that we don't need the "found" variable neither to get the same beheavior. We can also use break + else, but in this case, the return is cleaner since that's the default value for python functions. Additionnally, the logger should do the interpolation, not format().
I think the Python team is having to do the difficult job of filtering new feature, and it makes sense they don't introduce it in this case. We already have all the facilities in the language to deal with most nested loop cases, and those are rare cases anyway.
For this case, one should use a nested comprehension:
space = ((r, c, cell) for r, row in enumerate(table.rows) for c, cell in enumerate(row))
for (r, c, cell) in space:
if search_query.matches(cell.value):
logger.info("Found cell: (%s,%s)", r, c)
return (r, c)
Or see masklinn comment if you don't need the logger.
In all languages, you separate code for preparing your input and code for processing it. In python, it's also a good idea to do that at the loop level:
- prepare your stream of data so that it's normalized using itertools, generators, a function, a numpy array, etc
- do a single loop pass for your processing
This way you will you obtain a single iterable, and will be able to get the most out of the language tooling:
- you can pass it to map/filter, itertools or another comprehension
- you can convert to a list, a tuble, a Counter, etc. And slice it
- you can use "else" in the loop, which is an underused construct, but very useful when you need break
- you can use advanced unpacking
- you can call iter() and/or next(). This is what masklinn does in his example.
The point being, nested loops are rare enough, and we have tool to deal with them in an idiomatic way in Python, and not adding new syntax for a rare case that usually has a good solution makes sense to me.
Nassim Taleb famously destroys those lines of reasoning in his books: game theory is unpractical for most people, because it almost always ignore variables that don't exist in a lab but are crucial IRL.
Comments have been explaining which ones already apply to this article, I'm not going to repeat them.
But there is an another example from Taleb that always makes me smile:
- If the other player tosses a coin and gets 9 tail in a row, what are the chances of getting tail on the next toss?
- when declaring routing in code, it's harder to shoot yourself in the foot. So many php sites expose what they should not, and .httaccess is rarely crafted correctly
- renaming files don't change your website
- coding locally doesn't require apache if your tooling don't need it for routing. No need for stuff like EasyPhp
- python dev servers automatically reload for you on changes anyway
- declaring routes and parsing them at one place to get url id and slug is less duplication
- declaring url yourself mean you can use the language typing system for their checking too (see fastapi)
- I rarely need an entire file for one route endpoint, making 10 files for 10 enpoints that could fit in one is overkill
- wsgi servers like gunicorn will hapilly reload the workers when it receives SIGHUP in prod. No need to restart the master process manually.
- restarting a process every time mean you can't benefit much from nice python features like lru_cache, process/thread pools, connection pools, etc
- python is slow to start, cgi takes a toll
- it's easier to control the number of max workers that run an any given time
Honestly, even when coding in PHP I will use phpfpm (which is one long running process like python) and frameworks like laravel (in which you declare your routing).
I understand the desire for simplicity, and the one-file/one-route declaration is easy to get into. But if I want simple, I do a static website with a bit of client side JS, not need for a backend.
When I do need a backend, I much prefer long running workers and explicit route declaration.
I'd say they are both slow. Try Perl, Tcl, Lua or some other interpreted language that starts fast, and you'll likely see something like 200-300ms for the equivalent commands to above.
In benchmarking scenarios requiring more elaboration than makes sense in an HN comment, I see times as low as 140 microsec per run on that same machine/OS. In fact, as you push things to low overhead extremes, you can easily see the impact of how much environment variable data is in play (`env -i` vs. not).
It is true that Python start-up time is not that bad compared to a "mean diameter of the Internet in milliseconds" which is probably the relevant time scale for CGIs, but it's probably not so small as to be truly negligible, esp. once imports are happening.
Also, Python3 remains quite a bit slower (1.7X slower on that same machine) to start-up than Python2 even after more than a decade of promises to claw back start-up performance.
Meanwhile, on the other side of the comparison, starting up a Julia REPL seems to take quite a bit longer than the Python 16 ms..Like 340ms or 20X longer.
So, the overarching point of this overlong post is just a follow-up/supporting of @tyingq's "compared to what?" with a little more detail.
Too bad, it's an interesting topic.