Simple Social Share Button

This post explains a simple way to share the post on social media without any API. Just you following Urls url should be in Url Encoded format: Example: Url:   https://www.codebucket.in/ Url Encode : https%3A%2F%2Fwww.codebucket.in%2F Encoding can be easily done by various method:- Online: -https://www.urlencoder.org/ Php:- use urlencode() JavaScript:- use encodeURI() Twitter

Example:

Output: […]

Continue reading

Adapter Pattern

The adapter pattern converts the interface of a class into another interface clients expect. Adapter lets classes work together that couldn’t otherwise because of incompatible interfaces.        

Continue reading

Abstract Factory Pattern

Abstract Factory:- Provide an interface for creating families of related or dependent objects without specifying their concrete class. Each generated factory can give the objects as per the Factory pattern. Abstract factory is also called as factory of factories.

Continue reading

Factory Method: Design Pattern

Factory is a building or group of buildings where goods are manufactured. Here we manufacture objects. In Factory pattern, we create object without exposing the creation logic to the client and refer to newly created object using a common interface. Example 1:- Example 2:- See Complete Code   Also read https://www.tutorialspoint.com/design_pattern/factory_pattern.htm  

Continue reading

Facade: Desgin Pattern

Facade:face of Building or A deceptive outward appearance.   The people walking past the road can only see this glass face of the building. They do not know anything about it, the wiring, the pipes and other complexities. It hides all the complexities of the building and displays a friendly face. Def:- It hides the […]

Continue reading

Mediator Pattern : Design Pattern

This pattern provides a mediator class which normally handles all the communications between different classes. Example:- We are demonstrating mediator pattern by the example of a chat room where multiple users can send the message to the chat room, and it is the responsibility of chat room to show the messages to all users.

Continue reading

Observer: Design Pattern

The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. It is used when there is a one-to-many relationship between objects such as if one object is […]

Continue reading

Singleton: Design Pattern

What Singleton design pattern is a pattern in which we can have only one instance of the class. Singletons are used for centralized management of internal or external resources and they provide a global point of access to themselves. Example:- 1) One single DB connection shared between multiple objects. 2) In any in a system, […]

Continue reading

What are indexes in the database?

A database index is a data structure that improves the speed of data retrieval operations on a database table at the cost of additional writes and storage space to maintain the index data structure. Indexes are used to quickly locate data without having to search every row in a database table every time a database […]

Continue reading

SQL wildcard performance comparison?

I am here talking about ‘%’ wild card. Doubly truncated:- %code% Right truncated:- code% Left truncated:- %code No truncated:- code Can you guess, which one is fastest among all? Case a and Case c: If you put ‘%’ on the left side of your search term, SQL server has to examine every single row of […]

Continue reading

Tips to optimize database queries

1) Always select the columns, which are required We have the habit of using ‘*’ all time.

Instead, use,

  2) Limit Sometimes we need few records but request all records from the database. We fetch all data then truncate unwanted records at UI level. We can limit this by adding ‘LIMIT’ in […]

Continue reading

Decoding Complexity

O(1): known as Constant complexity 1 item: 1 second 10 items: 1 second 100 items: 1 second O(n): known as Linear complexity 1 item: 1 second 10 items: 10 seconds 100 items: 100 seconds O(n2): known as Quadratic complexity 1 item: 1 second 10 items: 100 seconds 100 items: 10000 seconds O(log n): known as […]

Continue reading

Complexity of Algorithm

Common Sorting Algorithm Algorithm Time Complexity   Best Average Worst Selection Sort Ω(n^2) θ(n^2) O(n^2) Bubble Sort Ω(n) θ(n^2) O(n^2) Insertion Sort Ω(n) θ(n^2) O(n^2) Heap Sort Ω(n log(n)) θ(n log(n)) O(n log(n)) Quick Sort Ω(n log(n)) θ(n log(n)) O(n^2) Merge Sort Ω(n log(n)) θ(n log(n)) O(n log(n)) Bucket Sort Ω(n+k) θ(n+k) O(n^2) Radix Sort Ω(nk) […]

Continue reading

Data Structure

Data Structure is a way of organization and storing data on the computer so that it can be accessed and modified efficiently. It is the collection of data values and the relationship among them. We can categorized data types in two parts:- Primitive Non-Primitive Primitive Data Type The programming language provides building blocks for storing […]

Continue reading

Decoding Dependency Injection

What is a dependency? A state in which one object depends on another object is term as Dependency or coupling. Example: When class X uses class Y, then X depends on Y. X can’t use independently without Y. X can’t be reused without resuing Y. X -> Dependant Y -> Dependency Dependency/Coupling are directional. X […]

Continue reading

GOF Design Pattern

Design pattern is a general repeatable solution to a commonly occurring problem in software design. A design pattern isn’t a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations. The design pattern is categorised into three […]

Continue reading

API REST SOAP

API: Application program interface It is a way(code) that allows two different applications to communicate with each other. REST REpresentational State Transfer(Rest), is an architectural style for providing standards between computer systems on the web, making it easier for systems to communicate with each other. Do this: https://www.codecademy.com/articles/what-is-rest   SOAP is a protocol. It stands […]

Continue reading

MVC variance

You can build software application without using these pattern, but using you will achieve:- 1) separation of concerns design principle(https://en.wikipedia.org/wiki/Separation_of_concerns) 2) improves maintainability of the application 3) improves testability of the application MVC It helps you write better organised, and therefore more maintainable code. Instead of writing all code in one, MVC separated it into […]

Continue reading

Architecture vs Design pattern

In the software world, people often face same type problems repeated in n numbers of ways, So people tried to find patterns to generalise the problems. Pattern: A pattern means regularity, i.e. the same thing repeating in different ways. These Patterns are well-known methods for solving problems in a way that has proven itself many […]

Continue reading