Saturday, 11 February 2017

Things to do after fresh/first install of Ubuntu

These notes are written wrt Ubuntu 16.x



Click to minimize an app from taskbar

Run this command:-
gsettings set org.compiz.unityshell:/org/compiz/profiles/unity/plugins/unityshell/ launcher-minimize-window true


Install Linux Graphics Drivers

    1. Open up the ‘Software & Updates’ tool from the Unity Dash
    2. Click the ‘Additional Drivers’ tab
    3. Follow any on-screen prompts to check for, install and apply any changes

Check for best driver option for your NVidia Graphics cards.

Install System Cleaner

Install Development Tools

Saturday, 28 January 2017

AOSP - Android Source Building Comprehensive Guide

Binaries Generated By The Build

1. boot.img
boot.img contains the kernel and ramdisk, critical files necessary to load the device before the filesystem can be mounted. You have to generate the boot.img yourself using mkbootimg, a tool provided by AOSP.

2.kernel
Binary for linux kernel.

3. ramdisk.img
ramdisk.img is a small partition image that is mounted read-only by the kernel at boot time.
It only contains /init and a few config files.
It is used to start init which will mount the rest of the system images properly and run the init procedure.

A Ramdisk is a standard Linux feature.


4. ramdisk-recovery.img
Recovery image for ramdisk.

5. recovery.img
It is the Android recovery image.

A bootable program on an Android flash memory partition that is used to perform a factory reset or restore the original OS version. In order to install a different OS version (a different ROM), the stock recovery image must be replaced with a custom version such as ClockworkMod Recovery. After rooting the Android, utilities such as ROM Manager install the custom recovery, which is then used to install the custom ROM.

6. userdata.img
userdata.img is a partition image that can be mounted as /data and thus contains all application-specific and user-specific data.   

7. system.img
system.img is a partition image that will be mounted as / and thus contains all system binaries

8. full_mako-img-eng.nsk.zip
A full update is one where the entire final state of the device (system, boot, and recovery partitions) is contained in the package. As long as the device is capable of receiving the package and booting the recovery system, the package can install the desired build regardless of the current state of the device.

Friday, 27 January 2017

Linux Troubleshooting

1. How do I fix a “Problem with MergeList” or “status file could not be parsed” ?

sudo rm -vf /var/lib/apt/lists/*
sudo apt-get update


2. How to run 32 bit binaries on 64 bit Linux ?

sudo dpkg --add-architecture i386

Or if you are using Ubuntu 12.04 LTS (Precise Pangolin) or below, use this:

echo "foreign-architecture i386" > /etc/dpkg/dpkg.cfg.d/multiarch

Then:

sudo apt-get update
sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386

3. How to remove openjdk ?

sudo apt-get purge openjdk*

Thursday, 26 January 2017

Linux rsync comand usage examples

rsync
-a
--progress
--delete = delete files/folders from /destination that are not on /source (so /destination is an exact mirror of /source)
--exclude
--dry-run
Always start with -n (fake run) before doing a real run.
-r = recursive (copy all directories, contents and their subdirectories)
-v = be verbose


1. Sync dirs
rsync -av --delete src/  dest/

2. With SSH
rsync -av –delete -e ssh /Directory1/ geek@192.168.235.137:/
Directory2/

3. With SSH and port
rsync -av –delete -e 'ssh -p 12345' /Directory1/ geek@192.168.235.137:/Directory2/

Saturday, 10 December 2016

dos and don'ts of writing c++ code

  1. Use namespaces - when you have huge code and classes, add them into a name spaces by categorizing them. Like a namespace for database, namespace for logger, namespace for ui etc. 
  2. Follow C++ coding conventions and remain consistent in project and with team ( and with global c++ community).
  3. In header files, avoid the use of forward declaration as much as possible and included the required header files.

Wednesday, 7 December 2016

Android create apk release with date

#
# script to create a release for apk with current date time
#

PROJECT="SpeedRiderApp"
DATE=`date +%Y-%m-%d`

echo "Preparing APK For ${PROJECT}"
echo "Removing previous releases of date: ${DATE}"

rm -fr "${HOME}/Desktop/${PROJECT}-${DATE}.apk" "${HOME}/Desktop/${PROJECT}-${DATE}" "${HOME}/Desktop/${PROJECT}-${DATE}.zip"

cp "app/build/outputs/apk/app-debug.apk"  "${HOME}/Desktop/${PROJECT}-${DATE}.apk"

echo "----- DONE MAKING APK -----"


cp -a . "${HOME}/Desktop/${PROJECT}-${DATE}"
cd "${HOME}/Desktop/${PROJECT}-${DATE}"

echo "Removing build"
rm -fr build

echo "Removing app/build"
rm -fr "app/build"

cd "${HOME}/Desktop/"
zip -r "${PROJECT}-${DATE}.zip" "${PROJECT}-${DATE}"

# back to project dir
cd -

Wednesday, 30 November 2016

Shell script To Make release zip for project

PROJECT="SpiritedRepublic"
DATE=`date +%Y-%m-%d`
DIR="${HOME}/Desktop/${PROJECT}-src-${DATE}"

# remove previous DIR
echo "removing $DIR"
rm -fr "$DIR"
mkdir "$DIR"

# python files
echo "Copying python files"
cp -a /home/neo/work/qt_projs/SpiritedRepublic/src/*.py "$DIR"

# ui files
echo "Copying ui files"
cp -a /home/neo/work/qt_projs/SpiritedRepublic/src/*.ui "$DIR"

# csv files
echo "Copying csv files"
cp -a /home/neo/work/qt_projs/SpiritedRepublic/src/*.csv "$DIR"

# shell script files
echo "Copying shell script files"
cp -a /home/neo/work/qt_projs/SpiritedRepublic/src/*.sh "$DIR"


# zip
ZIP_PATH="${DIR}.zip"
echo "Creating zip file at: ${ZIP_PATH}"
cd "${HOME}/Desktop"

zip -r "${PROJECT}-src-${DATE}.zip" . -i "${PROJECT}-src-${DATE}/*