Startup Job, a sample project to search startup jobs
Hi there,
I just published my first Phoenix project Startup Job, an umbrella project to search startup jobs which scraped from various websites.
You can find out more on the GitHub repo.
Streaming Data with Ecto
Let’s build a small CSV exporter to show how you can stream data from your database using Ecto!
Blog: Poncho Projects
New blog post on Embedded-Elixir - Why we prefer ponchos over umbrellas on Nerves-based projects. http://embedded-elixir.com/post/2017-05-19-poncho-projects/
Sobelow - 0.2.3
The Phoenix Framework vulnerability scanner - Source
Updates include minor bug fixes, and checks for some types of command injection.
retort 2.0.0
https://hex.pm/packages/retort/2.0.0
Changelog
https://github.com/C-S-D/retort/compare/v1.3.2…v2.0.0
Enhancements
-
Document
Retort.Resources -
Update to
alembic3.3.0-
Drop the need for
changeset_renderby usingJaSerializer.Formatter.Utils.format_keydirectly to make it the same ascalcinator.
-
Drop the need for
-
Update to
calcinator3.0.0-
Retort.Response.Error.to_calcinator_error(Retort.Response.t, Ecto.Changeset.t)will convertRetort.Response.tdataAlembic.Document.terrorsto aCalcinatorerror. If theAlembic.Error.tformat is unrecognized, it is assumed to be convertable toEcto.Changeset.terrors usingRetort.Response.Error.Ecto.Changeset.add_alembic_errors(changeset, errors)
-
Bug Fixes
-
A missed rename left the application name used for
Application.get_envas the original:interpreter_server_rpcinstead of:retortinRetort.Resources.timeout/2. -
Fix (
Map->map) typo inRetort.Client.Generic.start_linkoptions. -
Retort.Resources.client_start_linkshould not have been 0-arity, but 1-arity, so it can take in theclient_start_link_optionsas an argument instead of depending on lookup bymoduleto retrieve some hidden state. -
Retort.Meta.valid!/2checked if the Ecto.Repo was sandboxed withApplication.get_env(:retort, Retort.Repo), which is a faithful translation of the original in:interpreter_server_rpc, but has the problem that it only works inretortitself. To allow the repo to be check to be configured,Retort.Meta.valid!/2now takes an:ecto_repo_moduleoption, which is check if its sandboxed if any of the:ecto_schema_modulesare database-backed (have a non-blank__schema__(:source)). -
Retort.Server.Generic.Resources.handle_method/2converts{:error, :sandbox_token_missing}into RPC response errors instead of aCaseClauseErrorexception.
Incompatible Changes
-
Retort.Resources.client_start_linkcallback changes arity from0to1and now should take inoptionsinstead of callingRetort.Resources.client_start_link_options/0. -
Retort.Client.Generic.start_linkcalls where theecto_schema_module_by_typeecto_schema_modules are database-backed will now require:ecto_repo_moduleto check if theEcto.Repo.tis sandboxed. -
Require
alembic~> 3.3-
changeset_renderis no longer needed forRetort.Server.Generic.Resources, soRetort.Server.Generic.Resources.thas been removed and aCalcinator.tshould be used as the state instead.
-
-
Require to
calcinator~> 3.0-
Retort.Response.Error.Ecto.Changeset.add_alembic_errors(changeset, [Alembic.Error.t])will convert theAlembic.Error.ts to validation errors added to thechangeset. It’s a way to reverse the conversion done byAlembic.Document.from_ecto_changesetinalembic3.3.0. -
Retort.Response.Error.to_calcinator_error(Retort.Response.t, Ecto.Changeset.t)will convertRetort.Response.tdataAlembic.Document.terrorsto aCalcinatorerror. If theAlembic.Error.tformat is unrecognized, it is assumed to be convertable toEcto.Changeset.terrors usingRetort.Response.Error.Ecto.Changeset.add_alembic_errors(changeset, errors) -
Retort.Server.Generic.Resoruces.handle_method/2is simplified usingput_rendered_or_error/2, so that the large, duplicatecases are eliminated and error handling remains consistent across actions. For error,put_calcinator_erroris called. -
use Retort.Resourcesgeneratesdelete(changeset, query_options)to match the updatedCalcinator.Resources.delete/2. -
Retort.Resources.client_start_link_optionsnow takes(module, query_options), so that if:metaexists inquery_optionsand “beam” is set, then the pre-existing “beam” will be reused. -
All action callbacks in
Retort.Resourcescatch{:exit, {:timeout, _}}from theRetort.Client.Genericcalls, log them, and then return{:error, :timeout}, so thatCalcinator.Controllercan turn it into a 504 Gateway Timeout instead of crashing the calling process. -
All action callbacks in
Retort.Resourcescan transform{:error, %Retort.Response.Error{}}toCalcinatorerrors usingRetort.Client.Generic.error_to_calcinator_error. -
metain query_options is put back into the mergable params passed toRetort.Client.Genericcalls inRetort.Resources
-
GraphQL Authentication with Apollo and React
In this second part of my “GraphQL Authentication” series, I dive into the front-end and wire up a simple authentication system using React and Apollo client.
calcinator 3.0.0
https://hex.pm/packages/calcinator/3.0.0
Bug fixes for error handling and testing support led to incompatible changes in behaviours, but use generated code is updated as well, so no changes if you only use Calcinator.Resources.Ecto.Repo.
Enhancements
-
Can now return (and is preferred to return instead of a timeout exit)
{:error, :timeout}from allCalcinator.Resourcesaction@callbacks. -
When structs are deleted directly instead of changesets, there’s no way to add constraints, such as
no_assoc_constraintorassoc_constraintthat would transform DB errors into validation errors, soCalcinator.delete/3generate a changeset fromCalcinator.Resources.changeset(struct, %{}) -
Make the
Alembic.Document.tandAlembic.Error.tthatCalcinator.Controller.Erroruses internally available inCalcinator.Alembic.DocumentandCalcinator.Alembic.Error, respectively, so they can be reused in overrides andretort. -
Pass
:metathroughCalcinator.Retort.query_options, which allows pass through of meta like fromCalcinator.Meta.Beam, which is necessary for indirect callbacks through RPC calls forretort. -
Move
Calcinator.Meta.Beamkey to module attribute to prevent typos. -
Calcinator.Meta.beam.put_new_lazyallows beam information to only be set inmetaif its not already there to allow for loops betweenCalcinatorservers.
Bug Fixes
-
The
Calcinatoractions@specand@docinclude (hopefully) all the errors they can return now-
{:error, :sandbox_access_disallowed} -
{:error, :sandbox_token_missing} -
{:error, :timeout}
-
-
Ensure
Calcinator.Controlleractions havecaseclauses for all the declared return types fromCalcinatorcalls. -
get_related_resourcescould not handle has_many related resources, specifically-
Calcinator.JaSerializer.PhoenixView.get_related_resource/3would not allowdatato be alist. -
Calcinator.RelatedView.renderwith data assumes the data was singular and “links” could be added to that “data” map. -
Calcinator.authorizeddid not allow the unfiltered data to belist.
-
-
Fix
sourceassignsforget_related_resourceexample: example still used pre-open-sourcingassociationandid_key. -
Fix
show_relationshipexample that was just wrong. The sameassignsasget_related_resourceshould be used. Since at first I couldn’t figure out why showing a relationship would need a view module and I wrote the code, I added a note explaining its for theview_module.type/0callback since relationships are resource identifiers withidandtype. -
Calcinator.RelationshipView.data/1assumed that[:related][:resource]wasnilor amap, which didn’t handle thelistfor has_many relationships.
Incompatible Changes
-
Calcinator.Resources.allow_sandbox_access/1must now return:ok | {:error, :sandbox_access_disallowed}. The previous{:already, :allowed | :owner}maps to:okwhile:not_foundmaps to{:error, :sandbox_access_disallowed}. -
If you previously had total coverage for all return types from
Calcinatoractions, they now also return{:error, :sandbox_access_disallowed}and{:error, :timeout}. Previously, instead of{:error, :sandbox_access_disallowed},:not_foundmay been returned, but that was a bug that leaked an implementation detail from howDBConnection.Ownershipworks, so it was removed. -
Calcinator.deletedeletes a changeset instead of a resource struct-
Calcinator.Resources.delete/1must expect anEcto.Changeset.tinstead of a resourcestruct -
use Calcinator.Resources.Ecto.Repogeneratesdelete/1that expects anEcto.Changeset.tand callsCalcinator.Resources.Ecto.Repo.delete/2, which now expects a changeset instead of resource struct as the second argument.
-
-
:metais now a required key inCalcinator.Resources.query_options. -
Calcinator.Resources.delete/2must now accept both theEcto.Changeset.twith any constraints and theCalcinator.Resources.query_options, so that the newmetakey can be used to continue propagating theCalcinator.Meta.Beamfrom the original caller in a chain of calls.
WebSockex 0.1.3
Version 0.1.3 of WebSockex was just released!
The ChangeLog for this release includes:
-
WebSockex.start_linkwill no longer cause the calling process to exit on connection failure and will return a proper error tuple instead. -
Change
WebSockex.Conn.RequestErrortoWebSockex.RequestError. -
Add
handle_connect_failureto be invoked after initiating a connection fails. Fixes #5
Checkout the v0.1.2..v0.1.3 diff for more info.
Veritaserum: Simple sentiment analisys on Elixir
Hi there!
I just published Veritaserum, a simple sentiment analisys library for Elixir.
It’s based on the AFINN-165 word list, and it also supports:
- emojis (❤️, 😱…)
- boosters (very, really…)
- negators (don’t, not…)
You can check the repo on github.
Metaprogramming Without Macros
New blog post on metaprogramming without writing macros, just using quote and unquote, and functions from Code and Macro.
Supporting multiple event stores in Commanded using an adapter based approach for Elixir
Announcing the release of Commanded v0.10 with support for using Greg Young’s Event Store.
Commanded is an open-source library you can use to build Elixir applications following the Command Query Responsibility Segregation and event sourcing (CQRS/ES) pattern.
This article describes how an Elixir behaviour and adapter approach was used to support multiple event stores.
GPIO_RPI v0.2.0 released
I released a new version of my GPIO_RPI library today. It started as a fork of elixir_ale, but focuses on the Raspberry Pi only.
This new version allows setting pullup register on initialisation of a pin, allows changing of the input/output direction and mode.
GenMetrics - GenServer and GenStage runtime metrics.
New Elixir library supports the collection and publication of GenServer and GenStage runtime metrics. Metrics data are generated by an introspection agent. No instrumentation is required within the GenServer or GenStage library or within your application source code.
Built-in support for pushing metrics data to statsd agents and Datadog too.
Find out more on the GitHub repo, read the HexDocs, or sit back and enjoy a GitPitch presentation.
Take ownership of your data - Part 1
The difference between data modeling and database modeling: https://blog.digitalnatives.hu/take-ownership-of-your-data-part-1/
Sobelow - 0.2.1
Security-focused static analysis for the Phoenix Framework: Github.
Sobelow automatically detects some types of the following security issues:
- Insecure configuration
- Cross-Site Scripting
- SQL injection
- Directory traversal
- Unsafe serialization
alembic 3.3.0
Changelog
v3.3.0
Enhancements
-
#44 - @KronicDeth
-
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. -
Update
circle.yml-
Erlang
19.3 -
Elixir
1.4.1
-
Erlang
-
Bug Fixes
-
#43 - @KronicDeth
-
Allow
Alembic.Error.tsourceto benil - Lower minimum coverage because coverage number varies from run to run.
-
Allow
Testing HTTP requests in Elixir with ExVCR
A basic tutorial to setup ExVCR and how to filter sensitive data in the tests
https://dev.mikamai.com/2017/05/16/testing-http-in-elixir-with-exvcr/
Zuck, a Facebook API client
Just released Zuck, a Facebook API client for Elixir. Messenger and other cool features coming soon! https://github.com/boudra/zuck
