Showing posts with label vscode. Show all posts
Showing posts with label vscode. Show all posts

Monday, February 17, 2025

Learn C Programming Language, A Practical Guide

Although C programming language is no longer as dominant as it once was, it still has its strong application in systems programming, embedded systems, operating systems, and performance-critical applications. The Python programming language has taken over the lead in education due to its simplicity, but C remains irreplaceable in areas where direct control over hardware is needed. Known for its efficiency and flexibility, C is the foundation of many modern programming languages, including C++, Java, and Python. Whether you are a beginner who wants to start with programming or an experienced programmer who wants to deepen your understanding of low-level computing, learning the C language is an excellent choice. This C tutorial and practical guide will help you understand the basics of C programming, covering everything from setting up a development environment to writing and compiling C programs.

The C programming language is a general-purpose procedural language. It is not at all difficult as it is said, because it is only a set of correctly written instructions that the computer will execute. It was created in Bell Laboratories in New Jersey. Its creator, Dennis Ritchie, originally designed and implemented it for the UNIX operating system on a DEC PDP-11 computer, with the aim of replacing assembly language in solving systems programming. Despite the fact that it is generally rarely used today, its extension and successor is the C++ programming language, because unlike the C programming language, it supports object-oriented programming. However, before you step into the C++ programming language, we think you should first learn the C programming language. It is fully accepted by the C++ programming language, so it will also be much easier for you to learn and program in C++ afterwards.

The C programming language is often taught through Linux, especially at universities and technical school

The C programming language is often taught through Linux, especially at universities and technical school

Today, the C programming language is often taught through the Linux operating system more than through Windows or other operating systems, especially in universities and technical schools. The reasons for this are:
  • Natural environment for C – The Linux kernel is written in C, which makes it ideal for learning systems programming.
  • GCC and open-source tools – The GCC compiler and tools like gdb, make, and valgrind are standard in the Linux environment.
  • Terminal-based approach – Linux encourages working through the command line, which allows for a better understanding of compiling, linking, and running programs.
  • Learning programming while working with system resources – Students often learn how to manage memory, processes, and files in a Linux environment.
However, in a corporate environment, Windows is still used for C programming, especially in combination with the Microsoft Visual Studio environment.

How to Set Up a Development Environment for C Programming?

Saturday, September 28, 2024

PHP for Web Developers, Advanced Concepts and Best Practices

PHP, which stands for Personal Home Page or PHP Hypertext Preprocessor, is a specialized scripting language designed for creating dynamic web content that is executed on the server side. It's also considered a reflective programming language used to execute scripts on the server side, although it can also be used with the command-line interface or through a standalone graphical application. It has always been an alternative to commercial programming languages like Java and others. Incredibly, PHP originated in 1994 as a set of CGI binary files in the C programming language, coded by Danish programmer Rasmus Ledorf to replace Perl scripts on his personal webpage. Officially, PHP made its appearance on June 8, 1995.

Behind it today stand The PHP Development Team, Zend Technologies, the PHP Foundation, and millions of users. It is estimated that over 76% of websites on the Internet are powered by PHP in some way. By default, PHP files end with the *.php extension. Sometimes, a portion of PHP code is embedded directly into HTML pages; together with HTML, but best practice is to separate PHP from HTML into a separate file. When the server encounters a PHP header <?php and code in PHP; or a file that ends with *.php; it automatically passes the entire file to the PHP processor. The result is that your web browser will only display HTML, while all PHP code remains hidden. If you take any HTML file and rename it to *.php, the HTML will be executed as if you were using *.htm or *.html. If you're coding in PHP, always use *.php files.

A web designer is ready to take a big step forward and learn PHP

A web designer is ready to take a big step forward and learn PHP

The first version of PHP was officially named Personal Home Page Tools; PHP Tools. It was simply the first use of the name PHP. Consider that the creator of PHP didn't initially intend for PHP to become a programming language. In the second version, Rasmus Ledorf claimed that PHP was the simplest and fastest tool for creating dynamic web pages. The third version of PHP completely changed the entire foundation from scratch. From all 4.x versions; the Zend Engine was added; which added a more advanced tag-parsing system - parse-execute, superglobals were introduced, register_globals was disabled by default, and CLI was introduced as an addition to CGI. Only from July 13, 2004, did the PHP version bring significant improvements, of which object-oriented programming support is definitely one. This opened up a whole new set of possibilities and a whole range of frameworks for PHP emerged; which we would translate as work frameworks like Laravel.

You see, the problem with PHP is that it's too simple. You can easily try out your ideas and admire the quick successful results. The problem is when your project gets bigger and your team gets more people. In PHP, you can do many things in multiple ways; what is simple for you can be completely complicated for others. Some things become obsolete, some are discarded, others change while each new phase becomes a nightmare. What is done in one day quickly turns into five days or you get completely stuck. For example, instead of the PHP header <?php, you type <php? and the entire project, the Internet, time, and deadlines will turn upside down. And you simply have no idea what's wrong with the errors. In the PHP programming language, there are so many mistakes; on some small details or logic that fixing errors can become a nightmare for every programmer.

And if you're entangled in classes, inheritance, interfaces, some project organization that only the first creator understands; documentation is useless then. That's why frameworks were created, and sometimes it's advisable to use them so that some things are organized for you. Again, if you're going to use shared hosting; then stick with pure PHP; because providers can disable e.g., routing on their server and then You're stuck or rent your own server, which will cost you three times as much. So, only experience saves you. And it's based on the mistakes you've gone through yourself; justified or not.

Preparing For the PHP Adventure: Setting Up Your PHP Programming Environment

Tuesday, September 26, 2023

Korak po korak, kako kreirati u Django-u jednostavnu tabelu i koristiti Django administraciju?

Ukoliko ste pročitali, prostudirali, instalirali i pripremili sve neophodno za početak učenja Django radnog okvira, pogledajte prethodni post ovde; onda ste spremni za prva, početna i osnovna podešavanja projekta django_tutorial. U prošlom postu našeg tutorijala smo pored kreiranja projekta, takođe kreirali aplikaciju main i super korisnika. Proverili smo da se naš projekat pokreće na lokalnom serveru, portu 8000 uspešno i da se možemo ulogovati na Django administraciju. Da bi nastavili dalje sve iz prethodnog posta mora biti odrađeno uspešno. Ukoliko to nije slučajno vratite se na prošli post ovog Django tutorijala ovde i sve korak po korak ponovo odradite. Ako ste sve uradili kako treba, pokrenite Visual Studio Code ili IDE – Integrisano razvojno okruženje, koje vi koristite; i u njemu otvorite projekat django_tutorial. Proverite da li je meni opcija File -> Auto Save čekirano da se vaš svaki progres automatski sačuva i da ne morate konstanto pritiskati Save dugme. Zatim otvorite panel terminal na View -> Terminal i pokrenite aktivaciju vašeg projekta na sledeći način:

manuel@manuel-virtual-machine:~/django_tutorial$ source env/bin/activate

(env) manuel@manuel-virtual-machine:~/django_tutorial$

Proverite da li vaš projekat ima grešaka, tako što ćete pokrenuti razvojni server:

(env) manuel@manuel-virtual-machine:~/django_tutorial$ cd django_tutorial/

(env) manuel@manuel-virtual-machine:~/django_tutorial:~/django_tutorial$

(env) manuel@manuel-virtual-machine:~/django_tutorial:~/django_tutorial$ python3.11 manage.py runserver

Ukoliko ste dobili rezultat kao na sledećoj slici, onda je sve u redu i možemo nastaviti tačno tamo gde smo stali u prethodnom postu.


( Uspešno pokrećanje Django razvojnog servera )

I pored toga što ste kreirali aplikaciju main u projektu django_tutorijal, to nije dovoljno; nego se kreirana aplikacija mora definisati u fajlu projekta koji se zove settings.py . To je bitan korak koji omogućuje Django radnom okviru da razume i pravilno konfiguriše vašu aplikaciju unutar projekta. Zato, prvo definišite aplikaciju, tako što ćete dodati sledeći kôd u fajl settings.py

# Application definition

INSTALLED_APPS = [

    'django.contrib.admin',

    'django.contrib.auth',

    'django.contrib.contenttypes',

    'django.contrib.sessions',

    'django.contrib.messages',

    'django.contrib.staticfiles',

    'main',

]

Sledeća podešavanja bez kojih aplikacija ne može funkcija su URL-ovi. Ali šta je URL? URLDjango-u predstavlja Uniform Resource Locator - uniformni resursni lokator, odnosno adresu na kojoj se može pristupiti određenom delu vaše veb aplikacije. URL-ovi se koriste za mapiranje zahteva od korisnika na odgovarajuće views - poglede u vašoj aplikaciji. Bez obzira koliko je mala ili velika vaša aplikacija u projektu, ona će da koristi URL-ove koje joj definišete. S obzirom da jedan projekat može imati mnogo URL-ovaDjango preferira da svaka aplikacija ima svoj fajl u kojoj se definišu URL-ovi. Tako da se u glavnom projektu umesto URL-ova, pozivaju fajlovi koji imaju definisane URL-ove na nivou aplikacije. Zato sledeći korak je podešavanje URL-ova kako bi naša  aplikacija bila funkcionalna.

Podešavanja URL-ova u Django projektu i aplikaciji