ActiveRecord Smell With Elixir/Ecto
A quick how-to on bringing some ActiveRecord goodness into Elixir/Ecto.
A lot of unnecessary macro tweaking included :)
→ https://dev.to/mudasobwa/activerecord-smell-with-elixirecto-6dc
Generated Module As A Guard
Better and faster way to implement validation of incoming data than just looking it up in the global config map. An example of hot module generation and reload.
How to use Elixir LS with Vim
Elixir LS is the Language Server Protocol implementation for Elixir. Vim is the greatest text editor of all time. Now it’s time to combine the two.
https://www.mitchellhanberg.com/post/2018/10/18/how-to-use-elixir-ls-with-vim/
How many functions do you have in your #erlang / #elixirlang VM?
The latest article on Erlang Battleground: https://medium.com/erlang-battleground/code-server-erlang-elixir-6faa86206f70
IntelliJ Elixir 10.0.1
-
Eliminate freezes when calculating Module and Library dependencies during project import and dependency updates.
-
Run library syncing in tasks: When importing projects, run sync as a modal task while when
VirtualFileSystem
events occur, run sync as background tasks. Either style of task is cancellable and importantly, it allows to show what is happening during the syncing. This converts the unresponsive UI beachball on macOS during import to an updating progress bar. - Calculate dep sets iteratively with a work queue instead of recursively to limit the calculation of dep set for a root to 1 time. Then use normal transitive walk to get complete dep set for module. Vastly speeds up project import.
-
Cache dep set on package
PsiFile
to allow faster refreshes when indirect dependencies don’t change.
-
Run library syncing in tasks: When importing projects, run sync as a modal task while when
-
Log
nameSet
when it reaches suspect size (10
) to allow triaging if it is a real bug or just something with a lot of valid names. -
Fix inverted condition around when to warn and when to error and use
readAheadLength
.
Add extra security to your image handling
Improve image handling whitelist with Elixir, https://medium.com/coletiv-stories/add-extra-security-to-your-image-handling-in-elixir-45db69aab008
Kubernetes-native Phoenix Apps: Introduction and Part 1
Introduction and first content post in my new series about running Elixir Phoenix apps on Kubernetes go live today. I’m describing an opinionated and focused approach that assumes you are already comfortable with Elixir/Phoenix and with Kubernetes primitives, but not necessarily experienced with marrying the two. It will soon approach more advanced Kubernetes topics that have not been as widely discussed thus far.
Phoenix 1.4 Chat Server: Part 1
This is the first part of a longer series.
Setting up Phoenix 1.4 and Webpack with Babel and Sass
First we update our installers to use Phoenix 1.4 (rc 2) and create the chat server app.
Then we make sure we’ve got Cowboy 2 and Ecto 3, and check out the new changes in 1.4. Channels have changed a bit and the code in endpoint.ex and user_socket reflects it. Another big change is swapping out Brunch for Webpack.
Finally, we’ll install node-sass
and sass-loader
and adjust our to our Webpack setup so we can use SCSS instead of CSS.
A simple, drop-in plug for shallow ETags
Ever wondered why there was no ETag plug? Well, now there is!
Start using it now and reduce the bandwidth of your Phoenix application!
ExVenture Updates for October 2018
ExVenture is a text based MMORPG. The last month for ExVenture has been pretty good! There has been some additions to the Gossip network that ExVenture is apart of, and a new site for players of all ExVenture games has launched called Grapevine.
All of these projects are open source with links in the blog post.
IntelliJ Elixir 10.0.0
-
Go To Symbol and completion will only resolve in project source unless non-project sources are turned on.
-
deps
are properly marked as Libraries and no longer count as being in the project scope for the Go To tools. -
In umbrella projects, when
in_umbrella
is used, the Project Module for eachapps/#{APP_NAME}
will be marked a dependency, - Library and Modules are properly connected as dependencies, so that only declared dependencies will resolve, lessening false completions and declarations when different OTP app share common Module or function names.
-
-
deps
and the_build/#{MIX_ENV}/lib/#{DEP_NAME}
will be marked as Excluded, so that Libraries appear in External Libraries at the bottom of the Project Pane. - Go To Class action (Cmd+O) to go to modules separately from all functions as would happen with Go To Symbols (Alt+Cmd+O).
-
Add
.eex
to.ex
and.exs
for accepted file extensions used to hyperlink files in stacktraces. -
Resolve unaliased name when using
alias __MODULE__, as: Mod
-
Resolve usage of
Mod
inalias __MODULE__, as Mod
-
Mod
-
__MODULE__
inalias __MODULE__
-
defmodule MyModule
that is enclosing__MODULE__
.
-
-
Completion of functions in current module when using
Mod.
afteralias __MODULE__, as: Mod
. -
Show more context for
alias
calls in presentations, like “Choose Declaration” pop up for Go To Declaration.-
Show resolved
__MODULE__
name (alias MyModule
) when usingalias __MODULE__
. -
Show full
alias MyModule, as: Mod
when listingMod
inalias __MODULE__, as Mod
.
-
Show resolved
-
Exclude common directories when importing projects
-
cover
for test coverage -
doc
forex_doc
-
logs
for log files -
assets/node_modules/phoenix
forphoenix
-
assets/node_modules/phoenix_html
forphoenix_html
-
- Setup Libraries and Module dependencies when importing projects from Mix.
-
Canary, pre-release builds (
vMAJOR.MINOR.PATCH-pre+YYYYMMDDHHMMSS
) frommaster
branch- GitHub pre-release releases
- Release on the canary channel in the JetBrains Plugin Repository
-
Don’t include
null
useCall
as__MODULE__
dependency. -
Wrap
LibraryTable#removeLibrary
in write action. -
Wrap
Library#modifiableModule#commit
in write action. -
More closely match ExUnit.CliFormatter output in Test Runner.
-
Don’t
inspect
ExUnit failurereason
as##teamcity
message
. - Add captured logs to failure
- Colorize test failures - including diff colorization
-
Don’t
-
Map Elixir 1.7
:excluded
and:skipped
(added in elixir-lang/elixir#7245) totestIgnored
teamcity message, thereby restoring ignored test counts and markers from Elixir 1.6. -
When finding a
defmodule
, check that it is an ancestor of the entrance of theResolveState
, so that nested sibling modules are not scanned for potential call definition clauses, but only the outer module of the entrance. -
Remove
@2x
and@3x
SVG icons that render wrong size in 2018.3 EAP. -
flushBufferBeforeTerminating
was deprecated and in newer IntelliJ the call toprocessStatuses
does not occur unlessflushBufferOnProcessTermination
is also overridden. -
Treat
== Compilation error
inSTDOUT
asERROR
for ExUnit reporter -
Convert
(CompileError)
of a test file to test failure. The “Test framework quit unexpectedly” is converted to a failed run with a single test with the compilation error as the failure message. -
Don’t treat redefinition of
defmodule
macro as module definition (as occurs in @bitwalker‘s distillery‘sMix.Tasks.Release.Init.MixMock
-
Don’t log compilation errors as test failures unless a test has started. Test name being called
mix test
does not work, so log those compilation errors as normal build messages instead. -
Don’t interpret
:crypto
by default::crypto
includes NIFs that can’t be reloaded and so kills the debugger. - @KronicDeth -
Protect from
null
containingFile
for modular names during completion. -
Wrap
syncPublisher(JDK_TABLE_TOPIC)
ininvokeLater
runWriteAction
. - Dependencies are now counted as external to the project, so the Go To tools, like Go To Symbol will no longer include matches for both project sources and dependencies sources together, instead they will follow the more JetBrains native behavior
Getting Started with Ecto Part 2: Migrations, Schemas, and Changeset
Part 2 of Getting Started with Ecto goes over migrations, schemas, and changesets. Check it out and share it.
Implementing Bounded Contexts in Elixir
What if we could write loose coupling services without the overhead of common microservices architecture?
Read the post Implementing Bounded Contexts in Elixir to check out a pratical example using umbrella projects.
Dealing with runtime environment variables
Runtime environment variables in Elixir is not that easy. This is how I deal with it.
Timex and Ecto: Troubleshooting
Handle time operations in your Elixir application with Timex and Ecto.
Check out how in this blog post.
ElixirMix Podcast 024 - “Sagas” with Andrew Dryga
In this episode of Elixir Mix, the panel talks with Andrew Dryga a software engineer (full-stack), entrepreneur, blockchain architect, and consultant. We talk about “Sagas” and Sage, an Elixir project for more cleanly handling distributed transactions. Personally, Sage would have helped me better solve some complex problems I’ve encountered before. Learn about Sage and more!
Story about one small (elixir) library
https://www.badykov.com/ethereum/2018/10/22/story-about-one-small-library/
A couple of years ago I got interested in Ethereum. My favourite programming language at the time was Elixir (by the way, Elixir is still my favourite language). My first contribution to the Ethereum community was Ethereumex - Elixir JSON-RPC client for the Ethereum.
In this post, I’ll describe its evolution. I won’t go into too much detail about the technical details of Ethereumex as I want this post to be about the open source, not about technology that it implements.
Simple Graphql Client
As the name implies it’s a simple GraphQL client :slight_smile: It allows you to interact with graphql Api as simple as possible.
And i just released version 0.2.0 with support for absinthe subscriptions and a few more things
Phoenix with image upload to S3
Phoenix with image upload to S3 in an API: Implementation and testing.
Check out how in this blog post.
Phoenix 1.4 Chat Server Series Overview
Started a new Phoenix 1.4 Chat Server project to go over new changes. It will use:
- Webpack 4
- SCSS
- Babel
- Phoenix 1.4 channels
- Cowboy 2
The initial overview is here