Monday, 25 May 2015

Connecting Android Device to Android Studio

Enable USB debugging on the phone.

If you see the RSA pop up then everything is fine and you can proceed.


However if you don't, then follow the steps to setup the device

Run the command:
adb devices

If you see "??????   no permissions" , then follow on:

- Connect the device and type the command:
lsusb

- You can see the vendorId: productId of usbs. You can check which one is your phone by removing the phone and again executing to see which one vanished.

-Now edit this file as root (or create if doesn't exists)
/etc/udev/rules.d/51-android.rules
Then add these two lines:

SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4" , ATTR{idProduct}=="0c03" , MODE="0666" , GROUP="plugdev"
SUBSYSTEM=="usb", SYSFS{product}=="Android Phone", MODE="0666"

Replace idvendor and idProduct as displayed by lsusb command.

now restart the adb server.

sudo adb kill-server
sudo adb start-server

Execute:
adb devices
now you should be able to see the device listed.

Wednesday, 20 May 2015

Commands from Terminal

These are some basic operations that can be done through command line.


Create a new Folder:
mkdir <Folder_name>


Creating a new File:
echo  > filename.txt
touch filename.txt


Copying a File:
cp <Source_Path> <Destination_Path>


Copying a Folder:
cp -r <Source_Path> <Destination_Path>


Move a File to a Folder in current working directory:
mv <FileName> <FolderName>


Renaming a File:
mv <Old_fileName> <New_FileName>


Renaming a Folder
mv <Old_FolderName> <New_FolderName>


List all installed packages
dpkg --get-selections


See native architecture
dpkg --print-architecture


Add architecture on 64 bit machine
dpkg --add-architecture <arch_id>

     where <arch_id>= i386(for 32 bit), amd64(for 64 bit)

See Last few lines of a file in real time
tail -f <Path_To_File>


See the path of a file if you just know the name
locate FILE


Friday, 15 May 2015

Importing a .sql file into database

Execute this command where the sql file named file.sql resides or give the full path of the file.


mysql -u root -p < file.sql


(replace `root` with appropriate username. Since root is default username and often users don't change it, it should also do fine)