Skip to main content

Posts

15 Common mistakes JavaScript programmer does

15 Common mistakes that every new JavaScript programmer does 1. Truthy And Falsy Values 2. Ternary Operator 3. Equality Check 4. Addition and Concatenation 5. Using variable as key in object 6. Incorrect references to this 7. Thinking there is block-level scope 8. Creating memory leaks 9. Confusion about equality 10. Inefficient DOM manipulation 11. Incorrect use of function definitions inside for loops 12. Failure to use “strict mode” 13. Providing a string as the first argument to setTimeout or setInterval 14. Creating incorrect references to instance methods 15. Undefined != null

Retrieve Parameters and Query String values from URL in Angular 6, 7, 8, and 9

In Angular, we can get the value of query parameters using ActivatedRoute object, and queryParamMap . Two different ways:- 1.      Using route.paramMap.subscribe 2.      Using route.snapshot.paramMap What Are the difference between route.paramMap.subscribe and   route.snapshot.paramMap? The main difference between the two is that the subscription will continue to update as the parameter changes for that specific route.  Using subscribe is best way to get the value from URL because if value changes within same route then value get updated in the variable. When we use snapshot then value does not update if value of code updates in same route. Dummy URL:- http://localhost:8100/user?code=9f8c116dc868fa4377fe8c8065f21ec7e0969571 Accessing Query String Values From URL:- Example 1, import  { Component, OnInit }  from   '@angular/core' ; import  { ActivatedRoute }...

Fast SQL Server Stored Procedure with Filtering, Sorting and Paging

OFFSET/FETCH Pagination:-  With the help of these OFFSET and FETCH keywords inside a CTE I managed to build a SQL Stored procedure that was at least twice as fast in return times as the other average ones found on the internet. Here I'm sharing 2 examples to achieving the SQL filtering, sorting and paging . Both example are tested and working fine but I will recommend example 1 for you. Example 1, --[dbo].[usp_GetemployeeCodes] NULL, 1, 10, 'employee_code', 'DESC' CREATE PROCEDURE [dbo] . [usp_GetEmployeeCodes] (     /* Optional Filters for Dynamic Search*/     @SearchCode NVARCHAR ( 50 ) = NULL,             /*– Pagination Parameters */             @PageNo INT = 1 ,             @PageSize INT = 15 ,    /*– Sorting Parameters */  ...

Position Sticky Not Working in IE11 and edge

Below css class ( table-sticky-row ) position sticky ( position : sticky ) not working in IE11 and Edge . .table-sticky-row {     position : sticky ;     bottom : 0 ;     right : 0 ;     background : rgba(0, 211, 211, 1.6) ; } The sticky doesn't work on IE11/edge, but luckily, in this case, we can use position : fixed , which will work on both older and newer browsers i.e. table.header-sticky-scroll > tbody {     display : block ;     height : 150px ;     overflow : auto ; } table.header-sticky-scroll thead , tbody tr {     display : table ;     width : 100% ;     table-layout : fixed ; } table.header-sticky-scroll thead {     width : calc( 100% - 1em ) } As an Example, CSS Code looks like-  < style >     table.header-s...