Skip to main content

Posts

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 ...

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.

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" yourappname .  Note that this command will leave the app down. 3) Start the app again:  cf push -c "null" yourappname

Why do I love IBM Bluemix

I had six Ruby on Rails web apps hosted on Heroku that I wanted to migrate to a more scalable and professional platform within my budget. My first intention was to use my Bizspark account and deploy them to Microsoft Azure but, unfortunately, Azure Web Apps do not support Ruby on Rails yet. My attempt to deploy them in a single Linux Virtual Machine was painful and the performance very poor, so I decided to try IBM Bluemix . After signing up for the 30-day trial , I started loving its engaging and intuitive UI, the simple pricing model and the amount of available services for a 1-year old cloud platform. In less than one hour I had deployed my six web apps using Cloud Foundry CLI , migrated the PostgreSQL databases with the ElephantSQL add-on, and  set up the custom domain and SSL certificates. A tiny " Add Git " button introduced me to IBM Bluemix DevOps Services . This is simply mind-blowing! You are not only allowed to edit your code from the w...

How to schedule tasks in Ruby on Rails

There are some scenarios where we would like to set some actions to be performed at certain times of the day, or periodically. There is an easy way set up these cron jobs in Ruby on Rails with  rufus-scheduler . It does support four kinds of scheduling : scheduler. in '10d' do     # do something in 10 days end scheduler. at '2030/12/12 23:30:00' do     # do something at a given point in time end scheduler. every '3h' do     # do something every 3 hours end scheduler. cron '5 0 * * *' do     # do something every day, five minutes after midnight end The integration is incredibly simple. Just create a new file task_scheduler.rb in your /config/initializers folder, include the gem rufus/scheduler and set up your task. In the example below, I am sending an HTTP GET request to Google every 2 minutes and print the status code. # Required Gems require 'rubygems' require 'rufus/scheduler' require 'net/https' requ...

How to make an app start automatically on Ubuntu

Sometimes we found ourselves starting manually a set of apps or webservices everytime we reboot our Ubuntu instance. We can easily automate this process. 1)  Open the configuration file with sudo vi /etc/rc.local 2)  Add all the commands that you want to run. For example:     cd /home/myuser   rm *.tmp     nohup java -jar /var/www/myapp/app.jar & With nohup and the final & we force the jar file to run on background, creating the  nohup.out log file. 3) Always end with exit 0 4) Save changes with :x and reboot the system. The commands that you have added should be run at start up.

How to get your Azure Web App FTP credentials

In the new Microsoft Azure portal, when you create a new Web App, you might struggle to find your FTP user credentials.  This is how you can find them. 1) Open  portal.azure.com and browse to the Web App you want to access to. 2)  Click on the " Get Publish... " button as per screenshot below. It will download an XML file. 3) Open that file with a text editor and you will find the publishUrl , userName and userPWD fields you need.