Follow the below code to implement MQTT using Javascript.

<script src=”" type=”text/javascript”></script><script type=”text/javascript” language=”javascript”>client = new Paho.MQTT.Client(“”, 9001, “/ws”, “webdqweqe”);client.onConnectionLost = onConnectionLost;client.onMessageArrived = onMessageArrived;var myVar;// connect the clientclient.connect({ onSuccess: onConnect, onFailure: onFailure });function onFailure(e) {console.log(e);}function onConnect() {clearInterval(myVar);console.log(“onConnect”);client.subscribe(“rfidNo”);}// called when the client loses its connectionfunction onConnectionLost(responseObject) {if (responseObject.errorCode !== 0) {console.log(“onConnectionLost:” + responseObject.errorMessage);}myVar = setInterval(function () { sendTimer() }, 5000);}function sendTimer() {client.connect({ onSuccess: onConnect });}// called when a message arrivesfunction onMessageArrived(message) {console.log(“onMessageArrived:” + message.payloadString);}</script>



window.setInterval(function(){ // Set interval for checking
var date = new Date(); // Create Date object for a reference point
if(date.getHours() === 0 && date.getMinutes() === 0 && date.getSeconds() < 10){ // Check the time like above
}, 60000); // Repeat every 60000 milliseconds (1 minute)



highchart in angular by himalaya
Highchart in angular by himalaya

Step-1: Install high chart node modules from npm

npm install highcharts-angular — save
npm install highcharts — save

Step-2: put the code in the app.module.ts

import { HighchartsChartModule } from ‘highcharts-angular’;
@NgModule({imports: [HighchartsChartModule]})

Step-3: put the code in the component.html

<highcharts-chart [Highcharts]=”Highcharts” [options]=”chartOptions” [(update)]=”updateFlag” [oneToOne]=”true” style=”width: 100%; height: 130px; display: block;”></highcharts-chart>

Step-4: put the code in the component.ts

import * as Highcharts from ‘highcharts’;Highcharts: typeof Highcharts = Highcharts;
chartOptions: any;
updateFlag = false;
ngOnInit(): void {
this.chartOptions = {/*high chart code goes here…*/};
this.updateFlag = true;

Thank You!!! Enjoy your chart.



Method — 1


import { LocationStrategy, HashLocationStrategy } from ‘@angular/common’;providers: [{provide: LocationStrategy, useClass: HashLocationStrategy}]

Method — 2


imports: [RouterModule.forRoot(routes, { useHash: true })],



jQuery AJAX

AJAX is the technic of exchanging data with a server and updating parts of a web page — without reloading the whole page.

Example of $.ajax():

$.ajax({type : “POST”, url : “example.txt”, dataType: “xml/html/text/script/json”,success : function(data){console.log(data);},error : function(res) {console.log(JSON.stringify(res));}});

Excample of $.get():

Syntax — $.get(URL,data,function(data,status),dataType)

$.get(“demo_test.asp”, function(data, status){alert(“Data: “ + data + “\nStatus: “ + status);});

Example of $.post():


var txt = $(“input”).val();$.post(“demo_ajax_gethint.asp”, {suggest: txt}, function(result){$(“span”).html(result);});

Other Methods:

Serialize(), serializeArray()



MongoDB Version check

If you want to check the MongoDB version in your windows system, kindly follow the below steps:

Step — 1: Open the windows command prompt by entering “cmd” in your RUN prompt.

Step — 2: Go to the “bin” folder inside the MongoDB folder in your file manager, i.e: C:\Program Files\MongoDB\Server\5.0\bin

Step — 3: Reach to the above path in your command prompt and run “mongo –version”.

Thank You…



jquery with angular and typescript

Please follow these simple steps. It worked for me.

Step 1: Install jquery

npm install jquery — save//ornpm install @types/jquery

Step 2: In the HTML file.

<p class=”test”>Lorem ipsum dolor sit amet consectetur adipisicing elit. Possimus, voluptatem quae asperiores cupiditate velit ratione qui nulla in consectetur assumenda corporis praesentium molestias itaque repudiandae facilis nihil et sint porro.</p>

Step 3: In the typescript file. Use the below code:

import { Component, OnInit, ViewEncapsulation } from ‘@angular/core’;import * as $ from “jquery”;@Component({selector: ‘app-root’,templateUrl: ‘./app.component.html’,styleUrls: [‘./app.component.scss’],encapsulation: ViewEncapsulation.Emulated})export class AppComponent implements OnInit {title = ‘demo’;constructor() { }ngOnInit(): void {$(document).ready(function(){console.log($(‘.test’).html());});}}



FormGroup reset() keeps the input with Errors after reset() the form inputs.

After submitting the form in FormGroup. If it validating then I try to reset() the form. But after the reset() form keeps the validation errors in the inputs.

To remove that error, You need to put the below line for each input after reset().