Thursday, May 23, 2013

Some Tips - Linux (Ubuntu), Java, Android ...

Some Tips - Linux (Ubuntu), Java, Android ...

Experience is the best teacher....and learning is the never ending I would like to share some of the simple
tips while working with Ubuntu, Java & Android.

On Internet goggling through you will finds 100s of sites and blogs have documentation for Linux commands, here I have summarized only those commands which are usually used by the Android / Java developer while setting up Java & Android on Fresh Linux (Ubuntu) Systems

To Install any of the application/program in ubuntu through any of the sh or bin file First of all Asign permission to the file as follows,chmod 777 <filename.bin> OR
chmod +x <filename.bin>
After that ./<filename.bin>

While installing a new copy of Ubuntu OS 'root' user password isn't set, So to set the root password, type the following command,
sudo passwd
Then In the terminal it will prompt you to type the password of your current user, type the same and enter
Then you will be prompted to type the desired root password, type the same enter, then again retype the same password and you are done!

To view the hidden files in Ubuntu simple shortcut 'Cntrl+H', Though this is a simple command buts its useful when we want to set the java path in .bashrc or .profile file in the user's home directory.

Now comes the installation of Java, open jdk is directly available in ubuntu software center, & If you install directly from the same your java path is set, but for the oracle sun jdk, you need to download the bin files for jdk and jre from the downloads page from oracle java website, After downloading the jdk and jre bin installations, install the program as mentioned first point and set the path of the installation in .bashrc and .profile files in the home /home/<user>/ dir
export JAVA_HOME=<java installation path><your version of java>
export PATH=${PATH}:${JAVA_HOME}/bin

When you are using IDEs like eclipse for your development in ubuntu, you download the archive (zip/tar.gz) from the eclipse download page, Extract the contents, and when you double click on the eclipse icon to start up the IDE and if it do not start,  then simply right click on the icon,
 Properties > Premission Tab > Check the option 'Allow Executing File As Program'

The command chmod used in the first point works to assign the permission only for a single file but to assign permission to the whole directory and it sub directories and files use the -R option along with the chmod command.
Example to assign all permissions, chmod -R 777 <directory name>
Now this command is extremey useful when you copy your android-sdk folder from one linux system to another, run this command to the android-sdk directory and then specify the location for this folder in which ever IDE (Eclipse/Intellij Idea) you use for Android development else it will give permission denied error/adb cannot be started etc.

From terminal if you are not loged in as a root user, and to login as root user simply type 'su' command in terminal it will prompt to enter root password and there you are! else su -<username> command is used to switch from one user to another.

To Reset the MySQl root password, Simply follow these steps in terminal
mysql> use mysql;
mysql> update user set password=PASSWORD("<NEW PASSWORD>") where User='root';
mysql> flush privileges;

Animated Container in Flutter

Please check this flutter video tutorial for detailed example and implementation of Animated Container in Flutter.