HNHacker News
TopNewBestAskShowJobs

nitely

255 karma · joined April 16, 2014

just a pragmatic programmer nitely @ github
submissionscomments
nitely··on D’s Newfangled Name Mangling
https://madnight.github.io/githut/

This one seems up to date

nitely··on Django 2.0 released
They always make breaking changes. There's usually a deprecation period though. They didn't do semver but it seems they will now.
nitely··on Low Hanging Fruit of Programming Language Design
> The number of bugs are proportional to the lines of code, this is undeniable from empirical data.

Including unit tests? A code base with unit test is likely to contain less bugs and more lines of code. And what about code golf?. This just does not seem right and I believe the original saying is related to languages with/without rich stdlibs and/or the NIH syndrome.

nitely··on Target="_blank" – An underestimated vulnerability (2016)
They had their chance with HTML5. Actually, it was removed at some point.
nitely··on Fake WhatsApp update from “WhatsApp Inc.” with Unicode whitespace: 1M downloads
Or don't allow apps with similar name than a popular one in the first place.
nitely··on Efficient pagination of a SQL table with 100M records
Not really:

  SELECT *
   FROM sales
  WHERE (sale_date, sale_id) < (?, ?)
  ORDER BY sale_date DESC, sale_id DESC
  FETCH FIRST 10 ROWS ONLY
This is a postgresql example. See use-the-index-luke[0] for a generic approach.

[0] http://use-the-index-luke.com/sql/partial-results/fetch-next...

nitely··on Efficient pagination of a SQL table with 100M records
Also http://use-the-index-luke.com/sql/partial-results/fetch-next... for the actual keyset paging (aka the seek method) technique. Which gives a better explanation than the OP's article IMO.
nitely··on How JavaScript works: Event loop and the rise of Async programming
Looks nice. How is this implemented?
nitely··on How JavaScript works: Event loop and the rise of Async programming
The parent is asking how comes async I/O can handle higher volumes of requests given it's single threaded and even if it does how comes the database is still not the bottleneck. I answered both of these questions.
nitely··on How JavaScript works: Event loop and the rise of Async programming
pickle/unpickle is a way of serializing/deserializing in Python land.
nitely··on How JavaScript works: Event loop and the rise of Async programming
I agree. But like always, trade-offs.

> The problem with offloading to a thread is that you can't structurally share data with another thread.

That's really a JS issue, not a general async programming issue, though.

nitely··on How JavaScript works: Event loop and the rise of Async programming
> Does this mean that a web server written in node is running single-threaded?

Yes.

> But doesn't running on a single thread put an upper limit on the amount of work a server can handle?

Is not about how much work it can handle, it's about how much it can offload. Async servers can handle a much greater volume of I/O bounded tasks. So it can handle more connections. When the task is CPU bounded you can either create a thread (which does not really scale well) or offload it to some other servers that can scale horizontally (i.e doing micro services)

> And, if the solution is to spin up more servers with access to the same database, doesn't that mean that we are now having multiple threads accessing the database concurrently? Much like, say, Python Django?

Yes, to take advantage of all CPU cores you have to create more server instances. But why would they talk to the same database instance? It could be a replica or a shard. You can even have a pool of shards connections per server instance.

nitely··on How JavaScript works: Event loop and the rise of Async programming
Almost. In threaded programming a thread will wait/block until the lock is released and then make use of the protected resource. In async world you would probably just check some flag and if it's "locked" then register a callback to some "unlocked" event to mimic this.
nitely··on Firefox Focus – A new private browser for iOS and Android
Pretty sure they will get your IP. If you use any other Mozilla product, chances are they know who you are. And they can correlate it with other telemetry data. Not saying they do, just that they can.
nitely··on Benchmarks of PHP 7.2 Beta: PHP Is Still Getting Faster
Regex engine for all of those languages are coded in C, so that's probably not a good benchmark. That said CPython and Ruby MRI are slower than PHP5, so yeah PHP7 should be even faster.
nitely··on Django 1.11 Released
May be coz it's not meant to be very customizable? When you start overriding methods, it's better to use a regular view.

I've always seen the admin as a sort of phpmyadmin. For doing very basic crud.

nitely··on How I Became a Better Programmer
His previous blog did react.js server side rendering. That's prolly it. Plus, may be it was an advice to his followers as well.
nitely··on Postmodern Error Handling in Python 3.6
Kennethreitz requests lib? Just use requests.exceptions.RequestException, that should handle every error, if not then report it.

For python urllib IOError and OSError should suffice. At least in py3.

nitely··on More than one million requests per second in Node.js
It's useless for other reasons. Pipelining and non-idempotent methods (i.E POST) don't go togheter.
nitely··on Million requests per second with Python
No. Client sends one packet containing the 10 requests. Server sends 10 packets. Basically, the client avoids 9 extra round-trips and sits and waits for the ten replies. However, this whole thing has many cons, that's why is not even used anywhere.

It's more like this:

    1) client: gimme 10, gimme 9...
    2) server: here, have 10
    3) server: here, have 9
    ...
Edit: There is not always a 1:1 relationship between packets and requests/responses, but it's easier to explain that way. You end up sending less packets when pipelining, plus you don't need to wait for a response to send the next request which also saves time (i.e: client has sent every request and server don't have to wait for the client to receive the response to send another request).
nitely··on Million requests per second with Python
'coz enabling pipelining for the client has some gains (all requests in one package). Even if the server won't pipeline.
nitely··on Why you should ask questions at your next tech company interview
I doubt 5 or 10 minutes is enough time to ask/answer more than one or two questions...
nitely··on Be Careful with Python's New-Style String Format
Yes, it will, just use named placeholders: "%(some)s" % {'some': 'helllo'}
nitely··on How we switched our template rendering engine to React
Yes, that's what's done but also you want the page to be server side rendered for SEO and may be for those who have js disabled.
nitely··on For software developers: how to find a job with relocation to Europe
I've received offers from companies in Denmark, Ireland and Netherlands. They did not care about the lack of a formal degree and they would sponsor a work VISA. I think the hardest part about finding a job in Europe is finding one that won't low ball you.
nitely··on Sanic – Python 3.5+ web server that's written to go fast
> Also why not just improve aiohttp's performance…

Have you read aiohttp's code? there have been some discussions about improving its performance, there is basically no immediate bottleneck, the whole thing just performs poorly. I hate to say it but sometimes it's just better to start from scratch.

nitely··on Too Many Tools and Frameworks (2015)
I think a better example would be: be a contributor to Angular.js or be the creator of Aurelia.js.
nitely··on Meerkat built a new app under a pseudonym, and almost 1M people are using it
Uhm, the important bit is the audio. The vídeo is helpful to know people is still there...
nitely··on A bite of Python
I think she meant to not pass the strings but assign them to constants and then pass those.
nitely··on This Is What Python Beginners Have to Deal With
Usually there are examples for everything. Sometimes you have to scroll down, though. What the function returns is usually stated in the description. But I know what you are saying, actually most 3-party libs do document types.

IMHO, python docs are ok. If you struggle with them as a beginner I don't see what would change as an advanced programmer.

← PreviousPage 4 of 5Next →