Blogs

Phoenix liveView 0.9.1 breaking changes

If you updated your mix dependencies to use {:phoenix_live_view, “~> 0.9.0”} you might be surprised that …the web socket connection is gone. It’s due to backwards incompatible changes: “LiveView no longer uses the default app layout” which basically means you your liveView redendered template is no longer wrapped by the default layout which (in most cases) includes app.js that makes a connection to live web socket.

what’s the fix?

The fix is very simple. Open your router.ex and udpate paths to your /live routes to include layout.
For instance:

Continue reading

age_guard - hex package for age verification

After having fun with building Claritas, I knew I want to publish more packages. Claritas is very simple and doing just one job (darkens or lightern colors) but looks like 79 people (at the time of writing it) were interested to download it. It’s 78 more than I expected :) (that makes me happy! :))

what is age_guard?

AgeGuard verifies if a person born at a given date meets provided age requirements. I needed this functionality at my daily work and I couldn’t find anything simple and suitable to my needs, so I built it.

Continue reading

Claritas - my first hex package

Yesterday I published Claritas - my first hex package! The idea for the package came when I worked on some task and needed dynamically generate a heatmap where the more intensive colour, the higher value of given scale in the heatmap. I used CSS for that, but I though that a pure solution in Elixir would make the code much cleaner. Here it is:

Continue reading

Very good books I have read in 2019

Top books I’ve read this year:

Disrupted: My Misadventure in the Start-Up Bubble

by Dan Lyons

This one is super funny and you once you start it, you can’t stop it. A Newsweek journalist after being laid off (in his early 50s), gets a job in the marketing department of a start-up. Being the oldest (but also the most experienced and …sane) he’s trying to find himself in the world of buzzwords where experience and good ideas lose with incopetence and bumptiousness. This books exposes the worst anti-patterns in managing people and explains the phenomenon of start-ups bubble in Silicon Valley.

Continue reading

Protecting elixir apps with geoip

This is a common case these days to provide your service only to specific geo locations. It’s easy to bypass it but the law is not following changes in the tech world. Anyway, let’s try to implement a service that is checking client’s IP and allows to get in if the IP is on our whitelist.

I’ve chosen ipdata.co (https://ipdata.co/) as staring an integration is very simple and you can register for free. We will need just HTTPoison package added to our Phoenix deps.

Continue reading

Datatabase Multitenancy for Elixir applications

If you have never needed splitting data between different schemas (in Postgres), you work on just one (the default) schema - “Public”. Why would you want to use more schemas? For instnace financial institutions may require to keep their data isolated, and multi-tenant schemas is one way doing it. Different schemas may require different ACL, different backup procedures, etc. It’s still possible to do reference between tables in different schemas. I’m using this approach in my current approach but as it’s not released yet, I cannot speak about performance. Multitenancy is a much broader term and I’m describing here only specific case here.

Continue reading

Running Elixir Observer on wsl2

I had a occasion to test WSL2. I must say it’s working better than I expected. Docker isn’t supported that great but that’s another story.

If you’ve tried to run :observer.start from IEx in WSL2, you’ve probably encountered this error:

  1. In WSL2 console, set this export:
export DISPLAY=localhost:0

This will tell X11 programs where to display (:0 is the first local display that was started). I recommend you to add this line to your .bashrc (or any other shell), so you don’t have to remember next time you open WSL2.

Continue reading

Recommended books about elixir and phoenix

As probably I own all popular books about Elixir, I decided to give some rating to them.

My criteria:

  • no waffling
  • complete code samples (easy to follow, complete code without assumptions that reader aleady added some parts of the code)
  • readable font

Programming Elixir

by Dave Thomas

Everything you need to know to start working with Elixir. No boring intrussions. Focused. I’m still getting updates for my ebook from The Pragmatic Programmers. rating: 9/10

Continue reading

Pair programming with vscode

I recently started using LiveShare extension to VSCode and must say it works like a charm. I’ve always been a linux user and didn’t like Microsoft for its opinion about open source but that has changed in the last years and must admit: they’re doing great job building the best IDEs for developers. Visual Studio has been always ahead of other IDEs in terms of features and developer-friendly interface.

VSCode gained popularity among web developers and probably is one of the most popular IDEs these days. If you love pair programming like me, you should give LiveShare extension a try:

Continue reading

Very good books I read in 2018

Top books I’ve read this year:

Eat That Frog! 21 Great Ways to Stop Procrastinating and Get More Done in Less Time

by Brian Tracy

What’s remarable about this book …is that it’s telling you nothing you wouldn’t know already but it actually helps yout to turn this knowledge into action. Even the book is written the way that keeps you focused on the topic (only 144 pages, no long chapters). Brian Tracy is a motivational speaker and that fact worried me before I ordered this book but luckily he didn’t include any coaching bullshit there (I consider coaching as making money on people who have low self-confidence).

Continue reading