Before getting into fancy editor solutions here let's talk for a bit about Notepad if you are using Windows. Some people will say "dude are you serious". Yes I am, because Notepad is thing that will force you to do stuff manually so if you are beginner and you're doing stuff manually you will learn faster.
All other fancy options in modern editors will help you a great deal but first of all, you need to know why you need them at the first place. In modern editors all kind of help is offered, as syntax check, or basically code completion when an editor is helping you to finish your command.
In a Notepad you don't have that. You are staring at the screen trying to type correct commands and that's awesome - that's how you will learn much faster. But if you don't like this like basic Notepad solution still you can go with any of modern editors, and the best thing, they are mostly free.
One of these editors is Edit Plus. I was using it for a couple of years because of a very simple interface. It's very natural like classical Windows stuff. At the moment, you can use it for free for 30 days. After that, you can support Edit Plus author, or not. It's up to you.
The next thing is Sublime Text. A lot of people on YouTube are using it to record tutorials so that's the reason why I'm mentioning it. Personally I don't use it a lot, I use Atom much more, but some people like how it look alike so it's worth mentioning it. It's free, but there are some pop-ups on a screen every now and then. No, they are not aggressive, they are just there to remind you that you can buy it if you like.
Now, Ultra Text Editor. This is an absolute beast. I remember using this thing two decades ago and actually it is 25 years old. I was using it if I remember correctly for some time when I was learning reverse engineering. In that time it was very popular and I was younger. It's free for 30 days and then you can support company.
Interesting thing, they do have integrated FTP client so you can just get from UltraEdit into your hosting company to upload files, download files, change permissions and so on.
Right. The next thing is another beast which is Visual Studio Code and I completely understand if this is overkill for beginners but the thing is that a lot of corporations are using it because that's like a common ground for all programmers in big corporations. They just want to have one thing handling a lot of stuff.
On the other hand, if you are into Linux and BSD systems, consider using Kate editor. It's absolutely magnificent.
But to be honest, my best advice is just to get Notepad++. You can't get wrong with that one.
Saturday, April 19, 2025
HTML - Best Editor
HTML Introduction
Do you need to know HTML even if you don't want to be web developer?
Actually yes. For example, sooner or later there will be need to convert some reports from PDF, Excel, or some other format into Web Page so you can publish it on Internet on your own site or just enter data into Content Management Systems provided to you by Open Source Community.
Good thing is, there's no need to be perfect in Web Dev. As you gather more experience, it will be easier to find and arrange better solutions.
HTML is a markup language - it's not programming language like Python, JavaScript, PHP, C++, C#, Java and so on.
HTML will help you to structure skeleton of webpage. On top of that skeleton you will apply CSS to beautify your pages. After that learning path, JavaScript will help you to make web pages more interactive, for example with pop-ups.
HTML files are served to users through a Web Server. Web server is just dedicated application somewhere around the world on servers that can host many other applications that provide services like FTP, Telnet, MySQL, etc. Our web browsers are just dedicated applications that will render HTML codes into beautiful interfaces that wee see on our screens when we browse the internet.
HTML tags are special, standardized codes that goes onto left and right side of HTML element. Between tags, we have usable content that we will see on screens.
Please note, in the browser, on web page, you will not see tags, just content. But during page load, browser uses HTML tags to figure out how to represent content to you in nice manner.
HTML can provide an only minimalistic page feel. For all advanced stuff we use CSS to style pages better. But, HTML is a must to structure basic positions of elements of the web page. Don't worry about CSS and JS. We will handle it in dedicated tutorials on this site and YT playlists.
HTML files, that represent individual Web pages, are just plain text files with HTML codes in them, plus usable content. They have .html or .htm extension. HTML files are located in dedicated folders on Web Servers.
It's nice to note that before HTML pages, there was services like Gopher, FTP, Telnet, BBS. All those services were used to share data between users, way before invention of Web Pages. The problem was, all those services demanded individual, dedicated, client applications so you can get into servers to download files, read simple text based news, and send messages.
For example, Gopher was used to browse news and informations, FTP (File Transfer Protocol) to upload or download files, BBS to meet people online over slow Dial-up connections, IRC to chat, Telnet to control remote routers and servers.
In past, there was a lot of problems with HTML variants, but now we are lucky because a lot of stuff are polished in modern HTML versions.
C++ OO Virtual Inheritance, Diamond Problem
Virtual inheritance is a mechanism in C++ that allows a derived class to inherit from a base class such that only one instance of the inherited class is present in the memory, even if multiple paths exist in the inheritance hierarchy.
In a regular inheritance relationship, when a derived class inherits from a base class, a new instance of the base class is created for each derived class. However, in some cases, this can lead to ambiguity, for example, when a class inherits from multiple base classes that themselves have a common base class. Virtual inheritance solves this problem by creating a single shared base class subobject.
A
B C
D
The diamond problem is a common problem that arises in C++ when multiple inheritance is used with virtual inheritance. It occurs when a class inherits from two classes that have a common base class. The result is that the derived class has two copies of the common base class, leading to ambiguities in the code.
For example, consider the following class hierarchy:
Animal
/ \
Dog Cat
\ /
Pet
Here, Dog
and Cat
inherit from Animal
, and Pet
inherits from both Dog
and Cat
. If Pet
were to call a method inherited from Animal
, there would be two copies of that method available: one from Dog
and one from Cat
. This ambiguity can lead to errors and is known as the diamond problem.
To solve the diamond problem, virtual inheritance is used. Virtual inheritance allows a class to inherit from a base class only once, even if it appears multiple times in the class hierarchy. In the example above, Pet
would inherit virtually from Animal
, resulting in only one copy of the Animal
class in the Pet
class hierarchy. This ensures that there are no ambiguities when calling methods inherited from the common base class.
#include <iostream>
using namespace std;
class Prim_A{
public:
void printStuff() {
cout << "I am from A Class" << endl;
}
};
class Sec_B : virtual public Prim_A{
};
class Sec_C : virtual public Prim_A{
};
class Ter_D : public Sec_B, public Sec_C{
};
int main() {
Ter_D Object;
Object.printStuff();
return 0;
}
This code demonstrates the concept of virtual inheritance in C++.
In this example, there are three classes: Prim_A
, Sec_B
, and Sec_C
, and a derived class Ter_D
. The Prim_A
class has a method printStuff()
, which simply outputs a message to the console.
Both Sec_B
and Sec_C
inherit from Prim_A
using virtual inheritance. This means that when the Ter_D
class inherits from both Sec_B
and Sec_C
, there will be only one instance of Prim_A
shared by both Sec_B
and Sec_C
.
This avoids the diamond problem and ensures that there is only one copy of the Prim_A
base class in Ter_D
. The main()
function creates an object of Ter_D
class and calls the printStuff()
method which is inherited from Prim_A
through virtual inheritance.
C++ OO Abstract Classes
The purpose of an abstract class is to define a common interface for a set of related classes.
The derived classes must implement the pure virtual function(s) of the abstract class in order to be instantiated.
This way, an abstract class can provide a common functionality that all the derived classes must have, while allowing each derived class to implement its own specific behavior.
#include <iostream>
using namespace std;
class Prim{
public:
virtual void printing() {}
};
class Sec : public Prim{
public:
void printing() {
cout << "I am From Sec Cls" << endl;
}
};
class Third : public Prim {
public:
void printing() {
cout << "I am from Third Cls" << endl;
}
};
int main() {
Prim Object;
Object.printing();
return 0;
}
In this C++ code, we have defined a class hierarchy with a base class Prim
and two derived classes Sec
and Third
. The base class Prim
has a virtual function printing()
, which is overridden in both derived classes.
In the main()
function, an object of the base class Prim
is created and its printing()
function is called. Since the printing()
function is virtual and has been defined in the base class with an empty definition, it will call the base class's implementation. Therefore, the output will be an empty line.
Note that the Prim
class is an abstract class, as its virtual function printing()
has an empty definition, and hence it cannot be instantiated. We can only create objects of the derived classes, which have overridden the virtual function.
C++ OO Pure Virtual Functions
A pure virtual function is a virtual function that has no implementation in the base class and must be overridden by any derived classes that inherit from the base class.
Pure virtual functions are useful when you have a base class that defines a common interface, but the implementation of the function is left to the derived classes. By making the function pure virtual, you require the derived classes to implement the function and provide their own implementation.
Pure virtual functions are commonly used in abstract base classes, which are classes that are not meant to be instantiated directly, but are designed to be subclassed by other classes that provide the implementation of the pure virtual functions.
#include <iostream>
using namespace std;
class Prim{
public:
virtual void printing()=0;
};
class Sec : public Prim{
public:
void printing() {
cout << "I am From Sec Cls" << endl;
}
};
class Third : public Prim {
public:
void printing() {
cout << "I am from Third Cls" << endl;
}
};
int main() {
Third Object;
Object.printing();
return 0;
}
This C++ program demonstrates the use of a pure virtual function in a class hierarchy.
In this example, the class Prim
contains a pure virtual function called printing()
. A pure virtual function is declared with the syntax virtual void functionName() = 0;
and has no implementation.
Since Prim
contains a pure virtual function, it is an abstract class and cannot be instantiated. The classes Sec
and Third
inherit from Prim
and implement the printing()
function in their own unique ways.
In the main()
function, an object of the Third
class is created and its printing()
function is called, which outputs the message "I am from Third Cls" to the console.
The use of pure virtual functions allows for polymorphism in C++. By creating a pure virtual function in a base class, we can ensure that all derived classes provide their own implementation of that function.
C++ OO Pointers in Polymorphism
Pointers are often used in C++ to achieve polymorphism. When a function is declared as virtual, it enables dynamic binding, which means that the appropriate function to call is determined at runtime based on the type of the object pointed to by the pointer.
In other words, when a pointer of the base class type points to an object of the derived class, and the function is called using the pointer, the function in the derived class is executed rather than the function in the base class. This is an important aspect of polymorphism in C++, and it allows for the creation of flexible and extensible code.
#include <iostream>
using namespace std;
class Prim{
public:
virtual void printing() {}
};
class Sec : public Prim{
public:
void printing() {
cout << "I am From Sec Cls" << endl;
}
};
class Third : public Prim {
public:
void printing() {
cout << "I am from Third Cls" << endl;
}
};
int main() {
Sec Object;
Sec *Ptr1 = &Object;
Ptr1->printing();
Third Object_2;
Third *Ptr2 = &Object_2;
Ptr2->printing();
return 0;
}
This C++ code defines three classes: Prim
, Sec
, and Third
. The Prim
class has a virtual function printing()
defined. The Sec
and Third
classes inherit from Prim
and override the printing()
function.
In the main()
function, an object of the Sec
class is created and a pointer Ptr1
of type Sec
is initialized to point to the Object
object. The Ptr1->printing()
statement calls the printing()
function on the object pointed to by Ptr1
. Since the printing()
function is virtual and has been overridden in the Sec
class, the printing()
function in the Sec
class is called and the output is "I am From Sec Cls".
Then, an object of the Third
class is created and a pointer Ptr2
of type Third
is initialized to point to the Object_2
object. The Ptr2->printing()
statement calls the printing()
function on the object pointed to by Ptr2
. Again, since the printing()
function is virtual and has been overridden in the Third
class, the printing()
function in the Third
class is called and the output is "I am from Third Cls".
C++ OO Polymorphism, Virtual Functions
Polymorphism in C++ is the ability of objects of different classes to be treated as if they are objects of the same class. In C++, polymorphism can be achieved through inheritance and virtual functions.
Polymorphism through inheritance is achieved by creating a derived class that inherits from a base class. The derived class can override the methods of the base class with its own implementation, and objects of the derived class can be treated as objects of the base class.
Polymorphism through virtual functions is achieved by declaring a function in the base class as virtual, which allows derived classes to provide their own implementation of the function. When a virtual function is called on an object, the appropriate implementation of the function is selected based on the type of the object at runtime, rather than the type of the variable used to refer to the object.
Polymorphism allows for more flexible and reusable code, as objects of different classes that share a common base class can be treated in the same way. This can simplify program design and make code easier to maintain and extend.
A virtual function is a function that is declared in a base class and can be overridden in a derived class. When a virtual function is called on an object, the appropriate implementation of the function is selected based on the type of the object at runtime, rather than the type of the variable used to refer to the object.
To declare a virtual function, the virtual
keyword is used before the function declaration in the base class.
#include <iostream>
using namespace std;
class Prim{
public:
virtual void printing() {}
};
class Sec : public Prim{
public:
void printing() {
cout << "I am From Sec Cls" << endl;
}
};
class Third : public Prim {
public:
void printing() {
cout << "I am from Third Cls" << endl;
}
};
int main() {
Sec Object;
Object.printing();
Third Object_2;
Object_2.printing();
return 0;
}
This C++ code defines three classes: Prim
, Sec
, and Third
. Prim
is the base class, and Sec
and Third
are derived classes that inherit from Prim
. The Prim
class has a virtual function called printing()
that does not have any implementation, and Sec
and Third
both override the printing()
function with their own implementations.
In the main()
function, two objects are created, one of type Sec
and one of type Third
, and their printing()
methods are called. Since the printing()
method is declared as virtual in the base class Prim
, the appropriate implementation of the function is selected based on the type of the object at runtime.
C++ OO Objects As Parameters
We can pass objects as parameters to functions. When an object is passed as a parameter to a function, a copy of the object is created and passed to the function. This copy is then used within the function and any modifications made to the object will not affect the original object passed as the argument.
#include <iostream>
using namespace std;
class Prim{
public:
void printMe() {
cout << "From Prim Cls" << endl;
}
};
class Sec : public Prim{
public:
void printMe() {
cout << "From Sec Cls" << endl;
}
};
void caller(Prim x) {
x.printMe();
}
int main() {
Sec Object;
caller(Object);
return 0;
}
Ours C++ code defines two classes, Prim
and Sec
, where Sec
is a derived class of Prim
.
Prim
has a public member function called printMe()
that simply outputs a message saying "From Prim Cls". Sec
also has a public member function called printMe()
, but it overrides the implementation of printMe()
in the Prim
class and outputs a different message, saying "From Sec Cls".
The code also defines a function called caller()
that takes an object of type Prim
as a parameter and calls its printMe()
method.
In the main()
function, an instance of Sec
called Object
is created, and the caller()
function is called with Object
as an argument. Since Sec
is a subclass of Prim
, an instance of Sec
can be treated as an instance of Prim
.
However, since the caller()
function takes an object of type Prim
as a parameter, the printMe()
method of the Prim
class is called, not the printMe()
method of the Sec
class.
#include <iostream>
using namespace std;
class Prim{
public:
void printMe() {
cout << "From Prim Cls" << endl;
}
};
class Sec : public Prim{
public:
void printMe() {
cout << "From Sec Cls" << endl;
}
};
class Third : public Sec{
public:
void printMe() {
cout << "From Third Cls" << endl;
}
};
void caller(Prim x) {
x.printMe();
}
void callerT(Sec y) {
y.printMe();
}
int main() {
Third Object;
callerT(Object);
return 0;
}
This C++ code defines three classes, Prim
, Sec
, and Third
, where Sec
is a derived class of Prim
and Third
is a derived class of Sec
.
Prim
has a public member function called printMe()
that outputs a message saying "From Prim Cls". Sec
also has a public member function called printMe()
, but it overrides the implementation of printMe()
in the Prim
class and outputs a different message, saying "From Sec Cls". Third
also has a public member function called printMe()
, but it overrides the implementation of printMe()
in both the Prim
and Sec
classes and outputs a different message, saying "From Third Cls".
The code defines two functions called caller()
and callerT()
, each of which takes an object of a different class as a parameter and calls its printMe()
method.
In the main()
function, an instance of Third
called Object
is created, and the callerT()
function is called with Object
as an argument. Since Object
is an instance of Third
, it can be treated as an instance of both Sec
and Prim
, so the printMe()
method of Sec
is called.
C++ OO This Pointer
this
is a keyword that represents a pointer to the current object instance. It is a special pointer that is automatically created and initialized by the compiler for each member function of a class.
When a member function is called on an object, the this
pointer points to the memory address of that object. The this
pointer can be used to access member variables and member functions of the current object, as well as to return a reference to the current object.
#include <iostream>
using namespace std;
class First{
private:
string name;
public:
void setName(string x) {
this->name = x;
}
void getName() {
cout << "Name: " << name << endl;
}
};
int main() {
First Object;
Object.setName("Slavoj Zizek");
Object.getName();
return 0;
}
this
is a keyword that refers to the current object. The this
keyword is used to disambiguate between the local parameter variable name
and the class data member name
.
In the setName
function, this->name
refers to the name
data member of the current object. This is used to set the value of the name
data member of the current object to the value passed to the function as the parameter.
In this way, this
helps to differentiate between the local variable name
and the class member name
which have the same name.
C++ OO Accessing Overloaded Methods
This code demonstrates how to use scope resolution operator to access a method that is overloaded in multiple classes in a hierarchy:
#include <iostream>
using namespace std;
class Prim{
public:
void sameName() {
cout << "I am from Prim Cls" << endl;
}
};
class Sec : public Prim{
public:
void sameName() {
cout << "I am from Sec Cls" << endl;
}
};
class Third : public Sec{
public:
void sameName() {
cout << "I am from Third Cls" << endl;
}
};
int main() {
Sec Object;
Object.Prim :: sameName();
Third Object_T;
Object_T.Sec :: sameName();
return 0;
}
The code defines three classes: Prim
, Sec
, and Third
. Sec
is derived from Prim
, and Third
is derived from Sec
. All three classes have a method named sameName()
, which is overloaded in each derived class.
In the main()
function, two objects are created, one of Sec
and one of Third
. The scope resolution operator ::
is used to access the sameName()
method of the base class Prim
of Sec
object and the sameName()
method of the base class Sec
of Third
object.
When Object.Prim :: sameName()
is called, it calls the sameName()
method of Prim
class because it is explicitly qualified with the name of the class. Similarly, Object_T.Sec :: sameName()
calls the sameName()
method of the Sec
class.
C++ OO Method Overloading
Method overloading in C++ is a feature that allows a class to have multiple member functions with the same name but with different parameters.
When a function is called, the compiler matches the parameters provided with the appropriate function based on the number, type, and order of the parameters.
#include <iostream>
using namespace std;
class Prim{
public:
void sameName() {
cout << "I am from Prim Cls" << endl;
}
};
class Sec : public Prim{
public:
void sameName() {
cout << "I am from Sec Cls" << endl;
}
};
int main() {
Sec Object;
Object.sameName();
Prim Obj_2;
Obj_2.sameName();
return 0;
}
In this example, we have two classes, Prim
and Sec
, and both have a method with the same name sameName()
. However, the implementation of the method is different in both classes.
In Sec
, the sameName()
method prints "I am from Sec Cls", and in Prim
, the sameName()
method prints "I am from Prim Cls".
When we create an object of Sec
and call the sameName()
method, the implementation in the Sec
class is executed, and "I am from Sec Cls" is printed. When we create an object of Prim
and call the sameName()
method, the implementation in the Prim
class is executed, and "I am from Prim Cls" is printed.
This is because the compiler distinguishes between the two methods based on their signature, which includes the method name and the types and number of parameters. When there are multiple methods with the same name but different signatures, the compiler decides which method to call based on the arguments passed to it. This is called method overloading.
C++ OO Constructor Calling Constructor
Constructor calling constructor is useful when a derived class needs to initialize its base class members before initializing its own members. In some cases, it can make the code more concise and easier to read.
#include <iostream>
using namespace std;
class Prim{
public:
string name;
Prim(string x) {
name = x;
}
};
class Sec : public Prim{
public:
Sec(string y) : Prim(y) {
cout << "Done" << endl;
}
void printAll() {
cout << name << endl;
}
};
int main() {
Sec Obj("Michael");
Obj.printAll();
return 0;
}
A constructor in C++ can call another constructor using a technique called constructor chaining or constructor delegation.
In the code you provided, the constructor of the Sec
class is calling the constructor of the Prim
class using the syntax : Prim(y)
in the constructor initialization list. This means that before executing the body of the Sec
constructor, the constructor of the Prim
class is called first with the argument y
. This initializes the name
member variable of the Prim
class with the value of y
.
Then, the body of the Sec
constructor executes, which simply outputs "Done" to the console. Finally, the printAll()
function is called on the Obj
object, which prints the value of the name
member variable inherited from the Prim
class.
C++ OO Multiple Inheritance
Multiple inheritance is a feature in C++ that allows a class to inherit from more than one base class. This means that the derived class can have access to all the members of the base classes that it inherits from.
The need for multiple inheritance arises when a derived class needs to inherit functionality from more than one base class. For example, suppose you want to create a class that represents a square shape in both two-dimensional and three-dimensional space. You could have a base class for two-dimensional shapes and another base class for three-dimensional shapes. By using multiple inheritance, you can create a derived class that inherits from both of these base classes and has access to the functionality of both.
Multiple inheritance can also be used to create a hierarchy of classes with different levels of specialization.
#include <iostream>
using namespace std;
class First{
public:
string name = "Jordan";
void printName() {
cout << "Name: " << name << endl;
}
};
class Second{
public:
string last_name = "Peterson";
void printLastName() {
cout << "Last Name: " << last_name << endl;
}
};
class Third : public First, Second {
public:
void caller() {
printName();
printLastName();
}
};
int main() {
Third Object;
Object.caller();
return 0;
}
In this code, the classes First
and Second
are being inherited publicly by the class Third
, which means that the public and protected members of First
and Second
will be accessible by the objects of Third
.
Third
class has a member function caller()
which calls the member functions of both the base classes, First
and Second
. The printName()
and printLastName()
functions of the First
and Second
classes respectively are being called using the object of the Third
class.
int main() {
Third Object;
Object.caller();
First Obj_1;
Obj_1.printName();
Second Obj_2;
Obj_2.printLastName();
return 0;
}
We have created three objects of three different classes.
The first object Object
is of the class Third
, which inherits from both First
and Second
classes. Object
calls the caller
function, which in turn calls printName
function from First
class and printLastName
function from Second
class. Therefore, when Object.caller()
is executed, it prints out both the name and the last name.
The second object Obj_1
is of the class First
, and we call the printName
function of First
class, which simply prints out the name
variable.
The third object Obj_2
is of the class Second
, and we call the printLastName
function of Second
class, which simply prints out the last_name
variable.
So, in summary, we are able to create objects of different classes and call their respective member functions, and in case of Third
class object, it is able to call member functions of both First
and Second
classes because it inherits from both of them.
C++ OO Private Inheritance
Private inheritance is one of the three types of inheritance that allows a derived class to inherit the properties of a base class. With private inheritance, all public and protected members of the base class become private members of the derived class. This means that the derived class can access the inherited members, but they are not visible to any external code.
#include <iostream>
using namespace std;
class Prim{
protected:
string name;
public:
void setName(string x) {
name = x;
}
};
class Sec : private Prim{
public:
void printName() {
cout << "Name from Prim Cls: " << name << endl;
}
void caller(string x) {
setName(x);
}
};
int main() {
Sec Object;
Object.caller("Anabela");
Object.printName();
return 0;
}
The class Sec
inherits from the class Prim
using private inheritance. This means that Sec
is a derived class of Prim
, but it can only access the protected and public members of Prim
through its own interface.
In other words, Sec
can access the setName
function of Prim
, which is public, and can set the value of name
, which is protected. However, it cannot access name
directly, as it is private in Sec
.
The printName
function in Sec
is able to print the value of name
by calling it through the setName
function which is public in Prim
.
In the main
function, an object of Sec
is created and the caller
function is called to set the value of name
to "Anabela". The printName
function is then called to print the value of name
, which is "Anabela" in this case.
Tkinter Introduction - Top Widget, Method, Button
First, let's make shure that our tkinter module is working ok with simple for loop that will spawn 5 instances of blank Tk window . ...
