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
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
Categories
FaceBook Open Source Web

How to stop videos from playing automatically in the Facebook News Feed?

Facebook’s video auto-play settings can be turned on or off. This will help you save bandwidth and help remove the distraction of an autoplaying video. To stop videos from playing automatically do the following:
fb

  1. Go to your facebook timeline.
  2. From the top right of Facebook, click the  option and select Settings
  3. Click Videos in the left menu
  4. Click the dropdown menu next to Auto-play Videos and select Off
Categories
JavaScript jQuery Web

JQuery Check if Element Exists – JS Helpers

JQuery Check if Element Exists using this simple piece of code. To check this in the current page, we need to check the length of the element returned by the JQuery selector, if it returns you something then the element must exists otherwise no.

if( $('#EleSelector').length ) { // use this if you are using id, replace EleSelector with the id
// it exists
}

if( $(‘.EleSelector’).length ) { // use this if you are using class, replace EleSelector with the id
// it exists
}

In case of plain javascript try this:

//you can use it for more advanced selectors
if(document.querySelectorAll("#EleSelector").length){}

if(document.querySelector("#EleSelector")){}

//you can use it if your selector has only an Id attribute
if(document.getElementById("EleSelector")){}