Add your GMail account to Metatrader Notifications

On this article we’re going to set up Metatrader for email sending. This is recommended so you don’t miss important messages happening to your account. Getting a password from Google If you want to connect your Google email account, you have to generate a new password for Metatrader. To generate a Google password: On the GMail page click on the Apps menu at the top right corner and then click on Account.

Implementing put and delete operations using BatchWriteItem

The BatchWriteItem operation allows us to work with groups of up to 25 items per request. Additionally, we can put and delete items to one or multiple tables. Amazon DynamoDB’s page says: A single call to BatchWriteItem can write up to 16 MB of data, which can comprise as many as 25 put or delete requests. Individual items to be written can be as large as 400 KB. In this article we are going to go through the process of putting and deleting items to a table that looks like this:

Undoing the Last Git Commit

A command so important, it deserves its own page: git reset --soft HEAD~1 The previous command undoes the last commit to git. I think this is one of those commands that I have typed many times during the last year. It’s very important to know which branch we currently are on, but sometimes excitement (or stress) may make us forget checking it. Related to this, I have a custom prompt that shows a random smiley and the current git branch to the prompt.

Inserting and updating items to DynamoDB lists and maps

Should I use a map or a list? A simple rule: If you need to update or remove an item, lists only allow you to do it by index. While maps let you do it by key. Their simplified representation goes like this: { "someMap": { "key1": "value1", "key2": "value2", }, "someList": ["value1", "value2"] } Inserting and updating to a map The following example adds or updates an instance of “SomeItem” as a json string into a map field called someMapField.

Testing scala classes and controllers

This article discusses different approaches for testing classes, services, and PlayFramework controllers using scalatest. Setting up the project dependencies First step is to add to build.sbt the next dependency: "org.scalatest" %% "scalatest" % "3.2.2" The following template unit test uses the WordSpec style which offers a natural way for writing tests. scalatest offers more styles, but I find this one more expressive. PlaySpec (found in the PaylFramework) extends WordSpec and has a similar behavior.

Enumerations

Using case object Unlike other languages, Scala does not have a keyword for enumerations. One way to implement them is by using case objects. For example: sealed trait OperatingSystem case object FreeBsd extends OperatingSystem case object Debian extends OperatingSystem case object Alpine extends OperatingSystem case object Arch extends OperatingSystem case object Osx extends OperatingSystem To use it, just define a value of type OperatingSystem. You can even get a string representation from these values:

Installing Rancher on Ubuntu/Docker

On this article we are going to install a rancher server on Ubuntu. Let’s start by getting the rancher image from docker hub: sudo docker run -d --restart=always -p 8080:8080 --name=rancher-server rancher/server Go to http://ip-address:8080 and click on Add Host. It is important that you do not use a localhost address (127.0.0.1, localhost). If you do so, and you want to add your local computer as an agent, you will not be able to reach it.

From MySQL to Postgres - Useful commands

This article shows a list of basic commands on MySQL and their corresponding versions for PostgreSQL. Connecting to a database MySQL $ mysql -u root -p Postgres $ su pgsql $ psql Or using a different user: $ psql dbname If you can’t connect because you don’t know what databases are available, try any of these: psql -l psql postgres psql template1 The postgres database is a default database meant for use by users, utilities and third party applications read more.

Ideas for successful software projects

This article describes some ideas on getting a successful software development process. A successful project: Depends on the expertise of the team. Don’t try to push many new technologies to a project. It will be difficult for the team to get acquainted with them and deliver a quality project. Small steps are the best. Depends on the level of communication. Enforce communication among the team members. Even if they are working remotely.

Storing MySQL credentials on a file

MySQL allows you to store credentials in a file called ~/.my.cnf. The contents can look like this: [mysqldump] user=myuser password=mypassword We have to modify the file permissions and give read/write permissions to the owner only: chmod 600 ~/.my.cnf And done. We can now use it: mysqldump mydatabase mysqldump is going to read the credentials from that file.