Skip to content

Programming Articles

  • HOME
  • Python
  • JavaScript
  • C/C++
  • Java
  • Terms & Conditions and Privacy Policy
  • About US
Main Menu

Programming

Programming

What’s the difference between a method and a function?

A function is a piece of code that is called by name. It can be passed data to operate on (i.e. the parameters) and can optionally return data (the return value). All …

What’s the difference between a method and a function? Learn More
Programming

What is “Linting” in programming?

Query: PHPLint, JSLint, and I recently came across “you can lint your JS code on the fly” while reading something about some IDE. So, what is “linting”? What is “Linting”? Linting is the process of running …

What is “Linting” in programming? Learn More
JavaScript / Programming

What is the difference between call and apply in JavaScript?

Query: What is the difference between using Function.prototype.apply() and Function.prototype.call() to invoke a function? func.apply(); vs func.call(); Are there performance differences between the two aforementioned methods? When is it best to use call over apply and vice versa? Difference between …

What is the difference between call and apply in JavaScript? Learn More
Programming / Python

What are metaclasses in Python? [Answered]

Metaclasses in Python explained: Classes as objects Before understanding metaclasses, you need to master classes in Python. And Python has a very peculiar idea of what classes are, borrowed from …

What are metaclasses in Python? [Answered] Learn More
Design Patterns / Programming

What are the drawbacks or disadvantages of the singleton pattern? [Answered]

Query explained: The singleton pattern is a fully paid-up member of the GoF‘s patterns book, but it lately seems rather orphaned by the developer world. I still use quite a lot of singletons, especially …

What are the drawbacks or disadvantages of the singleton pattern? [Answered] Learn More
Programming

What’s the difference between call by reference and call by value? [Answered]

Query explained: What is the difference between a parameter passed by reference a parameter passed by value? Could you give me some examples, please? What’s the difference between passing by …

What’s the difference between call by reference and call by value? [Answered] Learn More
JavaScript / Programming

What’s the difference between using “let” and “var” in JavaScript? [Answered]

Query explanation: CMAScript 6 introduced the let statement. I’ve heard that it’s described as a local variable, but I’m still not quite sure how it behaves differently than the var keyword. What are the differences?. When should let be …

What’s the difference between using “let” and “var” in JavaScript? [Answered] Learn More
Programming / Regex

How to validate phone numbers using regex? [Answered]

Sample query explanation: I’m trying to put together a comprehensive regex to validate phone numbers. Ideally it would handle international formats, but it must handle US formats, including the following: …

How to validate phone numbers using regex? [Answered] Learn More
C/C++ / Java / Programming

Why is it faster to process a sorted array than processing an unsorted array? [Answered]

Query explained: Here is a piece of C++ code that shows some very peculiar behavior. For some strange reason, sorting the data (before the timed region) miraculously makes the loop almost …

Why is it faster to process a sorted array than processing an unsorted array? [Answered] Learn More
JavaScript / Programming

How does Access-Control-Allow-Origin header work? [Answered]

Sample problem: Apparently, I have completely misunderstood its semantics. I thought of something like this: A client downloads javascript code MyCode.js from http://siteA – the origin. The response header of MyCode.js contains Access-Control-Allow-Origin: http://siteB, which …

How does Access-Control-Allow-Origin header work? [Answered] Learn More
JavaScript / Programming

How to switch to AngularJS if I have a jQuery background? [Answer]

1. Don’t design your page, and then change it with DOM manipulations In jQuery, you design a page, and then you make it dynamic. This is because jQuery was designed for augmentation …

How to switch to AngularJS if I have a jQuery background? [Answer] Learn More
C/C++ / Programming

Can a local variable’s memory be accessed outside its scope? | C++ [Answered]

Problem: I have the following code. And the code is just running with no runtime exceptions! The output was 58 How can it be? Isn’t the memory of a local variable …

Can a local variable’s memory be accessed outside its scope? | C++ [Answered] Learn More
JavaScript / Programming

What is the explicit promise construction antipattern and how do I avoid it? [Answered]

Problem: 585262 I was writing code that does something that looks like: Someone told me this is called the “deferred antipattern” or the “Promise constructor antipattern” respectively, what’s bad about this …

What is the explicit promise construction antipattern and how do I avoid it? [Answered] Learn More
C/C++ / Programming

Why is “using namespace std;” considered bad practice? [Top Answers]

This article shared the top best answers to the problem mentioned above. Why is “using namespace std;” considered bad practice? Answer #1: This is not related to performance at all. …

Why is “using namespace std;” considered bad practice? [Top Answers] Learn More
how to extract numbers from a string in C
C Examples / C/C++

How to extract numbers from a string in C?

In this article, you’ll learn how to get numbers from a string in C with examples. There are many ways to do that, but my favorite a recommended method is …

How to extract numbers from a string in C? Learn More
C++ examples

C++ program to convert quarter, dime and nickel to cent

The following C++ program converts quarters, dimes and nickels to cents. It is assumed that you know the basic syntax of a C++ program. In this article, you’ll learn: To …

C++ program to convert quarter, dime and nickel to cent Learn More
C Examples / Examples

C program to delete an element from an array

This C program takes the position as input from the user and deletes the element of array at that position.In this program, the original array and its size is also …

C program to delete an element from an array Learn More

Posts navigation

1 2 … 4 Next

Featured Posts

History of UNIX

From UNIX to Linux – History of Linux

21st November 202013th November 2021

Top themes for Ubuntu

Best themes for Ubuntu: Make Ubuntu Beautiful

20th October 202029th November 2021

Strings in Python

Strings in Python

12th September 202010th November 2021

is python hard to learn

Is Python hard to learn? Top best learning resources

18th April 202013th November 2021

Recent posts

  • How to recursively grep all directories and subdirectories?
  • How to merge two Git repositories?
  • What is the main difference between an inner class and a static nested class in Java?
  • RegEx to match open tags except XHTML self-contained tags
  • How to count the occurrences of a list item in Python?
  • Why is it string.join(list) instead of list.join(string)?
Copyright © 2022 Programming Articles.
Powered by WordPress and HitMag.