Thursday, September 24, 2015

How to fix the "cryptswap1 is not ready yet" error on Ubuntu?

I never paid attention to the error message that, every time I started Ubuntu 14.04, was saying that "The disk drive for /dev/mapper/cryptswap1 is not ready yet or not present".

However, this caused that today I couldn't start the system at all, which is a painful and stressful experience. These are the steps I followed to fix the issue and get Ubuntu back to life.

1) At the GRUB menu, start Ubuntu in recovery mode
2) At the Recovery menu, select "Drop to root shell prompt"
3) Type "sudo swapoff -a" to disable swapping
4) Type "sudo mount -o remount,rw" to have write access to the system files
5) Type "sudo nano -w /etc/crypttab" and put a "#" at the beginning of the line that starts with "cryptswap1". Save the file.
6) Type "sudo nano -w /etc/fstab" and put a "#" at the beginning of the line that starts with "/dev/mapper/cryptswap1". Save the file.
7) Reboot the system. You should be now able to start Ubuntu normally.

Wednesday, September 23, 2015

Using Windows and you can't see your Android device on DDMS? This is how to fix it!

I recently bought a new phone running on Android 5.0.2 and, after enabling the Developer Mode and activating USB debugging, I was unable to connect it to Eclipse on Windows 10. The DDMS view and adb devices command showed an empty list.

This is how I fixed it:

1) Make sure you the Google USB Driver installed in your Android SDK folder.

2) Connect your device via USB and open Control Panel -> Device Manager.

3) You will see under "Other devices" an unrecognized "ADB Interface". Right-click on it and select "Update Driver Software".
4) Click on "Browse my computer" and enter the path to your Google USB Driver (<sdk>\extras\google\usb_driver\).

5) Click on "Let me pick from a list of device drivers" and select "Android USB Device".

6) Save changes and restart your IDE. Your device should be now visible from your DDMS view.

Sunday, September 6, 2015

How to deploy a PostgreSQL database in Ruby on Rails through Cloud Foundry

If you have a Ruby on Rails app with a PostgreSQL database and you are deploying it for the first time through Cloud Foundry to your hosting provider, you might have realized that a simple cf push yourappname doesn't initialize the database.
As it occurs when you are working locally, you first need to trigger the database creation and migration processes.

In my case, I am connecting to IBM Bluemix through Cloud Foundry, and my app is connected to an ElephantSQL PostgreSQL database. These are the steps to deploy my app successfully:

1) Deploy the app for the first time: cf push yourappname
2) Create the database and run the migrations (if any): cf push -c "bundle exec rake db:create db:migrate" yourappnameNote that this command will leave the app down.
3) Start the app again: cf push -c "null" yourappname