Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
Suor
searching Neon…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
5 ms
·
1.
▲
by
Suor
3y ago
Writing things directly is tightly coupling code. Sometimes quite distant portions of it, i.e. database access and presentation logic. With ORM and some smarter lazy technics or introspection at least you can untie it, with hand written SQL
2.
▲
by
Suor
3y ago
Never used this, but I see that it provides a context manager/decorator, which you can use to "shield" any code. And also some shortcuts for DjangoREST or something. Regarding extra code, you can simply replace the Djangos&#x
3.
▲
by
Suor
3y ago
cacheops is more of a general purpose ORM caching with automatic invalidation.
4.
▲
by
Suor
3y ago
For that fetching in chunks is usually a way to go. I use something of these usually https://handy.readthedocs.io/en/latest/db.html#queryset_iter...
5.
▲
by
Suor
3y ago
GraphQL makes it even more fun :)
6.
▲
by
Suor
3y ago
I usually use `.values()` and `.values_list()` only when model creation is really slow. Usually many rows fetched.
7.
▲
by
Suor
3y ago
Actually there is such thing already https://pypi.org/project/django-auto-prefetch/ Not a monkey patch though, so will only work on the models you inherit from this.
8.
▲
by
Suor
3y ago
Here is an example of such thing https://github.com/Suor/django-cacheops/blob/8b3a79de29b2545...
9.
▲
by
Suor
3y ago
Should be easy enough to implement. You only need a context manager that adds 1 to some threadlocal flag on enter and subrracts on exit then check this flag in the monkey patch. Not sure how costly that will be though.
10.
▲
by
Suor
3y ago
cacheops can do the same, but it never came to my mind to actually go this way. I would rather write some special code to fetch with `id__in=[...]` and then cache individually.
11.
▲
by
Suor
3y ago
HN keeps automatically replacing the URL. It used to be a redirect before, but not anymore
12.
▲
by
Suor
3y ago
Thanks
13.
▲
Ban 1+N in Django
(suor.github.io)
175 points
by
Suor
3y ago
|
148 comments
14.
▲
Show HN: A Cheatsheet for funcy sequence, collections and functional stuff
(funcy.readthedocs.io)
9 points
by
Suor
10y ago
|
1 comments
15.
▲
Async decorators and combinators for Node.js
(npmjs.com)
1 points
by
Suor
11y ago
|
0 comments
16.
▲
Practical Python to JavaScript Translation
(hackflow.com)
1 points
by
Suor
11y ago
|
0 comments
17.
▲
Show HN: Sublime Text move around and reform code demo
(hackflow.com)
7 points
by
Suor
11y ago
|
0 comments
18.
▲
Python Metaprogramming Beyond Decency
(hackflow.com)
2 points
by
Suor
11y ago
|
0 comments
19.
▲
by
Suor
12y ago
Using framework has its cost, so you can be better of if you understand clearly what you are doing. OTOH, framework brings structure so it's less probable you skrew up your design.
20.
▲
by
Suor
12y ago
There are sure some things I haven't covered. The major one is components, which make a big deal in factor, reuse and composition. But the post started to be too long and loosing point so I skipped it. There are also ideas beyond React
21.
▲
by
Suor
12y ago
I've already emailed there, won't make a difference probably anyway. I hate this HN tricky rating, one my post got dumped from top 5 cause there were too many comments! Reddit kind of saves the day :)
22.
▲
by
Suor
12y ago
I announced on twitter and posted to reddit. Is this prohibited?
23.
▲
by
Suor
12y ago
Maybe english?
24.
▲
by
Suor
12y ago
Is there something wrong with it?
25.
▲
Ask HN: Why my link disappeared from HN?
1 points
by
Suor
12y ago
|
7 comments
26.
▲
Boiling React Down to Few Lines in JQuery
(hackflow.com)
156 points
by
Suor
12y ago
|
32 comments
27.
▲
Higher level PostgreSQL client for Node.js
(github.com)
2 points
by
Suor
12y ago
|
0 comments
28.
▲
Growing Over Backward Incompatibility
(hackflow.com)
7 points
by
Suor
12y ago
|
0 comments
29.
▲
Show HN: A Sublime Text plugin to move around and reform things
(github.com)
25 points
by
Suor
12y ago
|
5 comments
30.
▲
by
Suor
12y ago
OTOH, if the program logic is mapping a sequence, then you better use map() on the sequence.
More ›