Skip to content

Programming Articles

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

Programming

Java / Programming

What is the difference between process and thread?

The major difference between process and thread is that threads (of the same process) run in shared memory space, while processes run in separate memory spaces. Let’s learn more about …

What is the difference between process and thread? Learn More
Design Patterns / Language agnostic / Programming

What is the difference between static class and singleton pattern?

The true difference between static class and singleton pattern is the following: A singleton allows access to a single created instance – that instance (or rather, a reference to that …

What is the difference between static class and singleton pattern? Learn More
General / Programming

How to format XML in Notepad++?

Try Plugins -> XML Tools -> Pretty Print (libXML) or (XML only – with line breaks Ctrl + Alt + Shift + B) You may need to install XML Tools using your plugin manager in order to …

How to format XML in Notepad++? Learn More
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

Posts navigation

1 2 … 4 Next

Featured Posts

From UNIX to Linux – History of Linux

21st November 202010th September 2022

Best themes for Ubuntu: Make Ubuntu Beautiful

20th October 202010th September 2022

Strings in Python

12th September 202010th September 2022

Is Python hard to learn? Top best learning resources

18th April 202010th September 2022

Recent posts

  • How to pad a string with zeroes to the left?
  • What is the difference between process and thread?
  • How to generate a random alpha-numeric string in Java?
  • How to auto-resize an image to fit a ‘div’ container?
  • How to get a Docker container’s IP address from the host?
  • How to display a JavaScript object?
Copyright © 2023 Programming Articles.
Powered by WordPress and HitMag.