Posts

Showing posts with the label terminal

Minimum Distance Classifier (MDC) in Ada

Image
This program is a short example in Ada illustrating basic syntax, subroutines, type constructions and console I/O. Specifically, a basic pattern classifier from Machine Learning, namely a Minimum Distance Classifier (MDC), is constructed by just two core functions/procedures and about 120 lines of code. This type of classifier can successfully address linearly separable problems, here in the 2-D planar domain (X,Y). The Ada programming language is a creation of CII Honeywell Bull company in 1977-1983, under contract to the USA Department of Defense (DoD), with the goal of being the one-fits-all replacement of over 450 other languages used by DoD at that time in various embedded and real-time systems. "Ada" is the credit to Ada Lovelance (1815–1852) or "lady Ada", often referred to as the first computer programmer. The most popular Ada compilers for retro PCs came out Ada came out at the Windows 95/98 era, requiring some DPMI host or extender like DJGPP to run, mak...

Queens puzzle solver in LISP

Image
This is a typical example of how LISP can be used to solve complex constrained programming tasks. The eight queens puzzle requires the placement of N (minimum) queens in a chessboard so that they do not threaten each other and at the same time control the entire grid. The definition is very simple, but the number of valid solutions explode exponentially as N becomes larger than eight. LISP was officially released in 1960, making it the third milestone programming language of the first era, along with Fortran and COBOL. The syntax of LISP is saturated with parentheses, which makes it somewhat difficult for reading but very efficient for parsing by the interpreter. At the same time it makes search tree creation very intuitive, a paradigm that was later used by several other declarative laguages like Prolog. Enable captions for more details and walk-through. Source code available at the Github repository (see channel info). Tags: #asmr #coding #programming #notalking #lisp #terminal ...

Text file statistics in C

Image
This program is a simple demonstration for illustrating how basic text file statistics can be retrieved with only 50 lines of C code. It is more or less a replacement of the standard 'wc' program available in all Unix/Linux distributions for returning the lines, words and characters of any text file given as input. Enable captions for more details and walk-through. Source code available at the Github repository (see channel info). Tags: #asmr #coding #programming #notalking #c-language #gcc #terminal #console

Datetime difference in PHP

Image
This is just a small snippet of PHP code illustrating the use of generic variables and console (server-side) scripting. Although PHP is almost entirely focused on web application development, basic syntax and features make it a general-purpose programming choice like other more popular alternatives, e.g. Python, Perl, Tcl, Bash, etc. Enable captions for more details and walk-through. Source code available at the Github repository (see channel info). Tags: #asmr #coding #programming #notalking #php #terminal #console

PRNG function in Fortran

Image
Pseudo-random number generator function in retro Fortran no-talking, in emulated 80286 / MS-DOS machine in DOSbox. This program implements a pseudo-random number generator (PRNG) by using the classic Mixed-Congruential Sequence (linear) method, as it was described by D. Knuth (1972) regarding proper parameter choices for high-entropy output. The general rules for parameter choice are: M (modulo) must be at most half the available bits width of the integer type used. C (increment) should be chosen close to the value: M * (1/2 - sqrt(3)/6) = 0.2113248654051871... For example: M=2^8 gives C=54 (54.09916...) A (multiplier) should be chosen as to satisfy the following three requirements: A mod 8 = 5 , A between M/100 and M-sqrt(M) , A must not have trivial bit pattern value. Then these three values, along with a user-provided seed value X0, can be used iteratively with: X(n+1) = (A * X(n) + C) mod M , X(0)=X0. Provided that all constraints are satisfied, there are various ...

Fibonacci numbers in C (4 different ways)

Image
Fibonacci series in pure C no talking, using only vim and gcc in terminal, implementing four alternative designs: 1) Recursive: using the typical mathematical definition for Fib(n) 2) Iterative: using loop instead of recursion to avoid call stack overflows 3) Dynamic Programming: using buffer for cached results, calculated only once 4) Analytical: using the solution of the differential equation for Fib(n) Each option has its pros and cons, typically trading code simplicity for resources (recursion) or trading memory (cache) for speed. The purpose of this tutorial is to demonstrate coding discipline when working with very limited coding tools (command-line only in terminal) and alternative designs for use in different situations. Inline comments describe details about the code being written. Enable captions for more information on what is happening in each section of the video. Enable captions for more details and walk-through. Source code available at the Github repository (see chann...

Pi value estimation in Pascal

Image
This is an example code for estimating the value of 'pi'. The method is a trivial Monte-Carlo sampling upon a quarter-circle using built-in 'random'. Two different estimations are impleneted: (a) the average area under curve (AUC), which is the (randomized) integral of y=f(x)=sqrt(1-x*x) in [0,1], and (b) the area ratio between the quarter-circle and its bounding box. Since the AUC uses twice the number of samples, it should produce consistently better estimations. Turbo Pascal 3.0 was one of those programming artworks of the early '80s, fitting an editor (external), a compiler, debugger and plenty of room to work with in just 64 KB of RAM. Similarly, it was one of the first programming tools (besides x86 Assemblers) to produce .COM executables directly, since the 'tiny' memory model was the default option at that time. Enable captions for more details and walk-through. Source code available at the Github repository (see channel info). Tags: #asmr #coding...

Datetime difference in PHP

Image
This is just a small snippet of PHP code illustrating the use of generic variables and console (server-side) scripting. Although PHP is almost entirely focused on web application development, basic syntax and features make it a general-purpose programming choice like other more popular alternatives, e.g. Python, Perl, Tcl, Bash, etc. Enable captions for more details and walk-through. Source code available at the Github repository (see channel info). Tags: #asmr #coding #programming #notalking #php #terminal #console

Quadratic equation solver in GW-Basic

Image
Quadratic equation (ax^2+bx+c=0) solver in retro GW-Basic no-talking, in emulated 80286 / MS-DOS machine in DOSbox. This tutorial is a taste of how home programming looked like in the early '80s, while also showing how difficult it was to correctly pre-plan all 'goto' conditional jumps beforehand when line numbering and editing was the only way to actually edit the source code. Enable captions for more details and walk-through. Source code available at the Github repository (see channel info). Tags: #ambient #coding #programming #notalking #basic #retro #msdos #dosbox

Apnea Coding trailer

Image
Welcome to the coding dive. Coding as it is supposed to be. No need to talk, no rush. Take a deep breath, keep it. Empty your mind. Exhale slowly. Relax. Now, let's dive in. Tags: #asmr #ambient #coding #programming #notalking #gcc #fortran #cobol #basic #pascal #msdos #linux #unix #vim #retro #terminal

Channel Updates