Posts

Showing posts with the label Software Engineers

How To Check MongoDB ID Valid Or Not

Image
As you must aware about the object ID in mongo database or MongoDB is 24 characters long so for check is it valid id or not there is no direct validation method in validations package such as node-input-validator. MongoDB - Education Funda So for checking entered id is valid or not we can us below tech-tics: Approach 1 - Simple JS Validation var checkForHexRegExp = new RegExp("^[0-9a-fA-F]{24}$") checkForHexRegExp.test("i am a string") // false checkForHexRegExp.test("5e63c3a5e4232e4cd0074ac2") // true Approach 2 - With Mongo DB Method (Best Way) var ObjectID = require("mongodb").ObjectID ObjectID.isValid("i am a string") // false ObjectID.isValid("5e63c3a5e4232e4cd0274332") // true With Node Input Validator You Can Use Below Method: const id_exists = "required|string|minLength:24|maxLength:24|idExists"   const validator = require ( "node-input-validator" ) const mongoose = require ( 'mongoose...

OG Tags For Social Media Sharing

Image
Share On Social Media OG Tags For Proper Title, Description and Image Social Sharing Step 1: Title Maximum of 65 characters <title>your keyword rich title of the website and/or webpage</title> Step 2: Description Maximum of 155 characters <meta name="description" content="description of your website/webpage, make sure you use keywords!"> Step 3: og:title Maximum 35 characters <meta property="og:title" content="short title of your website/webpage" /> Step 4: og:url Full link to your webpage address <meta property="og:url" content="https://www.example.com/webpage/" /> Step 5: og:description Maximum 65 characters <meta property="og:description" content="description of your website/webpage"> Step 6: og:image Image(JPG or PNG) of size less than 300KB and minimum dimension of 300 x 200 pixel is advised <meta property="og:image" content="//cdn.example.com/uplo...

Get YouTube Video Thumbnail And Use It With Your Code

Image
Download Any YouTube Video Thumbnail YouTube stores many different types of thumbnails on its server for different devices. You can access it by using the video id which every YouTube video has. You can display the images on your website using a variable $link which holds the id of the video and substituting it in the place for video_ID in the link. Download-Any-Youtube-Video-Thumbnail   Low quality thumbnail: https://img.youtube.com/vi/<YouTube_Video_ID_HERE>/sddefault.jpg Medium quality thumbnail: https://img.youtube.com/vi/<YouTube_Video_ID_HERE>/mqdefault.jpg High quality thumbnail: https://img.youtube.com/vi/<YouTube_Video_ID_HERE>/hqdefault.jpg Maximum quality thumbnail: https://img.youtube.com/vi/<YouTube_Video_ID_HERE>/mqdefault.jpg Such as in this blog we will get thumbnail of this YouTube video: Example: If you want to access the thumbnail of this above video: So the Video ID for this video is: aCB2WRqxxvo So, this is how video thumbnail link loo...

How To Save CK Editor Data Into Database

Image
The "CK Editor" is an HTML editor in which for saving the data into db we can use below function before saving it into DB in PHP language.   function dataready($data) {           $data = trim($data);           $data = stripslashes($data);           $data = htmlspecialchars($data);           return $data; } Before saving data we can call this function now: dataready($_POST['input_name']);  For for showing data into view pages we can use: html_entity_decode($var_article_text); Thanks for reading this blog I hope it will helpful for you.

Solve MongoDB.Service: Failed With Result 'Exit-Code'

Image
Solve MongoDB Failed Service Error This worked for me and I didn't reinstall MongoDB. I have created manually sudo mkdir /var/lib/mongodb sudo mkdir /var/log/mongodb   and changed owner permission for both sudo chown -R mongodb:mongodb /var/lib/mongodb sudo chown -R mongodb:mongodb /var/log/mongodb   pgrep mongod sudo service mongodb start sudo service mongodb status Please share your feedback in comment section. Thanks

Top GIT Interview Questions

Image
Git is an open source code management system (SCM) which can control the source code of small and large scale projects in a very efficient way along with speed. It uses C language to maintain high level languages easily. GIT - Education Funda Let's jump into "Top 10 GIT Interview Questions": Important Notes For You GIT Repository A repository consists of a list named .git, where git holds all of its metadata for the catalogue. The content of the .git file is private to Git. GIT Stash When we do some edits and this edit we don’t want to push in the master branch so we can use the ‘git stash’ command. It will store the edits in Stack and our production branch will not reflect with it. For getting these changes again we can create a new branch and use ‘git status pop’ for retrieving the ‘git stash’ edits. We can remove the last added stash via the ‘git stash drop’ command and if we want to use specific then we can also do it via passing arguments. For showing listings o...