Posts

Showing posts from July, 2025

Server's CPUs from Intel and AMD

Both Intel and AMD make their versions of server CPUs. Differences of server CPUs from desktop version of CPUs include the following: 1. Their performance is better for software operations. 2. They support greater amount of memory (RAM) and I/O operations. 3. Server CPUs are designed for 24/7 operations. 4. Server CPUs usually consume more power than their desktop counterparts. Due to greater power consumption, they require more efficient cooling. Usually servers are in the cold rooms. 5.Server CPUs usually cost more then desktop CPUs. YouTube video

Processors architerure

There are several processor architectures out there. Home user will either chose Intel's x86 compatible systems or processors, AMD processors which are compatible with Intel processors. For servers both Intel and AMD make their processors too.  IBM makes processors that are called Power processors. These processors are geared toward mainframe computers. For low power systems both Intel and AMD make their processors, additionally Broadcom makes low power CPUs that are used in Raspberry Pi systems.  YouTube video

Linux distributions

Linux distribution is a collection of software that works well with each other. By design Linux is free, but it is possible to add commercial components to it and charge for that Linux distribution. It is done this way by RedHat. CentOS Linux distribution takes their software and removes commercial components, therefore it makes Linux software free of charge. in case of RedHat Linux there is a company behind that product, in case of CentOS you are on your own. If there is a problem that you experience then hopefully somebody else reported this problem and a way to fix it on the Internet, or hopefully you have experience to fix it. YouTube video

How do companies charge money for Linux distributions?

The source code of Linux is free, then how companies exist and charge money for Linux. It is possible to charge money for a Linux distribution, however source code which is open source needs to be made free of charge. Also it is possible to charge money for the support contract. If there is a critical issue with their distribution, then there is a company behind that product and there are people that are able to resolve that issue. If a company is capable of resolving issues on it’s own, or they can implement workaround, or they can live with an issue: than support contract for Linux is optional. YouTube video

GPL license

GPL stands for General Public License. Code under GPL license needs to be made available. It doesn’t mean that a company cannot charge. Yes, it doesn’t make sense to charge for the code, since it is available and everyone can download it for free, however a company can charge for a support contract. Good example of that is Red Hat Linux. The code of Red Hat Linux is available, however a person that needs to receive support from that company needs to pay for support contract. It doesn’t make sense to pay for support contract for personal use, however companies may chose to pay for support contract. If there is an issue that needs to be addressed quickly, than there is a company behind that product, and there is a good chance that they will resolve this issue.

History of Linux operating system

Linux is Unix like operating system. There is no one distribution of Linux operating system, there are many different distributions each with its own flavor. Some are bleeding edge distributions and some are conservative. Linux distribution is a set of software packages. Linux was originally developed for personal computers running on x86 architecture. Majority of servers run on x86 architecture. Android and Chrome OS have Linux roots. Many of the server on the Internet are running Linux OS. Many of the embedded systems are also running Linux OS. It is possible to use Linux for many things. Personally Linux can be used to watch videos, play or create music, run software to create documents or spreadsheets. Businesses may use Linux to host their applications or web sites. Linux also found in embedded systems, game consoles, phones. Linux has philosophy of open source, many people can contribute to new development or fixing issues. Originally development of Linux started by Linus Torvald...

Source code

Source code is code written by a developer in programming language of choice. Source code is a raw code and not compiled code in any way.

Reading and understanding somebody else code

It is important for a developer to understand what somebody else code does. It is important for code review. If it is unclear for somebody else of what the code does, then the question can be asked of the developer of what that specific section of the code does. If it is unclear to another developer what that specific code does, than there may be a bug with that code, or implementation can be done differently and more understandable by others. Why code reviews by others is important? It will minimize chances of an error to slip through into production environment. Errors may still slip through to a production environment, even so the code had been reviewed by others, however the chances of an error will be minimized by doing so.

Incremental improvements

One of the ways to make a big change is to implement incremental improvements. Even so final result will not that what we want, but it will be better with each iteration. It will get closer to that what we want the final result to be.

ICMP protocol

ICMP stands for Internet Control Message Protocol. ICMP protocol is used to troubleshoot networking or connectivity issues. Utilities such as traceroute or ping will use ICMP protocol.

Ramdomness

Getting a random number maybe useful for a game, where events will not happen not in the same order. If they happen in the same order, then it will be one boring game. Random numbers are used in cryptography. If it is possible to guess a number for cryptography algorithm, then it will be a weak encryption algorithm. Often in programming it is possible to initialize random function, so it will not give the same results.

Splitting code to procedures or functions

Even so same functionality can be obtained by implementing same code several times within main body of a program, it is probably not the best design. It is a good idea to put repeatable code in standalone procedures and to call those procedures instead of executing same code again and again. The difference between function and procedure, is that a function will return a value, but a procedure will not. Example of a function is a sum of two numbers, example of a procedure - printing something on a screen.

Arguments of a function

Arguments of a function are the values that need to be passed to that function. For example taking a square root of a number will give us a number which is squared will give us the original number. Square root without a number will represent a good mathematical concept, but it will not solve any mathematical problem.

Runlevels

There are 7 runlevels in a Linux. These runlevels determine how the system will start. Runlevel 0 is used for system shutdown. Runlevel 1 is a single user mode, with networking disabled. Runlevel 1 is used to troubleshoot issues. Runlevel 2 is a multiuser mode, however networking is disabled. Runlevel 3 is multiuser mode with no Graphical User Interface. GUI maybe useful for fancy graphics, however it may slow down the system, and may be not necessary for remote operations. Runlevel 4: Not defined. Runlevel 5: It is a multi user mode with Graphical User Interface enabled. Runlevel 6: It is used for reboot of the system.

Journaling filesystem

Journaling filesystem is a filesystem where all the changes to its content first written to a log file, and this write is made then actual change is made. It enhances data integrity and recovery of the content of the filesystem. It slows down operation, but it adds integrity to them. Most commonly known filesystem that support journaling is ext3 filesystem. ext3 is essentially ext2 filesystem with added journal.

Applications in Linux

Applications in Linux have familiar names to a Unix user, however implementation of these are different. Over the years these have been changed, so the performance of these had been improved.

Flowchart

A flowchart is a graphical representation of a program flow. A flowchart let a developer think about implementation details of a solution. A flowchart may help a developer to uncover options that developer did not think about. A flowchart can be helpful to others to explain what a program does without actually looking at the code. Not everyone is a technically savvy person, and a flowchart may help explaining logic of a program to those people.

Algorithm

Algorithm is a set of instructions that needs to be executed by a computer to solve a specific computer problem. Algorithm is a step before implementation, it allows a developer to think about specific implementation details. Algorithm is often accompanied by a flowchart.

__FILE__ PHP directive

__FILE__ PHP directive will contain system path of the file that is being executed plus filename of the file which is being executed. If need to know just folder names __DIR__ directive must be used.

__DIR__ PHP directive

__DIR__ PHP directive will contain system path of the file that is being executed. This directive will only show the path, if needed to know the full path including filename, then __FILE__ directive must be used.

Displaying PHP errors

To display or not display PHP errors it is possible to use display_errors directive in the. Full syntax of it is ini_set('display_errors,1) setting it to 0, will disable displaying errors. It is a good idea only to show errors in your development or QA environment, and hide errors in production environment. Users have no reason to see errors, errors can be exploited by a person with malicious intent.

CSS syntax

Each element in CSS file consists of three things: 1. Name of the objects. 2. Property name. 3. Property value. Name of the corresponds to HTML element. For example header. Property name is characteristic of that element. For example font. Property value is what is assigned to that element. Since I gave an example of font, property value is the font type to be used.  Property name and value will vary depending on the type of HTML element.

Declarative and procedural programming languages

HTML and CSS are examples of declarative programming languages.HTML is responsible for content and CSS is responsible for the look of that content. Even so it is possible to specify how each element is going to look like with HTML document itself, it is probably not as efficient from developer standpoint. Procedural programming languages are programming languages such as C, C# and so on.

A binary search tree

A binary search tree is a mathematical principle of sorting an information and get to it efficiently. Binary search tree consists of a node with two branches, one to the left and one to the right. Left branch will contain a number that is less than original number, and the right branch will contain a number that is larger than original. This principle can be used in computer software development.

Nested loop

Nested loops consist of two (or more) loops. A loop which is inside is called an inner loop and the loop which is outside is called an outer loop. One the example of using a nested loop is to count number of cells in a rectangle. One the loops will count cells that are horizontal and another one will be counting cells that are vertical. I know that this process is inefficient, there is more efficient way of doing it, but I hope that this example gives a good example of using a nested loop.

Declaring constants in PHP

Declaring a constant in PHP is done via define method. This method takes two arguments. First one is a name of a constant, and second one is a value of that constant. Name of the variable needs to be enclosed in quotes. Older way of declaring a constant is via using a keyword const in front of the variable that needs to be treated as a constant. A value of a constant cannot be changed at a later time. Constants add clarity to the code.

Data casting in PHP

Data casting in PHP means to take a data of one type and convert it to another. For example 3 represent a number. It is possible to represent this value as a string. In order to do so a desired data type, in this case string data type needs to be added in front of this value in parenthesis. A number 3 in this case will be converted to a string "3".

Data types in PHP

Basic data types in PHP are: integer, float, boolean, array, string and null. These data types can be used for basic programming. There are additional data types in PHP can be viewed on php.net web site.

Troubleshooting with var_dump in PHP

var_dump() function in PHP can be used for troubleshooting. var_dump() function can be used without any value. In this case this method will display a lot of system and environment information. If a variable is included in var_dump() method, then this function will provide information of what data type that variable is.

Multiple assignment in PHP

It is possible to assign the same value in PHP to more than one variable at the same time. It is done via assigning first variable to second one, second one to a third one and so on. Last variable in this list will be assigned to a value. All of the variables in this list will be assigned to the same value. It is called "multiple assignment".

Strict type of variables

Strict type of variables is a requirement of a programming language to specify a type of a variable at variable initialization time. For example C is a strict type programming language.

Loose type of variables

Loose type of variables is a programming language technique to determine type of a variable by that variable content. For example PHP is a loose type language. Opposite of loose type is strict type.

Pascal casing

Pascal casing is a technique is to capitalize first letter of each word while naming variable names. For example $CarSpeed with capital letters C and S is an example of Pascal casing.

Snake casing

"Snake casing" is a name used for variables, when words in a variable name is separated by underscore character,

Camel casing

A common technique to name variables is to capitalize the first letter of a word. The first word will stay lowercased. For example: $currentCarSpeed is an example of that. The first word current in this variable name is lowercased, however first letter of each new word is capitalized. This technique adds clarity to variables. This technique is know as camel casing.

Prohibited characters in variable names in PHP

There are some characters that can not be used in PHP for variables naming. For example dash (-) symbol cannot be used in a variable name, please consider replacing a dash symbol with an underscore. Variables cannot start with a number, even so they can contain one.

Case sensitivity in PHP

PHP is a case sensitive language, for example two variable with the same name, but with different casing are different.

Declaring vs. defining a variable

Declaring a variable is to first time initializing it. Defining a variable means to assign a value to it.

Finishing code in PHP with semicolon

Finishing piece of code in PHP is done by putting a semicolon. Some sections of code in PHP do not require semicolons. For example loops or if statements do not require semicolons, because these are not executable code, but code flow logic.

JSON format

JSON allows for efficient data exchange. JSON data is human readable. JSON stands for JavaScript Object Notation. JSON format is well known and widely used. Alternatives to JSON format are XML format, and sending data in binary. Disadvantage of XML format, that such data is larger in size, binary data even so it is small in size, however it is difficult to understand and it is not flexible. JSON data easily can be modified.

Special symbols in programming

Some of the characters in a computer cannot by typed, or if typed they may have a different meaning. Three of the commonly used symbols that can be represented by escape sequence are: \n - new line \r - carriage return, or return cursor to the beginning \t - tab

Listing files in Linux

It possible to list files and folders in a command line interface (CLI) in Linux (or BSD, or Mac) using ls command. ls command has a number of command options. I will not list these here, you can lookup help for this command using --help option. ls stands for list. There are two special directories: . (single dot) represents current directory. .. (two dots) represent parent directory.

Dynamic binding

It is possible to do static binding, when a specific object is tied to a specific class, however it is also possible to perform dynamic binding. Dynamic binging is a binding to a class that depends on a value of a variable. For example a pet can be a dog or a cat depending on what owners got.

Class inheritance in PHP

Classes in PHP can inherit properties or methods of another class. When a new class is created, then a new class may use extends keyword to specify what is underlying class a new class is based on. This will do two things: 1. Minimize errors while developing a new functionality by utilizing functionality that exists in a parent class. 2. Reduce or completely remove duplicate functionality.