First impressions of property testing with StreamData
I haven’t done any property based testing before, so this is obviously quite basic. But I spent half of yesterday playing with the new StreamData library and thought I’d post a little write-up on that.
IntelliJ Elixir v6.0.0
- Formatter
- Parallel test reporting
- OTP 20 support for AtU8 chunk decompilation
- Nix and NixOS support on Mac and Linux
- Mix path quoting fix on Windows
- Reference caching for performance improvements
Hulaaki v0.1.0 released - an #MQTT protocol library for #Elixir
An Elixir library (driver) for clients communicating with MQTT brokers(via the MQTT 3.1.1 protocol). - https://github.com/suvash/hulaaki/
View the complete changelog at https://github.com/suvash/hulaaki/blob/master/CHANGELOG.md
[0.1.0] - 2017-08-12
Added
- Added link to CHANGELOG in the README
- Add instructions on using Makefile for running tests.
-
Handle
gen_tcpconnection failures instead of crashing - Add automatic ping to server (based on keep alive) and expect ping response with callbacks
- Handle packet ids internally (for control packets with variable header)
- Adds TLS/SSL support for the library
- Implement chunked message receiving so as to parse packets sent together
Fixed
- Replaces all occurences of 65_536 to 65_535 (max limit for 2 bytes)
ParallelTask: easily run functions in parallel and capture the results
A library for easily parallelizing slow tasks such as API requests, database queries and the like.
https://github.com/Fabianlindfors/parallel_task
Inspired by Ryan Sydnor’s article Reducing Elixir Backend Time From 120ms to 20ms With Parallelization.
Using GenServer :via
I have two GenServers that use the same handle_* interface so I figured out how to use :via to talk to either through the same means.
ReceiptDecoder: Decode iOS App receipt
ReceiptDecoder is a tool to decode iOS App receipt in Elixir. You can do some validation before sending receipt to remote server.
Benchmarking in Elixir
Ready to measure the performance of two pieces of code w/ the same output? Check out the latest episode: Benchmarking with Benchee https://elixircasts.io/benchmarking-with-benchee
What if Elixir were Homoiconic?
This article explores the misconception that Elixir is homoiconic, dives into what “homoiconic” actually means, and envisions what Elixir would look like if it truly were a homoiconic language.
Hammer: an elixir rate-limiter with pluggable backends
Hammer is a rate-limiter for Elixir, with a modular backend system, so you can choose where to persist the rate-limit counters. Currently supported backends are ETS and Redis.
alembic 3.4.0
https://hex.pm/packages/alembic/3.4.0
Changelog
Enhancements
-
Alembic.Document.from_ecto_changeset/2converts theerrorsinecto_changesettoAlembic.Error.tin a singleAlembic.Document.t. Bypasses a bug inJaSerializerwhere it assumes all fields that don’t end in_idare attribute names, which leads to association names (as opposed to their foreign key) being put under/data/attributes.Alembic.Document.from_ecto_changesetreflects on theEcto.Changeset.tdatastruct module to get the__schema__/1information from theEcto.Schema.t. It also assumes that if the field maps to no known attribute, association or foreign key, then the error should not have anAlembic.Source.tinstead of defaulting to/data/attributes. -
Alembic.Pagination.Page.countcalculates the number of pages given the pagesizeand thetotal_sizeof resources to be paginated. -
Alembic.Pagination.Page.firstreturns theAlembic.Pagination.Page.tfor thefirstforAlembic.Pagination.tgiven any page and the page count. -
Alembic.Pagination.Page.lastis the last page forAlembic.Pagination.tgiven any page and the page count. -
Alembic.Pagination.Page.nextis the next page after the currentpage. Ifpagenumbermatchescount, then it must be the last page and so next will benil. -
Alembic.Paginaton.Page.previousis the previous page to the currentpage. If thepagenumberis1, then it is the first page, and the previous page isnil. -
Alembic.Pagination.Page.to_paginationtakes the currentpageand thetotal_sizeof resources to paginated and produces theAlembic.Paginationwithfirst,last,next, andpreviousaround thatpage. Ifpagenumberis greater than the calculated page count{:error, Alembic.Document.t}is returned instead of{:ok, Alembic.Pagination.t}. -
Alembic.FromJson.integer_from_json -
Alembic.FromJson.integer_to_positive_integertakes an integer and returns it if positive, otherwise returns errorDocumentif0or below. -
Alembic.Pagination.Page.from_paramsparses param format with quoted integer page number and size or JSON format with integer page number and size. -
Allow pagination opt-out with
%{“page” => nil}.Alembic.Pagination.Page.from_params(%{“page” => nil})will return{:ok, :all}while no“page”param will return{:ok, nil}. - Use IntelliJ Elixir formatter for make the formatting consistent
-
Support
many_to_manyassociations inAlembic.ToEctoSchema.to_ecto_schema/2 -
Alembic.ToEctoSchema.to_ecto_schema/2doctests
Bug Fixes
-
Allow
nextandpreviousto benilinPagination.t@typesince they were already allowed to benilin use for the last and first page, respectively. -
Alembic.Pagination.Pagenumberispos_integerbecausenon_neg_integerallows 0, but that’s not valid becausenumberis 1-based, not 0-based.
Elixir for the Little Things
You don’t have to have a big problem to use a great language. Elixir shines at scripting, too
Elixir and Doctest - Help Writing Better Programs, One Method At A Time
Sometimes it’s the small things that you find enjoyable, like… having Doctest. ;)
http://fredwu.me/post/163901408538/elixir-and-doctest-help-writing-better-programs
How to run Phoenix framework application inside a Docker container?
How to run Phoenix framework application inside a Docker container? https://blog.lelonek.me/how-to-run-phoenix-framework-application-inside-a-docker-container-b02817d860b4
Nerves 0.7.1 Released
Nerves has really been moving forward quickly over the past few months. One exciting new feature that I’ve been working on is the nerves.system.shell Mix task, which allows you to more easily build custom Nerves systems regardless of what OS you’re using. Check out the updated documentation to learn more!
HTTP/2 client available from Ace > 0.11.1
The latest version of Ace includes a HTTP/2.0 client. https://hexdocs.pm/ace/Ace.HTTP2.Client.html
From zero to Production Elixir, part 2
This is the second part of the story of how we got an Elixir application running in Production in a month. This time we’re more focused on the code aspect and how we applied the umbrella apps concept. The article ends with some thoughts on how Elixir welcomes newcomers like me. https://medium.com/onfido-tech/from-zero-to-production-elixir-in-1-month-2-2-1deca839be14
National Health Service on Elixir, React and Kubernetes
The second case study how we built eHealth system for NHS of Ukraine on Elixir, React and Kubernetes. https://medium.com/nebo-15/national-health-service-on-elixir-and-kubernetes-b1c2551f0dbb
Time zones in PostgreSQL, Elixir and Phoenix
I just blogged about the way I handle time zones (specifically timestamps) in Elixir/Phoenix/Ecto applications on our corporate blog
