Monday, 28 October 2013

How to add JAR library to the Android project in Android Studio?

Some times trivial things like adding a lib references becomes a big pain! Adding jar lib to an Android project in Android Studio on Mac was very problematic for me and of course, many other guys!
After checking different web sites and reading through a bunch of questions in stackoverflow, I managed to get it working.
The steps are:
Create a lib folder in your project folder (the inner one) and copy your jar file there.
Edit the build.gradle file (the inner one) and add: compile files ('lib/ks2.jar')
Close the project and open a terminal and go to the folder of your project. There you'll find a file named gradlew, change that to be executable (chmod +x gradlew), then execute it: ./gradlew clean
It would take a while to finish and you should see a 'BUILD SUCCESSFUL' message upon completion. Once done, open the project, and you're done!

Thursday, 10 October 2013

LaTeX: Make Bibliography appear in "Table of Contents"

Normally in report/book classes of documents, Bibliography will not appear in "Table of Contents", there are many workarounds for that; the easiest would be using the "tocbibind" package in preamble...

Saturday, 5 October 2013

Restart Ubuntu Desktop

Linux core is very stable, but that does not necessarily means that Ubuntu desktop is stable as well!
Many times Unity (Ubuntu's shell interface for GNOME) becomes totally unresponsive (at least for me!), since the core is stable and it is running, you can easily restart the desktop (without even having your running programs closed). If the desktop is totally unresponsive, then press Alt+Ctrl+F1 (to F6) to bring the console window. There you can run unity by (remember to detach the process by adding & disown, also redirect the output and error &> /dev/null. After it, simply hit Alr+Ctrl+F7 (or F8) to come back to the graphical desktop.
An alternative way is to restart compiz (since unity is a plugin of it): compiz --replace and if you're running from Alt+Ctrl+F1 terminal, then specify the display: compiz --display :0 --replace. You still need to add & disown.