Installing Ubuntu as a second system on Mac Mini

Today my task was to install Ubuntu as second system on my Mac Mini.

I tried several USB Image creation tools [list]. At the end I’m going to use
YUMI which I found in the official Ubuntu manual.

nointremap solution: https://forums.opensuse.org/showthread.php/479576-problem-in-MAC-OS/page2

Select Linux Distributions and press tab to edit boot options

Other open tabs:

_https://forums.opensuse.org/showthread.php/479576-problem-in-MAC-OS/page2?s=2dfb19d13bc17e66654ffbb5f95cf134

https://bugzilla.redhat.com/show_bug.cgi?id=948262

_https://help.ubuntu.com/community/Installation/FromUSBStick

_http://www.pendrivelinux.com/yumi-multiboot-usb-creator/

_http://www.hecticgeek.com/2012/10/how-to-setup-encrypted-ubuntu-installation/

 

 

Phonegap: You may not have the required environment or OS to build this project

BUILD FAILED
Total time: 5.352 secs

/var/www/bt/platforms/android/cordova/node_modules/q/q.js:126

throw e;

^
Error code 1 for command: /var/www/bt/platforms/android/gradlew with args: cdvBuildRelease,-b,/var/www/bt/platforms/android/build.gradle,-Dorg.gradle.daemon=true

ERROR building one of the platforms: Error: /var/www/bt/platforms/android/cordova/build: Command failed with exit code 8
You may not have the required environment or OS to build this project

Answer: http://stackoverflow.com/a/30761663/613702

Installing Robot Framework on [x]Ubuntu 15.04 + PyCharm plugin

Installing Robot Framework

Install Selenium for Python and selenium2library for Robot Framework:

pip install selenium robotframework-selenium2library

Installing Ride GUI for Robot

Official guide: https://github.com/robotframework/RIDE/wiki/Installation-Instructions#installing-from-source

Step by step

Installing wxPython required by Ride (thanks to this SO answer):

sudo apt-get install python-wxgtk2.8 python-wxtools wx2.8-doc wx2.8-examples wx2.8-headers wx2.8-i18n

Installing plugins

Now I’m going to install Robot Framework plugin for PyCharm.

Normally you may find a correct version by navigating to File->Settings->Plugins->Browse repositories

Download Robot Framework plugin for PyCharm here: plugins.jetbrains.com/plugin/7415
I’m still using PyCharm version 3.4, so I had to download an archive with 0.10.2 version supported by my PyCharm.
After download completed, in PyCharm open File->Settings->Plugins

Finalizing my first application in the Google Play Market

Not too technical, but still… For a long time I was playing with some Android development, but it was always just for fun and never left the local computer or my own phone.

Now I’ve finally finished a tiny silly but cute app and started uploading it to the Play Store. What can I say – it’s like a new love to programming. Coding starts matter, you again care about all tiny details your app has. You have to groom it before showing to public and you feel it’s your child.

So definitely, if you’re tired of programming – try making some software for people.

To be continued…

Python docstring

Small tutorial on how to correctly format docstrings in Python: Example on how to document your Python docstrings

I love to document code and I use PyCharm for Python development. And I always forget the syntax of method arguments type/description. I think the tutorial in the link above is quite explanatory, but I’ll update this post in case I find something new.

Make Celery ignore Django settings

I wanted to run an instance of Celery on my Linux machine. I installed it in a separate virtual environment (celery-test), but when I tried to run a sample application, I’ve got an error

ImportError: No module named xxx.settings

It was obvious that the problem was that I had Django installed system wide, so even from its own virtualenv my Celery could see Django settings. So I checked if I have references to Django in my environment variables:

printenv | grep xxx
DJANGO_SETTINGS_MODULE=xxx.settings

Let’s get rid of Django references for this particular virtualenv. Virtual environments have hooks for different types of events like preactivate or postdeactivate. They are stored in separate files in the virtualenv folder:

ls $VIRTUAL_ENV/bin

In my case I decided to delete Django environment variables after I activate my Celery virtualenv and set them back when I deactivate it. To do that I had to put the following command to $VIRTUAL_ENV/bin/postactivate :

unset DJANGO_SETTINGS_MODULE

And modify $VIRTUAL_ENV/bin/postdeactivate to set variables back:

DJANGO_SETTINGS_MODULE=xxx.settings

Now don’t forget to re-activate the virtualenv and the Celery should run fine:

deactivate  # deactivate virtualenv
workon celery-test  # activate virtualenv

celery worker -A tasks  # run celery

 

Install Phonegap on Windows

Required tools

1. PhoneGap Desktop application.

This will let you easily transfer the application to the mobile device without necessity to compile the application on host computer and transfer the .apk file (in case of Android device).

Install the PhoneGap Desktop application as described here. Download the installer and run it.

2. PhoneGap CLI

If your goal is simple Javascript applications, you can stop after the previous step. But I’m going to use plugins, so I’ll need a command line tool.

Prerequisite is node.js. Download it and install. I will use the latest version, but LTS is always safer. Note, that on different versions of Windows node.js behaves differently. On Windows8 I recall I got a separate console for Node.js. On Windows7 it can be run from a normal Windows console (type cmd  in the command search).

Now from console run the following command:

npm install -g phonegap@latest

From now on we can use phonegap  command from the command line.

3. Android SDK manager

On windows this comes as a part of Android Studio, though it’s possible to install it separately: http://developer.android.com/sdk/installing/index.html

I will download Android Studio: http://developer.android.com/sdk/index.html and call SDK Manager from the toolbar.

Optional tools

I store my code on Github, so I’ll need Git.

Git

Download the installer here and run it.

When the installer asks about the PATH modification, I prefer to choose the option to allow git to run from command line (third option on the picture below):
Git installer

 

Git for Windows as a perfect installer

I just have installed git under Windows and what I want to say: this was probably the most perfect program installer I’ve ever seen.

Usually I have to check if the program didn’t check unnecessary checkboxes and whether it doesn’t try to install some additional crapware. In best cases you just click through without modifying checkboxes.

In case of git I even had to decrease the ‘safety level’ of some options. I just see that this was made with love to users and that creators really thought what people need from their program and how they’re going to use it.

With love to git.

Building a PhoneGap project with plugins in Ubuntu

Okay, ladies and gentlemen, today I’m working on the proof of concept (PoC) of a mobile application that has to work with Bluetooth.

For this purpose I’ve chosen a PhoneGap framework which lets us build mobile application for all mobile platforms (Android, iOS, Windows Phone and some others). Strong side of PhoneGap is plugins – modules of native code for all mobile platforms which can be accessed from PhoneGap Javascript.

Normally for a simple project I’d choose Adobe Build to build the project for me. It can automatically build packages for all mobile platforms for you and even do more like publishing your project in corresponding app markets.

Unfortunately, I had issues building the project using Adobe Builder – it seems not to include plugins to the project. As right now I need only a package for Android, I decided not to strugle with Adobe and to build the .apk locally. For that go to the project directory and run the following:

$ phonegap build android

Build starting… and failing:

[phonegap] executing 'cordova platform add --save android'...
[phonegap] completed 'cordova platform add --save android'
[phonegap] executing 'cordova build android'...
Running command: /var/www/phonegap-bluetooth-poc/platforms/android/cordova/build

[Error: Failed to find 'ANDROID_HOME' environment variable. Try setting setting it manually.
Failed to find 'android' command in your 'PATH'. Try update your 'PATH' to include path to valid SDK directory.]

ERROR building one of the platforms: Error: /var/www/phonegap-bluetooth-poc/platforms/android/cordova/build: Command failed with exit code 2
You may not have the required environment or OS to build this project

So, failed to find ‘android’ command in your ‘PATH’. To fix that we need an Android SDK; we’ll get it from Android website.

After installing Android SDK, let’s update environment variables. Add the following lines to the end of ~/.bashrc file (replace /home/minras/Android/Sdk/  with your path):

export ANDROID_HOME=/home/minras/Android/Sdk/
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools

And finally run source ~/.bashrc to initialize those variables.

Now the build should succeed:

$ phonegap build android

Internet never forgets

Amazon. Nothing is forgotten. This picture Amazon showed me on some IT website today. First watches here is what I’ve searched for just yesterday on European Amazon, the second one is what I bought from American Amazon five years ago.

So, Internet remembers everything. Feels a bit scary when it’s related personally to you. Your past and your future in one picture built by a computer.