Skip to content

Instantly share code, notes, and snippets.

View vishnu-saini's full-sized avatar

Vishnu Saini vishnu-saini

View GitHub Profile
@vishnu-saini
vishnu-saini / Sorting Algorithms.md
Last active July 31, 2018 10:01
Data Structures and Algorithms

Java Sorting Algorithms

A sorting algorithm is an algorithm that puts elements of a list in a certain order. The most-used orders are numerical order and lexicographical order. Efficient sorting is important for optimizing the use of other algorithms such as search and merge algorithms, which require input data to be in sorted lists; it is also often useful for canonicalizing data and for producing human-readable output.

Java Sorting Algorithms Examples

  1. bubble sort in java
  2. selection sort in java
  3. insertion sort in java
  4. quick sort in java
  1. The bind() method creates a new function that, when called, has its this keyword set to the provided value, with a given sequence of arguments preceding any provided when the new function is called. Function.prototype.bind()
    var module = {
      x: 42,
      getX: function() {
        return this.x;
      }
    }
    

When port is not free (8080 or other)

  You can use "netstat" to check whether a port is available or not.
  ```
  netstat -ano | findstr 8080
  TCP    0.0.0.0:8080           0.0.0.0:0              LISTENING       6696
  TCP    [::]:8080              [::]:0                 LISTENING       6696
  ```
  then kill the process with 
  1. To check the avilable memory

    df -h 
    

    -h is human readable

  2. current directory

    pwd
    

To Fill up the timesheet

$("select option[value='357815']").attr("selected", "selected");
$( "#content-ts tr td select" ).trigger( "change" );
$("select option[value='159087']").attr("selected", "selected");
$("#content-ts tr td:nth-child(12) input").attr("value","09");

Note : Here 357815 is project id which is 'struts upgrade' and 159087 is task id which is 'developement'

Java 8 provides features

  1. Lambda expressions,
  2. Method references,
  3. Functional interfaces,
  4. Stream API,
  5. Default methods,
  6. Base64 Encode Decode,
  7. Static methods in interface,
  8. Optional class,

Threads

Have you ever watched a movie with a group of friends, laughing, shouting, and sharing popcorn, nachos, or fries—all at the same time? If yes, you’ve already practiced multithreading and concurrency.

“Every problem has a solution, and every solution has a problem”—this statement holds true for threads. Threads were created so that they could make the best use of a processor’s time. An application can create multiple threads. When threads share objects among themselves, it can result in interleaving operations (thread interference)

Redux Notes

What is Redux

Redux is one of the hottest libraries for front-end development in today’s marketplace. It is a predictable state container for JavaScript applications and is used for the entire applications state management. Applications developed with Redux are easy to test and can run in different environments showing consistent behaviour image

Three principles of Redux

  • Single source of truth: The state of the entire application is stored in an object/ state tree within a single store. The single state tree makes it easier to keep track of changes over time and debug or inspect the application.
  • State is read-only: The only way to change the state is to trigger an action. An action is a plain JS object describing the change. Just like state is the minimal representation of data, the action is the minimal representation of the change to that data.
  • **Changes are