Categories
Android Apps Device Open Source Solutions

How to Disable Back Button Press in Android

You need to override the “onBackPressed” method to avoid the default action. You can leave the function empty if you dont want any action to be taken on press of the Back Button. The Code: @Override public void onBackPressed() { } Note: this requires API Level 5 or higher.

Categories
Open Source Solutions

Git – Undo Uncommitted Changes to a Specific File

Here are the steps remove uncommited changes to a file in Git: Firstly check the list of uncommited changes in your system by using the command “git status“ To remove the changes to the file use the command: git checkout <filepath>  Make sure you use the full path as seen in the git status output […]

Categories
AngularJS Solutions Web

AngularJS – Filter to add Leading 0s to any Number

Lets say you want to display a list of numbers from 1 to n but want them to be displayed as 01 02 03 04 05… and not 1 2 3 4 5… Angular by default doesn’t have a filter for this. Here is how you implement it: Implement the filter in a module. Here […]

Categories
Linux Solutions Ubuntu Web

WordPress: Error Uploading Media Files

I recently got the following error while uploading media to my wordpress site: Unable to create directory uploads/2016/06. Is its parent directory writable by the server? Here are the steps to fix the issue: Possible Issue 1: Incorrect Directory pointed to in the settings: Open your WordPress Admin page (this is usually at /wp-admin) Hover […]

Categories
MongoDB Open Source Solutions Web

Creating users in MongoDB

Creating users in MongoDB is as simple as running the following commands: use db_name; db.createUser({ user: “user_name”, pwd: “password”, roles: [ “readWrite”, “dbAdmin” ] }) Here: db_name : Database Name user_name: Username of the user password: Password of the user roles: Roles of the user – Is an array and can be empty Eg. readWrite, dbAdmin, clusterAdmin, […]