Is there not a limit to how many items the browser is happy to render? If you throw 1,000,000 items into your page, what happens?
There is probably a practical limit to how many items you can shove into the DOM of a page, but the focus here was to minimize the per-connection server memory utilization.
In situations where millions of items should be rendered, it might be worth using a custom hook or some other client-side code to virtualize or GC the list.
I actually think fly.io uses phx-update="append" in their container logs page, which is much higher volume than anything Iāve ever shipped. As far as I can tell, they donāt do anything to clean up the entries. Worst-case, the user can always refresh the page or a filtering UI can be added.
Donāt mind me, I have a personal vendetta against āinfinite scrollā. I have a somewhat lacklustre implementation of truly infinite scrolling so I always read posts about it with interest. Sadly, it always turns out to be finite scroll. It should be called āload a bit more until the browser collapses scrollā or āgenerally sufficient amount of items scrollā.
AFAIK if you want actual infinite scroll, you need virtual scrolling.
we knew that browsers start struggling with more than 20k log lines
How do you efficiently search through millions of names in Postgres and Ecto? This blog post dives into Postgresā ILIKE and SIMILARITY operators and their important caveats.
Also included: The most in-depth explanation of how Postgres calculates the SIMILARITY score ever!
Enjoyed reading it!
Regarding:
SET pg_trgm.similarity_threshold = 0.3;
Sadly, at the time of writing, we were not able to find a solution that allows us to configure this threshold for an
Ecto.Repo(tips are more than welcome).
You could do:
query_args = ["SET pg_trgm.similarity_threshold = 0.3", []]
config :my_app, MyApp.Repo,
username: "postgres",
password: "postgres",
database: "demo_dev",
hostname: "localhost",
pool_size: 10,
after_connect: {Postgrex, :query!, query_args}
The above is an adjusted excerpt from the ebook āThe Little Ecto Cookbookā by Dashbit, where they showed how to set a particular schema for a repo.
Thank you! Oh thatās so cool! Iāll update the blog post tomorrow! thanks so much! ![]()
Weāve published a new article, āOban Starts Where Tasks End,ā to answer the question, āwhy do we need background jobs when we have tasks?ā
This article will focus on two intertwined languages: Elixir and Erlang.
Cross Site Scripting (XSS) Patterns in Phoenix
If youāve ever been involved with a pentest on an Elixir application, you know someone calling āraw/1ā directly on user input is rare, along with bypassing the view/template/render pattern to render HTML. The author of Sobelow, Griffin Byatt, mentions this in his ElixirConf talk, ElixirConf 2017 - Plugging the Security Holes in Your Phoenix Application Itās a fantastic talk, he gives the example of file upload leading to XSS. I close out this blog post with that example, and hope you find it useful in ensuring the security of your own apps.
Thanks for the helpful information. I will be putting this to use.
Nice find and while you are at it there is also @moduletag which allows you to do the same but at the module level. I use this tagging to segment my unit tests from their integration and system tests siblings.
Nice series. Is this something you could also leverage for Facebook Workplace?
This epic article of 4500 words covers everything there is to know about efficient full-text search with Postgres and Ecto. It explains how Postgresā full-text search works and how you can use indexes to speed up your search. It also covers search modifiers, query testing, extracting headlines, and so much more!
I fell off the writing wagon a couple years ago, after my first child was born, but Iām trying to hop back on! Hereās a rundown of a method Iāve been using to handle combinatorial explosions of query parameters in my Phoenix applications.
In this blog post, I share how to create a reproducible development environment for Elixir with Nix. Let me know what you think ![]()
https://blog.dmarcoux.com/posts/reproducible-development-environment-for-elixir-with-nix/
Todayās article explains how to simulate a bad internet connection when developing locally by adding latency, jitter, and package loss to your connection. Itās crucial to test your app under these circumstances before deploying it. Otherwise, especially users on a mobile connection will have a bad UX when using your site.
Securing Elixir/Phoenix Applications: 5 Tips to Get Started
Hey everyone, this article consists of five recommendations:
- Read the EEFās Secure Coding and Deployment Hardening Guidelines
- Use Sobelow for static analysis
- Check for vulnerable dependencies with MixAudit
- Harden your application against bot attacks (I donāt recommend reCaptcha)
- Use the SafeURL library to stop SSRF attacks
Hope itās useful in your work!
How to serve the webfinger protocol using phoenix:
Learn how to build a Roles and Permissions (RAP) system for Phoenix! Not all your users should have access to all your data. A RAP helps you to set up user groups and control which data they can access through permissions.
Thanks for the post, Peter!
It was very timely for me, as Iāve been working on an authorization library over the last few days and took this as an opportunity to integrate it with your RAP example. I wrote up some thoughts and added the modified modules in a gist. It was a great opportunity to see how the auth library Iām working on might integrate with the permissions architecture you presented. Would love to hear your (or anyone elseās) feedback, if you find time to take a look.
Looking forward to part 2!






















