• Bubble
  • Bubble
  • Line

Elixir Game - 0x06 Modifications to State - Modifying the User module and paving the way for our NPC

Andrei Clinciu Article AUthor
Andrei Clinciu
  • 2018-03-29T21:10:00Z
  • 8 min to read
Elixir Game - 0x06 Modifications to State - Modifying the User module and paving the way for our NPC

Our User module works great for the purpose it has been created.

However we need to to prepare for the future when we'll implement our NPC's and battle system.
We will also probably need to store other details in a "global" repository in memory.
Yes, ETS works great for this, however that's for a future date.

We can copy paste the user module and modify it each time we need to store data, but there is an easier and better way.

Creating another Module DataStorage on which our User extends.
This way our application will make calls to the DataStorage module

DataStorage module

the DataStorage module is responsible for handling all our data in a special process. We will then implement the user model on top of that.

To view ALL The code in the Fossil Respository for the 0x06 Modifications to State click here

read more

GoAccess Log analyzer for nginx and Phoenix

Andrei Clinciu Article AUthor
Andrei Clinciu
  • 2018-03-23T14:16:00Z
  • 2 min to read
GoAccess Log analyzer for nginx and Phoenix

I've deployed my first live system with Phoenix and Elixir. Since this was a mostly manual process, I need a way to analyze the access logs generated by nginx.

Google Analytics works great for those clients that have JavaScript enabled. But what about uses who don't? What about bots, cralwers, and requests to other files like CSS/JS?

Or what happens when there's someone like me and doesn't allow javascript by default or blocks certain domains?

read more

Elixir Game DevLog update - 0x05 Documentation, Testing and Polishing

Andrei Clinciu Article AUthor
Andrei Clinciu
  • 2018-03-22T08:13:00Z
  • 1 min to read
Elixir Game DevLog update - 0x05 Documentation, Testing and Polishing

I had planned to write a full extensive explanation on how to use doctests, test files and on how to implement testing with exdoc by using mix test

It's however come to my attention that there are already MANY places on the internet that already discuss this.

Since time is valuable I'd rather go ahead with the development.

You can view the changes that occured in 0x05 at the Life Beyond Apocalypse Fossil repository.

Download the full sourcecode here for 0x05 here

 

read more

Elixir LBA Game - 0x04 - Introducing Items

Andrei Clinciu Article AUthor
Andrei Clinciu
  • 2018-03-15T19:22:00Z
  • 8 min to read
Elixir LBA Game - 0x04 - Introducing Items

This is part of the Elixir Life Beyond Apocalypse Zombie Game creation tutorial.

Before we start coding we first need to think how do we handle and save our items?
Should we save them in a database, a flat file? Sqlite? In memory? Embedded in the code?
It depends. I've long opted and worked with SQL databases.
For our purpose we will save everything in a module variable in memory.
This will make everything easier since we don't need to go into details on how to work with SQL from Elixir right now.
Items the user has are stored in the items
Whenever we save the state of a user we can save it to a file.

Later we will refactor our code and save our data differently.

At the moment we will keep things short and easy. Items will not be stackable.
We won't make too many verifications for the sake of smplicity.
For example we won't verify if the user already has full health or energy.
These will be added later on.

read more

FFMPEG video encoding to save GB of data - which encoding is the best?

Andrei Clinciu Article AUthor
Andrei Clinciu
  • 2018-03-11T10:13:00Z
  • 4 min to read
FFMPEG video encoding to save GB of data - which encoding is the best?

I was back-up'ing my system and I reviewed everything after the stupid debian bug I've encountered.
I noticed that I had some 37 GB of video's from the 2nd semester of the CCCP study.
For 50 minutes of lecutre I had around 900 MB.
For a resolution of 1280x720 at 30 frames per second with 24bit color quality per pixel you would get a 30 GB file without any compression.
So clearly this is a 30:1 win and even the 900MB is a great compression if you stop to think about it since it was already compressed with the H264 codec.
I started to look around and test things with libtheora and ffmpeg I eventually got a 401 MB file.
For a aproximate bitrate of 1024K/s for the video the file size was roughly half. One problem I encountered with the libtheora was that it could not use all cores, which made it VERY SLOW.
Ok, i could convert all my videos at once, but that's pretty lousy. Not to mention the quality was reduced so theora wasn't an option.

read more

Elixir Game - 0x03 Saving state in Processes

Andrei Clinciu Article AUthor
Andrei Clinciu
  • 2018-03-08T19:43:00Z
  • 7 min to read
Elixir Game - 0x03 Saving state in Processes

This is part of the Elixir Life Beyond Apocalypse Zombie Game creation tutorial.

In the last tutorial(Elixir - 0x02 Command Line Fun - LBA Game) we created a command-line application.
Due to the immutability of Elixir and Erlang we had to pass the user structure map to every function.
However, passing the user struct form one function to another only makes things more complex and makes everything error prone.

Elixir has a solution for this.

Storing data in Elixir can be done by creating a new process and storing the data there.
We will be using spawn, send and receive for the whole thing.
Later on we will upgrade our codebase to use Agents.

Normally when we work with processes we always need to work with a PID. This means that whenever we want to send information to the process (to get back a response) we need to pass the pid.
This makes it again a little bit difficult since we would need to pass the pid instead of the user struct.
However thanks to Elixir we can name our processes! This can help us a lot.

read more

New Blog System

Andrei Clinciu Article AUthor
Andrei Clinciu
  • 2018-03-05T12:05:00Z
  • 2 min to read
New Blog System

Once upon a time a software developer began to implement his own version of a blog.

 

This website has been written from scratch. I know that it kind of misses the main point of Wheel Reinvention, however it was for a noble cause; mastering Phoenix!

I've also switched from hosting provider and mail provider for multiple domains. No downtime occured, however due to DNS propagation weird happened but it's now been solved.

read more

GDPR - Know your Rights - Analyzing the inevitable

Andrei Clinciu Article AUthor
Andrei Clinciu
  • 2018-03-01T20:18:00Z
  • 7 min to read
GDPR - Know your Rights  - Analyzing the inevitable

DISCLAIMER: This post is NOT in any way legal advice. I'm not an lawyer. Seek professional advice of a lawyer together with an IT specialist!
Also note that this is work in progress and that I'm updating this and waiting untill after 25 may 2018 to see how others have implemented various solutions to comment on them.

I've first read the GDPR law in 2016 for the Computer and Cybercrime Professional university degree I followed. We handled it in 2 distinct courses IT Laws and Privacy and IT Governance, Security Compliance and Risk assessment. The information gained there together with prior knowledge about Privacy laws made me realize that there are many similarities and new things which are awesome.

Data Protection regulations implemented by most countries in the European Union before GDPR gave citizens the same rights GDPR now wants to give EU citizens worldwide.
This is an incredible effort. Since if you were an EU citizen and where registering in the US or anywhere else in the world, those companies didn't have to comply to any regulation. Now with GDPR if you're an EU citizen they are forced to comply.

read more

Building Great Software
The digital Revolution begins when you learn to automate with personalized software.

Find me on social media