Skip to main content

Posts

Showing posts from May, 2022

jQuery Selectors

How to find elements from HTML using jQuery In this article, you will learn about jQuery selectors and how to find DOM element(s) using selectors. The jQuery selector provides functionality to find DOM elements in your web page. jQuery selectors are one of the most important parts of the jQuery library. All selectors in jQuery start with the dollar sign and parentheses: $(). jQuery Selector Syntax $(selector expression) Example 1 : The .class Selector The jQuery .class selector allow you to finds all the elements with a specific class. If you want to find all the elements with class name "post-title" then the syntax will be as following. $(".post-title")   Example 2 : The #Id Selector The jQuery #Id selector allow you to finds the particular element with a specific Id. The Id selector will be used when you want to find single element from web page. $(document).ready(function(){ $("#btn-hide-title").click(function(){ $(".post-title").h

JavaScript Arrow Function

In this example, you will learn about JavaScript arrow function. Arrow function is one of the features introduced in the ES6 version of JavaScript. It allows you to create functions easy way compared to regular functions. Regular Function // regular function let result = function(a, b) { return a + b; } ES6 Arrow Function // arrow function let result = (a, b) => a + b; Arrow Function Syntax The syntax of the arrow function look like is: let myFunction = (arg1, arg2, ...argN) => { statement... } Here, myFunction is the function name arg1, arg2,...argN is the argument(parameter) of the function statement... is the body of the function

JavaScript Program to Remove Specific Item From an Array

How to Remove Specific Element From An Array In this example, you will learn to write a JavaScript program that will remove a specific element from an array. Example 1 : Using For Loop Remove Element From Array function removeElementFromArray(array, n) { const newArray = []; for ( let i = 0; i < array.length; i++) { if(array[i] !== n) { newArray.push(array[i]); } } return newArray; } const elements = [1, 2, 3, 4, 5]; const result = removeElementFromArray(elements, 4); console.log(result); Output [1,2,3,5] In the above program, an element 4 is removed from an array using a for loop. Example 2 : Using Array.splice() Remove Element From Array const elements = [1, 2, 3, 4, 5]; //remove element 3 const result = elements.splice(2,1); console.log(elements); Output [1, 2, 4, 5] In the above program, an element 3 is removed from an array using a splice() method.

How To Create Image Gallery in UWP Application

How to implement image gallery in gridview This article demonstrates how to make image gallery application using universal windows platform.  1. Let's start step by step. first of all open visual studio and create new blank UWP project as follows.     2. Click next and enter your project name and choose location where you want to save your project.   3. Click Create and choose target and minimum version that your UWP application will support.     4. Click Ok and your UWP project will created automatically and look like as following. 5. Now open MainPage.xaml file and enter below code between Grid tag. <NavigationView IsSettingsVisible= "False" IsBackButtonVisible= "Collapsed" > <NavigationView.MenuItems> <NavigationViewItem x:Name= "MenuImage" Tag= "image" Content= "Image Category" Icon= "Pictures" ></Navig

ASP.NET Core - Overview

What is ASP.NET Core? ASP.NET Core is a web framework created by Microsoft for building web applications, APIs, and microservices. It uses common patterns like MVC (Model-View-Controller), dependency injection, and a request pipeline comprised of middleware. It's open-source under the Apache 2.0 license, which means the source code is freely available, and the community is encouraged to contribute bug fixes and new features. ASP.NET Core runs on top of Microsoft's .NET runtime, similar to the Java Virtual Machine (JVM) or the Ruby interpreter. You can write ASP.NET Core applications in a number of languages (C#, Visual Basic, F#). C# is the most popular choice. You can build and run ASP.NET Core applications on Windows, Mac, and Linux. Why do we need another web framework? There are a lot of great web frameworks to choose from already: Node/Express, Spring, Ruby on Rails, Django, Laravel, and many more. What advantages does ASP.NET Core have?  Speed . ASP.NET Core is fast. Bec

How to backup database in sql server using query

This article demonstrates how to backup database from SQL server to disk using query. Let's start step by step. Open Microsoft SQL Server management studio and run following query. The following example backs up the complete TestDB database to disk. USE TestDB; GO BACKUP DATABASE TestDB TO DISK = 'c:\temp\TestDB.bak' WITH FORMAT, MEDIANAME = 'SQLServerBackups', NAME = 'Full Backup of TestDB'; GO   Full back up to disk as default location from SQL Server Management Studio In this example, the database Test will be backed up to disk at the default backup location. 1. The connect SQL server database engine instance in your machine. 2. Expand Databases , then right click on Test database, then select Tasks , then select Back Up . 3. Then click OK. 4. When the backup completes successfully, select OK to close dialog box.  

How To Import Data From Excel To SQL Table Using Query

This article demonstrates how to import the data from a Microsoft Excel sheet to a SQL Server table in Microsoft SQL Server. Let’s start step by step. Here I have one Excel sheet with employee details data with six columns as above and this detail I will use as an example and load into employee table.  Open SQL Server management studio and run following SQL query. DECLARE @Qry NVARCHAR(MAX) DECLARE @FilePath NVARCHAR(255)='D:\Employee.xlsx' EXEC sp_configure 'Show Advanced Options', 1; RECONFIGURE; EXEC sp_configure 'Ad Hoc Distributed Queries', 1; RECONFIGURE; SET @Qry='SELECT * FROM OPENROWSET(''Microsoft.ACE.OLEDB.12.0'', ''Excel 12.0; HDR=yes; Database='+CONVERT(NVARCHAR(255),@FilePath)+''', [Sheet1$]);' INSERT INTO Employees EXEC (@Qry) select * from Employees You have to make sure "Microsoft Access Database Engine Redistributable" is install or not in your local machine. If it is not

SQL Joins

A SQL JOIN is used to combine two or more tables, based on a related column between tables. Let's take a look selection from the "Orders" table: OrderId CustomerId OrderDate 1001 1 2020-05-22 1002 2 2020-05-22 1003 3 2020-05-22 Then, look at a selection from the "Customers" table: CustomerId CustomerName Country 1 John USA 2 Bill USA 3 Jimmy USA Now, the relationship between Orders table and Customers table is the "CustomerId" column. Then, we can create the following SQL statement that contains an INNER JOIN, It'll select records that have matching values in both tables: SELECT o.OrderId, c.CustomerName, o.OrderDate FROM Orders as o INNER JOIN Customers as c ON o.CustomerId=c.CustomerId and above SQL statement will produce following result like this: Orde

First C# Program

C# can be used in a window-based, web-based, or console application. To start with, we will create a console application to work with C#.  Open Visual Studio (2019 or later) installed on your local machine. Click on File -> New Project... as below       From the New Project popup, select C# in the language menu and select the Console App in the project type menu and click next.       In the name section, give any appropriate project name, a location where you want to create your project files.     Click next and select target framework.   Click Create to create the console application.   Program.cs will be created as default a C# file in Visual Studio where you can write your C# code in Program class, as shown above.   To see the output of the above C# program, we have to compile it and run it by pressing Ctrl + F5 or clicking the "HelloWorld" Run button.