Tuesday, 28 June 2016

Understanding Many to Many Relationships using Hibernate

https://howtoprogramwithjava.com/hibernate-manytomany-unidirectional-bidirectional/

Friday, 4 December 2015

Subversion Commands

Checkout a new repository.
svn co REPO_URL

See differences between working copy and repo in all files
svn diff

See the difference between working copy and repo for a specific file
svn diff path/to/file

See the difference between working copy and specific revision for all files
svn diff -r REVISION_NUMBER

See the difference between working copy and specific revision for a specific file
svn diff path/to/file -r REVISION_NUMBER

Take the latest code from repo in working copy
svn up

Take the latest code of a specific file from repo in working copy
svn up path/to/file

Take the code from repo in working copy from a specific revision
svn up -r REVISION_NUMBER

Take the latest code of a specific file from repo in working copy from a specific revision
svn up path/to/file -r REVISION_NUMBER

View a file of a specific revision number
svn cat path/to/file -r REVISION_NUMBER

Commit all changes to repo
svn ci -m"Commit Message"

Commit Few files to repo
svn ci -m"Commit Message" path/to/file1 path/to/file2 ....... path/to/fileN

Add a file/folder to svn for versioning
svn add path/to/(file/folder)

Remove a file/folder from versioning
svn rm path/to/(file/folder)

Add entire current folder for versioning
svn add .
(Notice the dot -  meaning current directory)

See revision number and other details of working copy
svn info
You may need to take latest code(svn up) to see this correctly

See full log since the first commit
svn log

See full log since the first commit along with the files committed in the revision
svn log -v

See log of a specific revision
svn log -rREVISION_NUMBER

See log of a specific revision along with the files committed in the revision
svn log -rREVISION_NUMBER -v

See log from and to a specific revision
svn log -rREVISION1:REVISION2

See log from and to a specific revision along with the files committed in the revision
svn log -rREVISION1:REVISION2 -v


Monday, 15 June 2015

Few Useful facts to help easy navigation in Ubuntu

Location of .desktop files:

/usr/share/applications/


Location of default file:

/etc/gnome/defaults.list


Location of Conf file of website running on Apache

/etc/apache2/sites-available/000-default.conf


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)

Tuesday, 24 March 2015

I can't seem to activate my Whatsapp calling feature in my Micromax A106 phone.
My phone is running android 4.4.2 with MTK and the latest version available to download from the app store was 2.7.
Even after receiving a Whatsapp call from one of my friend and successfully talking, the feature won't activate. restarting didn't work either. I manually downloaded the apk of version 2.12 and installed it. Again it won't activate after a call.
If you can help me or point me to a solution I will be grateful.