Category Archives: Programming (en)
How to post code correctly on a blog
I came across an unpleasant snag. It turns out that when you put php, SQL and other code in the body of a WordPress post, it is reformatted in a certain way and when it is copied into the real … Continue reading
Reducing the CPU consumption of hosting. How to speed up any CMS site
Today, almost every site is not running on ancient HTML, but on the complex CMS, written in PHP. Most often it can be Joomla, WordPress, Drupal and so on. Since such CMS are quite “heavy” (and, frankly speaking, not very … Continue reading
How PHP Works
If we want to look at HTML: 1. The user requests a page with ‘clean’ html 2. The server checks if the page exists 3. if there is – returns the .html page to the user as it was on … Continue reading
The phpinfo function
phpinfo is a PHP service function that outputs information about the version, configuration and extensions of PHP; about the Apache server and its settings. To call this function, use the construct: <?php phpinfo(); ?> How do I locate the … Continue reading
PHP 7.1 → 7.2
In continuation of the post: “Reducing the CPU consumption of hosting. How to speed up any CMS site”. I switched to PHP 7.2. Hosting load is 20% less: On the axis of ordinates – CPU: the number of minutes … Continue reading
Create a Makefile for gcc in Visual Studio Code
Install MinGW (how to set up MinGW – watch this video) Inatsll Visual Studio Code (VSC) you can immediately integrate VSC with Git so that everything is automatically synchronized. To do this, simply make a repository on Github and clone … Continue reading
C Language: Dictionary Spell Checker
At the end of the fifth week of the CS50 Harvard course, we studied hash tables, which can be used to solve the problem of hashing words from text to check their spelling in a dictionary (speller.c). A dictionary is … Continue reading
C language: inheritance of blood type of family members
In the fifth week of the Computer Science – CS50 (Harvard) course, we studied data structures and learned how to access structure elements by their address. To complete your homework (Lab 5 – inheritance.c), you need to understand the scientific … Continue reading
C Language: Simple Random Number Generator
Random number generator in C with srand() and time(). Srand() is a helper function for the rand() function, generating a seed for the start of a sequence of (pseudo)random numbers. Because the time returned by the time() function changes once … Continue reading
Half of the Computer Science course completed!
New words in my vocabulary: 🔸 pointer (pointer to a memory cell; something like a book card in library drawers, which indicates the name of the book and its place on the shelf); Real life example: Do not deign to … Continue reading
C language: recover photos from memory card
Imagine that you deleted photos from your memory card and then wanted to restore them. It turns out that in some cases it is possible to do this, because when we delete a photo with the “delete” button, what actually … Continue reading
C language: a filter that highlights the edges of objects in an image
At the end of the fourth week of the CS50 (Harvard) course, we had an interesting task: to make a program that takes the original image and imposes a filter on it with selection of the edges of objects (filter-more). … Continue reading
C language: change file sound volume
In the fourth week of the CS50 (Harvard) course, we learned how to work with memory, which will help you perform a laboratory work on changing the volume of the sound in a .wav file using a program that receives … Continue reading
C language: Apply a filter to an image
In the 4th week of the CS50 (Harvard) course, we studied the principles of working with memory and data arrays. We were faced with the task of writing a program that will apply filters to the original image (filter-less). You … Continue reading
C language: addresses and pointers
An example of how addresses are stored in memory: #include <stdio.h> #include <stdlib.h> int main(void) { int* x = NULL; printf (“address of new pointer-type variable x: %p\n”, &x); printf (“value of variable x: %p\n”, x); x = (int*) malloc(sizeof(int)); … Continue reading
C language: Swap variables
A curious feature: howto swap numeric variables ezpz without a buffer using the bitwise XOR operation (bitwise exclusive OR): #include <stdio.h> int main(void) { int a = 3; int b = 5; printf(“a = %d, b = %d\n”, a, b); … Continue reading
C language: sorting lab
We continue the course cs50, week three, sorting algorithms. It’s time for the lab. It is very simple: download test setup: https://cdn.cs50.net/2021/fall/labs/3/sort.zip inside the archive there are three already compiled C programs: sort1, sort2 and sort3 are binaries, i.e. binary … Continue reading