Tuesday, 26 March 2019

Router in Angular 6,7,8


interface Route {
  path?: string
  pathMatch?: string
  matcher?: UrlMatcher
  component?: Type<any>
  redirectTo?: string
  outlet?: string
  canActivate?: any[]
  canActivateChild?: any[]
  canDeactivate?: any[]
  canLoad?: any[]
  data?: Data
  resolve?: ResolveData
  children?: Routes
  loadChildren?: LoadChildren
  runGuardsAndResolvers?: RunGuardsAndResolvers
}

1.      path - It uses the route matcher DSL
2.      pathMatch - It uses to specifies the matching strategy
3.      matcher - It uses to defines a custom strategy for path matching
4.      component - It is a component type
5.      redirectTo - It is the URL fragment and it will replace the current matched segment
6.      outlet - It is the name of the outlet the component should be placed into
7.      canActivate  - It is an array of DI tokens  and used to handle the CanActivate handlers
8.      canActivateChild - It is an array of DI tokens and used to handle the CanActivateChild handlers
9.      canDeactivate - It is an array of DI tokens and used to handle the CanDeactivate handlers
10.  canLoad - It is an array of DI tokens and used to handle the CanLoad handlers
11.  data - It is additional data provided to the component by using the ActivatedRoute
12.  resolve - It is a map of DI tokens used to look up data resolvers
13.  runGuardsAndResolvers - It is defined when guards and resolvers will be run and by default, they run only when the matrix parameters of the route change.
14.  children - it is an array of child route definitions
15.  loadChildren - It is a reference to lazily loaded child routes.



Angular router has own library package - @angular/router.
import {RoutesRouterModule,}  from '@angular/router';

The basic concept of Angular Router and It allows you to -
1.      Redirect a URL to another URL
2.      Resolve data before a page is displayed
3.      Run scripts when a page is activated or deactivated
4.      Lazy load parts of our application

The router supports both styles with two LocationStrategy providers -
1.      PathLocationStrategy— this is the default style.
2.      HashLocationStrategy— adds the route path to the hash (#) in the browser’s URL.

Saturday, 23 March 2019

built a Data Portal and Ecommerce business from scratch task list

After a quick brainstorming session, we settled on the following action items:
  • Determine what to sell 
  • research on local target market and google trend 
  • research on online portal business model
  • Select an appropriate business model
  • Source a supplier
  • Order samples
  • Determine pricing
  • Create the brand
  • Find a Domain Name
  • Create a logo
  • if Data portal collect a data source 
  • if Data portal  discussion and decide what filed (or property is important)
  • if Data portal  discussion and decide what filed get from witch source 
  • if Data portal set a field ( product property ) filter set 
  • Set up the online store
  • Set SEO keyword 
  • Submit website in SEO bot
  • Take product photos
  • Create blog content
  • Set up social accounts
  • find a best cloud hosting provider 
  • Launch
  • integrate customer fatback forms or help chat box like plugin 
  • Test multiple marketing channels
  • Drive targeted traffic
  • Make sales




Data Portal business from scratch task list
E commerce business from scratch task list

Wednesday, 20 March 2019

Create select dynamic in Angular 6



         
<select [(ngModel)]="perPage" (change)="onGridPageLenthChange($event.target.value)" class="form-control form-control-sm">
                   <option *ngFor="let lenghtChangeItem of lengthChangeMenu" value={{lenghtChangeItem.valueField}} >
                       {{lenghtChangeItem.displayField}}
                   </option>
                </select>

        in compoent

  perPage:any;
  lengthChangeMenu:any[];


     [(ngModel)]="perPage"    For  default selected


'lengthChangeMenu':[
    {
      displayField:5,
      valueField:5
    },
    {
      displayField:10,
      valueField:10
    },
    {
      displayField:25,
      valueField:25,
      selected:true
    },
    {
      displayField:50,
      valueField:50,
      selected:true
    },
    {
      displayField:100,
      valueField:100,
      selected:true
    }
  ],
   



Create dropdown  dynamic in Angular 2
Create select in ngfor  in Angular 4
set default value in  Angular 6



Thursday, 7 March 2019

Explain Angular 2+ ngModule




@NgModule({
   declarations: [
      AppComponent
   ],
   imports: [
      BrowserModule
   ],
   providers: [],
   bootstrap: [AppComponent]
})

  • module is a class decorated with @NgModule. It serves as a registry (aka container) for all the components, pipes, directives and providers in your application.
  • An import is what you put in the imports property of the @NgModule decorator. It enables an Angular module to use functionality that was defined in another Angular module.
  • An export what you put is the exports property of the @NgModule decorator. It enables an Angular module to expose some of its components/directives/pipes to the other modules in the applications. Without it, the components/directives/pipes defined in a module could only be used in that module.
  • Providers

    This will include the services created.

    Bootstrap

    This includes the main app component for starting the execution.

Wednesday, 6 March 2019

@Attribute decorator in Angular Js

import {
    Component,
    Attribute
} from '@angular/core';

export type ButtonType = 'primary' | 'secondary';

@Component({
    selector: 'app-button',
    template: `
    <button [ngClass]="type">
      <ng-content></ng-content>
    </button>
  `
})
export class ButtonComponent {

    constructor(@Attribute('type') public type: ButtonType = 'primary') {}

}



  @Attribute decorator in Angular 2 
 Angular will evaluate it once and forget about it. As a general rule, I prefer the @Attribute() approach when the string is a fixed value that never changes.

Use Example 

<app-button type="secondary" (click)="click()">Click</app-button>

Tuesday, 5 March 2019

Use of symbols in custom directives and Components Scope Binding in angular 1

< is for one-way binding.
@ binding is for passing strings. These strings support {{}} expressions for interpolated values.
= binding is for two-way model binding. The model in parent scope is linked to the model in the directive's isolated scope.
& binding is for passing a method into your directive's scope so that it can be called within your directive.
When we are setting scope: true in directive, Angular js will create a new scope for that directive. That means any changes made to the directive scope will not reflect back in parent controller.

<: one-way binding
=: two-way binding
&: function binding
@: pass only strings

Sunday, 21 October 2018

Picture-in-Picture Javascript and Html example

Picture-in-Picture Javascript and Html , Chrome latest 70 version support 

#PictureinPicture #javascript #Chrome70


  Your Html <style>
video { background: #1e2327; border-radius: 4px; width: 100%; }
button { margin: 4px 0; }
</style>

<video id="video" controls playsinline
src="https://storage.googleapis.com/media-session/caminandes/short.mp4"
poster="https://storage.googleapis.com/media-session/caminandes/artwork-512.png"></video>
<button id="togglePipButton">Toggle Picture-in-Picture</button>

Your Javascript Code

let pipWindow;

togglePipButton.addEventListener('click', async function(event) {
  log('Toggling Picture-in-Picture...');
  togglePipButton.disabled = true;
  try {

    if (video !== document.pictureInPictureElement)
      await video.requestPictureInPicture();
    else
      await document.exitPictureInPicture();

  } catch(error) {
    log(`> Argh! ${error}`);
  } finally {
    togglePipButton.disabled = false;
  }
});

// Note that this can happen if user clicked the "Toggle Picture-in-Picture"
// button but also if user clicked some browser context menu or if
// Picture-in-Picture was triggered automatically for instance.
video.addEventListener('enterpictureinpicture', function(event) {
  log('> Video entered Picture-in-Picture');

  pipWindow = event.pictureInPictureWindow;
  log(`> Window size is ${pipWindow.width}x${pipWindow.height}`);

  pipWindow.addEventListener('resize', onPipWindowResize);
});

video.addEventListener('leavepictureinpicture', function(event) {
  log('> Video left Picture-in-Picture');

  pipWindow.removeEventListener('resize', onPipWindowResize);
});

function onPipWindowResize(event) {
  log(`> Window size changed to ${pipWindow.width}x${pipWindow.height}`);
}

/* Feature support */

if ('pictureInPictureEnabled' in document) {
  // Set button ability depending on whether Picture-in-Picture can be used.
  setPipButton();
  video.addEventListener('loadedmetadata', setPipButton);
  video.addEventListener('emptied', setPipButton);
} else {
  // Hide button if Picture-in-Picture is not supported.
  togglePipButton.hidden = true;
}

function setPipButton() {
  togglePipButton.disabled = (video.readyState === 0) ||
                             !document.pictureInPictureEnabled ||
                             video.disablePictureInPicture;
}




picture in picture mode tutorial with example




Thursday, 20 September 2018

Surat Diamond ganpati



Surat ganpati

Surat Diamond ganpati

                         Surat Diamond ganpati click hear





ધ્યાન-

ॐ सिन्दूर-वर्णं द्वि-भुजं गणेशं लम्बोदरं पद्म-दले निविष्टम्।
ब्रह्मादि-देवैः परि-सेव्यमानं सिद्धैर्युतं तं प्रणामि देवम्।।
।। મૂળપાઠ ।।
सृष्ट्यादौ ब्रह्मणा सम्यक् पूजित: फल-सिद्धए।
सदैव पार्वती-पुत्र: ऋण-नाशं करोतु मे।।1
त्रिपुरस्य वधात् पूर्वं शम्भुना सम्यगर्चित:।
सदैव पार्वती-पुत्र: ऋण-नाशं करोतु मे।।2
हिरण्य-कश्यप्वादीनां वधार्थे विष्णुनार्चित:।
सदैव पार्वती-पुत्र: ऋण-नाशं करोतु मे।।3
महिषस्य वधे देव्या गण-नाथ: प्रपुजित:।
सदैव पार्वती-पुत्र: ऋण-नाशं करोतु मे।।4
तारकस्य वधात् पूर्वं कुमारेण प्रपूजित:।
सदैव पार्वती-पुत्र: ऋण-नाशं करोतु मे।।5
भास्करेण गणेशो हि पूजितश्छवि-सिद्धए।
सदैव पार्वती-पुत्र: ऋण-नाशं करोतु मे।।6
शशिना कान्ति-वृद्धयर्थं पूजितो गण-नायक:।
सदैव पार्वती-पुत्र: ऋण-नाशं करोतु मे।।7
पालनाय च तपसां विश्वामित्रेण पूजित:।
सदैव पार्वती-पुत्र: ऋण-नाशं करोतु मे।।8
इदं त्वृण-हर-स्तोत्रं तीव्र-दारिद्र्य-नाशनं,
एक-वारं पठेन्नित्यं वर्षमेकं सामहित:।
दारिद्र्यं दारुणं त्यक्त्वा कुबेर-समतां व्रजेत्।।







Wednesday, 25 April 2018

Update Column With Random predefined word list in PostgreSQL


   Update Column With Random  enum word list in PostgreSQL ?
   How to Update Column With Random word ?

    UPDATE stock
    SET shape = (
              (
               ARRAY['CS','CM','RN','EM','AS','PR','OV','HT','BG','Round','MQ','PC']
              )          [floor(random()*12)+1]
           );

Update Date Column With RANDOM date in PostgreSQL



Random Dates and Numbers in PostgreSQL with the RANDOM() Function



select NOW() + (random() * (NOW()+'90 days' - NOW())) + '30 days';

UPDATE stock SET trans_date = NOW() + (random() * (NOW()+'90 days' - NOW())) + '30 days';



Monday, 23 April 2018

How to Flush/Clean DNS cache in Ubuntu 16.04 and Ubuntu 20.04



In Windows, we useipconfig /flushdnsin Ubuntu 16.04  run this command to flush dns cache:
sudo /etc/init.d/dns-clean restart

or use:

sudo /etc/init.d/networking force-reload


Ubuntu 20.04 

How to Clear DNS Cache on Ubuntu?

We can run the following command to clear the DNS cache on Ubuntu.

 sudo systemd-resolve --flush-caches



Friday, 13 April 2018

SURAT: India's first district cooperative bank built on the green concept

 SURAT: India's first district cooperative bank built on the green concept will be inaugurated in the diamond city by Chief Minister Vijay Rupani on Friday
Established in 1909, the 109-year-old Surat district cooperative bank  has become the first among the 370 district banks in India and 18 district banks in Gujarat for constructing its new headquarter in the diamond city’s Majura Gate on the green building concept. Constructed on 45,000 square feet, the bank took just 15 months for completition at the cost of Rs 34 crore.


The terrace of the district bank is installed with rooftop solar plant for generating 36 kilowatts of electricity for its in-house needs. The solar panels have been so designed that the electricity requirements would be met even during the monsoon season.

The five-storey bank building has green patches for gardening at each of the floors. The entry of the building has a green landscape with lush garden for providing a different feeling to the customers visiting the bank. Each floor has the facility of toilets and reception, mineral RO plants for clean drinking water etc.

Watch a New Surat district cooperative bank in 360 degree.


SURAT district cooperative bank entrance gate


Saturday, 24 February 2018

Install Latest and update Node js in Ubuntu


On Ubuntu 16.04 LTS the easier way is
1 Install npm:
sudo apt-get install npm
2.Install n
sudo npm install n -g
3 Get latest version of node
sudo n latest
If you prefer to install a specific version of `node you can
4 List available node versions
n ls
5 and the install a specific version

sudo n 4.5.0