Web Technology

Web technology refers to the means by which computers communicate with each other using markup languages and multimedia packages. It gives us a way to interact with globally all over the world, like websites. Web technology involves the use of hypertext markup language (HTML) and cascading style sheets (CSS) and various types of scripting languages (such as - PHP, JAVA, C# etc). Web Technology includes: 1) Internet 2) HTML (markup language) 3) Scripting Languages such as java, php, javascript, C#, node.js, python, ruby etc. 4) Web Building

Subjects

Latest Asked Question

A : In Sequelize, you can achieve the functionality of updating a row if it exists, or inserting a new row if it doesn't exist, using the findOrCreate() method. This method searches for a matching row based on certain criteria and creates a new one if it doesn't exist. If a matching row is found, it can update that row instead. const { Sequelize, DataTypes } = require('sequelize'); const sequelize = new Sequelize('database', 'username', 'password', { host: 'localhost', dialect: 'mysql' }); const YourModel = sequelize.define('YourModel', { id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true }, name: { type: DataTypes.STRING, allowNull: false },  });   async function updateOrInsert(dataToUpdateOrInsert) { try { const [row, created] = await YourModel.findOrCreate({ where: { id: dataToUpdateOrInsert.id }, defaults: dataToUpdateOrInsert  }); if (!created) { YourModel.update(dataToUpdateOrInsert, { where: { id: dataToUpdateOrInsert.id } }); } console.log('Operation successful!'); } catch (error) { console.error('Error:', error); } } updateOrInsert({ id: 1, name: 'Updated Name' }); In this example:
  • findOrCreate() searches for a row based on the specified criteria (in this case, id) and returns the row if found along with a boolean flag indicating whether the row was created or not.</li> <li>If the row is found (created is false), update() method is called to update the row with the new data.</li> <li>If the row is not found (created is true), a new row is created with the specified data (dataToUpdateOrInsert).</li> </ul> <xmp> 
45 Likes
45 Likes
A : best view answer echo Request::fullUrl() echo Request::url(); echo Request::path() echo Request::segment(1); echo Request::is("admin/*")
45 Likes
A : hello here is your solution, <?php function distance_bt_two_points($latitudeFrom, $longitudeFrom, $latitudeTo, $longitudeTo) { $longitude1 = deg2rad($longitudeFrom); $longitude2 = deg2rad($longitudeTo); $latitude1 = deg2rad($latitudeFrom); $latitude2 = deg2rad($latitudeTo); //Haversine Formula $dlong = $longitude2 - $longitude1; $dlati = $latitude2 - $latitude1; $val = pow(sin($dlati/2),2)+cos($lat1)*cos($lat2)*pow(sin($dlong/2),2); $res = 2 * asin(sqrt($val)); $radius = 3958.756; return ($res*$radius); } $latitudeFrom = 19.017656 ; //mumbai $longitudeFrom = 72.856178; //mumbai $latitudeTo = 28.615338; //delhi $longitudeTo = 77.193474; //delhi // Distance between Mumbai and Delhi echo(distance_bt_two_points( $latitudeFrom, $longitudeFrom, $latitudeTo, $longitudeTo)." "."miles"); ?> OUTPUT : 717.3753011057 miles
45 Likes
A : this your solution use indexOf() and array.splice() method in javascript.  var array = [2, 5, 9]; console.log(array); var index = array.indexOf(5); if (index > -1) {   array.splice(index, 1); } // array = [2, 9] alert(array);
45 Likes
A : You can solve your query using reduce() method in javascript Use the JavaScript reduce() Method var array1 = [95, 782, 523, 474]; var array2 = [55, 12, 50]; // Getting sum of numbers of aray1. var sum1 = array. reduce(function(a, b){ return a + b; }, 0); // Getting sum of numbers of aray2. var sum2 = array2. reduce(function(a, b){ return a + b; }, 0); console. log(sum1 + sum2); // Prints: 1991.
45 Likes
A : hi you can try var x = [{"hello":"1", "hello2":"456"}]; var y = [{"hi1":"852", "hi2":"9632", "hi3":"75391}]; Array.prototype.push.apply(x,y); console.log(x); //x will print combined array; workable and tested.
45 Likes
A : I follow these steps to create animation in angular. Enabling the animations module by importing    import { BrowserAnimationsModule } from '@angular/platform-browser/animations'   in your app.module.ts file next you need to create animation.ts file and write below code . import {   animate,   query,   style,   transition,   trigger,   group, } from '@angular/animations';   export function routerAnimation() {   return trigger('routerAnimation', [     // One time initial load. Move page from left -100% to 0%     transition('-1 => *', [       query(':enter', [         style({           position: 'fixed',           width: '100%',           transform: 'translateX(-100%)',         }),         animate(           '500ms ease',           style({             opacity: 1,             transform: 'translateX(0%)',           }),         ),       ]),     ]),       // Previous, slide left to right to show left page     transition(':decrement', [       // set new page X location to be -100%       query(         ':enter',         style({           position: 'fixed',           width: '100%',           transform: 'translateX(-100%)',         }),       ),         group([         // slide existing page from 0% to 100% to the right         query(           ':leave',           animate(             '500ms ease',             style({               position: 'fixed',               width: '100%',               transform: 'translateX(100%)',             }),           ),         ),         // slide new page from -100% to 0% to the right         query(           ':enter',           animate(             '500ms ease',             style({               opacity: 1,               transform: 'translateX(0%)',             }),           ),         ),       ]),     ]),       // Next, slide right to left to show right page     transition(':increment', [       // set new page X location to be 100%       query(         ':enter',         style({           position: 'fixed',           width: '100%',           transform: 'translateX(100%)',         }),       ),         group([         // slide existing page from 0% to -100% to the left         query(           ':leave',           animate(             '500ms ease',             style({               position: 'fixed',               width: '100%',               transform: 'translateX(-100%)',             }),           ),         ),         // slide new page from 100% to 0% to the left         query(           ':enter',           animate(             '500ms ease',             style({               opacity: 1,               transform: 'translateX(0%)',             }),           ),         ),       ]),     ]),   ]); } next in your app-routing.module.ts file,write below code where routes define , { path: 'abc', component: AbcComponent, data: { num: 1 } } { path: 'test', component: TestComponent, data: { num: 2 } } next in your app.component.ts file you need to write below code, import { routerAnimation } from './common/animations'; import { Component } from '@angular/core'; import { RouterOutlet } from '@angular/router';   @Component({   selector: 'app-root',   templateUrl: './app.component.html',   styleUrls: ['./app.component.scss'],   animations: [routerAnimation()], }) export class AppComponent {   constructor() {}     public getRouteAnimation(outlet: RouterOutlet) {     const res =       outlet.activatedRouteData.num === undefined         ? -1         : outlet.activatedRouteData.num;       return res;   } } next in app.component.html file you need to write below code, <div class="navbar">   <a [routerLink]="['abc']">Abc</a><xmp>   <a [routerLink]="['test']">Test</a><xmp>    </div>   <div class="content" [@routerAnimation]="getRouteAnimation(router)">   <router-outlet #router="outlet"></router-outlet> </div> follow all of the above steps to make animation in your angular projects.  
45 Likes
A : Hi, You can try this code, it is working Fine in my project. In Template file you can  write below code after constructor. originalOrder = (a: KeyValue<number,string>, b: KeyValue<number,string>): number => {       return 0; And in html component file you can write below code. write this code in ngfor pipe keyvalue. <select class="form-control"  id="test" [(ngModel)]="testing">         <option> --Select category--</option>           <option   *ngFor="let categoryList of categoryLists | keyvalue: originalOrder"   value="{{categoryList.key}}">{{categoryList.key}}</option>                            </select>  
45 Likes
Web Technology Related Topic's