Categories
JavaScript Open Source Web

AngularJS – Round off Number to Fixed Length of Fractions

Angular’s built in number filter allows one to specify the number of decimals that should be displayed.

The syntax is as follows:
{{val | number:<count>}}

Where val is the value to be displayed, number is the filtername and count is the number of decimals to be displayed.

For eg.:

If val is 1234.56789

{{val | number:2}}

Displays: 1234.56

{{val | number:0}}

Displays: 1235

{{val | number:4}}

Displays: 1234.5679

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, readAnyDatabase
Categories
Laptop OsX

Maximize windows in OsX

The maximize button (top left – 3rd button to the right on the window) hides the top bar and dock automatically in OsX.  If you want to make a window cover the whole screen without covering the dock and top bar, use the following key combinations:

Option + (click on green button on top left) – This maximizes the window vertically, useful for some apps that dont require as much horizontal space

Shift + Option + (click on green button on top left) – This maximizes the window to cover both horizontal and vertical space

Categories
Linux Open Source Solutions

Fixing Open Office Issue – User Installation could not be completed

Encountered this issue while trying to run Open Office from a newly installed Ubuntu box:

This application could not be started.
User installation could not be completed.

To fix this issue you need to basically reset the config of LibreOffice. This can be done using the following command (Warning: This deletes all your settings and config wrt LibreOffice):

rm -rf ~/.config/libreoffice

Note: This issue can also occur when the permissions of the config folder is incorrect (root instead of user), use this command to fix that issue:

chown haas -r ~/.config/libreoffice

Categories
Android Device Hardware Nexus 5 Open Source Solutions

How To Disable Keyboard Touch Vibration in Android 6 Marsh Mallow (Nexus 5x & 6p)

Google Keyboard is the default keyboard in the Android 6(Marsh Mallow). By default, its configured to enable vibration on key press. If you are someone who dislikes this feature and wants to disable it, here is a simple way of disabling it:
{adinserter 3}

  • Go to Home -> Settings -> Language & input
  • Locate “Google Keyboard” and press it to open its options.
  • Select Preferences
  • Disable the “Vibrate on keypress” option and you are good