Monday, June 24, 2013

Ubuntu : Upgrade Git

git

Sometimes simply updating from "Ubuntu update" won't update/upgrade some of the required packages. We need to to it manually by adding necessary repositories. To upgrade git:
sudo add-apt-repository ppa:voronov84/andreyv
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install git
If the first command result in error "couldn't connect to host"

Ubuntu : Java alternatives

java alternative

Ubuntu will include openJDK by default. If you install some other version or Sun JDK, then the first installation is set to be the default one.

To check if there are any other java installations:

update-java-alternatives -l
Change the default to any of them:
update-java-alternatives -s NAME-OF-IT

Ubuntu : Install Sun java 6

java 6

Ubuntu has dropped including Sun/Oracle Java in its repository, and added OpenJDK. But, the former is more reliable than latter, and is also must for some applications.
Here is a way to add Sun java 6:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java6-installer
Possible error : "couldn't connect to host"

To make this version as default: here.

If you want to install java 7, instead of last command try
sudo apt-get install oracle-java7-installer
If you are under proxy network or seen a error like
Cannot add PPA: 'ppa:webupd8team/java'.
Please check that the PPA name or format is correct.
and if you are sure that the PPA is working, the try
sudo -E add-apt-repository ppa:webupd8team/java
and proceed with remaining commands.

Ubuntu : Error "couldn't connect to host"


This error will be resulted mostly because of the user permissions. To go through it, we need the simulate the initial login mode:
sudo -i
Now run the commands which resulted in the above error, but without prefixing with 'sudo'. Remember to go out of this mode after running your commands. To go out:
exit

Ubuntu : Adding a new repository (PPA)

ubuntu

To add a repository ppa:
sudo add-apt-repository ppa:user/ppa-name
sudo apt-get update
Sometimes adding a repository may result in error related to missing key. Then copy that key and run following command

sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com KEY
Do this for each of the missing keys.
Now re-run the above two commands.

If you are under proxy network or seen a error like
Cannot add PPA: 'ppa:user/ppa-name'.
Please check that the PPA name or format is correct.
and if you are sure that the PPA is working, the try
sudo -E add-apt-repository ppa:user/ppa-name

Ubuntu: Set Network proxy system-wide including Terminal

ubuntu

Set the proxy in "Network Proxy" setings and click "apply system-wide", and also at the following locations. Some terminal applications need them.

sudo gedit /etc/apt/apt.conf.d/95proxies
Acquire::http::proxy "http://username:passwd@proxy:port/";
Acquire::ftp::proxy "ftp://username:passwd@proxy:port/";
Acquire::https::proxy "https://username:passwd@proxy:port/";
sudo gedit .bashrc
export http_proxy=http://username:passwd@proxy:port
export https_proxy=http://username:passwd@proxy:port
export HTTP_PROXY=http://username:passwd@proxy:port
export HTTPS_PROXY=http://username:passwd@proxy:port

Requires both CAPITALS and small ones. Some applications accepts only CAPITALS.

Wednesday, June 19, 2013

Openlogic : Open Source Software Database

Ol

Here is a open source software repository, which contains almost every version of the packages. This will be useful for all those who need any older version of the package, which sometimes is difficult to find. So, I'm sharing the link here:
http://olex.openlogic.com/
Type the package name in search field and select the version you need.

Tuesday, June 18, 2013

Ubuntu : Mount a volume with ROOT privileges

ubuntu

My system is having multiple internal hard disks and due to some memory concerns I have to work on the second drive(hdd2). Then on visiting "/mnt/hdd2", I found entire drive  is protected by root. To change the privileges, I tried the normal way:
sudo chmod 755 /mnt/hdd2
Result : NO CHANGE.
Then tried
sudo chmod a+x /mnt/hdd2
Result : NO CHANGE.
No I googled I find:
sudo chmod -R 755 /mnt/hdd2
Result : To my surprise NO CHANGE
Here is the solution:
sudo chown -R chaithanya:chaithanya /mnt/hdd2
Result : SUCCESS ('chaithanya' is the username).

Monday, June 17, 2013

Setting up / Working with Android Source code

ubuntuandroid

1. Install Ubuntu 10.04, as the Android root is built on it.

2. Update the system - Run Update manager and install new packages

3. Update the system settings:
4. Install sun java 6
5. Installing required packages:
sudo apt-get install git-core gnupg flex bison gperf build-essential \zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs \x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev \libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown \libxml2-utils xsltproc
6. Upgrade git
7. Installing Repo:
mkdir ~/bin
PATH=~/bin:$PATH
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
chmod a+x ~/bin/repo
8. Initialising a Repo client:
mkdir WORKING_DIRECTORY
cd WORKING_DIRECTORY
repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1
If any error saying "HTTP request failed", open file "~/bin/repo" and change "https" in the beginning to "http".
If the error "GnuTLS recv error (-9): A TLS packet with unexpected length was received" occurs, try http instead of https above. i.e.,
repo init -u http://android.googlesource.com/platform/manifest -b android-4.0.1_r1

9. Download Android Source
repo sync
10. Add Git tags:
$ gpg --import
Copy and paste the following code and press Ctrl-D:

-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.2.2 (GNU/Linux)

mQGiBEnnWD4RBACt9/h4v9xnnGDou13y3dvOx6/t43LPPIxeJ8eX9WB+8LLuROSV
lFhpHawsVAcFlmi7f7jdSRF+OvtZL9ShPKdLfwBJMNkU66/TZmPewS4m782ndtw7
8tR1cXb197Ob8kOfQB3A9yk2XZ4ei4ZC3i6wVdqHLRxABdncwu5hOF9KXwCgkxMD
u4PVgChaAJzTYJ1EG+UYBIUEAJmfearb0qRAN7dEoff0FeXsEaUA6U90sEoVks0Z
wNj96SA8BL+a1OoEUUfpMhiHyLuQSftxisJxTh+2QclzDviDyaTrkANjdYY7p2cq
/HMdOY7LJlHaqtXmZxXjjtw5Uc2QG8UY8aziU3IE9nTjSwCXeJnuyvoizl9/I1S5
jU5SA/9WwIps4SC84ielIXiGWEqq6i6/sk4I9q1YemZF2XVVKnmI1F4iCMtNKsR4
MGSa1gA8s4iQbsKNWPgp7M3a51JCVCu6l/8zTpA+uUGapw4tWCp4o0dpIvDPBEa9
b/aF/ygcR8mh5hgUfpF9IpXdknOsbKCvM9lSSfRciETykZc4wrRCVGhlIEFuZHJv
aWQgT3BlbiBTb3VyY2UgUHJvamVjdCA8aW5pdGlhbC1jb250cmlidXRpb25AYW5k
cm9pZC5jb20+iGAEExECACAFAknnWD4CGwMGCwkIBwMCBBUCCAMEFgIDAQIeAQIX
gAAKCRDorT+BmrEOeNr+AJ42Xy6tEW7r3KzrJxnRX8mij9z8tgCdFfQYiHpYngkI
2t09Ed+9Bm4gmEO5Ag0ESedYRBAIAKVW1JcMBWvV/0Bo9WiByJ9WJ5swMN36/vAl
QN4mWRhfzDOk/Rosdb0csAO/l8Kz0gKQPOfObtyYjvI8JMC3rmi+LIvSUT9806Up
hisyEmmHv6U8gUb/xHLIanXGxwhYzjgeuAXVCsv+EvoPIHbY4L/KvP5x+oCJIDbk
C2b1TvVk9PryzmE4BPIQL/NtgR1oLWm/uWR9zRUFtBnE411aMAN3qnAHBBMZzKMX
LWBGWE0znfRrnczI5p49i2YZJAjyX1P2WzmScK49CV82dzLo71MnrF6fj+Udtb5+
OgTg7Cow+8PRaTkJEW5Y2JIZpnRUq0CYxAmHYX79EMKHDSThf/8AAwUIAJPWsB/M
pK+KMs/s3r6nJrnYLTfdZhtmQXimpoDMJg1zxmL8UfNUKiQZ6esoAWtDgpqt7Y7s
KZ8laHRARonte394hidZzM5nb6hQvpPjt2OlPRsyqVxw4c/KsjADtAuKW9/d8phb
N8bTyOJo856qg4oOEzKG9eeF7oaZTYBy33BTL0408sEBxiMior6b8LrZrAhkqDjA
vUXRwm/fFKgpsOysxC6xi553CxBUCH2omNV6Ka1LNMwzSp9ILz8jEGqmUtkBszwo
G1S8fXgE0Lq3cdDM/GJ4QXP/p6LiwNF99faDMTV3+2SAOGvytOX6KjKVzKOSsfJQ
hN0DlsIw8hqJc0WISQQYEQIACQUCSedYRAIbDAAKCRDorT+BmrEOeCUOAJ9qmR0l
EXzeoxcdoafxqf6gZlJZlACgkWF7wi2YLW3Oa+jv2QSTlrx4KLM=
=Wi5D
-----END PGP PUBLIC KEY BLOCK-----
11. Setup ccache:
export USE_CCACHE=1
export CCACHE_DIR=<path-to-your-cache-directory>
prebuilts/misc/linux-x86/ccache/ccache -M 50G
12. Initialize the build:
$ . build/envsetup.sh
13. Choose the target:
$ lunch full-eng
14. Build the code: (-j4 : 4 threads. Change the value as per your system configuration)
$ make -j4
15. Run:
$ emulator

Tuesday, June 4, 2013

Clean-up GRUB entries


grub
Whenever a kernel update is installed, your system adds an entry into GRUB. And while booting you can see a very long list, depending on how many updates you have installed. Here is a simple way to clean the GRUB.
  • Open Synaptics package manager.
  • Remove "linux-image-2.6.xxxx" and "linux-headers-2.6.xxxx" corresponding to old kernel images.
  • Update the grub using: "update-grub"

If you wish to set a background image for your GRUB, then goto "/etc/grub.d/" and open the theme file(debian_theme) and set "use_bg=false" to "true". Change the WALLPAPER, to point to the desired image(Better use .png file).

To apply the changes to the grub: "update-grub"

Monday, June 3, 2013

SVN Error: "OPTIONS of 'https://…' could not connect to server (…)"

SVN

Today when I tried to download source-code of an application from a repository on googlecode, an error saying "could not connect to server xxxx.googlecode.com" occurred. I thought the repository might have been down and not available for download. Then I tried the same URL in web browser and it worked.
On searching for a while, I found that this problem is created by proxy settings. SVN needs the proxy settings, apart from that you applied system-wide settings. Then I came to know a solution which worked perfectly. Here it is:
svn --config-option servers:global:http-proxy-host=MY_PROXY_HOST --config-option servers:global:http-proxy-port=MY_PROXY_PORT checkout http://xxxx.googlecode.com/yyyyy/
If the proxy server needs authentication, then try this:
svn --config-option servers:global:http-proxy-host=MY_PROXY_HOST --config-option servers:global:http-proxy-port=MY_PROXY_PORT --config-option servers:global:http-proxy-username=USERNAME --config-option servers:global:http-proxy-password=PASSWORD checkout http://xxxx.googlecode.com/yyyyy/
For various available options:
http://svnbook.red-bean.com/en/1.1/ch07.html#svn-ch-7-sect-1.3.1