MEAN.IO – MongoDB, Express, Angularjs Node.js powered fullstack web framework

My next experiment will be with: MEAN.IO – MongoDB, Express, Angularjs Node.js powered fullstack web framework.

And of course my next book will be: MEAN Machine from Chris Sevilleja and Holly Lloyd on Leanpub.

Is it? Is it not? “ORM is an anti-pattern” | Seldo.Com Blog

If you are into whether you’re going to use ORM in your next project or not, you’ll appreciate the thoughts about why and when ORM can be bad for the application. First its design flaws are shown and then alternatives are given. Too many queries, the need to break the abstraction by using raw queries, how bad it can be in the long term when it’s too late and many more:

ORM is an anti-pattern | Seldo.Com Blog.

I personally like ORM, defining the relations properly and then having the powerful code coming from this abstraction. I am on my way to use ORM in a big project too. I also know and use SQL a lot for example in data mappers. I think sometimes it may be better to create a custom in-house ORM for a project though this may require constant changes to it when adding new features. I also think that every query produced by the ORM should be checked before going in production and also using a monitoring tool for your application in prod and testing your application by overloading it in a dev environment is good.

Defining relationships among database tables with Eloquent @

One very clever article showing all types of complicated relations that you may stumble upon in your job.

The author shows in a very clean way how to create such migrations, seeds and models.

Check out how morphs(), morphTo(), morphToMany(), morphedByMany and withPivot() are used.

Read it a couple of times, test it with all possible databases Laravel supports and see the differences, check the structure created: tables, data, foreign keys. Add, delete records and see what happens inside the database. Try creating your own app using these functions to get even more clear picture.

Laravel, Eloquent, polymorphism, one-to-many, many-to-many and polymorphic many-to-many relationships:

Defining relationships among database tables with Eloquent.

Owncloud: How to change the admin password from the command line.

I’ve been playing with Owncloud in a Docker container today and something was not set right. The admin password was not the default one. So my options were to delete the sqlite db file or run some password generating commands and queries to update the password.

The first thing is to generate a new sha1 password:

echo -n "password" | sha1sum

Use the result from the command above as the new password.

The second thing is to open the sqlite database with the sqlite3 command and update the admin’s password:

cd /var/www/owncloud/data
sqlite3 owncloud.db
update oc_users set password = "newsha1password" where uid = "admin";

Now you can login normally with admin/newpassword and from there you can set up all of the rest.

The sources I used for this article: here and here.

Building Mobile-First Infrastructure for Messenger | Engineering Blog | Facebook Code

“..until recently the back-end systems hadn’t evolved much from early iterations, and Messenger’s performance and data usage started to lag behind — especially on networks with costly data plans and limited bandwidth. To fix this, we needed to completely re-imagine how data is synchronized to the device and change how data is processed in the back end..”

Read the rest of the article here: Building Mobile-First Infrastructure for Messenger | Engineering Blog | Facebook Code.