Saturday, May 30, 2020

Face Recognition using JavaScript

Face recognition using JavaScript


Into this article i am going to describe How we can calculate age, gender detection, and his/her expression by just detecting his/he face.

Surprised. I was too.... Now face detection is possible using java script which is one of the most common applications of Artificial Intelligence

code structure of face recognition using javascript : By visionfortech

In Javascript world face-api.js came up with JavaScript API for face detection and face recognition in the browser implemented on top of the tensorflow.js core APIs

Want to download source code ? : face-recognition-using-javascript


Output of this Application : 

code structure of face recognition using javascript : By visionfortech


In this article we will provide the information that how we can detect expression of a human being, Age of a person and his/her Gender

Below will be the project structure.

code structure of face recognition using javascript : By visionfortech


Or You can download the code from face-recognition-using-javascript

Hope you enjoyed the article and it got added something new to your knowledge.
To Learn more about Javascript Javascript Treasure.
To add something new every-time into your mind stay tuned to visionfortech.

Enjoy......!!!
Happy Learning.....!!!

Sunday, March 29, 2020

Steps to update Angular from Angular 8 to Angular 9

Update application from Angular 8 -> Angular 9


Though we have angular9 released so in this article i would like to discuss how we can update our Angular App from Angular8 to Angular 9. In other words i would like to say Migrate existing angular application to angular9 from angular8

To know what are the new features into Angular 9 Angular 9 Features.

So to upgrade it to angular 9 follow below steps.


  • Make sure you will have node version 10.13 or later version. I would advice use latest version that is Node 12.
  • Make sure you will have your angular-cli at 8 ( You can check angular version by ng --version command).
  • After that update your angular-cli to latest version using ng update @angular/cli
  • After upgradation of angular-cli please update your angular/core package using ng update @angular/core command
  • Now you can check that you will have angular9 installed using ng--version.
Hope you enjoyed the article and it got added something new to your knowledge.
To Learn more about Javascript Javascript Treasure.
To add something new every-time into your mind stay tuned to visionfortech.

Enjoy......!!!
Happy Learning.....!!!

Saturday, March 21, 2020

Top New Features introduced into Angular 9 / What's majorly new in Angular 9

what's new into Angular 9 or Features into Angular 9




If you would like to know the features or new things which got introduced into Angular 9 then you are at the right place. Here into this article we are going to discuss what are the new things got introduced into Angular 9 or what are the features got introduced into Angular 9

Angular Features

  1. Default Ivy Compiler
  2. Smaller Bundles and Performance
  3. Typescript 3.7 Support
  4. Service Worker Updates
  5. Enables the AOT compiler on by default
  6. i18n Improvements
  7. Need for Faster Mobile Apps
  8. Changes with Angular Forms
  9. Dependency Injection Changes in Core
  10. Lazy load Angular components
  11. Angular Component Updates
  12. API Extractor Updates


Default Ivy Compiler

The more awaited very big new feature Ivy compiler is available  default for Angular 9, which will make sure to make your angular apps built with Ivy are faster and more efficient. So user won't require to add any compiler options in tsconfig.json file to enable Ivy like Angular 8.


Smaller Bundles and Performance

Into Angular 9 IVY complier make sure that you Angular Application production bundle will have lower size in result we can faster build generation and the performance for the same application will get increased


Service Worker Updates

In current version of Angular 9, for service workers the deprecated versioned files option in the service worker asset group config has been removed. This means that your new ngsw-config.json file that looked like below file:
"assetGroups": [
{ "name": "visionfortech", "resources": { "versionedFiles": [ "/**/*.txt" ] } } ]

will now look something like below

"assetGroups": [
{ "name": "visionfortech", "resources": { "files": [ "/**/*.txt" ] } } ]


i18n Improvements

Angular a JavaScript framework is supporting internationalization, and with the Angular CLI you can generate standard codes that will help create translator files so that your angular application can be published in multiple languages. This process has been even further refactored by the Angular team on Ivy to make it easier by adding compile-time inlining.

Changes with Angular Forms

Into Angular 9 there are some more changes related to Angular Form. First change is <ngForm></ngForm> is no longer supported for Angular Form instead you need to use <ng-form></ng-form>.Second, the FormsModule.withConfig is no longer supported instead you have to use FormsModule directly.


Angular Component Updates


There is an upgrade for the @angular/cdk on Hammer.js, which allows to include gesture support and was needed if you chose to use the CDK. It's possible now. You can import it with this below command optionally:

import "HammerModule" from [@angular/platform-browser]


Dependency Injection Changes in Core

The new version of Angular has minor improved for dependency injections. This is not a big change but some support.functionality has been added for the providedIn value section of dependency injections.

@Injectable({ providedIn: 'platform' })  class VisionfortechService {...}
  1. Platform : Specifying providedIn: 'platform' makes the service available on a special singleton platform injector that is used by all applications on the page.
  2. Any : Provides a unique instance in each module (including lazy modules) that injects the token.


Enables the AOT(Ahead-of-time) compiler on by default

In the current IVY architecture, we see a so many changes in the compiler's performance. This means that the AOT(Ahead-of-time) builds will be noticeably faster. The change in the compiler and runtime, will no longer require entryComponents. and ng serve. These components in latest version of Angular 9 will compile automatically depending on their usage.



Need for Faster Mobile Apps

Now a days mobile usage is rapidly growing around the quarter of the website traffic is made up of phones and other mobile devices. Some percentage of these mobile devices is going to access web pages from slow internet connections. Its important to decrease downloadable resources and increase mobile user experience,to get that Ivy helps in speed application startup by reducing the size of JavaScript classes.

Hope you enjoyed the article and it got added something new to your knowledge.
To Learn more about Javascript Javascript Treasure.
To add something new every-time into your mind stay tuned to visionfortech.

Enjoy......!!!
Happy Learning.....!!!

Friday, February 21, 2020

[Solution] Invoking generator for vue-cli-plugin-nativescript-vue... ERROR Error: Cannot find module '@vue/cli-service/generator/template/src/main.js'

[Solution] Invoking generator for vue-cli-plugin-nativescript-vue... ERROR Error: Cannot find module '@vue/cli-service/generator/template/src/main.js'

visionfortech nativescript-vue

If you are facing "Invoking generator for vue-cli-plugin-nativescript-vue... ERROR Error: Cannot find module '@vue/cli-service/generator/template/src/main.js" error while working with vue-cli-nativescriot-vue plugin So you are at the correct place.

I have found a solution for the same and below is the solution.

Please follow below steps to get it resolved.
Please remove npm and npm-cache folder from your computer's below location.
Windows :
C:\Users\AppData\Roaming.
Linux/Ubuntu:
/usr/local
Then Follow below steps
1) npm install -g @vue/cli@3.10.0
2) Go to code sharing project Directory's root folder location where you have package.json
3)npm install --save-dev @vue/cli-service@3.5.0
4)npm install --save-dev vue-cli-plugin-nativescript-vue@0.0.12
5)vue invoke vue-cli-plugin-nativescript-vue
 after that it will ask you for some user input and i provided below inputs.
? Enter a unique application identifier: org.nativescript.application
? Use HTML5 history mode? (Default: hash mode) No
? Is this a brand new project? (Default: Yes) Yes
? Dual Native AND Web development experience or a Native only? (Default: Dual) Dual Native AND Web
? What type of template do you want to start with? (Default: Simple) Simple.

So by following above steps you will be able to resolve the above error..

If anyone is still facing the same issue please comment that into the post i will happy to help them to get that resolved.
Hope you enjoyed the article and it got added something new to your knowledge.
To add something new every-time into your mind stay tuned to visionfortech.

Enjoy......!!!
Happy Learning.....!!!

Thursday, January 24, 2019

Angularjs forms and models

forms and models


now into review i want to insert a review form to get review from users so lets start to insert form into review tab

Into the form of review tab we are going get how much starts user want to give for our product and what are the reviews and what author gives the review.i want all above information.

Into HTML
<form name="reviewForm>
<blockquote>
<b>Stars : {{review.stars}}</b>
{{review.body}}
<author>by : {{review.author}}</author>
</blockquote>
<select ng-model="review.stars">
<option value="1">1 Star </option>
<option value="2">2 Star </option>
<option value="3">3 Star </option>
<option value="4">4 Star </option>
<option value="5">5 Star </option>
</select>
<textarea ng-model="review.body"></textarea>
<label>by : </label>
<input ng-model="review.author" type="email" />
</form>

so in above code we can't define review variable anywhere so better coding prctise we need to define that so for that we need to intialize that and commonly intialization can be done into the controller so lets create the Controller.

App.js
app.controller("reviewController",function(){
this.review={}
});

So,now we need to bind this review Controller into our form so for that we need to do the Following.

Into HTML

<form name="reviewForm ng-controller="reviewController as reviewCtrl">
<blockquote>
<b>Stars : {{review.stars}}</b>
{{reviewCtrl.review.body}}
<author>by : {{reviewCtrl.review.author}}</author>
</blockquote>
<select ng-model="reviewCtrl.review.stars">
<option value="1">1 Star </option>
<option value="2">2 Star </option>
<option value="3">3 Star </option>
<option value="4">4 Star </option>
<option value="5">5 Star </option>
</select>
<textarea ng-model="reviewCtrl.review.body"></textarea>
<label>by : </label>
<input ng-model="reviewCtrl.review.author" type="email" />
</form>

So after filling needed information we need to submit the form and into Angular we have a ng-submit directive

ng-submit allows us to call a function when the form is submitted and after that we need to define that function into our ReviewController.

So into HTML :

<form name="reviewForm ng-controller="reviewController as reviewCtrl" ng-submit="reviewCtrl .addReview(product)">
<blockquote>
<b>Stars : {{review.stars}}</b>
{{reviewCtrl.review.body}}
<author>by : {{reviewCtrl.review.author}}</author>
</blockquote>
<select ng-model="reviewCtrl.review.stars">
<option value="1">1 Star </option>
<option value="2">2 Star </option>
<option value="3">3 Star </option>
<option value="4">4 Star </option>
<option value="5">5 Star </option>
</select>
<textarea ng-model="reviewCtrl.review.body"></textarea>
<label>by : </label>
<input ng-model="reviewCtrl.review.author" type="email" />
</form>

So now we have to define this addReview function into ReviewController.

So Into app.js

app.controller("ReviewController",function(){

this.review={};

this.addReview=function(product)
{
product.review.push(this.review);
};
});

But when we went to browser and input our review and after submitting the form container which has all the input controller are not getring blank or we can say resetted so for that we just need to add one line into the addReview function of reviewController.

So Into app.js

app.controller("ReviewController",function(){

this.review={};

this.addReview=function(product)
{
product.review.push(this.review);
this.review={};
};
});

So what it can do is when this form is getting submitted and when this function got called so after pushing review into array we can assign a new javascript object to the review object which is blank.So after getting submitted the element's values will get reset.

form
1)You need to create multiple li's for each review that exists.
2)Set the blockquote stars ( strong tag) to the review stars.
3)Add the review body between the strong & cite tags.
4)Set the cite to the review author.
5)Use ng-model for review.stars select form field.
6)Use ng-model for review.body for the forms textarea.
7)Use ng-model for review.author – the email field.
8)In the strong tag, before Stars, put in the right expression to display review.stars. Keep the space prior to Stars
9)On the blank line with no tags put in the right expression to display review.body
10)In the cite tag, immediately after the -, put in the right expression to display review.author. 

Tuesday, October 16, 2018

Javascript JSON to string

Javascript JSON to string


Into this post we are going to discuss how to convert Javascript JSON ( Javascript Object Notation ) to string or javascript json to string.

Into this kind real IT world we can say Javascript is everywhere like front end and BackEnd both so we can say Javascript is going to rule everywhere.

Javascript JSON to String by visionfortech , Javascript blog

So in today's article we are going to discuss JSON which generally uses to pass data from one end to another end.

Let start understanding of that using below simple examples.

So into Javascript we can do that easily using JSON.stringify().

First let's take and example of Object

let json_to_string = JSON.stringify({ javascript_json: 5, json_to_string: 6 })

console.log(json_to_string);

//output: "{"javascript_json":5,"json_to_string":6}"
Now let's take an example of run time creation of Array of Object

let json_to_string = JSON.stringify([new String('visiofortech'),new Boolean(false),new Number(7)])

console.log(json_to_string);

//output: "["visiofortech",false,7}"
Now let's take an example of Date object

let json_to_string = JSON.stringify(new Date(2018, 10, 16, 15, 4, 5))

console.log(json_to_string);

//output: ""2018-11-16T09:34:05.000Z""

Hope you enjoyed the article and it got added something new to your knowledge.
To add something new every-time into your mind stay tuned to visionfortech.

To Learn more about Javascript Javascript Treasure.

Please comment below if you have something doubts or some questions.

Enjoy...!!!
Happy Learning....!!!

Thursday, September 13, 2018

Javascript Global and Local Variables

Javascript Global and Local Variables


Into this post we are going to discuss difference between how to declare javascript global variable and javascript local variable and its scope

we are going to discuss how can we declare global variable and local varible into Javascript with example.

Javascript global variable vs local variable by visionfortech
Javascript global variable vs local variable by visionfortech


Javascript Global Variable:

If we define var and let variable same globally then let variable will not get added into global window object while var variable will get added to global window object.

So let's declare two variables at the time of window loaded
let Visionfortech_global = "Visionfortech is defined as Global variable"

var Visionfortech_local = "Visionfortech is defined as Local variable"

console.log(Visionfortech_global);
o/p : undefined

console.log(Visionfortech_local);
o/p : Visionfortech is defined as Local variable
  

Javascript Local Variable : 
let js_local_variable = 1;

if (js_local_variable === 1) {
  let js_local_variable = 2;

  console.log(js_local_variable);
  // output: 2
}

console.log(js_local_variable);
// output: 1
  

Now let see the scope example of Javascript global and Local variable.

var global_variable = 1;
var javascript_global_variable = 2;
if (a === 1) {
var global_variable = 11; // the scope is global
let javascript_global_variable = 22; // the scope is inside the if-block
console.log(global_variable); // 11
console.log(javascript_global_variable); // 22
}
console.log(global_variable); // 11
console.log(javascript_global_variable); // 2

Enjoy....!!!!

Feel free to comment below your experience with above approach and If you still find any problem  with above steps Let me know I would love to help you to resolve your  problem.

 If you want to take your Technological Knowledge to the Next Level and For More Technological information Stay tuned to Visionfortech

Friday, August 10, 2018

Javascript let vs var


Javascript Let vs Var


Into this post we are going to discuss difference between Javascript var and Let.

we are going to discuss about Javascipt variable declaration method like where user can declare variable with var and where user can declare variable with let.



Global Variable Declaration:

If we define var and let variable same globally then let variable will not get added into global window object while var variable will get added to global window object.

So let's declare two variables at the time of window loaded
let Visionfortech_let = "Visionfortech is defined as let variable"

var Visionfortech_var = "Visionfortech is defined as var variable"

console.log(Visionfortech_let);
o/p : undefined

console.log(Visionfortech_var);
o/p : Visionfortech is defined as var variable
  

Redeclare Variable:


So Here let's discuss about one more example of let vs var into Javascript.You can not declare let variable but you can redeclare var variable


'use strict';
var let_vs_var = "Javascript let vs var";
var let_vs_var = "Difference Between let and var Javascript"; //replaced easily
'use strict';
let let_vs_var = "Javascript let vs var";
let let_vs_var = "Difference Between let and var Javascript"; // Error: let_vs_var is already declared

Javascript Let Example : 
let vision = 1;

if (vision === 1) {
  let vision = 2;

  console.log(vision);
  // output: 2
}

console.log(vision);
// output: 1
  

Now let see the scope example of Javascript let vs var.

var let_vs_var = 1;
var javascript_var = 2;
if (a === 1) {
var let_vs_var = 11; // the scope is global
let javascript_var = 22; // the scope is inside the if-block
console.log(let_vs_var); // 11
console.log(javascript_var); // 22
}
console.log(let_vs_var); // 11
console.log(javascript_var); // 2

Enjoy....!!!!

Feel free to comment below your experience with above approach and If you still find any problem  with above steps Let me know I would love to help you to resolve your  problem.

 If you want to take your Technological Knowledge to the Next Level and For More Technological information Stay tuned to Visionfortech

Thursday, September 7, 2017

How to prevent remote access of mognodb in windows and linux

How to prevent remote access of mognodb in windows and linux

This post is all about how to protect your mongodb server of windows or linux from ransomeware attack or we can say mongodb server is accessible only to localhost or 127.0.0.1 not any other location.

Please see the below solution.Hope you will get what you want..!!

Into Linux :

To prevent access of mongodb remotelly user need to do some changes into mongodb.conf.So to do that follow below steps.

1) Open /etc/mongodb.conf using below command
vi /etc/mongodb.conf

2) find all the statments which starts with bind_ip.Delete all the sentences.

3) Enter Below statment only into /etc/mongodb.conf
bind_ip=12.0.0.1

        If user want to give access to some machines or we can say some IP addresses for Application so user can do that by adding below line to /etc/mongod.conf

   bind_ip=<ip address>

Into windows :

1) First of all user need to turn of the firewall.

2) To turn on the firewall follow below steps.

*) Open command prompt using CMD

*) Run Below command and if it has 0.0.0.0:27017 then any user can access your database remotely.
netstat -a

*) Open Run using start -> Run or press windows+R Key to open Run prompt.

*) Write control into run prompt

*) It will open Control Pannel.

*) Go to Network and sharing center

*) Go to Windows firewall



*) Go to Advance setting

          
*) Select Inbound Rules and delete all rules related to Mongodb


                *) Again please apply below command to command prompt and you won't be able to see 0.0.0.0:27017 instead of that you will see 127.0.0.1:27017

So now no outside user will be able to access your mongodb server.Because you have grant access of only localhost or 127.0.0.1 to mongodb server only.


Cheers...!!!Enjoy...!!!

Feel free to comment below your experience with above approach and If you still find any problem with above steps Let me know I would love to help you to resolve your  problem.

If you want to take your Technological Knowledge to the Next Level and For More Technological information Stay tuned to Visionfortech

Tuesday, July 25, 2017

[Violation] Added non-passive event listener to a scroll-blocking 'touchstart' event. Consider marking event handler as 'passive' to make the page more responsive

[Violation] Added non-passive event listener to a scroll-blocking 'touchstart' event. Consider marking event handler as 'passive' to make the page more responsive


In this post i am going to discuss about how to remove a jQuery violation "[Violation] Added non-passive event listener to a scroll-blocking 'touchstart' event. Consider marking event handler as 'passive' to make the page more responsive" from chrome console.

Basically user can remove all the basic violations from just changing the type of log from "Verbose" to "Info".

visionfortech,javascript,Pratik Soni













But what if  user want to remove above violation from "Verbose" log Type ?
So Here is the solution.

Problem : 









The above violation is occur because e.preventDefault() will take much time and it will not passively load the component or we can say DOM.

So to remove that please include below code on top of your javascript.

Solution :

{passive:true}

// To remove the violation jquery-1.11.1.min.js:3 [Violation] Added non-passive event listener to a scroll-blocking 'touchstart' event. Consider marking event handler as 'passive' to make the page more responsive.

jQuery.event.special.touchstart = {
setup: function( _, ns, handle ){
if ( ns.includes("noPreventDefault") ) {
 this.addEventListener("touchstart", handle, { passive: false });
} else {
this.addEventListener("touchstart", handle, { passive: true });
}
}
};

//Remove violation code End

So now run your application and above violation will not appear into console.

Cheers...!!!Enjoy...!!!

Feel free to comment below your experience with above approach and If you still find any problem with above steps Let me know I would love to help you to resolve your  problem.

I hope this article will provided you solution which you are expecting. If you want to know more about Javascript check out Javascript World

If you want to take your Technological Knowledge to the Next Level and For More Technological information Stay tuned to Visionfortech

Protected by Copyscape