Web development

How to correctly fix the AngularJS error: “digest already in progress”

AngularJS_logo

 

$digest already in progress

$digest already in progress

First of all, don’t fix it this way

if ( ! $scope.$$phase) {
  $scope.$apply();
}

It makes no sense because $$phase is just a boolean flag for $digest cycle, so your $apply() sometimes won’t run. And remember it’s a bad practice.

Continue reading

Standard
Databases

How to schedule a MongoDb backup using cron

If you are looking for a quite simple way to automate MongoDb backup using cron, here is one:

* 1 * * * DATE=`date +\%y/\%m/\%d/`; mkdir -p /mongo-backup/$DATE && mongodump --out /mongo-backup/$DATE

Notes:

  • Everyday at 01:00 am
  • Example path on 10th November 2014: /mongo-backup/14/11/10/
  • In the day folders, you will find a folder per database
  • In each database folder, you will find a JSON & BSON for each collection

MongoDB backup output

 

Read more about cron or mongodump

Standard
Dev Ops

Nginx: could not build the server_names_hash, you should increase server_names_hash_bucket_size

 

could not build the server_names_hash, you should increase server_names_hash_bucket_size

I got this error when I added a new host in the Nginx configuration file, but don’t worry, it’s very easy to fix it.

Just add the next line in the http block: Continue reading

Standard