<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Promethee Spathis on Medium]]></title>
        <description><![CDATA[Stories by Promethee Spathis on Medium]]></description>
        <link>https://medium.com/@spathis?source=rss-2a130a6be6b5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*mizDrK9ODNYV7haGJnlrLg@2x.jpeg</url>
            <title>Stories by Promethee Spathis on Medium</title>
            <link>https://medium.com/@spathis?source=rss-2a130a6be6b5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 16 May 2026 18:07:07 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@spathis/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[Understanding Check Digit Algorithms: A Practical Guide for Programmers and Data Engineers]]></title>
            <link>https://spathis.medium.com/check-digit-algorithms-5fea4b0db0f4?source=rss-2a130a6be6b5------2</link>
            <guid isPermaLink="false">https://medium.com/p/5fea4b0db0f4</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Promethee Spathis]]></dc:creator>
            <pubDate>Tue, 22 Jul 2025 05:44:23 GMT</pubDate>
            <atom:updated>2026-02-26T05:59:57.453Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, I present 18 check digits and the algorithms to compute them. Check digit algorithms offer a real-world application while reinforcing key programming concepts such as:</p><ul><li><strong>String manipulation:</strong> Extracting and analyzing characters from user input.</li><li><strong>Loops:</strong> Iterating over digits to process each one individually.</li><li><strong>Accumulator variables:</strong> Keeping a running total (like a weighted sum).</li><li><strong>Conditional logic:</strong> Making decisions based on checksum values or input validity.</li><li><strong>Type conversion:</strong> Switching between strings and numbers to perform calculations.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GrvdxhWVnkQahuaQ2vu-Yg.png" /></figure><p>Because these algorithms are short and precise, they’re perfect for building confidence while teaching students how computers validate data efficiently — a foundational concept in software engineering, data processing, and cybersecurity. Plus, the immediate feedback from correct or incorrect results makes debugging intuitive and satisfying.</p><h3>Check Digits</h3><p>A check digit is a single digit number added to the end of a longer number, used to verify the accuracy of this number. It’s calculated using a specific algorithm based on the other digits in the number and helps detect errors when the number is entered manually or transmitted electronically.</p><p>In this document, I present the following check digits and the algorithms to compute them:</p><ol><li>IBSN-10 and ISBN-13 (International)</li><li>Identity Card Number (China)</li><li>UPC-A Barcodes (International)</li><li>Credit Cards Check Digit (International)</li><li>International Securities Identification Number (International)</li><li>Shipping Container Identification Number (International)</li><li>IBAN (International)</li><li>VIN (International)</li><li>CLABE (Mexico)</li><li>GSTIN (India)</li><li>Fødselsnummer (Norway)</li><li>Sozialversicherungsnummer (Germany)</li><li>CURP (Mexico)</li><li>Número de la Seguridad Social (Spain)</li><li>CAS Registry Number (CAS RN)</li><li>Turkish Identification Number (Turkey)</li><li>South African ID Number (South Africa)</li><li>EAN-8 Barcode</li></ol><h3>1. International standard book number (IBSN)</h3><p>An <strong>ISBN (International Standard Book Number) </strong>is a unique identifier assigned to commercial books. Before 2007, ISBNs were 10 digits long. After that year, they were expanded to 13 digits to align with international EAN standards.</p><p>In both ISBN-10 and ISBN-13 formats, the last digit is a check digit, used to detect errors in the number.</p><ul><li>In<strong> ISBN-10</strong>, the check digit can be a number from 0 to 9 or the letter ‘X’, which represents the value 10.</li><li>In<strong> ISBN-13</strong>, the check digit is always a digit from 0 to 9.</li></ul><p>The purpose of this task is to write a program that checks whether a number is a valid ISBN-10 or a valid ISBN-13.</p><h4>ISBN-10 Check Digit Calculation</h4><ul><li>Calculate s, the weighted sum of the first 9 digits, using decreasing weights from 10 to 2.</li><li>Compute n, the number that must be added to s to make it divisible by 11:</li></ul><pre>n = (11 - (s % 11)) % 11</pre><ul><li>If n == 10, the check digit is &#39;X&#39;. Otherwise, it is the digit n.</li></ul><h4>ISBN-13 Check Digit Calculation</h4><ul><li>Calculate s, the weighted sum of the first 12 digits, using alternating weights of 1 and 3, starting with 1 on the left.</li><li>Compute n, the number that must be added to s to make it divisible by 10:</li></ul><pre>n = (10 - (s % 10)) % 10</pre><ul><li>The check digit is n.</li></ul><h4><strong>Example ISBN-10:</strong> 0306406152</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3K0xPH8QfWvLXUyM7AQmDg.jpeg" /></figure><ul><li>Weighted sum:</li></ul><pre>0×10 + 3×9 + 0×8 + 6×7 + 4×6 + 0×5 + 6×4 + 1×3 + 5×2 = 130</pre><ul><li>Check digit:</li></ul><pre>(130 + 2) % 11 = 0</pre><p>030640615<strong>2</strong> is a valid ISBN-10.</p><h4><strong>Example ISBN-13</strong>: 9780306406157</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NOyuusjpBOan5ktqHxjUFA.jpeg" /></figure><ul><li>Weighted sum:</li></ul><pre>9×1 + 7×3 + 8×1 + 0×3 + 3×1 + 0×3 + 6×1 + 4×3 + 0×1 + 6×3 + 1×1 + 5×3 = 93</pre><ul><li>Check digit:</li></ul><pre>(93 + 7) % 10 = 0</pre><p>978030640615<strong>7 </strong>is a valid ISBN-13.</p><h4>Program Requirements</h4><ul><li>Prompt the user with:<br> &quot;Enter an ISBN number: &quot;</li><li>Check the length of the input:<br>- If it’s neither 10 nor 13 characters, print:<br> &quot;Not a valid ISBN.&quot;</li><li>If the input has 10 (or 13) digits:<br>- Compute the ISBN-10 (resp. the ISBN-13) check digit based on the first 9 digits (resp. the 12 digits).<br>- Compare it to the last digit.<br> * If it matches: print &quot;Valid ISBN-10&quot;<br> * If not: print &quot;Not a valid ISBN-10&quot;</li></ul><h4>Sample output</h4><pre>&gt;&gt;&gt; Enter an ISBN number: 020151141<br>&gt;&gt;&gt; Not a valid ISBN<br><br>&gt;&gt;&gt; Enter an ISBN number: 020151141X<br>&gt;&gt;&gt; Valid ISBN-10<br><br>&gt;&gt;&gt; Enter an ISBN number: 0306406153<br>&gt;&gt;&gt; Not a valid ISBN-10<br><br>&gt;&gt;&gt; Enter an ISBN number: 0306406152<br>&gt;&gt;&gt; Valid ISBN-10<br><br>&gt;&gt;&gt; Enter an ISBN number: 9782340076556<br>&gt;&gt;&gt; Valid ISBN-13</pre><h3>2. Identity Card Number</h3><p>The<strong> Identity Card Number (ICN)</strong> is an 18-digit number that uniquely identifies every citizen in mainland China. The last digit is called the checksum, which is used to confirm the validity of the first 17 digits.<br>The checksum can be a digit from <strong>0 to 9</strong>, or the letter <strong>‘X’</strong> if its value is <strong>10</strong>.</p><p>The goal of this task is to write a program that checks whether a given number is a valid Identity Card Number.</p><h4>Checksum Calculation</h4><p><strong>1/ Index the digits</strong> from <strong>right to left</strong>, starting from <strong>1</strong>.</p><p>That is, the rightmost digit (checksum) has index 1, the second-to-last has index 2, and so on up to index 18 on the leftmost digit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T7zdngQxS_eOUdnlj9ns0g.jpeg" /><figcaption>Indices for ICN 911124198108030024</figcaption></figure><p><strong>2/ Compute the weighted sum</strong> of the <strong>first 17 digits</strong>, using the following formula for the weight of each digit:</p><pre>W_i = 2^{i−1} mod 11</pre><p>where <em>i </em>is the <strong>index from the right</strong> (i.e., the leftmost digit has <em>i</em> =18, the rightmost of the 17 digits has <em>i</em> = 2).</p><h4>Example: 911124198108030024</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xfy4PcNbpmpUPMmSWlVvWA.jpeg" /><figcaption>Weights for ICN 911124198108030024</figcaption></figure><p><strong>1/ </strong>For the number 911124198108030024, the weights from left to right (<em>i </em>= 18 to 2) are:</p><pre>W_18 = 2^17 % 11 = 131072 % 11 = 7<br>W_17 = 2^16 % 11 = 65536 % 11 = 9<br>W_16 = 2^15 % 11 = 32768 % 11 = 10<br>...</pre><p><strong>2/ </strong>The weighted sum is:</p><pre>= 9 × 7 + 1 × 9 + 1 × 10 + 1 × 5 + 2 × 8 + 4 × 4 + 1 × 2 + 9 × 1 + <br>  8 × 6 +1 × 3 + 0 × 7 + 8 × 9 + 0 × 10 + 3 × 5 + 0 × 8 + 0 × 4 + 2 × 2  <br>= 272</pre><p><strong>3/ </strong>The checksum is:</p><pre>M = (12 − (272 mod 11)) mod 11 = 4</pre><p><strong>4/ </strong>91112419810803002<strong>4</strong> is a valid Identity Card Number.</p><h4>Program Requirements</h4><ul><li>Prompt the user with:<br>&quot;Enter an Identity Card Number: &quot;</li><li>If the input is <strong>not 18 characters long</strong>, print:<br>&quot;Not a valid Identity Card Number.&quot;</li><li>If the first 17 characters are not all digits, or the last character is neither a digit nor ‘X’, print:<br>&quot;Not a valid Identity Card Number.&quot;</li><li>If the input passes the format check:<br>- Compute the checksum from the first 17 digits.<br>- Compare it to the last digit:<br> * If they match: print &quot;Valid Identity Card Number.&quot; <br>* If they don’t match: print &quot;Not a valid Identity Card Number.</li></ul><h4>Sample Output</h4><pre>&gt;&gt;&gt; Enter a Identity Card Number: 91112419810803002<br>    Not a valid Identity Card Number.<br>&gt;&gt;&gt; Enter a Identity Card Number: 911124198108030021<br>    Not a valid Identity Card Number.<br>&gt;&gt;&gt; Enter a Identity Card Number: 91112419810803002X<br>    Not a valid Identity Card Number.<br>&gt;&gt;&gt; Enter a Identity Card Number: 911124198108030024<br>    Valid Identity Card Number.<br>&gt;&gt;&gt; Enter a Identity Card Number: 22010219900307257X<br>    Valid Identity Card Number.</pre><h3><strong>3. UPC-A Barcodes</strong></h3><p>A <strong>barcode</strong> is a method of representing data in a visual, machine-readable form. <strong>Linear barcodes</strong> encode information by varying the widths, spacings, and sizes of parallel lines.</p><p>Different types of linear barcodes encode different numbers of digits. In this task, we focus specifically on <strong>UPC-A barcodes</strong>.</p><p>In linear barcodes, the <strong>last digit is called the check digit</strong>, which is used to verify that the barcode has been scanned correctly.</p><p>The image below shows a UPC-A barcode, where the rightmost digit (2) is the <strong>check digit</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/228/1*V0sBsP3LIzRqqjmJIF8FTg.png" /><figcaption>The right most digit 2 is the check digit in UPC-A barcode 036000291452</figcaption></figure><p>The goal of this taks is to write a Python program that computes and verifies the <strong>check digit</strong> for a <strong>UPC-A barcode</strong>.</p><h4>What is a UPC-A Barcode?</h4><p>A <strong>UPC-A barcode</strong> encodes exactly <strong>12 digits</strong>:</p><ul><li>The first <strong>11 digits</strong> are <strong>data digits</strong>.</li><li>The last digit is the <strong>check digit</strong>, used to verify the integrity of the first 11 digits.</li></ul><p>The check digit is an integer from <strong>0 to 9</strong>.</p><h4>UPC-A Check Digit Calculation</h4><ol><li><strong>Start with the first 11 digits</strong> of the barcode (exclude the last digit).</li><li><strong>Multiply the digits in odd positions</strong> (1st, 3rd, 5th, etc.) by <strong>1</strong>.</li><li><strong>Multiply the digits in even positions</strong> (2nd, 4th, 6th, etc.) by <strong>3</strong>.</li><li><strong>Sum</strong> the results of both groups.</li><li>Compute the result <strong>modulo 10</strong>:</li></ol><ul><li>If the sum is divisible by 10, the check digit is 0.</li><li>Otherwise, subtract the last digit of the sum from 10 to get the check digit.</li></ul><h4>Example: 036000291452</h4><p><strong>UPC-A barcode:</strong> 036000291452(The last digit, 2, is the check digit.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ym6C_-RHpmFAQ1OmT2tYgQ.jpeg" /></figure><ul><li><strong>First 11 digits:</strong> 03600029145</li><li><strong>Even-positioned digits (1 × weight):</strong></li></ul><pre>3 + 0 + 0 + 9 + 4 = 16</pre><ul><li><strong>Odd-positioned digits (1 × weight):</strong></li></ul><pre>(0×3) + (6×3) + (0×3) + (2×3) + (1×3) + (5×3) = 42</pre><ul><li><strong>Total sum:</strong></li></ul><pre>16 + 42 = 58</pre><ul><li><strong>Modulo 10:</strong></li></ul><pre>58 % 10 = 8</pre><ul><li><strong>Check digit</strong></li></ul><pre>10 – 8 = 2</pre><ul><li>036000291452 is a valid UPC-A barcode.</li></ul><h4>Program Requirements</h4><ul><li>Prompt the user with:<br> &quot;Enter a UPC-A barcode: &quot;</li><li>Check if the input is exactly <strong>12 digits</strong>:<br> - If not, print: &quot;Not a valid UPC-A barcode.&quot;</li><li>Compute the checksum using the <strong>first 11 digits</strong>.</li><li>Compare the computed check digit with the <strong>last digit</strong> entered:<br> - If they match, print: &quot;Valid UPC-A barcode.&quot;f<br> - If not, print: &quot;Not a valid UPC-A barcode.&quot;</li></ul><h4>Sample Output</h4><pre>&gt;&gt;&gt; Enter a UPC-A barcode: 03600029145<br>    Not a valid UPC-A barcode<br>&gt;&gt;&gt; Enter a UPC-A barcode: 03600029145X<br>    Not a valid UPC-A barcode<br>&gt;&gt;&gt; Enter a UPC-A barcode: 036000291457<br>    Not a valid UPC-A barcode<br>&gt;&gt;&gt; Enter a UPC-A barcode: 036000291452<br>    Valid UPC-A barcode</pre><h3>4. International Securities Identification Number</h3><p>An <strong>International Securities Identification Number (ISIN)</strong> is a globally standardized code used to uniquely identify a <strong>security</strong> (such as a stock or bond) for <strong>clearing, reporting, and settlement of trades</strong>.</p><p>An ISIN is a <strong>12-character alphanumeric code</strong>, structured as follows:</p><ul><li>The <strong>first two characters</strong> are <strong>letters</strong>, identifying the <strong>issuing country</strong> (e.g., “US” for the United States).</li><li>The <strong>next nine characters</strong> are <strong>alphanumeric</strong>, representing the <strong>security identifier</strong>.</li><li>The <strong>last character</strong> is a <strong>numeric check digit</strong>, used to verify the validity of the ISIN.</li></ul><p>The goal is to write a program that checks whether a given 12-character string is a <strong>valid ISIN</strong> based on the <strong>check digit algorithm</strong>.</p><h4>ISIN Check Digit Calculation</h4><ol><li>Convert any letters to numbers by taking the ASCII code of the capital letter and subtracting 55.</li><li>Drop the check digit to form the <strong>payload</strong>.</li><li>With the payload, start from the rightmost character. Moving left, double the value of every second digit.</li><li>Sum the values of the resulting digits.</li><li>Take the modulo 10 of the sum.</li><li>Subtract from 10.</li><li>Take the modulo 10 of the result.</li></ol><h4><strong>Example: US0378331005</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*czWkvgVF_BAMKTQRCoSoxA.jpeg" /></figure><ul><li>Letters: U = 85 - 55 → 30, S = 83 - 55 → 28</li><li>Expanded digits:<br> US037833100 → 3028037833100</li><li>Double the value of every second digit:</li></ul><pre>(3×2)+0+(2×2)+8+(0×2)+3+(7×2)+8+(3×2)+3+(1×2)+0+(0×2)</pre><ul><li>The sum of the resulting digits is:</li></ul><pre>6 + 0 + 4 + 8 + 0 + 3 + (1 + 4) + 8 + 6 + 3 + 2 + 0 + 0 = 45</pre><ul><li>The check digit is:</li></ul><pre>(10 - (45 mod 10)) mod 10 = 5</pre><h4>Program Requirements</h4><ul><li>Prompt the user:<br> &quot;Enter an ISIN number: &quot;</li><li>Validate input length:<br> - If the input is not exactly <strong>12 characters</strong>, print:<br> &quot;Not a valid ISIN.&quot;</li><li>Validate format:<br> - If the <strong>first 11 characters</strong> contain invalid characters, print:<br> &quot;Not a valid ISIN.&quot;</li><li>If the format is valid:<br> - Compute the check digit using the steps above.<br> - Compare it to the <strong>last digit</strong> of the input: <br> * If they match, print: &quot;Valid ISIN.&quot; <br> * If they don’t match, print: &quot;Not a valid ISIN.&quot;</li></ul><h4>Sample Output</h4><pre>&gt;&gt;&gt; Enter a ISIN number: US0378331005<br>    US0378331005 is a valid ISIN number<br>&gt;&gt;&gt; Enter a ISIN number: US0378331006<br>    US0378331005 is not a valid ISIN number<br>&gt;&gt;&gt; Enter a ISIN number: US037833100<br>    US0378331005 is not a valid ISIN number<br>&gt;&gt;&gt; Enter a ISIN number: AU0000XVGZA3<br>    AU0000XVGZA3 is a valid ISIN number<br>&gt;&gt;&gt; Enter a ISIN number: AU0000XVGZAX<br>    AU0000XVGZAX is not a valid ISIN number</pre><h3><strong>5. Credit Cards Numbers</strong></h3><p>Credit card numbers are composed of <strong>8 to 19 digits</strong>, structured into the following parts:</p><ul><li>The <strong>first 6 to 8 digits</strong> represent the <strong>Issuer Identification Number (IIN)</strong>, also known as the <strong>Bank Identification Number (BIN)</strong>.</li><li>The digits following the IIN, <strong>excluding the last digit</strong>, represent the <strong>individual account number</strong>.</li><li>The <strong>last digit</strong> is the <strong>Luhn check digit</strong>, used to validate the entire number.</li></ul><p>The Luhn check digit is calculated by the Luhn algorithm as follows:</p><ol><li><strong>Drop the check digit</strong> (if validating an existing number). This leaves the <strong>payload</strong>.</li><li>Starting from the <strong>rightmost digit</strong> of the payload (moving left), <strong>double every second digit</strong>.</li><li>If doubling a digit results in a number <strong>greater than 9</strong>, <strong>subtract 9</strong> from it (or equivalently, sum its digits).</li><li><strong>Add up all the digits</strong>, including the ones that were not doubled.</li><li>Compute the check digit using the formula: (10 — (<em>s</em> mod 10)) mod 10 where <em>s</em> is the sum from step 3.</li></ol><p>The goal is to write a program that checks whether a given string is a valid credit card numbers based on the Luhn algorithm.</p><h4>Example: <strong>17893729974</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2lICJeciY1ipO5X28wljFQ.jpeg" /></figure><ul><li>Drop the check digit → Payload: 1789372997</li><li>Starting from the right, double every second digit:</li></ul><pre>(7×2) + 9 + (9×2) + 2 + (7×2) + 3 + (9×2) + 8 + (7×2) + 1 =<br>14 + 9 + 18 + 2 + 14 + 3 + 18 + 8 + 14 + 1</pre><ul><li>Sum digits of numbers <strong>greater than 9:</strong></li></ul><pre>14 + 9 + 18 + 2 + 14 + 3 + 18 + 8 + 14 + 1 →<br>5 + 9 + 9 + 2 + 5+ 3 + 9 + 8 + 5 + 1</pre><ul><li>Sum all digits:</li></ul><pre>5 + 9 + 9 + 2 + 5 + 3 + 9 + 8 + 5 + 1 = 56</pre><ul><li>Check digit:</li></ul><pre>65 modulo 10 = 5</pre><p>So, the check digit for this credit card number is <em>5</em>.</p><h4><strong>Sample Output</strong></h4><pre>&gt;&gt;&gt; Enter a credit card number: 17893729975<br>    17893729975 is a not valid credit card number<br>&gt;&gt;&gt; Enter a credit card number: 17893729974<br>    17893729974 is a valid credit card number</pre><h3>6. Shipping Container Identification Number</h3><p>Shipping containers are identified by an 11-character code defined by the <strong>ISO 6346 international standard</strong>. The structure is as follows:</p><ul><li><strong>4 letters</strong>:<br> - <strong>Owner Code</strong>: 3 letters<br> - <strong>Equipment Category Identifier</strong>: 1 letter</li><li><strong>6 digits</strong>: Serial number</li><li><strong>1 digit</strong>: Check digit</li></ul><h4><strong>Shipping Container Identification Number Check Digit Calculation</strong></h4><p>1/ Assign a numeric value to each letter using the following table:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iltVwjhqvE4Cgy0oM-zSIg.jpeg" /></figure><p>2/ Combine with the digits of the serial number.</p><p>3/ Each position gets a weight of 2^<em>n</em> starting from <em>n </em>= 0 on the left.</p><p>4/ Sum of products.</p><p>5/ Divide the sum by 11 and take the remainder.</p><p>The remainder is the check digit.</p><h4><strong>Example: CSQU3054383</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LN9DvFOUMEQ9smYyTI9xTw.jpeg" /></figure><ul><li>Assign a numeric value to each letter:</li></ul><pre>C = 13, S = 30, Q = 28, U = 32<br>C  →  13<br>S  →  30<br>Q  →  28<br>U  →  32<br>3  →  3<br>0  →  0<br>5  →  5<br>4  →  4<br>3  →  3<br>8  →  8</pre><ul><li>Multiply values by weights:</li></ul><pre>C  (13 × 1)     =   13  <br>S  (30 × 2)     =   60  <br>Q  (28 × 4)     =  112  <br>U  (32 × 8)     =  256  <br>3  (3 × 16)     =   48  <br>0  (0 × 32)     =    0  <br>5  (5 × 64)     =  320  <br>4  (4 × 128)    =  512  <br>3  (3 × 256)    =  768  <br>8  (8 × 512)    = 4096  </pre><ul><li>Sum of products:</li></ul><pre>13 + 60 + 112 + 256 + 48 + 0 + 320 + 512 + 768 + 4096 = 6185</pre><ul><li>Divide the sum by 11:</li></ul><pre>6185 % 11 = 3</pre><p>The check digit is 3.</p><h4>Sample Output</h4><pre>&gt;&gt;&gt; Enter a shipping container number: CSQU3054384<br>    CSQU3054384 is a not valid shipping container number<br>&gt;&gt;&gt; Enter a shipping container number: CSQU3054383<br>    CSQU3054383 is a valid shipping container number</pre><h3>7. International Bank Account Number</h3><p>The IBAN (International Bank Account Number) is a standardized format used to uniquely identify bank accounts internationally. Its structure varies by country but follows a general pattern defined in ISO 13616.</p><p>The general structure of an IBAN is the following:</p><pre>[CC][CD][BBAN]</pre><p>where:</p><ul><li>CC is the country code — two letters;</li><li>CD is the check digit — two digits;</li><li>BBAN is the Basic Bank Account Number (BBAN) — up to 30 alphanumeric characters that are country-specific.</li></ul><h4>IBAN Check Digit Calculation</h4><p>To calculate or verify the two-digit check digits (<strong>CD</strong>) in an IBAN:</p><ol><li><strong>Substitute the check digits with “00”</strong></li><li><strong>Move the first 4 characters (country code and check digits) to the end</strong></li><li><strong>Convert letters to numbers</strong> using the mapping A = 10, B = 11, …, Z = 35</li><li><strong>Convert the result to an integer and compute mod 97</strong></li><li><strong>Calculate the check digits</strong> as: 98 − <em>result</em> where <em>result</em> is from step 4</li><li>If the result is a single digit, <strong>pad with a leading zero</strong></li></ol><h4>Example: <strong>GB82WEST12345698765432</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LRC_4IKbZRnaNvLpIBt9Pg.jpeg" /></figure><ul><li>Replace the check digits with 00:</li></ul><pre>GB82WEST12345698765432 →<br>GB00WEST12345698765432</pre><ul><li>Move the first 4 characters to the end:</li></ul><pre>WEST12345698765432GB00</pre><ul><li>Replace all letters with their numeric equivalents:</li></ul><pre>3214282912345698765432161100</pre><ul><li>Compute mod 97:</li></ul><pre>3214282912345698765432161100 % 97 = 16</pre><ul><li>Calculate the check digits:</li></ul><pre>98–16 = 82</pre><p>The check digits are: 82.</p><h4>Sample Output</h4><pre>&gt;&gt;&gt; Enter a IBAN number: GB16WEST12345698765432<br>    GB16WEST12345698765432 is a not valid IBAN number.<br>&gt;&gt;&gt; Enter a IBAN number: GB32WEST12345698765432<br>    GB32WEST12345698765432 is a valid IBAN number.</pre><h3>8. Vehicle Identification Number</h3><p>The VIN (Vehicle Identification Number) is a standardized 17-character code used worldwide to uniquely identify motor vehicles. Its structure is defined by ISO 3779, and each section encodes specific information about the vehicle.</p><p>A VNI is divided in three main parts:</p><p><strong>1/ </strong>WMI — World Manufacturer Identifier (Positions 1–3)<br> - Position 1: Country code — 1 = USA, J = Japan, W = Germany, etc.<br> - Position 2: Manufacturer code — H = Honda, B = BMW, etc.<br> - Positon 3: Vehicle type or division — often specific to manufacturers.</p><p><strong>2/</strong> VDS — Vehicle Descriptor Section (Positions 4–8)</p><p><strong>3/</strong> Check Digit (Position 9)</p><p><strong>4/</strong> VIS — Vehicle Identifier Section (Positions 10–17)</p><h4>Vehicle Identification Number Check Digit Calculation</h4><p>The check digit is computed as follows:</p><p><strong>1/ </strong>Replace the check digits with 0.</p><p><strong>2/ </strong>Convert all letters to their numeric equivalents according the following transliteration table:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RlUp6yedxFLAvC8qUDBucA.jpeg" /></figure><p><strong>3/ </strong>Multiply each numeric value by its position weight listed in the following table:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z4e-Yqj9TXOJm7VotEaLqg.jpeg" /></figure><p><strong>4/ </strong>Sum all products.</p><p><strong>5/ </strong>Compute mod 11.</p><p><strong>6/ </strong>Determine the check digit:</p><ul><li>If the result is 10, the check digit is “X”.</li><li>Otherwise, it’s the numeric result itself.</li></ul><h4>Example: 1HGCM82633A004352</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hrSwvuY-2Iqp4ZafyRE5mA.jpeg" /></figure><ul><li>Replace the check digit (position 9) with 0:</li></ul><pre>1HGCM82603A004352</pre><ul><li>Convert characters to numbers (transliteration):</li></ul><pre>1 H G C M 8 2 6 0 3 A 0 0 4 3 5 2 → 1 8 7 3 4 8 2 6 0 3 1 0 0 4 3 5 2</pre><ul><li>Multiply by weights and sum:</li></ul><pre>1×8 + 8×7 + 7×6 + 3×5 + 4×4 + 8×3 + 2×2 + 6×10 + 0×0 + 3×9 + <br>                          1×8 + 0×7 + 0×6 + 4×5 + 3×4 + 5×3 + 2×2 = 311</pre><ul><li>Compute 311 % 11 = 3</li></ul><p>The check digit is 3.</p><h4>Sample Output</h4><pre>&gt;&gt;&gt; Enter a VIN number: 1HGCM82613A004352<br>    1HGCM82613A004352 is a not valid VIN number.<br>&gt;&gt;&gt; Enter a VIN number: 1HGCM82633A004352<br>    1HGCM82633A004352 is a valid VIN number.</pre><h3>9. Mexico Clave Bancaria Estandarizada</h3><p>The<strong> CLABE (Clave Bancaria Estandarizada) </strong>is the standardized 18-digit bank account number used in Mexico for domestic electronic funds transfers. The last digit (18th) is a check digit that ensures the validity of the number and helps prevent input errors.</p><h4>CLABE Check Digit Calculation</h4><p>The CLABE check digit is computed as follows:</p><ol><li>Multiply each of the first 17 digits (from left to right) by the repeating sequence of weights [3, 7, 1].</li><li>Reduce each product modulo 10.</li><li>Sum all these modulo-10 values.</li><li>Compute the check digit using the formula: (10 — (sum mod 10)) mod 10.</li></ol><h4><strong>Example: </strong><strong>002010061493012344</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uQkBGvSppKNxZQkNUnubwg.jpeg" /></figure><ul><li>Multiply each digit (from left to right) by cyclic weights [3, 7, 1]:</li></ul><pre>3×0 + 7×0 + 1×2 + 3×0 + 7×1 + 1×0 + 3×0 + 7×6 + 1×1 + 3×4 +<br>                                7×9 + 1×3 + 3×0 + 7×1 + 1×2 + 3×3 + 7×4<br>= 0 + 0 + 2 + 0 + 7 + 0 + 0 + 42 + 1 + 12 + 63 + 3 + 0 + 7 + 2 + 9 + 28</pre><ul><li>Reduce each product modulo 10</li></ul><pre>0 + 0 + 2 + 0 + 7 + 0 + 0 + 2 + 1 + 2 + 3 + 3 + 0 + 7 + 2 + 9 + 8</pre><ul><li>Sum all these modulo-10 products</li></ul><pre>0 + 0 + 2 + 0 + 7 + 0 + 0 + 2 + 1 + 2 + 3 + 3 + 0 + 7 + 2 + 9 + 8 = 46</pre><ul><li>Compute the check digit:</li></ul><pre>(10 - (46 % 10)) % 10 = 4</pre><p>The check digit is 4.</p><h3>10. Indian Goods and Services Tax Identification Number</h3><p>The <strong>GSTIN</strong> (Goods and Services Tax Identification Number) is a <strong>15-character alphanumeric identifier</strong> assigned to registered taxpayers in India under the GST system. It ensures uniqueness and includes a <strong>check digit</strong> (15th character) to detect input errors.</p><h4>GSTIN Check Digit Calculation</h4><ol><li><strong>Replace all letters</strong> in the first 14 characters. with their numeric equivalents: A = 10, B = 11, ..., Z = 35.</li><li><strong>Multiply each digit/converted letter</strong> (from left to right) by cyclic weights [1, 3, 7].</li><li><strong>Sum</strong> all the products</li><li><strong>Compute mod 36</strong> of the sum</li><li><strong>Determine the check digit</strong>:</li></ol><ul><li>If result &lt; 10 → use digit 0–9</li><li>If result ≥ 10 → convert to letter: 10 = A, 11 = B, ..., 35 = Z</li></ul><h4>Example: 27ABCDE1234F1Z4</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ibsiBRfADwYlv00cIbULVQ.jpeg" /></figure><ul><li>Replace all letters with their numeric equivalents (A=10 to Z=35):</li></ul><pre>A=10, B=11, C=12, D=13, E=14, F=15, Z=35<br>27ABCDE1234F1Z → 2 7 10 11 12 13 14 1 2 3 4 15 1 35</pre><ul><li>Multiply each digit (from left to right) by cyclic weights [1, 3, 7]:</li></ul><pre>2×1 + 7×3 + 10×7 + 11×1 + 12×3 + 13×7 + 14×1 + 1×3 +<br>                                2×7 + 3×1 + 4×3 + 15×7 + 1×1 + 35×3<br>= 2 + 21 + 70 + 11 + 36 + 91 + 14 + 3 + 14 + 3 + 12 + 105 + 1 + 105</pre><ul><li>Sum of all products:</li></ul><pre>2 + 21 + 70 + 11 + 36 + 91 + 14 + 3 + 14 + 3 + 12 + 105 + 1 + 105 = 488</pre><ul><li>Compute mod 36:</li></ul><pre>488 % 36 = 4</pre><ul><li>Determine check digit:</li></ul><pre>4 &lt; 10 → Check digit = &#39;4&#39;<br></pre><p>The check digit is is 4.</p><h3>11. Norwegian National Identity Number</h3><p>The Norwegian National Identity Number (<strong>Fødselsnummer</strong>) is an <strong>11-digit personal identifier</strong> assigned to Norwegian citizens and residents. It encodes:</p><ul><li><strong>6 digits</strong> for the date of birth (DDMMYY)</li><li><strong>3-digit serial number</strong></li><li><strong>2 check digits</strong>: k1 (digit 10) and k2 (digit 11)</li></ul><h4>First Check Digit (k1) Calculation</h4><ol><li>Multiply the first <strong>9 digits</strong> by these fixed weights:<br> [3, 7, 6, 1, 8, 9, 4, 5, 2]</li><li>Sum all the products.</li><li>Compute:<br> k1 = (11 - (sum % 11)) % 11</li></ol><h4>Second Check Digit (k2) Calculation</h4><ol><li>Multiply the first <strong>10 digits</strong> (including k1) by these weights:<br> [5, 4, 3, 2, 7, 6, 5, 4, 3, 2]</li><li>Sum all the products.</li><li>Compute:<br> k2 = (11 - (sum % 11)) % 11</li></ol><h4>Example: 01020322280</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sJIMOlmrFxDbcHymGkC8BQ.jpeg" /></figure><p><strong>First check digit (k1):</strong></p><ul><li>Multiply the first 9 digits by fixed weights: [3, 7, 6, 1, 8, 9, 4, 5, 2]</li></ul><pre>3×0 + 7×1 + 6×0 + 1×2 + 8×0 + 9×3 + 4×2 + 5×2 + 2×2</pre><ul><li>Sum all products:</li></ul><pre>3×0 + 7×1 + 6×0 + 1×2 + 8×0 + 9×3 + 4×2 + 5×2 + 2×2 = 58</pre><ul><li>Compute k1:</li></ul><pre>k1 = (11 - (sum % 58)) % 11 = 8</pre><p>The first check digit k1 (digit 10) is 8.</p><p><strong>Second check digit (k2)</strong></p><ul><li>Multiply the first 10 digits by fixed weights [5, 4, 3, 2, 7, 6, 5, 4, 3, 2]:</li></ul><pre>5×0 + 4×1 + 3×0 + 2×2 + 7×0 + 6×3 + 5×2 + 4×2 + 3×2 + 2×8</pre><ul><li>Sum all products:</li></ul><pre>5×0 + 4×1 + 3×0 + 2×2 + 7×0 + 6×3 + 5×2 + 4×2 + 3×2 + 2×8 = 66</pre><ul><li>Compute k2:</li></ul><pre>(11 - (sum % 66)) % 11 = 0</pre><p>The second check digit k2 (digit 11) is 0.</p><h3>12. German Sozialversicherungsnummer</h3><p>The <strong>German Sozialversicherungsnummer</strong> (SVNR), or social security number uniquely identifies individuals within the social insurance system of Germany. The structure of a is formed of the following 4 parts:</p><pre>AA BBBBBB C DDD</pre><p>where:</p><ul><li>AA (2): Area number (insurance agency)</li><li>BBBBBB (6): Birth date in DDMMYY</li><li>C (1): Initial of last name</li><li>DDD (3): Check digit + serial number</li></ul><p>The 12th (last) digit is a checksum used to validate the number’s correctness.</p><h4><strong>SVNR Check Digit Calculation</strong></h4><p>This checksum is calculated using a modulo 10 algorithm with weighting.</p><ol><li>Extract numeric parts (exclude the surname letter).</li><li>Apply alternating weights: 2, 1, 2, …</li><li>Multiply each digit by its weight.</li><li>If the product ≥10, sum the digits.</li><li>Add all these digit sums together.</li><li>Compute the check digit: (10 — s % 10) % 10 where s is the sum from step 5.</li></ol><h4>Example: 65 131277 M 01</h4><p>1/ Extract numeric parts</p><p>From <em>65 131277 M 01</em>, extract: <em>6513127701</em></p><p>2/ Apply alternating weights: 2, 1, 2, …</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*diR56fR3xnBMdO_kAYIQhw.jpeg" /></figure><p>3/ Multiply each digit by its weight:</p><pre>   2×6 + 1×5 + 2×1 + 1×3 + 2×1 + 1×2 + 2×7 + 1×7 + 2×0 + 1×1<br> = 12 + 5 + 2 + 3 + 2 + 2 + 14 + 7 + 0 + 1</pre><p>4/ If the product ≥10, sum the digits:</p><pre>12 + 5 + 2 + 3 + 2 + 2 + 14 + 7 + 0 + 1 → 3 + 5 + 2 + 3 + 2 + 2 + 5 + 7 + 0 + 1</pre><p>5/ Add all these digit sums together:</p><pre>3 + 5 + 2 + 3 + 2 + 2 + 5 + 7 + 0 + 1 = 30</pre><p>6/ Compute the check digit:</p><pre>(10 - 30 % 10) % 10 = 0</pre><p>The check digit is <strong>30</strong>.</p><h3>13. Mexican Clave Única de Registro de Población</h3><p>The <strong>Mexican CURP (Clave Única de Registro de Población) </strong>is an 18-character alphanumeric identity code. The 18th character is a check digit calculated using a weighted sum modulo 10.</p><p>Mexican CURP has the following structure:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7qPwd5G5yVan4VTLKk5TJw.jpeg" /></figure><h4><strong>CURP Check Digit Calculation</strong></h4><ol><li>Convert each of the 17 characters to a numeric value using A = 10, B = 11, …, N = 23, Ñ = 24, O = 25, …, Z = 35.</li><li>Multiply each value by a weight: 18 down to 2.</li><li>Sum all the products.</li><li>Compute check digit: (10 — (s % 10)) % 10 where s is the sum from step 3.</li></ol><h4><strong>Example: GOCJ880323HMCLNS08</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EcOjuaZOp8Q8iIUJ4wc4kg.jpeg" /></figure><p>1/ Convert each of the 17 characters to a numeric value:</p><pre>GOCJ880323HMCLNS0 ➝ 16 24 12 19 8 8 0 3 2 3 17 22 12 21 23 28 0</pre><p>2/ Multiply each value by a weight:</p><pre>  18x16 + 17x24 + 16x12 + 15x19 + 14x8 + 13x8 + 12x0 + 11x3 + 10x2 + 9x3 + <br>  8x17 + 7x22 + 6x12 + 5x21 + 4x23 + 3x28 + 2x0<br>= 2112</pre><p>3/ Compute check digit:</p><pre>(10 - (2112 % 10)) % 10  = 8</pre><p>The check digit is <strong>8</strong>.</p><h3>14. Spanish Número de la Seguridad Social</h3><p>The <strong>Número de la Seguridad Social (NSS)</strong> is the <strong>Spanish Social Security Number</strong>, used to uniquely identify individuals in Spain’s <strong>social security and healthcare systems</strong>.</p><p>The structure of the NSS is the following:</p><pre>PP NNNNNNNN CC</pre><p>where:</p><ul><li>PP (2): Province code (01–52 for Spain’s provinces)</li><li>NNNNNNNN (6–8): Personal sequence number (unique per person)</li><li>CC (2): Checksum</li></ul><h4>Example: 08 12345678 29</h4><p>1/ Left-pad the full number:</p><pre>08 12345678 29 ➝ 812345678</pre><p>2/ Compute the checksum:</p><pre>(98 - (812345678 % 97)) = 29</pre><p>3/ The checksum is <strong>29</strong>.</p><h3>15. CAS Registry Number (CAS RN)</h3><p>A<strong> CAS Registry Number (CAS RN)</strong> is a unique numeric identifier assigned to every chemical substance described in the open scientific literature by Chemical Abstracts Service.</p><p>A CAS RN has three parts, separated by hyphens:</p><pre>XXXXXXX - YY - Z</pre><p>where:</p><p><strong>First part (XXXXXXX)</strong></p><ul><li>2 to 7 digits</li><li>No inherent chemical meaning</li><li>Simply a serial number</li><li>Grows as more substances are registered</li></ul><p><strong>Second part (YY)</strong></p><ul><li>Exactly 2 digits</li><li>Also has no chemical meaning</li><li>Helps with formatting and uniqueness</li></ul><p><strong>Third part (Z) — the check digit</strong></p><ul><li>Exactly 1 digit</li><li>Used for error detection</li><li>Calculated from the previous digits</li></ul><h4><strong>CAS Check Digit Calculation</strong></h4><ol><li>Remove all hyphens from the CAS string.</li><li>Set the last digit (the check digit) aside.</li><li>Working from right to left (starting from the digit immediately before the check digit), multiply each digit by its position index (1, 2, 3, …).</li><li>Sum these products.</li><li>Compute the value modulo 10. This result must match the check digit.</li></ol><h4><strong>Example: 7732–18–5</strong></h4><p><strong>Water:</strong> 7732–18–5</p><p>1/ Remove all hyphens:</p><pre>7732–18–5 → 7732185</pre><p>2/ Set the last digit (the check digit) aside:</p><pre>7732185 → 773218</pre><p>3/ Multiply each digit by its position index:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/779/1*eIaJqCKVndtAVTOW6CPScw.jpeg" /></figure><p>4/ Sum these products:</p><pre>8×1 + 1×2 + 2×3 + 3×4 + 7×5 + 7×6 = 105</pre><p>5/ Take the modulo 10 of the sum.</p><pre>105 % 10 = 5</pre><p>The check digit is<strong> 5</strong>.</p><h3>16. <strong>Turkish Identification Number</strong></h3><p>The <strong>Turkish Identification Number</strong>, officially called T.C. Kimlik No, is a unique national identity number assigned to every citizen of Turkey.</p><h4><strong>Structure of the T.C. Kimlik No</strong></h4><p>The T.C. Kimlik No is a fixed 11-digit numeric identifier used to uniquely identify individuals in all official, legal, and administrative processes in Turkey:</p><pre>D₁ D₂ D₃ D₄ D₅ D₆ D₇ D₈ D₉ D₁₀ D₁₁</pre><p>where:</p><ul><li>The first digit D₁ cannot be 0.</li><li>D₁₀ is the first check digit.</li><li>D₁₁ is the second check digit.</li></ul><h4><strong>TCKN Check Digit Calculation</strong></h4><p><strong>To calculate the 10th digit D₁₀:</strong></p><p>1/ Sum the digits in the odd positions:</p><pre>Sodd = D₁ + D₃ + D₅ + D₇ + D₉</pre><p>2/ Sum the digits in the even positions:</p><pre>Seven = D2 + D4 + D6 + D8</pre><p>3/ <strong>D₁₀ </strong>Calculation:</p><pre>D₁₀ = ((Sodd × 7) − Seven) % 10</pre><p><strong>To calculate the 11th digit D₁₁:</strong></p><p>4/ Sum the first 10 digits:</p><pre>D₁ + D₂ + D₃ + D₄ + D₅ + D₆ + D₇ + D₈ + D₉ + D₁₀</pre><p>5/ <strong>D₁₁ </strong>Calculation:</p><pre>D₁₁ = (D₁ + D₂ + D₃ + D₄ + D₅ + D₆ + D₇ + D₈ + D₉ + D₁₀) % 10</pre><h4><strong>Example: </strong>21574521838</h4><p>1/ Sum of even digits:</p><pre>1 + 7 + 5 + 1 = 14</pre><p>2/ Sum of odd digits:</p><pre>2 + 5 + 4 + 2 + 8 = 21</pre><p>3/ Calculation of <strong>D₁₀:</strong></p><pre>D₁₀ = ((21 * 7) - 14) % 10 = 3</pre><p>4/ Sum the first 10 digits:</p><pre>2 + 1 + 5 + 7 + 4 + 5 + 2 + 1 + 8 + 3 = 38</pre><p>5/ Calculation of <strong>D₁₁:</strong></p><pre>D₁₁ = 38 % 10 = 8</pre><p>The check digits are <strong>38</strong>.</p><h3>17. South African ID Number</h3><p>A<strong> South African ID Number </strong>is a 13-digit numeric identifier assigned to citizens and permanent residents of South Africa.</p><h4>Structure of the South African ID Number</h4><p>A South African ID Number is a 13-digit numeric identifier:</p><pre>YYMMDD SSSS C A Z</pre><p>where:</p><ul><li>YYMMDD is the date of birth</li><li>SSSS encodes the gender: 0000–4999 → Female, 5000–9999 → Male</li><li>C indicates legal status: 0 → South African citizen, 1 → Permanent resident</li><li>A reserved for future administrative use, historically fixed at 8</li><li>Z is the check digit</li></ul><h4><strong>South African ID Number Check Digit Calculation</strong></h4><ol><li>Remove the check digit (if present). This leaves the first 12 digits of the ID number, known as the payload.</li><li>Process the payload digits from left to right. Double every second digit, starting with the second digit (i.e., digits in even positions).</li><li>Reduce doubled values greater than 9 by subtracting 9 (equivalently, summing the digits of the result).</li><li>Sum all digits, including both the modified and unmodified digits. Let this sum be S.</li><li>Compute the check digit using: Check digit = (10−(S mod 10)) mod 10.</li></ol><h4><strong>Example: 9002156789080</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_X5rqXRAi5nEbD2eHFURIA.jpeg" /></figure><p>1/ Remove the check digit:</p><pre>9002156789080 → 900215678908</pre><p>2/ Double every second digit, starting with the second digit:</p><pre>   1×9 + 2×0 + 1×0 + 2×2 + 1×1 + 2×5 + 1×6 + 2×7 + 1×8 + 2×9 + 1×0 + 2×8<br> = 9 + 0 + 0 + 4 + 1 + 10 + 6 + 14 + 8 + 18 + 9 + 16</pre><p>3/ Reduce doubled values greater than 9 by subtracting 9:</p><pre>   9 + 0 + 0 + 4 + 1 + (1+0) + 6 + (1+4) + 8 + (1+8) + 0 + (1+6)<br> = 9 + 0 + 0 + 4 + 1 + 1 + 6 + 5 + 8 + 9 + 0 + 7</pre><p>4/ Sum all digits:</p><pre>9 + 0 + 0 + 4 + 1 + 1 + 6 + 5 + 8 + 9 + 0 + 7 = 50</pre><p>5/ Compute the check digit:</p><pre>(10−(59 mod 10)) mod 10 = 0</pre><p>The check digit is <strong>0</strong>.</p><h3>18. EAN-8 Barcode</h3><p>The<strong> EAN-8 (European Article Number) </strong>is a compact 8-digit barcode used to identify products when space is limited (e.g., small packages). It is standardized and administered by GS1.</p><p><strong>Structure of the EAN-8 Barcode</strong></p><p>The EAN-8 consists of 8 digits:</p><pre>D1 D2 D3 D4 D5 D6 D7 Z</pre><p>where:</p><ul><li><strong>D1–D7:</strong> Product identifier (assigned by GS1 member organizations)</li><li><strong>Z: </strong>Check digit (error detection)</li></ul><h4>EAN-8 Check Digit Calculation</h4><p>The check digit Z is computed from the first 7 digits using a modulo-10 weighted sum:</p><ol><li>Take the first 7 digits (exclude the check digit).</li><li>Starting from the right, multiply digits by alternating weights 3, 1, 3, 1, ….</li><li>Sum the weighted values → call the sum <em>S</em>.</li><li>Compute: Z = (10 − (<em>S</em> % 10)) % 10.</li></ol><h4><strong>Example: 73513537</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8POUr8lBCnnuUpl6Kt6NVg.jpeg" /></figure><p>1/ Take the first 7 digits:</p><pre>73513537 → 7351353</pre><p>2/ Starting from the right, multiply digits by alternating weights 3, 1, 3, 1, ….</p><pre>(3×3) + (5×1) + (3×3) + (5×1) + (1×3) + (3×1) + (7×3)</pre><p>3/ Sum the weighted values:</p><pre>(3×3) + (5×1) + (3×3) + (5×1) + (1×3) + (3×1) + (7×3) = 63</pre><p>4/ Compute the check digit:</p><pre>(10 − (63 mod 10)) mod 10 = 7</pre><p>The check digit is <strong>7</strong>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5fea4b0db0f4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[15 Number-Based Code Challenges for Python Beginners]]></title>
            <link>https://spathis.medium.com/15-number-based-code-challenges-for-python-beginners-70fcec1669de?source=rss-2a130a6be6b5------2</link>
            <guid isPermaLink="false">https://medium.com/p/70fcec1669de</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[beginner]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Promethee Spathis]]></dc:creator>
            <pubDate>Mon, 16 Jun 2025 11:23:04 GMT</pubDate>
            <atom:updated>2025-07-22T14:43:45.966Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’re learning Python, these 15 number-focused coding challenges are perfect for leveling up. They cover everything from palindromes and digit sums to Roman numeral conversion and lucky numbers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4cXFkQxincRhrd0lgjuWww.jpeg" /></figure><p>Each problem strengthens your understanding of loops, string manipulation, and number logic — without needing advanced libraries or algorithms. Whether you’re preparing for interviews or just looking for a fun practice set, this list offers the right mix of creativity and challenge.</p><h3>Summary Table</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NUo5Yk6BcnDlR2Q84hCv5w.jpeg" /></figure><h3>Easy: Basic Digit and String Manipulation</h3><h4>01 - Count <strong>Palindromic Numbers</strong></h4><p>Count how many numbers from 1 to <em>N</em> are palindromic numbers. A <strong>palindromic number</strong> is a number that reads the same<strong> </strong>forwards and backwards.</p><p><strong>Examples:</strong></p><pre>101, 111, 121, 131, 141 → ✅<br><br>100, 110, 122, 113 → ❌</pre><p><strong>Output:</strong></p><p>For <em>N </em>= 100, there are <strong>19 palindromic numbers</strong> (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, 66, 77, 88, 99).</p><p><strong>Main Challenge: </strong>String reversal and comparison.</p><h4>02 - Most Common Digit Sum</h4><p>Compute the sum of digits for numbers from 1 to <em>N</em>, and find the digit-sum that appears most often.</p><p><strong>Examples:</strong></p><pre>123 → 1 + 2 + 3 = 6<br><br>234 → 2 + 3 + 4 = 9</pre><p><strong>Output :</strong></p><p>For<em> N</em> = 1000, the digit-sum that appears the most often is <strong>13 and 14</strong>. They appear <strong>75 times</strong>.</p><p><strong>Main Challenge: </strong>Digit sum computation and frequency count.</p><h4>03 - Unique Digits Only</h4><p>Count how many numbers from 1 to<em> N</em> have no repeating digits.</p><p><strong>Example:</strong></p><pre>121 → ❌<br><br>123 → ✅</pre><p><strong>Output:</strong></p><p>For <em>N</em> = 1000, there are <strong>738 numbers</strong> with no repeating digits.</p><p><strong>Main Challenge: </strong>Duplicate detection in digits.</p><h4>04 - Consecutive Repeating Digits</h4><p>Count how many numbers from 1 to<em> N</em> contain at least one pair of consecutive identical digits.</p><p><strong>Example:</strong></p><pre>122 → has &quot;22&quot;<br><br>345 → no consecutive repeats</pre><p><strong>Output:</strong></p><p>For <em>N </em>= 1000, there are <strong>181 numbers</strong> with one sequence of consecutive identical digits.</p><p><strong>Main Challenge: </strong>Pattern recognition within digits.</p><h4>05 - Harshad Number</h4><p>Count how many numbers from 1 to <em>N </em>are Harshad (aka Niven) numbers. A A <strong>Harshad number</strong> is a number that is divisible by the sum of its digits.</p><p><strong>Examples:</strong></p><pre>21 → 2 + 1 = 3 → 21 % 3 == 0 ✅<br><br>23 → 2 + 3 = 5 → 23 % 5 ≠ 0 ❌</pre><p><strong>Output:</strong></p><p>For <em>N </em>= 1000, there are <strong>213 Harshad numbers</strong>.</p><p><strong>Main Challenge:</strong> Modulo check with digit sum.</p><h3>Intermediate: More Logic or Multi-Step Checks</h3><h4>06 - Lucky Numbers</h4><p>Count how many numbers from 1 to N are lucky numbers. <strong>A number is lucky</strong> if the sum of the first half of its digits equals the sum of the second half.</p><p><strong>Examples:</strong></p><pre>1230 → 1+2 == 3+0 → ✅<br><br>17908 → 1+7 == 0+8 → ✅</pre><p><strong>Output:</strong></p><p>For <em>N</em> = 1000, there are <strong>108 lucky numbers</strong>.</p><p><strong>Main Challenge:</strong> Slicing and comparing digit sums.</p><h4>07 - Digit Sum Equals Product</h4><p>Count all numbers in the range 1 to<em> N</em> where the sum of digits equals the product of digits.</p><p><strong>Example:</strong></p><pre>123 → 1 + 2 + 3 = 6, 1 * 2 * 3 = 6 → ✅<br><br>22 →  2 + 2 = 4,  2 * 2 = 4 → ✅</pre><p><strong>Output:</strong></p><p>For <em>N </em>= 1000, there are <strong>16 numbers</strong> where the sum of digits equals the product of digits.</p><p><strong>Main Challenge: </strong>Digit math and logical comparison.</p><h4>08 - Armstrong Numbers</h4><p>Count all Armstrong numbers (aka narcissistic numbers) up to <em>N</em>. <strong>A number is Armstrong</strong> if the sum of each digit power to the number of digits is the number itself</p><p><strong>Examples:</strong></p><pre>153 → 1³ + 5³ + 3³ = 153<br><br>9474 → 9⁴ + 4⁴ + 7⁴ + 4⁴ = 9474</pre><p><strong>Output:</strong></p><p>For <em>N</em> = 1000, there are <strong>14 Armstrong numbers</strong>. (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 153, 370, 371, 407).</p><p><strong>Main Challenge: </strong>Exponentiation with dynamic digit length.</p><h4>09 - Digital Roots Count</h4><p>Find the most common digital root for numbers from 1 to <em>N</em>. The<strong> digital root</strong> is the iterative sum of digits until a single digit remains.</p><p><strong>Example:</strong></p><pre>Digital root of 987 is 6: 9 + 8 + 7 = 24 → 2 + 4 = 6</pre><p><strong>Output:</strong></p><p>For <em>N </em>= 1000, the <strong>most common digital root is 1</strong>. 1 is the digital root for 112 numbers.</p><p><strong>Main Challenge: </strong>Recursion or repeated digit sum.</p><h4>10 - Increasing Digit Subsequence</h4><p>Count how many numbers from 1 to <em>N</em> contains a strictly increasing sequence of digits.</p><p><strong>Examples:</strong></p><pre>123 → digits increasing (1 &lt; 2 &lt; 3) → count it<br><br>132 → not increasing → skip</pre><p><strong>Output:</strong></p><p>For <em>N</em> = 1000, there are <strong>219 numbers</strong> that contains a strictly increasing sequence of digits.</p><p><strong>Main Challenge:</strong> Strict order comparison of digits.</p><h3>Advanced: Complex logic, Iteration &amp; Recursion</h3><h4>11 - Reduce to Zero by Subtracting the Max Digit</h4><p>For each number from 1 to <em>N</em>, repeatedly subtract its largest digit until the number becomes zero. Count how many steps this process takes, and find how many numbers share the max step count.</p><p><strong>Example:</strong></p><pre>For number 57:<br>Step 1: 57 - 7 = 50<br>Step 2: 50 - 5 = 45<br>Step 3: 45 - 5 = 40<br>Step 4: 40 - 4 = 36<br>...<br>Step 10: 10 - 1 = 9<br>Step 11: 9 - 9 = 0<br><br>For 57, it took 11 steps to reach 0.</pre><p><strong>Output:</strong></p><p>For N = 99, the <strong>max step count is 16</strong> and <strong>6 numbers</strong> share this step count (94, 95, 96, 97, 98, 99).</p><p><strong>Main Challenge:</strong> Iterative reduction with max tracking.</p><h4>12 - Reverse and Add Until Palindrome</h4><p>Reverse the digits for each number from 1 to <em>N</em> and add to the original number repeatedly until a palindrome forms. Find the numbers in range 1 to <em>N</em> that require the most iterations to reach a palindrome.</p><p><strong>Example:</strong></p><pre>For number 87:<br><br>Step 1: 87 + 78 = 165 (not palindrome)<br><br>Step 2: 165 + 561 = 726 (not palindrome)<br><br>Step 3: 726 + 627 = 1353 (not palindrome)<br><br>Step 4: 1353 + 3531 = 4884 (palindrome!) → stop.<br><br>For 87, it took 4 steps to reach a palindrome.</pre><p><strong>Output:</strong></p><p>For <em>N </em>= 100, it took <strong>24 iterations for numbers 89 and 98</strong> to reach palindrome 8813200023188.</p><p><strong>Main Challenge: </strong>Recursion and palindrome detection.</p><h4>13 - Most Frequent Digit Count</h4><p>Count the number of times <strong>the most frequent digit</strong> appears in numbers from 1 to <em>N</em>.</p><p><strong>Examples:</strong></p><pre>Numbers from 1 to 13:<br>Digits are: 1,2,3,4,5,6,7,8,9,1,0,1,1,1,2,1,3<br>Digit counts:<br><br>&#39;1&#39;: appears 6 times<br><br>&#39;2&#39; and &#39;3&#39;: appear 2 times<br><br>Others: 1 time each<br><br>So, the most frequent digit is 1, and it appears 6 times.</pre><p><strong>Output:</strong></p><p>For <em>N</em> = 9999, <strong>digit 1 appears 4000 times</strong>.</p><p><strong>Main Challenge:</strong> Full range digit analysis and counting.</p><h4>14 - Roman Numerals Count</h4><p>Convert numbers from 1 to<em> N</em> to Roman numerals, count how many times the most frequent Roman letter (e.g., ‘X’ or ‘I’) appears in all these Roman numerals combined.</p><p><strong>Examples:</strong></p><pre>1994 → MCMXCIV<br><br>58 → LVIII</pre><p><strong>Output:</strong></p><p>For <em>N </em>= 999, <strong>‘X’</strong> and <strong>‘C’</strong> are the most frequent Roman letters. They appear <strong>148 times</strong>.</p><p><strong>Main challenge:</strong> Roman conversion and symbol counting.</p><h4><strong>15 - Number to Words</strong></h4><p>Convert a number into its plain English words and count how many times a specific letter appears in the result.</p><h4>Examples:</h4><pre>123 → &quot;one hundred twenty-three&quot;<br><br>9999 → &quot;nine thousand nine hundred ninety-nine&quot;</pre><p><strong>Output:</strong></p><p>Letter ‘n’ appears <strong>10 times</strong> in 9999 (nine thousand nine hundred ninety-nine).</p><p><strong>Main Challenge:</strong> Number-to-word conversion and filtering.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=70fcec1669de" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[3 Eating Hacks That Actually Work]]></title>
            <link>https://spathis.medium.com/3-eating-hacks-that-actually-work-37170d413cfa?source=rss-2a130a6be6b5------2</link>
            <guid isPermaLink="false">https://medium.com/p/37170d413cfa</guid>
            <category><![CDATA[nutrition]]></category>
            <category><![CDATA[mindful-eating]]></category>
            <category><![CDATA[healthy-habits]]></category>
            <category><![CDATA[behavioral-psychology]]></category>
            <category><![CDATA[weight-loss-tips]]></category>
            <dc:creator><![CDATA[Promethee Spathis]]></dc:creator>
            <pubDate>Wed, 11 Jun 2025 11:17:43 GMT</pubDate>
            <atom:updated>2025-06-11T11:17:43.133Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, I’m sharing three simple hacks that helped me lose 20 pounds without feeling deprived or hungry.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*buZptt4igwTwaAODXWt11w.jpeg" /></figure><p>Next time you’re eating with friends or colleagues, take a moment to observe the table. You’ll often notice that those who finish their meals last tend to be slimmer, while the faster eaters are more likely to carry extra weight. Why is that?</p><p>The answer lies in the communication delay between your stomach and your brain.</p><h3>Eat Slow, Lose More</h3><p>It’s no secret that weight loss comes down to consuming fewer calories. But how do you eat less without feeling starved? The key lies in tuning into your body’s natural satiety cues — the internal signals that tell you when you’ve had enough.</p><p>But here’s the catch: it takes about <strong>20 minutes</strong> for your brain to register that your stomach is full. During those first 20 minutes, your body is basically in “all-you-can-eat” mode. Only after that point does your brain send the signal to stop.</p><p>Since you can’t speed up this 20-minute delay, the smart move is to slow down your eating. Doing so gives your brain the time it needs to catch up — helping you naturally eat less, without feeling like you’re missing out.</p><p>The following three strategies are easy, low-effort ways to reduce your eating speed and improve portion control — all while enjoying your food more mindfully.</p><h3>Tip #1: Put the Fork on the Table Between Each Bite</h3><h4><strong>Why it works</strong></h4><p>Freeing your hands from cutlery helps break the automatic rhythm of eating. When your hands aren’t constantly guiding food to your mouth, you interrupt the mechanical pace that often leads to overeating. This built-in pause encourages you to chew more slowly, giving your body time to digest and register fullness.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rAuT0riqnp-NKuXZ4PhV_A.png" /><figcaption>Tip #1: Put the Fork on the Table Between Each Bite</figcaption></figure><h4>Practical tips</h4><ul><li>After each bite, place your fork down and focus on chewing thoroughly.</li><li>Use the pause to engage with your senses — texture, taste, smell — or chat with your dining companion.</li><li>Try chewing each bite 20–30 times; this not only slows you down but helps digestion.</li></ul><h3>Tip #2: Use Your Non-Dominant Hand to Eat</h3><h4>Why it works</h4><p>When you eat mindlessly, it’s easy to consume more than you need. Switching to your non-dominant hand introduces just enough awkwardness to interrupt this automatic behavior. The slight clumsiness forces you to focus on the act of eating, making it a more deliberate experience. By requiring conscious coordination, this simple trick helps you slow down and makes it harder to overeat.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*186i14RUtkQpdAAcI-TiXA.png" /><figcaption>Tip #2; Use Your Non-Dominant Hand to Eat</figcaption></figure><h4>Practical tips</h4><ul><li>Try it with simple meals first (e.g., salads, rice bowls, pasta, or sandwiches).</li><li>If it feels too awkward at first, practice this technique in a low-pressure setting (e.g., lunch or dinner at home).</li><li>Combine this method with other mindfulness techniques (e.g., no phones or TV while eating).</li></ul><h3>Tip #3: Use a Dessert Fork for Smaller Bites</h3><h4>Why it works</h4><p>Using smaller utensils is a simple way to reduce the size of your bites. Dessert and fruit forks are intentionally smaller than standard table forks. They are designed for lighter, more refined portions. Smaller bites mean more individual bites per meal and more time spent eating. Chewing these smaller bites thoroughly helps you get closer to the crucial 20-minute mark while consuming less food overall.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aKBW5M9SZxpQgG3evIYwzQ.png" /><figcaption>Tip #3; Use a Dessert Fork for Smaller Bites</figcaption></figure><h4>Practical tips</h4><ul><li>Swap your standard fork for a dessert or salad fork.</li><li>Use chopsticks if you’re not proficient with them.</li><li>Avoid overloading small fork. Keep the bites truly bite-sized.</li></ul><h3>Bonus Tip: Drink Water 20 Minutes Before Meals</h3><h4>Why it works</h4><p>Drinking a glass of water 20 minutes or so before eating gently expands your stomach, triggering stretch receptors that signal early fullness. This improves digestion and helps regulate how muc you eat.</p><p>Drinking during meals, however, may have the opposite effect. It dulls taste perception, making food seem less flavorful and possibly leading you to eat more to feel satisfied.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Li_NtmQStc_1y05d3NQNUg.jpeg" /><figcaption>Bonus Tip: Drink Water 20 Minutes Before Meals, Not During</figcaption></figure><h4>Practical tips</h4><ul><li>Drink a glass of water 20 minutes before meals to naturally reduce appetite.</li><li>Sip water during meals sip only if necessary to aid swallowing.</li><li>Minimize water intake with food to better enjoy flavors and feel more satisfied.</li></ul><h3>Takeaway</h3><p>Weight loss doesn’t have to mean deprivation or hunger. All you need is to slow down your eating. This will allow your natural satiety cues guide you. When you give your body enough time to register fullness, you’ll likely consume fewer calories without feeling restricted.</p><p>The three strategies I shared in this article are easy to incorporate into your daily routine and don’t require special diets, calorie counting, or willpower. You can pair them for even better results. These strategies reinforce each other, making it easier to break mindless eating habits and tune into your body’s natural hunger cues.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=37170d413cfa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Python Compound Data Types: A Comprehensive Guide]]></title>
            <link>https://spathis.medium.com/understanding-python-compound-data-types-a-comprehensive-guide-1287bf68601f?source=rss-2a130a6be6b5------2</link>
            <guid isPermaLink="false">https://medium.com/p/1287bf68601f</guid>
            <category><![CDATA[cheatsheet]]></category>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[aide-memoire]]></category>
            <dc:creator><![CDATA[Promethee Spathis]]></dc:creator>
            <pubDate>Tue, 23 Jul 2024 01:21:14 GMT</pubDate>
            <atom:updated>2024-07-23T01:21:14.507Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, I present a Python <em>aide-mémoire</em> that will help you understand the various compound data types offered in Python.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/804/1*5RXPigmKs0MA6F7uzq2Yow.jpeg" /></figure><p>Understanding and using the compound data types effectively can greatly improve the efficiency and organization of your Python code.</p><h3>Download the Aide-Mémoire</h3><p>This comprehensive aide-mémoire is completely free and easily accessible online. It covers the main compound data types of Python 3 with examples.</p><p>To improve the efficiency and organization of your Python code, do yourself a favor and utilize this cheat sheet. <a href="https://drive.usercontent.google.com/u/0/uc?id=124e22vI2yewV-0mQFfsr-ifAFJQ_JIZj&amp;export=download"><strong>Download the cheat sheet here</strong></a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L4rXyzBHMmrjmFKgSaIttA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8Rw4hoI52aWib_ry76bM6A.jpeg" /><figcaption>Preview of the Python Compound Data Types Cheat Sheet</figcaption></figure><h3>What is a Compound Data Type?</h3><p>Compound data types in Python are types that can hold multiple items or values. They are used to group together multiple values and can be of different data types.</p><pre>my_list = [1, 1, 2, &#39;A&#39;, &#39;B&#39;, &#39;C&#39;]<br>my_tuple = (1, 1, 2, &#39;A&#39;, &#39;B&#39;, &#39;C&#39;) <br>my_set = {1, 2, &#39;A&#39;, &#39;B&#39;, &#39;C&#39;}<br>my_dictionary = {1:&#39;A&#39;, 2:&#39;B&#39;, 3:&#39;C&#39;}<br>my_string = &#39;112ABC&#39;<br>my_bytes = b&#39;112ABC&#39;<br>my_bytearray = bytearray(b&#39;112ABC&#39;)</pre><p>Compound data types provide various ways to group and manipulate multiple items in Python, allowing for efficient data management and operations.</p><h3>What are the Compound Data Types in Python?</h3><p>In Python, the main compound types are:</p><ul><li>List</li><li>Tuple</li><li>Set</li><li>Dictionary</li><li>String</li><li>Bytes</li><li>Bytearray</li></ul><h3>Similarities and Differences among Python Compound Data Types</h3><p>In Python, compound data types share some similarities but also exhibit certain differences. Understanding these can help you choose the right type for your needs.</p><h4>Similarities</h4><ol><li><strong>Iterable</strong>: All compound data types are iterable, meaning you can loop over their elements.</li><li><strong>Contain Multiple Elements</strong>: They can hold multiple items or elements.</li><li><strong>Support Membership Testing</strong>: You can use the in and not in keywords to check for the presence of an element.</li><li><strong>Indexable</strong>: Lists, tuples, strings, bytes, and bytearrays support indexing, allowing you to access elements by their position.</li><li><strong>Support for Common Operations</strong>: You can perform operations like len() to get the number of elements.</li></ol><h4>Differences</h4><p><strong>1. Mutability</strong>: Mutability refers to the ability of an object to change its state or contents after it has been created. Immutable data types make better use of memory through memory sharing, optimization, elimination of defensive copies, and simpler memory management.</p><ul><li><strong>Mutable</strong>: Lists, sets, dictionaries, bytearrays.</li><li><strong>Immutable</strong>: Tuples, strings, bytes.</li></ul><p><strong>2. Order</strong>: The order in which the elements are specified when the object is defined is maintained for the object’s lifetime unless explicitly changed.</p><ul><li><strong>Ordered</strong>: Lists, tuples, strings, bytes, bytearrays.</li><li><strong>Unordered</strong>: Sets, dictionaries (though dictionaries maintain insertion order since Python 3.7).</li></ul><p><strong>3. Uniqueness</strong>: Some compound data types allow for duplicate elements to be added.</p><ul><li><strong>Unique Elements</strong>: Sets and dictionary keys.</li><li><strong>Duplicated Elements</strong>: Lists, tuples, strings, bytes, bytearrays.</li></ul><p><strong>4. Indexing and Slicing</strong>: Indexing refers to the process of accessing a specific element in a sequence using its position or index number. Slicing refers to the method of extracting a portion of a sequence.</p><ul><li><strong>Supports Indexing and Slicing</strong>: Lists, tuples, strings, bytes, bytearrays.</li><li><strong>Does Not Support Indexing and Slicing</strong>: Sets, dictionaries (access elements via keys in dictionaries).</li></ul><p><strong>5. Access times vs memory usage:</strong></p><ul><li>Sets and dictionaries are best for fast searches due to their underlying hash table implementation. Highly efficient lookups come at the cost of higher memory usage due to the metada required to manage the hash table structure.</li><li>Tuples and strings are more memory-efficient due to their immutability and fixed size.</li><li>Lists are less efficient than tuples because they are mutable and may require extra space for dynamic resizing and additional memory management overhead.</li></ul><h3>Summary of Compound Data Types</h3><p>The similarities and differences among Python Compound Data Types are summarized in the following table:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HdCOUf8zlUEHvAIunyZPLg.jpeg" /><figcaption>Similarities and differences among Python Compound Data Types</figcaption></figure><h3>About the Author</h3><p>Promethee Spathis is a Professor of Practice in Computer Science at <a href="https://shanghai.nyu.edu/">NYU Shanghai</a>. He is also a Senior Associate Professor in the <a href="https://sciences.sorbonne-universite.fr/">Faculty of Science &amp; Engineering</a> at <a href="https://www.sorbonne-universite.fr/">Sorbonne Université</a>, France. He received both his Masters and PhD degree in Computer Science from Sorbonne Université.</p><p>With a primary focus on Computer Science, Professor Spathis has designed and developed a wide array of courses spanning B.Sc, M.Sc, and Ph.D. levels. At NYU Shanghai, he currently teaches courses in computer networking and computer programming, bringing his extensive expertise and innovative teaching methods to the classroom. His commitment to education and research continues to inspire and shape the next generation of computer scientists.</p><h3>Keywords</h3><p>Python Cheat Sheet, Python Quick Reference, Python Tips and Tricks, Python for Beginners, Python Programming Guide, Python Syntax Cheat Sheet, Python Coding Shortcuts, Python Basics, Python Code Snippets, Python Essential Commands, Learn Python Quickly, Python One-liners, Python Reference Guide, Python Programming Basics, Python Developer Tools, Python Quick Tips, Python Code Examples</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1287bf68601f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Only Python Cheat Sheet You Will Ever Need]]></title>
            <link>https://spathis.medium.com/the-only-python-cheat-sheet-you-will-ever-need-42b41cc54b3d?source=rss-2a130a6be6b5------2</link>
            <guid isPermaLink="false">https://medium.com/p/42b41cc54b3d</guid>
            <category><![CDATA[developer-tools]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[cheatsheet]]></category>
            <category><![CDATA[python-programming]]></category>
            <dc:creator><![CDATA[Promethee Spathis]]></dc:creator>
            <pubDate>Tue, 04 Jun 2024 15:51:01 GMT</pubDate>
            <atom:updated>2025-01-27T15:20:54.499Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, I present the ultimate Python cheat sheet, covering over 95% of all Python 3 commands with examples. Designed for both beginners and experienced developers, it provides quick answers and efficient learning without overwhelming you with details.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a1o7OnBQGx7ZWsa3HKQ-Ew.jpeg" /><figcaption>Image created with Microsoft Designer</figcaption></figure><p>Learning and remembering every fact about a new topic can be challenging, if not impossible. Cheat sheets are crafted to help you memorize and recall essential information swiftly, making them an efficient tool for learning and using new technologies.</p><p>The cheat sheet provided in this article is an invaluable resource for both beginners and experienced developers. For novices, it lowers the entry barrier, making Python more approachable. For experts, it serves as a quick refresher to sharpen their skills.</p><h3>Download the Cheat Sheet</h3><p>This comprehensive cheat sheet is completely free and easily accessible online. It covers over 95% of all Python 3 commands with examples. At the end of this article, you’ll find the detailed list of all topics covered. To make your learning process smoother and faster, do yourself a favor and utilize this cheat sheet. <a href="https://drive.usercontent.google.com/u/0/uc?id=1zmyh4P0dFRNxfCcDfRrk-sxL5uRszm6C&amp;export=download"><strong>Download the cheat sheet here</strong></a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bOHGLFNWnZfoN0QYMkLkyQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hPxQLAXm_B9Gm5kc2QOhdw.jpeg" /><figcaption>Python 3 Cheat Sheet</figcaption></figure><h3>What Are Cheat Sheets?</h3><p>Cheat sheets are indispensable tools. They come in handy to students in preparation of or during their exams but also to professionals who can use them as concise quick reference guides.</p><p>Cheat sheets provide a condensed, easy-to-access reference for key information. They allow beginners and experts to quickly look up important details without having to search through extensive documentation or manuals.</p><p>A well designed cheat sheet usually fits on one page and holds all the information related to one topic. Designing a cheat sheet can be challenging as they need to be both readable while being holistic.</p><h3>Cheat Sheets for Computer Science</h3><p>Cheat sheets for Computer Science are particularly useful. They contain all the most essential information about a specific subject or domain into a short format, covering syntax, commands, functions, shortcuts, and hotkeys.</p><p>Programming and software cheat sheets are extremely popular amongst computer science students and professionals who can quickly access information at one glance such as the syntax, commands, functions, shortcuts, or hotkeys.</p><h3>Benefits of Programming Cheat Sheets</h3><p>Cheat sheets are valuable tools for both novice and experienced programmers. Here are some key benefits of Python Cheat sheet:</p><ol><li><strong>Quick Reference:</strong> They save time by providing immediate answers to common questions.</li><li><strong>Learning Aid:</strong> They help reinforce learning by summarizing key concepts.</li><li><strong>Consistency:</strong> They promote adherence to coding standards and best practices.</li><li><strong>Productivity:</strong> They improve coding efficiency by offering quick solutions and reminders.</li><li><strong>Advanced Features: </strong>They include less frequently used commands or features that might not be memorized.</li><li><strong>Teaching and Collaboration: </strong>They are invaluable for teaching and assisting students with new concepts.</li><li><strong>Compact and Portable:</strong> They are easy to carry and use in different environments, whether online or offline.</li><li><strong>Improved Code Quality: </strong>They help in writing cleaner and more efficient code by providing examples and best practices.</li><li><strong>Self-Reliance:</strong> They encourage independent problem-solving and learning.</li><li><strong>Motivation:</strong> They can inspire beginners to explore further and experts to keep their skills sharp.</li></ol><p>In summary, cheat sheets are versatile tools that enhance learning, improve productivity, ensure consistency, and promote best practices. They serve as an indispensable resource for both students and professionals in the programming community.</p><h3>Python Cheat Sheet</h3><p>The spread sheet I give below is completely free and easily accessible online. It contains over 95% of all Python 3 commands with examples. So remember, to make your learning process smoother and faster, utilize this cheat sheet.</p><p>To download the Python cheat sheet <a href="https://drive.google.com/file/d/1zmyh4P0dFRNxfCcDfRrk-sxL5uRszm6C/view?usp=sharing"><strong>click here</strong></a>.</p><h3>Topics Covered in the Cheat Sheet</h3><p>This cheat sheet covers the following concepts:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hPxQLAXm_B9Gm5kc2QOhdw.jpeg" /><figcaption>Python 3 Cheat Sheet Page 1</figcaption></figure><h3>Page 1</h3><h4><strong>Data Types</strong></h4><ul><li>Text Type: str</li><li>Numeroc Type: int, float, complex</li><li>Boolean Type: bool</li><li>Sequence Types: List (list), Tuple (tuple), Range (range)</li><li>Set Type: Set (set)</li><li>Mapping Type: Dictionary (dic)</li></ul><h4><strong>Data Type Conversions</strong></h4><ul><li>Integer and Float Conversions: float(), int()</li><li>Real to Complex Data Type Conversion: complex()</li><li>Data Type Conversion with Strings: int(), str()</li><li>Type Conversion to Tuples and Lists: tuple(), list()</li><li>Type Conversion to Dictionaries and Sets: set(), dict()</li><li>Convert Binary to Decimal: bin(), int()</li><li>Convert Hexadecimal to Decimal: hex(), int()</li><li>Convert Text to Decimal: ord(), chr()</li></ul><h4><strong>Booleans</strong></h4><ul><li>Booleans as Numbers</li><li>Comparison Operators: ==, !=, &lt;, &gt;, &lt;=, &gt;=</li><li>Membership and Identity Operators: in, not in, is, is not</li><li>Boolean Operators: not, and, or</li></ul><h4><strong>Operator Precedence</strong></h4><h4><strong>Print Function</strong></h4><ul><li>print(), sep, end</li></ul><h4><strong>User Input</strong></h4><ul><li>input()</li></ul><h4><strong>Decision Structure</strong></h4><ul><li>if-then-elif-else statements</li></ul><h4><strong>Repetition Structures</strong></h4><ul><li>While statement</li><li>For statement</li></ul><h4><strong>Exceptions</strong></h4><ul><li>FileNotFoundError, IndexError, KeyError, ModuleNotFoundError, NameError, SyntaxError, TypeError, ValueError, ZeroDivisionError</li></ul><h4><strong>Modules</strong></h4><ul><li>import statement</li><li>from… import statement</li></ul><h4><strong>Files</strong></h4><ul><li>open(), close(), read(), readline(), readlines()</li><li>access modes: read, write, append, create</li></ul><h4><strong>Strings</strong></h4><ul><li>String Delimiters: single quotes, double quotes, triple single quotes, triple double quotes</li><li>Escape Sequences</li><li>String Operations: concatenation, repetition</li><li>String Length: len()</li><li>Unicode Code/Text Conversion: ord(), chr()</li><li>String Membership: in, not in</li><li>String Indexing</li><li>String Slicing</li><li>String Slicing Steps</li><li>String Methods: upper(), lower(), isupper(), islower(), count(), endswith(), find(), index(), isalnum(), isalpha(), isdecimal(), isdigit(), isnumeric(), strip(), rstrip(), lstrip(), split(), replace()</li><li>Iterating over Strings</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bOHGLFNWnZfoN0QYMkLkyQ.jpeg" /><figcaption>Python 3 Cheat Sheet Page 2</figcaption></figure><h3>Page 2</h3><h4><strong>Lists</strong></h4><ul><li>List Creation: list()</li><li>List Comprehension</li><li>List Indexing</li><li>List Slicing</li><li>List Length: len()</li><li>List Membership: in, not in</li><li>List Comparison: ==, !=, &lt;, &gt;, &lt;=, &gt;=</li><li>List Manipulation</li><li>List Concatenation and Repetition</li><li>Adding Elements: append(), extend(), insert()</li><li>Removing Elements: remove(), pop()</li><li>Deleting Elements: del</li><li>List Counting, Searching, and Sorting: count(), index(), reverse(), sort()</li><li>String-to-List and Back: split(), join()</li><li>List Built-in Functions: all(), any(), len(), list(), max(), min(), reversed(), sorted(), sum(), tuple(), zip()</li><li>Iterating over Lists</li></ul><h4>Tuples</h4><ul><li>Tuple Creation: tuple()</li><li>Tuple Unpacking</li><li>Tuple Built-in Functions: all(), any(), count(), enumerate(), filter(), index(), len(), list(), map(), max(), min(), next(), reversed(), slice(), sum(), sorted(), tuple(), zip()</li><li>Tuple Operations: indexing, slicing, concatenation, repetition, membership</li><li>Iterating over Tuples</li></ul><h4>Sets</h4><ul><li>Set Creation: set()</li><li>Adding Elements: add(), update()</li><li>Removing Elements: remove(), discard()</li><li>Set Operations: union, intersection, difference, symmetric difference, subset, superset</li><li>Iterating over Sets</li></ul><h4>Dictionaries</h4><ul><li>Dictionary Creation: dict()</li><li>Dictionary Length: len()</li><li>Key Membership: in, not in</li></ul><h4>Retrieving a Value Given a Key</h4><ul><li>get()</li></ul><h4>Adding a Key/Value Pair</h4><h4>Updating a Key/Value Pair</h4><h4>Deleting a Key/Value Pair</h4><ul><li>del()</li></ul><h4>Dictionary Methods</h4><ul><li>get(), items(), keys(), pop(), popitem(), update(), clear()</li></ul><h4>Iterating over Dictionaries</h4><h4>Similarities &amp; Differences</h4><ul><li>Ordered</li><li>Duplicates allowed</li><li>Mutable</li><li>Comparison</li><li>Access elements</li><li>Slicing</li><li>Concatenation,</li><li>Repetition</li><li>Iteration</li></ul><h3>About the Author</h3><p>Promethee Spathis is a Professor of Practice in Computer Science at <a href="https://shanghai.nyu.edu/">NYU Shanghai</a>. He is also a Senior Associate Professor in the <a href="https://sciences.sorbonne-universite.fr/">Faculty of Science &amp; Engineering</a> at <a href="https://www.sorbonne-universite.fr/">Sorbonne Université</a>, France. He received both his Masters and PhD degree in Computer Science from Sorbonne Université.</p><p>With a primary focus on Computer Science, Professor Spathis has designed and developed a wide array of courses spanning B.Sc, M.Sc, and Ph.D. levels. At NYU Shanghai, he currently teaches courses in computer networking and computer programming, bringing his extensive expertise and innovative teaching methods to the classroom. His commitment to education and research continues to inspire and shape the next generation of computer scientists.</p><h3>Keywords</h3><p>Python Cheat Sheet, Python Quick Reference, Python Tips and Tricks, Python for Beginners, Python Programming Guide, Python Syntax Cheat Sheet, Python Coding Shortcuts, Python Basics, Python Code Snippets, Python Essential Commands, Learn Python Quickly, Python One-liners, Python Reference Guide, Python Programming Basics, Python Developer Tools, Python Quick Tips, Python Code Examples</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=42b41cc54b3d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[2 Must-Have Cheat Sheets for Network Engineers and Students]]></title>
            <link>https://spathis.medium.com/computer-network-cheat-sheets-b5146eefa2d4?source=rss-2a130a6be6b5------2</link>
            <guid isPermaLink="false">https://medium.com/p/b5146eefa2d4</guid>
            <category><![CDATA[cheatsheet]]></category>
            <category><![CDATA[computer-networking]]></category>
            <category><![CDATA[ipv6]]></category>
            <category><![CDATA[computer-network]]></category>
            <category><![CDATA[tcp-ip]]></category>
            <dc:creator><![CDATA[Promethee Spathis]]></dc:creator>
            <pubDate>Thu, 14 Sep 2023 05:51:22 GMT</pubDate>
            <atom:updated>2025-03-24T05:16:26.023Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, I will give you the only 2 cheat sheets you will ever need for Internet related technologies. They will help you answer any of your questions without worrying about all the details.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HrtFA2uC-KNWxXyAtINrnA.jpeg" /></figure><p>Learning and remembering every facts about a new topic is difficult and sometimes impossible. Cheat sheets are designed to help you memorize and recall essential information quickly, making them an efficient way to learn and use new technologies.</p><p>The cheat sheet provided in this article are invaluable resources for both beginners and experienced engineers. They can be used to lower the entry barrier for novices and help experts refresh their internet skills.</p><h3>Download the Cheat Sheets</h3><p>These two comprehensive cheat sheets are completely free and easily accessible online. They cover all IPv4/IPv6 headers and more protocols such as TCP, UDP, DNS, and ICMP. At the end of this article, you’ll find the detailed list of all topics covered. To make your learning process smoother and faster, do yourself a favor and utilize this cheat sheet. <a href="https://bit.ly/internet-spathis"><strong>Download the cheat sheets here</strong></a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ui87YS6omhJjwuxz0wwYeA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j-RIFoo4CQiyDt924numJQ.png" /><figcaption><a href="https://bit.ly/internet-spathis">TCP/IP and IPv6 Cheat Sheets</a></figcaption></figure><h3><strong>What Are Cheat Sheets?</strong></h3><p>Cheat sheets are amazing tools. They come in handy to students in preparation of or during their exams but also to professionals who can use them as concise quick reference guides.</p><p>Cheat sheets provide a condensed, easy-to-access reference for key information. They allow beginners and experts to quickly look up important details without having to search through extensive documentation or manuals.</p><p>A well designed cheat sheet usually fits on one page and holds all the information related to one topic. Designing a cheat sheet can be challenging as they need to be readable while being holistic.</p><h3><strong>Cheat Sheets for Computer Science</strong></h3><p>Cheat sheets for computer science contain all the most essential information about a specific subject or domain in short, such as the syntax, commands, functions, shortcuts, or hotkeys.</p><p>Programming and software cheat sheets are extremely popular amongst computer science students and IT professionals who can quickly access information at one glance. This is also true for computer networking.</p><p>Cheat sheets for Internet technologies can be useful for beginners who want to get started with a new technology, or for experts who want to refresh their memory on some details. They summarize a wide range of topics and concepts into a compact format that can be used for quick reference of a particular protocol or service.</p><h3><strong>Benefits of Computer Networking Cheat Sheets</strong></h3><p>Computer networking involves a wide range of protocols and services. Each protocol comes with its own header consisting of various fields. Details regarding a field include its name, its position, its length, and the list of values it can hold, each value carrying a specific meaning.</p><p>The two spread sheets I give below are completely free and easily accessible online. So remember, to make your learning process smoother and faster, utilize these cheat sheets.</p><h3><strong>TCP/IP Cheat sheet</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ik8dUweRYPzk_2QQEDOZSQ.png" /><figcaption><a href="https://bit.ly/tcpip-spathis"><strong>TCP/IP Cheat Sheet</strong></a></figcaption></figure><p>To download the TCP/IP cheat sheet <a href="https://bit.ly/tcpip-spathis"><strong>click here</strong></a>. This cheat sheet covers the following concepts:</p><ul><li><strong>Link layer:</strong> Ethernet frames, ARP requests and responses.</li><li><strong>IPv4 addresses:</strong> IPv4 classes, IPv4 special-purpose addresses</li><li><strong>IPv4 packets: </strong>IPv4 header, IPv4 options, IPv4 pseudo-header</li><li><strong>ICMP messages:</strong> Destination unreachable, Time Exceeded, Parameter Problem, Redirect Message, Echo request and reply</li><li><strong>Transport Layer:</strong> TCP segment, TCP options, UDP datagrams, Well-known port numbers.</li><li><strong>Application layer: </strong>DNS Messages</li></ul><h3>IPv6 Cheat Sheet</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Feu9dowhpR8Pu60KH7qTqw.png" /><figcaption><a href="https://bit.ly/ipv6-spathis"><strong>IPv6 Cheat Sheet</strong></a></figcaption></figure><p>To download the IPv6 cheat sheet <a href="https://bit.ly/ipv6-spathis"><strong>click here</strong></a>. This cheat sheet covers the following concepts:</p><ul><li><strong>IPv6: </strong>IPv6 Addresses, IPv6 Packet Header, Header Extensions (Routing and Fragment), IPv6 Pseudo-header.</li><li><strong>ICMPv6: </strong>Destination Unreachable (Type 1), Packet Too Big (Type 2), Time Exceeded (Type 3), Parameter Problem (Type 4), Echo Request and Reply (Type 128 and 129).</li><li><strong>Neighbor Discovery Options:</strong> Source and Target Link-Layer Address Options (Type 1 and 2), Prefix Information Option (Type 3), Redirected Header Option (Type 4), MTU Option (Type 5),</li><li><strong>Neighbor Discovery Messages: </strong>Router Solicitation (Type 133), Router Advertisement (Type 134), Neighbor Solicitation (Type 135), Neighbor Advertisement (Type 136), Redirect (Type 137).</li><li><strong>Multicast Listener Discovery</strong></li></ul><h3>Further Readings</h3><p>Here is a list of books where you will find more details on Internet protocols and technologies:</p><ul><li><a href="http://bit.ly/3XE6RB5">Technologies et protocoles Internet</a>, Promethee Spathis, Ellipses Editions, 2023.</li><li>Computing Networking: A Top Down Approach, 8th edition, J.F. Kurose &amp; K.W. Ross. Pearson/Addison-Wesley.</li><li>Computer Networks: A Systems Approach, Larry L. Peterson, 6th Edition, Morgan Kaufmann.</li><li>Computer Networks and Internets, Douglas E. Comer, 6th Edition, Chapman and Hall/CRC.</li><li>TCP/IP Illustrated: The Protocols (Volume 1), Kevin Fall &amp; W. Stevens, 2nd Edition, Addison-Wesley.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b5146eefa2d4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Si en 2022 tu n’as pas ta SwatchXOmega …]]></title>
            <link>https://spathis.medium.com/omega-swatch-moonwatch-collab-c5481893dc36?source=rss-2a130a6be6b5------2</link>
            <guid isPermaLink="false">https://medium.com/p/c5481893dc36</guid>
            <category><![CDATA[swatch]]></category>
            <category><![CDATA[moonwatch]]></category>
            <category><![CDATA[omega-x-swatch]]></category>
            <category><![CDATA[omega]]></category>
            <category><![CDATA[bioceramics]]></category>
            <dc:creator><![CDATA[Promethee Spathis]]></dc:creator>
            <pubDate>Sun, 24 Apr 2022 16:06:09 GMT</pubDate>
            <atom:updated>2022-04-26T15:26:32.331Z</atom:updated>
            <content:encoded><![CDATA[<h3>Si en 2022 tu n’as pas une Omega … Achète toi une SwatchXOmega !</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/980/1*gAS_YgGFHzowVf4n_wioOA.jpeg" /></figure><p>Comment faire pour acquérir une SwatchXOmega sans se ruiner ? Que faut-il savoir avant de se lancer ? A quoi faut-il s’attendre ? Je partage ici mon expérience dans ma quête d’une Moonwatch et mon avis sur les collaborations en général.</p><h3>SwatchXOmega, qu’est ce que c’est ?</h3><p>Si vous lisez cet article, c’est que vous connaissez déjà les prémisses de cette collaboration. Dans ce cas, vous pouvez sauter cette section.</p><p>Pour les autres, il s’agit de onze montres co-brandées Swatch et Omega dont les modèles sont inspirés des corps célestes du système solaire :</p><ul><li>Le Soleil.</li><li>Les 9 planètes : Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus, Neptune et Pluto.</li><li>La Lune.</li></ul><p>Le design est inspiré du <a href="https://www.omegawatches.com/fr-fr/watches/speedmaster/moonwatch-professional/product">fameux chronographe Omega Speedmaster</a>, première montre à être allée sur la Lune lors la mission Apollo 11 en 1969. Tout comme la Speedmaster, l’anneau extérieur est gradué avec le “dot over 90 (DON)”, du point en diagonale du chiffre 70 et de l’accent grave sur le premier E de tachymètre. Le cadran comprend les 3 compteurs en creux. Le bracelet est en velcro et frappé des logos Swatch, Omega Ω et Speedmaster.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/959/1*MNBw71i03_c4iYsT_xhBrw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nbpLxEXvNOBbPzRFtFF5gw.jpeg" /><figcaption>Lunettes et cadrans Speedmaster Omega (à gauche) et SwatchXOmega Mission to the Moon à droite)</figcaption></figure><p>La comparaison s’arrête là puisque le mouvement et les matériaux sont ceux utilisés par Swatch. Le boîtier est en <a href="https://www.swatch.com/fr-fr/bioceramic.html">biocéramique</a>, un mélange de céramique et d’huile de ricin qui, en remplaçant le plastique, rend les montres plus éco-responsable (?). Le verre est en plexiglas et ultrasensibles aux rayures. Par contre, à la manière des Rolex dont le saphir est gravé au laser avec une couronne, le plexiglas des Moonwatch est frappé de la lettre ‘S’ au centre du plexiglas. Si vous le trouvez, faites le savoir dans les commentaires. Moi je ne le vois pas.</p><p>Chaque modèle reprend les couleurs du corps célestes qu’il célèbre : le modèle Soleil est jaune, le modèle Terre est vert (même si on parle de Planète Bleue), Venus est rose, Mars est rouge, Neptune est bleu (c’était le Dieu des Mers dans la mythologie, n’est-ce-pas ?)… Le couvercle de la pile représente l’image du corps céleste dont s’inspire le modèle.</p><h3>Samedi 23 avril, 10h00</h3><p>Arrivée le samedi matin aux environs de 10h du matin, le 23/04 à l’angle des rues de Sèvre et du Cherche midi. On y trouve des capuches rabattues sur des casquettes, des baskets et des joggings, une odeur qui rappelle les rues d’Amsterdam. On se croit à proximité d’un McDo vu le nombre de livreurs à vélo qui font des rondes. Je me dis quelque chose se trame. Je demande aux agents de sécurité en faction devant la porte de la boutique. Ils restent vagues concernant la disponibilité.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SZsVJLyu_OBC4VPEu7n64Q.png" /><figcaption>Swatch Paris Croix Rouge : 2 Rue du Cherche Midi Place Croix Rouge 75006 Paris. Tél : 01 45480960.</figcaption></figure><p>Je savais, pour avoir posé la question il y deux semaines, que des montres étaient mises en vente sans savoir quand mais toujours en quantité limitée. « <em>On en a eues ce matin mais elles sont toutes parties.</em> » Hoax ou vérité ?</p><p>Je décide de camper à quelques pas sous les testic… du Centaure de César. Certains sont installés sur des chaises de camping. La police fait des rondes. L’ambiance reste bon enfant. L’accès à la boutique et le trottoir restent dégagés. Tout le monde est en arc de cercle. Le 26 mars, jour du lancement officiel, ce n’était pas la même. Des échauffourées avaient précipité la fermeture de la boutique et l’annulation de la vente.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pvPrOpy5yoL_y-nT5DMxgw.png" /><figcaption>Le Centaure de César installé sur la place Michel-Debré, dans le 6e arrondissement de Paris.</figcaption></figure><p>J’ai une vue directe sur l’intérieur de la boutique. Sur les coups de midi, je vois les vendeurs faire des allers-retours fréquents, depuis et vers l’arrière-boutique. Je décide de m’approcher davantage. On est quelques-uns. Les habitués, eux, ne sont pas émus pour autant et restent sur les trottoirs opposés.</p><p>Et c’est là où, tout d’un coup, tout se précipite. Des vigiles habillés de noir, surgissent de nulle part et commencent à tirer le long du trottoir, des poteaux à sangle rétractable. L’un d’eux m’interpelle :</p><blockquote>- Monsieur, vous devez partir, vous n’êtes pas sur la liste.</blockquote><blockquote>- Quelle liste ? Il y a une liste ?</blockquote><blockquote>- Oui Monsieur.</blockquote><blockquote>- Mais Monsieur, je ne suis pas au courant d’une quelconque liste. S’agit-il d’une liste officielle Swatch ?</blockquote><p>“Monsieur, mettez-vous en face”, me dit-il de manière autoritaire, en me montrant le trottoir opposé.</p><blockquote>- Le trottoir est un espace public et je suis libre d’y rester. Dites-moi où est la file pour que je m’y mette.</blockquote><p>Un de ses collègues lui dit de se contenter de déployer les poteaux.</p><p>Apparaît alors un individu en jogging que tout le monde semble écouter. J’entends des voix qui l’identifient comme étant la même personne qui gère les ventes chez Nike. Sans doute celles des Jordan ou autres modèles qu’on voit dans les pubs pour StockX sur Facebook. Il nous invite, moi et ceux qui avions pris position devant la boutique, à quitter le trottoir pour celui d’en face. Il s’adresse à moi :</p><blockquote>- Monsieur, oui il y a une liste et vous n’y êtes pas.</blockquote><blockquote>- Comment je fais pour m’y mettre ? Je suis là depuis 10h du matin et personne ne m’a parlé d’une liste. Est-ce une liste officielle swatch ?</blockquote><blockquote>- Monsieur, tout le monde est là depuis 5 heures du matin. Tout le monde s’est mis sur la liste. Vous voulez acheter, vous devez être sur la liste. Mettez-vous sur le côté et je vous promets de vous laisser passer.</blockquote><p>Un vendeur sort et s’adresse aux vigiles en me montrant :</p><blockquote>- Le Monsieur est là, il est le premier dans la file, laissez le entrer.</blockquote><p>Parallèlement, un grondement s’élève dans la rue du Cherche Midi où la file commence à s’étendre. On se chamaille pour avoir les meilleures places. À moins que ce soit pour faire respecter l’ordre de la fameuse liste.</p><p>Quelques adolescents qui m’avaient suivi, cèdent aux intimidations et quittent la file. Les individus qui se retrouvent derrière moi m’interpellent.</p><blockquote>- Vous n’avez pas le droit d’être là, Monsieur. C’est pas juste. On est là depuis 5 heures du matin. On est là pour se faire un petit billet.</blockquote><p>Malgré le ton agressif, je reste calme et courtois.</p><blockquote>- Si on m’avait parlé de la liste en arrivant, je respecterai l’ordre de passage.</blockquote><blockquote>- Vous n’avez pas demandé. C’est à vous de demander pour la liste.</blockquote><blockquote>- Si je ne connais pas l’existence de la liste, comment demander à y être ou savoir à qui m’adresser ?</blockquote><blockquote>- Vous avez un ton condescendant, c’est pas bien.</blockquote><p>La condescendance, c’est un mot qui a le vent en poupe en ce moment. C’est comme l’arrogance. On nous les sert à toutes les sauces. Je suis pris de sympathie et je laisse passer deux personnes. À moins que ce soit la peur ?</p><p>Les vendeurs qui sortent à la porte pour faire entrer les clients un par un, m’invitent à entrer.</p><blockquote>- Non il n’y a pas de liste Monsieur. Vous avez bien fait de rester.</blockquote><p>J’ai acheté une Mercury, la Moon n’étant apparemment pas disponible. Les responsables de la boutique se sont excusés pour l’expérience client. Je les ai sentis désemparés, comme abandonnés par leur entreprise.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y4MP7p9NpKW3n9mQq_UZdQ.jpeg" /><figcaption>Le modèle Mission to Mercury.</figcaption></figure><h3>La chasse aux collab’</h3><p>La collection SwatchXOmega remporte un franc succès. Le marketing a été rondement mené. Comme toutes les collaborations, le but est d’étendre le cercle des acheteurs à une population plus large, plus frénétique. Et Swatch a su la trouver auprès d’un public conquis, prêt à acheter ses montres.</p><p>Qui n’a pas envie de s’offrir une Omega pour (trois fois) le prix (et la qualité) d’une Swatch ? Reste à savoir si l’opposé est vrai. Ah mais c’est vrai, <a href="https://www.swatchgroup.com/en/brands-companies">Omega appartient au groupe Swatch</a>…</p><p>Le seul hic c’est qu’il faut entretenir la hype, donner une raison d’être fier de son acquisition, de poster des vidéos et des photos sur les réseaux sociaux. La satisfaction d’être acquéreur se mesure en nombre de likes de nos jours. La stratégie numéro 1 pour ces collab’, c’est de produire en nombre limité. Ca fait des files d’attente monstres qu’on peut filmer en accéléré et poster sur Insta.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bLSKEg2LEJ_-88Is3fAW3A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gJkLHWrQFUMKRSnSxQwH5A.png" /><figcaption>Reventes de la collection Bioceramic Moonwatch sur Chrono24 (à droite) et sur Ebay (à gauche).</figcaption></figure><p>Ca fait aussi monter les prix à la revente, ça contribue à l’imaginaire collectif en faisant croire que ces montres en valent le prix. Mais en valent-elles la peine ? Pas vraiment car payer ces prix, c’est aussi pour ne pas avoir à faire des queues interminables où il faut lutter pour avoir une place, sans savoir si les pièces mises en vente seront en nombre suffisant ou si la boutique sera sommée de fermer ses portes pour cause de troubles à l’ordre public.</p><p>600 euros, c’est le prix moyen à la revente. C’est 350 euros de bénéf net. Si on se poste à 5 heures du matin et que la vente commence à 10 heures c’est 7 fois le smic horaire. Voire même 10, si ça part à 800 euros. On est 10 fois au-dessus d’une Swatch classique.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6v91FNefsb1Bqnzukle55g.png" /><figcaption>Côte de la OmegaXSwatch Mission to the Moon (Source : www.chrono24.com)</figcaption></figure><p>Les prix des modèles les plus recherchés comme la Mission to the Moon ont déjà perdu un tiers de leur valeur à la revente. Reste à savoir si les attroupements de revendeurs aux portes des boutiques suivront la même tendance.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c5481893dc36" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How DNS Got Its Messages on Diet]]></title>
            <link>https://spathis.medium.com/how-dns-got-its-messages-on-diet-c49568b234a2?source=rss-2a130a6be6b5------2</link>
            <guid isPermaLink="false">https://medium.com/p/c49568b234a2</guid>
            <category><![CDATA[iot]]></category>
            <category><![CDATA[compression]]></category>
            <category><![CDATA[dns]]></category>
            <dc:creator><![CDATA[Promethee Spathis]]></dc:creator>
            <pubDate>Tue, 19 Oct 2021 13:27:28 GMT</pubDate>
            <atom:updated>2021-10-19T13:27:28.522Z</atom:updated>
            <content:encoded><![CDATA[<h4>An illustrated Guide to DNS Message Compression</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qVCkEvK6gZxuG-BWuv0XyQ.png" /></figure><p>DNS message compression refers to a technique used to remove redundant information from its messages. This technique works by replacing duplicated names in a DNS message with a two-byte value indicating the location of their first occurrence. Given that a domain name can be up to 253-byte long, DNS compression reduces substantially the length of DNS messages.</p><p><strong>In this article, I present how DNS message compression works. I also provide a concrete example.</strong></p><h3>DNS Database and Resource Records</h3><p>DNS refers to a distributed database maintained across <strong>multiple DNS servers</strong> including the Root, the TLD, and the Authoritative servers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CxmYxLyGZUsZMa2hOhXoMg.jpeg" /><figcaption>The hierarchy of DNS servers.</figcaption></figure><p>The <strong>DNS database</strong> consists of records called <strong>Resource Records (RRs) </strong>of different types. The most common types of RRs include:</p><ul><li>Type A records contain the IPv4 address corresponding to a domain name.</li><li>Type AAAA records contain the IPv6 address corresponding to a domain name.</li><li>Type CNAME records contain the canonical name corresponding to a domain name acting as an alias.</li><li>Type NS records contain the authoritative server in charge of a domain name.</li><li>Type MX records contain the name of the incoming mail server for a domain.</li></ul><p>DNS clients send a <strong>DNS query </strong>message to fetch one of these RRs for a given domain name. To do so, a client encapsulates a DNS query in a UDP datagram submitted to the <strong>local DNS server</strong>. In case of a recursive query, the client will wait and receive the DNS answer message eventually.</p><h3>DNS Messages</h3><p>A DNS message contains a header followed by the following four (4) different types of sections (some may be empty):</p><ul><li>Questions</li><li>Answers</li><li>Authority</li><li>Additional</li></ul><p>Each of these four (4) sections contains 0 or more resource records.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FGQHwD37IyeKXF_gVHfr0A.png" /><figcaption>The format of a DNS message.</figcaption></figure><p>The header consists of the following six (6) fields:</p><ul><li>Identification</li><li>Control</li><li>Number of Questions</li><li>Number of Answers</li><li>Number of Authority</li><li>Number of Additional</li></ul><p>The four (4) last fields named “Number of …” indicate the number of resource records contained in the corresponding four sections following the header.</p><p>The records listed in the Question section are incomplete whereas the other 3 sections contain complete resource records. The format of a Question record contains the following fields:</p><blockquote>{QNAME, QTYPE, QCLASS}</blockquote><p>where:</p><ul><li><em>QNAME</em> refers to the name of the requested resource,</li><li><em>QTYPE</em> (16) refers to the type of the resource record (i.e., A, AAAA, CNAME, MX, …),</li><li><em>QCLASS</em> (16) is set to IN (0x0001) for Internet.</li></ul><p>The records listed in the Answer, the Authority, and the Additional sections are complete resource records. They correspond to the resource records as stored in the DNS distributed database. The format of a resource record contains the following fields:</p><blockquote>{NAME, TYPE, CLASS, TTL, RDATA_LENGTH, RDATA}</blockquote><p>where:</p><ul><li><em>NAME</em> refers to the queried domain name,</li><li><em>TYPE</em> (16) refers to the type of the resource record (i.e., A, AAAA, CNAME, MX, …),</li><li><em>CLASS</em> (16) is set to IN (0x0001) for Internet,</li><li><em>TTL</em> (32) is the duration in seconds during which the resource records will remain valid,</li><li><em>RDATA_LENGTH </em>(16) refers to the length of the <em>RDATA </em>field,</li><li><em>RDATA</em> is the data contained in this resource record.</li></ul><p>The data in a resource record depends on the type of the resource record:</p><ul><li>For Type=A (0x0001), data is an IPv4 address.</li><li>For Type=AAAA (0x001C), data is an IPv6 address.</li><li>For Type=CNAME (0x0005), data is the canonical name.</li><li>For Type=NS (0x0002), data is the name of the authoritative server.</li><li>For Type=MX (0x000F), data is the name of a mail server.</li></ul><p>Due to the many records listed in the 4 sections of a DNS message, a single DNS message may contain multiple names. The same name or a fraction of a name may be duplicated across the multiple records present in the message. Recall that the labels located at the end of a domain name is the name of the parent domains. These repetitions may lead to long messages which waste bandwidth unnecessarily.</p><h3>DNS Message Compression</h3><p>A technique called <strong>message compression</strong> is used to reduce the length of DNS messages by removing duplicated information. This technique targets the names contained in the records carried in the four sections of a DNS message.</p><p>According to the DNS message compression technique, a name can be provided either as a sequence of<strong> data labels</strong><em>,</em> as a<strong> compression label</strong><em>,</em> or as a mix of data and compression labels.</p><ul><li><strong>A data label</strong> starts with one byte indicating the length in bytes of the label. The last label of a name is followed by the null label 0x00.</li></ul><blockquote>Example: Data label ‘fr’ is encoded by value 0x02667200 where 0x02 is the length of the label (2 characters) and 0x6672 the ASCII codes in hex for characters ‘f’ (0x66) and ‘r’ (0x72). 0x00 is the ending label since ‘fr’ is a TLD domain.</blockquote><ul><li><strong>A compression label</strong> refers to a 2-byte label which points to one or many consecutive data labels located above in the DNS message. Instead of repeating the same data label(s), a compression label indicates where to find the data label(s) to be reused. A compression label is 2-byte (e.g., 16-bit) long: The value of the first two bits are set to 0b11 and the remaining 14 bits indicates the offset of the data label(s) to be reused in the DNS message.</li></ul><blockquote>Example: 0xC010 indicates that this is a compression label and the data label(s) to be reused is (are) located 16 (0x0010) bytes from the start of the DNS message. All labels, if many, will be read starting from byte 16 until the ending label 0x00.</blockquote><h3>An Illustrative Example of DNS Compression</h3><p>The following figure shows the DNS answer message received in response to a DNS query for name “www.upmc.fr”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*wFO5n0I-KtRC34VLp5DmpQ.png" /><figcaption>The DNS answer message for query “www.upmc.fr” is highlighted in blue. The first bytes correspond to the header of the encapsulating Ethernet frame.</figcaption></figure><p>The values for the header fields of this message are:</p><ul><li>Identification: 0x37E5</li><li>Control: 0x8180</li><li>Number of questions: 0x0001</li><li>Number of answers: 0x0002</li><li>Number of authority: 0x0000</li><li>Number of additional: 0x0000</li></ul><p>The header is followed by the 2 non-empty sections Question and Answers.</p><p>The Question section contains one question record:</p><blockquote>{NAME=www.upmc.fr, TYPE=1 (A), CLASS=1 (IN)}</blockquote><p>The Answer section contains 2 resource records:</p><ul><li>Resource Record 1: Type CNAME</li></ul><blockquote>{NAME=www.upmc.fr, TYPE=5 (CNAME), CLASS=1 (IN), TTL=30 (seconds), RDLENGTH=6 (bytes), CNAME=web.upmc.fr}</blockquote><ul><li>Resource Record 2: Type A</li></ul><blockquote>{NAME=web.upmc.fr, TYPE=1 (A), CLASS=IN (1), TTL=30 (seconds), RDLENGTH=4 (bytes), RDATA=134.157.250.59}</blockquote><p>The DNS answer message contains 4 names listed below by order of appearance:</p><ul><li>Name 1: www.upmc.fr (3 data labels)</li><li>Name 2: www.upmc.fr (1 compression label)</li><li>Name 3: web.upmc.fr (1 data label, 1 compression label)</li><li>Name 4: web.upmc.fr (1 compression label)</li></ul><p>In the following table, each row represents a data label or a compression label. The value of each column varies depending on whether the row represents a data label or a compression label.</p><p>For a data label:</p><ul><li>Column 1: The length of the label,</li><li>Column 2: The value of the label in hexadecimal,</li><li>Column 3: The value of the data label in plain characters.</li></ul><p>For a compression label:</p><ul><li>Column 1: The value of the compression label in hexadecimal,</li><li>Column 2: The value of the offset in decimal,</li><li>Column 3: The value of the data labels (in plain characters) that have been compressed.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*THz2MTR0avTgr6VG5JIdKA.png" /><figcaption>List of labels: First column constrains the length of the data label or the value of the compression label.</figcaption></figure><p>After compression, the DNS message is 63 byte long. With no compression, the DNS message would have been 92-byte long:</p><blockquote>name 1: 13 bytes (www.upmc.fr)</blockquote><blockquote>name 2: 13 bytes instead of 2 bytes (www.upmc.fr)</blockquote><blockquote>name 3: 13 bytes instead of 6 bytes (web.upmc.fr)</blockquote><blockquote>name 4: 13 bytes instead of 2 bytes (web.upmc.fr)</blockquote><blockquote>63-(2+6+2)+3*13 = 92 bytes.</blockquote><p>The compression ratio for the DNS message in this example is 31.52%.</p><p>Let’s now consider the following trace representing the answer of the DNS request for lip6.fr&#39;s authoritative servers (<em>nslookup -type=NS lip6.fr</em>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VWOXNj-KfAUbsv8UN1goQg.jpeg" /><figcaption>The DNS answer message for “lip6.fr” authoritative servers is highlighted in blue. The first bytes correspond to the header of the encapsulating Ethernet frame.</figcaption></figure><p>What is the compression ratio for this message? <a href="https://bit.ly/3DSZPOw">Detailed answer here</a>.</p><h3>Final Word</h3><p>Techniques such as DNS message compression are of paramount importance for the Internet of Things and the integration of low-powered wireless devices as these techniques lower the size of IPv6 packets to match small MTUs. DNS message compression exploits the hierarchical nature of domain names. This technique works by removing the duplicated names and the labels shared between names belonging to domains under the same parent domain.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c49568b234a2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Comprendre Internet et son fonctionnement]]></title>
            <link>https://spathis.medium.com/comprendre-internet-et-son-fonctionnement-9b2f63a07430?source=rss-2a130a6be6b5------2</link>
            <guid isPermaLink="false">https://medium.com/p/9b2f63a07430</guid>
            <category><![CDATA[internet]]></category>
            <category><![CDATA[tcp]]></category>
            <category><![CDATA[ip]]></category>
            <category><![CDATA[lecture-notes]]></category>
            <category><![CDATA[education]]></category>
            <dc:creator><![CDATA[Promethee Spathis]]></dc:creator>
            <pubDate>Sun, 29 Aug 2021 07:09:59 GMT</pubDate>
            <atom:updated>2023-01-13T14:42:48.940Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OHZyWeh67L_CB3O49pV5Wg.jpeg" /><figcaption>Les pionniers de l’Internet : de gauche à droite, Jon Postel, Steve Crocker et Vint Cerf.</figcaption></figure><p>Dans cet article, j’introduis les notions et concepts nécessaires à la compréhension d’Internet et aux réseaux de données en général.</p><p>Cet article est basé sur le chapitre de mon ouvrage intitulé “<a href="bit.ly/3XE6RB5">Technologies et protocoles Internet</a>” publié dans la collection Références sciences des éditions Ellipses.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/510/1*oZx6PdHiedDdVxfWHoT8cQ.png" /><figcaption>“<a href="http://bit.ly/3XE6RB5">Technologies et protocoles Internet</a>”. Promethee Spathis. Ellipses 2023.</figcaption></figure><p>Cet article concentre en grande partie sur les notes de cours de l’unité d’enseignement LU3IN033 que <a href="https://medium.com/u/2a130a6be6b5">Promethee Spathis</a> enseigne à Sorbonne Université et que vous pouvez <a href="https://youtube.com/playlist?list=PL9ajI3AAR78p39TV7d_Mu6GSrJPKLGzb-">visionner sur YouTube</a>.</p><h3><strong>Les données, d’où viennent-elles et pourquoi les transporter ?</strong></h3><p>Les <strong>données</strong> font référence aux bits que génèrent les <strong>applications</strong> exécutées à l’initiative des<strong> utilisateurs</strong> sur leur ordinateur. Des exemples d’applications sont les navigateurs Web, les clients mail ou un client BitTorrent. Toutes ces applications sont des programmes qui communiquent avec un programme homologue, exécuté sur une machine distante.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oeABeIrChZ205e6o6XKrZA.png" /><figcaption>Les <strong>machines hôtes</strong> situées à la périphérie du réseau hébergent les <strong>applications</strong>. Dans le cadre des applications client serveur, on distingue les <strong>serveurs</strong> qui proposent des contenus et des services que les <strong>clients</strong> accèdent en soumettant des requêtes.</figcaption></figure><h4><strong>Modèle client-serveur</strong></h4><p>Originellement, ces deux programmes étaient conçus de manière <strong>asymétrique</strong> : le programme distant diffère de celui exécuté sur l’ordinateur des utilisateurs. En tant qu’utilisateurs, nous nous connectons à un réseau de données en vue de recevoir une page web, des images, un email ou une vidéo. Ces objets sont hébergés sur des machines appelées <strong>serveurs</strong>. Nous sommes les <strong>clients</strong> de ces machines qui, du fait de répondre à nos requêtes, sont appelées serveurs.</p><p>Les serveurs offrent des capacités de stockage qui leur permettent d’héberger des contenus accessibles à tous. Les serveurs disposent également de capacités de traitement qui leur permettent de traiter les requêtes de leurs clients.</p><h4><strong>Modèle pair-à-pair</strong></h4><p>Récemment, on a vu l’avènement d’un nouveau type d’applications résultant de l’exécution de programmes identiques. On parle d’applications <strong>pair-à-pair</strong> où une même machine peut agir aussi bien en tant que client que serveur.</p><h4><strong>Interopérabilité</strong></h4><p>Applications client-serveur ou pair-à-pair sont mises à disposition au téléchargement par leurs développeurs. Les utilisateurs sont libres d’installer ces applications sur leur ordinateur. Il n’y a pas, à proprement parler, de réel contrôle concernant les applications qu’un utilisateur peut installer sur son ordinateur.</p><p>Qu’ils s’agissent des constructeurs de matériel informatique ou des concepteurs de systèmes d’exploitation qui équipent nos ordinateurs à leur achat, tous œuvrent dans le but de concevoir des équipements ouverts et interopérables qui rendent leurs produits attractifs du fait de leur versatilité. C’est ce qui a fait le succès de l’Internet.</p><p>L’utilisation de certains logiciels peut être restreinte. Un fournisseur d’accès Internet (FAI) peut éventuellement être soumis aux lois nationales contre le piratage informatique ou la violation des droits d’auteur par exemple. Pour autant, les FAI ne sont pas toujours en mesure de filtrer avec succès les trafics dérogeant à ces lois.</p><h3><strong>Comment les données </strong>sont-elles ‘emballées’<strong> en vue de leur transport ?</strong></h3><p>A la manière des produits ou denrées transportés par un transporteur tel que Colissimo ou UPS, les données ont besoin d’être emballées.</p><h4>Fragmentation</h4><p>Dans un réseau de données, les données sont <strong>fragmentées</strong> : une longue série de bits de données appartenant à un même fichier est répartie dans plusieurs colis appelés <strong>messages</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pxnr5ujolpv5FYwlCQ5sjQ.png" /><figcaption>Les bits de données appartenant à un même fichier sont <strong>fragmentés</strong> et répartis dans plusieurs messages. Un <strong>entête</strong> est ajouté à chaque fragment. Les entêtes contiennent des bits de contrôle nécessaires au transport des données.</figcaption></figure><h4><strong>Encapsulation et désencapsulation</strong></h4><p>L’équivalent des cartons d’emballage sont des bits supplémentaires ajoutés généralement en tête des bits de données appelés de ce fait, <strong>entête</strong>. A la manière des dimensions ou du poids d’un colis, la longueur des messages exprimée en nombre de bits est soumise à des restrictions qui imposent une longueur minimale et maximale. L’ajout d’un entête est appelé <strong>encapsulation</strong> et le retrait de l’entête <strong>désencapsulation</strong>.</p><h4><strong>Entête et charge utile</strong></h4><p>Dans un réseau de données, un colis est donc un message constitué d’un entête et des bits de données. Les bits de données forment le corps du message que l’on appelle aussi <strong>charge utile</strong> du message. Les messages ayant une longueur maximale, plusieurs messages sont nécessaires pour transmettre un même objet telle qu’une image.</p><p>Dans l’entête d’un message, on retrouve des bits appelés <strong>informations de contrôle</strong> telles que l’adresse du destinataire et celle de l’expéditeur. A la manière du papier-bulle utilisé pour éviter la casse des produits fragiles, l’entête peut également contenir des bits appelés <strong>somme de contrôle</strong> permettant de détecter les bits reçus en erreur. Une fois détectées, on peut réparer les erreurs en retransmettant les messages erronés.</p><p>Les bits correspondant aux adresses ou la somme de contrôle sont des exemples de champs. Un entête est une succession de <strong>champs</strong> dont la longueur est variable ou fixe. La <strong>structure d’un entête </strong>aussi appelé <strong>format d’un entête</strong> fait référence aux champs qui composent cet entête. Pour chaque champ est précisé le nom, la longueur en bits, et sa signification selon la valeur qu’il contient. La valeur d’un champ peut être fournie sous la forme d’un code binaire (la valeur 0x06 fait référence au protocole TCP) ou du code ASCII de la valeur en question (la valeur 0x474554 indique la méthode GET).</p><h3><strong>Transporter les données avec des garanties</strong></h3><p>L’entête d’un message étant ajouté dans un but précis, plusieurs entêtes sont nécessaires afin d’assurer les nombreuses propriétés attendues concernant le transport des données.</p><p>De telles propriétés comprennent la fiabilité (réception de l’intégralité des données, exemptes d’erreurs), l’efficacité (la quantité des données émises maximise l’utilisation de la capacité du réseau) ou la résistance au facteur d’échelle.</p><h4><strong>Fiabilité</strong></h4><p>Des messages pouvant être perdus, reçus en erreur, en désordre ou dupliqués, des bits de contrôle sont inclus dans leur entête. Ces bits font référence à un numéro appelé <strong>numéro de séquence </strong>qui permet de détecter les messages manquants, de réordonner les messages ou de supprimer les doublons. On trouve également une <strong>somme de contrôle</strong> dont le rôle est de vérifier si le message contient des bits en erreur. Comme l’indique son nom, son calcul résulte de la somme des bits du message avant son envoi. A sa réception, le destinataire refait le même calcul et vérifie si le résultat coïncide avec la somme calculée par la source.</p><h4><strong>Efficacité</strong></h4><p>L’efficacité dans un réseau de données est similaire à celle qu’un transporteur met en œuvre pour s’assurer que ses fourguons sont tous utilisés au maximum de leur capacité de transport. L’efficacité peut également faire référence à la proportion du message occupée par son entête comparée à sa charge utile. Si envoyer un colis est facturé sur la base de son poids brut, l’expéditeur cherchera à minimiser le poids du carton d’emballage. Il en va du même des autoroutes dont le nombre de voies est déterminé de façon à éviter les bouchons mais également leur sous-utilisation. Le coût de réalisation et d’exploitation des autoroutes doit être en adéquation avec leur utilisation, leur financement dépendant des recettes aux péages. On parlera alors d’utilisation efficace des autoroutes. De la même manière, les coûts liés au déploiement et à la maintenance d’un réseau de données ainsi que sa capacité doivent être en adéquation avec le volume des données transportées, le nombre d’utilisateurs et le prix d’un abonnement Internet.</p><h4><strong>Résistance au facteur d’échelle</strong></h4><p>Une autre propriété est la résistance au facteur d’échelle (ou scalabilité). Il s’agit d’un principe de conception qui caractérise un système dont les performances ne sont pas, ou sont peu sensibles à une grandeur dénombrable croissante, caractérisant ce système. Cette grandeur peut faire référence au nombre d’utilisateurs ou de nœuds dans un réseau. Une autre grandeur peut aussi faire référence au nombre de messages en transit dans le réseau ou de requêtes que reçoit un serveur. Un transporteur de colis doit s’assurer du bon déroulement de ses opérations, y compris à l’occasion des fêtes de fin d’années.</p><p>Dans un réseau de données, pour assurer les nombreuses propriétés attendues concernant la livraison des données, un seul entête ne suffit pas.</p><h3><strong>Architecture en couches</strong></h3><p>Un message comprend donc une série d’entêtes ajoutée aux bits de données. Un entête est ajouté dans un but spécifique qui détermine le type d’informations contenues dans cet entête. L’ajout d’un entête se fait en sollicitant un programme qui prend en paramètre les bits de données.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dGjHn8_Rq91OSgSW-NtsnA.png" /><figcaption>Préalablement à leur envoi, les données transitent le long d’une chaîne de programmes qui chacun ajoute un entête. Le dernier programme à ajouter un<strong> entête</strong> ajoute également un<strong> enqueue</strong>.</figcaption></figure><p>Les bits de données passent par une série de programmes qui se relaient pour ajouter un entête supplémentaire avant que le message final soit prêt à être transmis sur le support de transmission. Le dernier programme à ajouter un entête, ajoute également des bits en fin du message appelés de ce fait <strong>enqueue</strong> du message.</p><p>A la réception du message final, les entêtes sont progressivement retirées en traversant une séquence de programmes similaire à celle traversée avant l’émission de ce message mais en sens inverse. Le dernier entête à avoir été ajouté est le plus externe (situé à gauche) et donc le plus accessible. Chaque programme accède uniquement à l’entête ajouté côté émetteur par son programme homologue.</p><h4><strong>Couches et protocoles</strong></h4><p>Dans Internet, les programmes qui contribuent à la préparation des données en vue de leur transmission sont au nombre de 5. En première position, on retrouve les programmes applicatifs qui génèrent les données côté émetteur et les consomment côté récepteur. En dernière position, on retrouve la carte réseau dont les composants matériels transforment le message sous la forme d’un signal émis sur le support de transmission.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kHsPyrIl9OWOcVQJKPRurA.png" /><figcaption>Les programmes qui contribuent à la préparation des données en vue de leur transmission sont au nombre de 5. <strong>Par souci de représentation</strong>, ces programmes sont <strong>empilés</strong> et on parle, de ce fait, de <strong>couches </strong>en lieu en place de ces programmes.</figcaption></figure><p><strong>Empilement.</strong> Par souci de représentation, ces programmes sont empilés les uns sur les autres et la traversée des données se fait de haut en bas côté émetteur et de bas en haut côté récepteur. On parle alors de <strong>couches</strong> en lieu et place des programmes, une même couche pouvant être implémentée de plusieurs manières différentes selon les propriétés attendues de cette couche.</p><p><strong>Protocole. </strong>Une couche collabore avec sa couche homologue distante selon des règles bien précises concernant la structure de l’entête qu’elle ajoute et retire aux messages. Ces règles définissent également les actions à exécuter en vue de l’émission ou suite à la réception d’un message. De ces actions peuvent résulter l’installation, la mise à jour ou la suppression d’un <strong>état</strong>. Un état fait référence à une valeur stockée en mémoire qui caractérise l’état de l’échange entre deux machines. L’ensemble de ces règles forme un <strong>protocole</strong>. Pour communiquer entre elles, deux machines exécutent simultanément plusieurs protocoles, un par couche.</p><p><strong>Standardisation.</strong> Certains protocoles ont été standardisés rendant ainsi leurs spécifications accessibles à tous. C’est le cas par exemple de HTTP, le protocole qui régit les communications entre navigateurs et serveurs Web. Les spécifications de HTTP étant publiques, plusieurs navigateurs sont proposés par différentes sociétés telles que Microsoft ou Google. Du fait d’avoir été développés conformément au standard, navigateurs et serveurs savent communiquer entre eux, le logiciel coté serveur étant également conforme au standard.</p><p><strong>Entête de protocole. </strong>À la manière des étiquettes apposées sur un colis, un protocole ajoute un entête à l’émission d’un message. La position de cet entête est déterminée par la couche à laquelle le protocole appartient. L’entête est ajouté en vue d’être lu par sa couche homologue une fois le message reçu. Ce sont les informations de contrôle contenues dans les champs de cet entête qui permettent de déterminer les actions à entreprendre à la réception du message. Des exemples d’actions inclus l’installation ou la mise à jour d’un <strong>état</strong>, la génération d’une réponse sous la forme d’un message retourné à la source ou la suppression du message si reçu en erreur par exemple. De l’exécution de ces actions résultera le service attendu de cette couche.</p><p><strong>Services de communication.</strong> Une même couche pouvant offrir différents types de service, certaines couches implement plusieurs protocoles. C’est le cas de la couche application qui implémente autant de protocoles que d’applications installées sur nos ordinateurs. Un service de communication résulte de l’exécution du protocole spécifique à la couche qui offre ce service.</p><p>L’ensemble des couches et des protocoles qu’elles implémentent constitue ce qui est communément appelée une <strong>architecture de réseau</strong>. Du fait de l’empilement des couches qui implémentent les protocoles, on parle aussi d’<strong>architecture en couches</strong>.</p><h3><strong>Internet et modèle OSI</strong></h3><p>Les composants logiciels et matériels qui permettent aux utilisateurs d’envoyer ou de recevoir des données via les applications qu’ils installent sur leur machine sont donc structurés en couches, au nombre de 5 dans Internet.</p><p>Les fonctions prises en charge par chacune de ses couches sont habituellement décrites en faisant référence au <strong>modèle OSI</strong> (Open Systems Interconnection) normalisé dans les années 1970 par l’ISO (International Organization for Standardization). Le modèle OSI comporte 7 couches identifiées par un numéro et un nom. La numérotation commence à 1 pour la couche la plus basse appelée couche Physique.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K13W05xmhPBQ2Gtw7MYx5w.png" /><figcaption>Source et destination implémentent une pile protocolaire composée de protocoles qui chacun, ajoute côté émetteur un entête aux données provenant de la couche immédiatement supérieure. Côté récepteur, les couches retirent l’entête aux messages passées par la couche immédiatement inférieure.</figcaption></figure><p>Sur les 7 couches du modèle OSI, seules 5 ont été implémentées dans Internet, les fonctions des couches numérotées 5 et 6, appelées Session et Présentation respectivement, étant prises en charge pour certaines par la couche 7. L’ensemble de ces couches et les protocoles qu’elles implémentent forment une <strong>architecture de réseau</strong>. On parle aussi de<strong> pile protocolaire</strong> pour faire référence à l’ensemble des protocoles réunis au sein d’une même architecture de réseau.</p><h4><strong>Couche Application (7)</strong></h4><p>L’architecture de Internet comprend au niveau le plus élevé la couche 7 appelée couche Application. Les programmes qui implémentent cette couche sont par exemple, les navigateurs Web côté client et les serveurs Web côté serveur. Leur but est d’exécuter le protocole HTTP (Hypertext transfer protocol) qui permet le téléchargement des pages Web.</p><p>Les deux couches suivantes nommées couche Transport (couche 4) et couche Réseau (couche 3) sont fournies avec les systèmes d’exploitation installés sur les ordinateurs personnels, les smartphones ou autres objets communicants.</p><h4>C<strong>ouche Transport (4)</strong></h4><p>La couche 4 appelée couche Transport offre deux services résultant de deux protocoles : TCP (Transmission control protocol) et UDP (User datagram protocol).</p><p>TCP segmente les données générées par l’application émettrice et ajoute à chaque segment un entête. Le message résultant de cette encapsulation est appelé <strong>segment</strong>. Dans le cas de UDP, les données générées par l’application ne sont pas segmentées. UDP se contente d’ajouter son entête aux données applicatives. Le message résultant de l‘encapsulation des données applicatives est appelé <strong>datagramme</strong>. Si la taille du datagramme le requiert, c’est la couche Réseau (3) sous-jacente qui se chargera de sa fragmentation.</p><p>C’est la couche Transport qui fournit aux développeurs l’interface de programmation, appelée <strong>socket</strong>,<strong> </strong>qui permet de concevoir des applications réseau.</p><h4>C<strong>ouche Réseau (3)</strong></h4><p>La couche 3 appelée couche Réseau implémente le protocole IP (Internet Protocol) qui ajoute à son tour un entête et le message qui en résulte est appelé <strong>paquet</strong>. Un paquet est donc un segment TCP ou un fragment de datagramme UDP auquel a été ajouté un entête de couche 3. Cet entête contient notamment les adresses source et destination du paquet. La couche 3 a pour rôle l’acheminement des paquets vers leur destination.</p><h4>C<strong>ouche Liaison de données (2)</strong></h4><p>La couche 2 appelée couche Liaison de données est à la fois logicielle et matérielle. La partie logicielle correspond aux pilotes qui permettent d’interagir avec la partie matérielle qui elle, correspond aux cartes réseau telles que Ethernet ou Wifi. La couche Liaison de données a la particularité d’ajouter un entête mais également un enqueue à la suite des bits de données du paquet pour former une <strong>trame</strong>.</p><h4><strong>Couche Physique (1)</strong></h4><p>La partie matérielle comprend également la couche 1 appelée couche Physique. Elle est responsable de la conversion des bits sous la forme d’un signal adapté aux supports de transmission. Dans l’architecture Internet, les couches 1 et 2 forment un tout dénommé <strong>interface réseau</strong> que l’on désigne usuellement par l’identifiant <em>eth0 </em>dans le cas des cartes Ethernet ou Wifi.</p><p>Les couches 1 et 2 dépendent des caractéristiques physiques du support de communication et du nombre de machines connectées à ce support.</p><h3><strong>Cœur vs. périphérie du réseau</strong></h3><p>Dans Internet, la pile TCP/IP fait référence aux deux protocoles implémentés respectivement par la couche Transport (4) et Réseau (3). Pour comprendre le rôle des couches 4 et 3 dans Internet, il est nécessaire de présenter les deux types de machines que l’on trouve dans les réseaux de données. Ces deux types de machines différent selon :</p><ol><li>leur position dans le réseau et</li><li>les fonctions qui leur incombent.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wGo75f6pNj2yPVDSZ8Oaxg.png" /><figcaption>Les <strong>machines hôtes</strong> sont situées à la périphérie du réseau. Le cœur du réseau est formé d’une interconnexion partiellement maillée d’équipements appelés <strong>routeurs </strong>en charge d’acheminer les données entre machines hôtes source et destination.</figcaption></figure><h4>Machines hôtes vs. routeurs</h4><p><strong>Machines hôtes. </strong>Le premier type de machines sont les ordinateurs personnels, tablettes, smartphones et autres dispositifs que nous utilisons pour accéder à Internet. Ces machines sont les seules où peuvent être installées et exécutées les applications dans un réseau. Du fait d’héberger les applications, ces machines sont appelées <strong>machines hôtes</strong>. Elles forment la <strong>périphérie du réseau</strong> où les données sont générées et consommées. Les machines hôtes sont donc situées aux extrémités des communications.</p><p><strong>Routeurs. </strong>Le second type de machines sont les noeuds internes du réseau appelés <strong>routeurs</strong>. Ces derniers sont reliés entre eux par des liens selon une configuration formant un maillage partiel. Les routeurs et les liens les reliant forment ce qu’on appelle le <strong>cœur du réseau</strong> en opposition à la périphérie du réseau où se retrouvent les machines hôtes. Cette interconnexion de routeurs permet de minimiser le nombre de liens nécessaires pour connecter les machines hôtes entre elles.</p><p>Parmi l’ensemble des routeurs, on distingue ceux situés en bordure du cœur auxquels se connectent les machines hôtes pour accéder au réseau. Ces routeurs sont de ce fait dénommés <strong>routeurs d’accès</strong>. Les machines hôtes accèdent à Internet en contactant un premier routeur qui agit comme la passerelle par défaut appelée en anglais <strong>default gateway</strong>. Les machines hôtes qui utilisent les services d’une même passerelle sont connectées à un même réseau physique appelé <strong>réseau local</strong>.</p><p>Le rôle des routeurs découle de la topologie du réseau de cœur. Le maillage partiel entraîne l’existence de plusieurs chemins alternatifs entre paires de machines hôtes. Il est donc nécessaire pour chaque destination de sélectionner un chemin unique, le long duquel seront acheminés invariablement les messages tant que ce chemin reste disponible. Nous verrons que cette constance dans le choix du chemin emprunté par l’ensemble des messages pour une même destination est primordial pour la réparation efficace de leur perte.</p><h4>Routage vs. acheminement</h4><p>Le rôle d’un routeur est donc double. Le premier est l’acheminement des données, le second est le routage (ou sélection de chemins). Un routeur achemine les messages en les transmettant sur le lien de sortie qui les rapprochera de leur destination finale. Ce lien de sortie permet de joindre un nœud voisin appelé <strong>saut suivant</strong>. Le choix du saut suivant résulte d’un algorithme de routage dont l’objectif est de choisir un chemin pour chaque destination du réseau.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-iN6yXJu0qiUQXdNA6Qj8g.png" /><figcaption>Routage vs. acheminement.</figcaption></figure><p><strong>Algorithme de routage. </strong>Pour ce faire, certains algorithmes de routage calculent le chemin le plus court, la distance des chemins pouvant faire référence au nombre de routeurs qu’ils les constituent par exemple. C’est le cas de l’algorithme de Bellman-Ford. Si les liens sont configurés avec un coût, le chemin choisi est alors celui dont la somme des coûts des liens qui le constituent, est la plus petite. C’est le cas de l’algorithme de Dijkstra. D’autres algorithmes considèrent les accords commerciaux entre FAI (Fournisseurs d’accès Internet) qui collaborent pour acheminer les données sur des distances couvrant des zones géographiques étendues telles que des pays ou des continents.</p><p><strong>Protocole de routage. </strong>Pour s’exécuter, ces algorithmes ont besoin de connaître la topologie partielle ou complète du réseau. Les routeurs la découvrent en exécutant un protocole de routage implémenté par la couche Réseau (3) des routeurs. Un protocole de routage permet aux routeurs de collaborer en échangeant des messages contenant des informations sur la topologie du réseau et selon les règles définies par le protocole de routage. Des exemples de protocole de routage sont RIP (Routing information protocol), OSPF (Open shortest path first) ou BGP (border gateway protocol).</p><p><strong>Adressage. </strong>Pour calculer les chemins, les routeurs doivent connaître la position des nœuds au sein de la topologie du réseau. Pour ce faire, une valeur unique appelée <strong>adresse</strong> est attribuée à chacun des nœuds. Dans le cas de Internet, cette adresse est une valeur binaire longue de 32 bits appelée <strong>adresse IP</strong>. Les adresses IP sont présentées au format décimal pointé : les quatre octets qui les forment sont convertis en décimal et les valeurs décimales résultant de cette conversion séparées par un point.</p><p>A la manière des numéros de téléphone, les adresses IP sont attribuées hiérarchiquement par les fournisseurs Internet. Tout comme les indicatifs téléphoniques qui identifient une zone géographique, les premiers bits d’une adresse identifient le réseau auquel est connecté la machine à qui appartient l’adresse. Ces bits appelés<strong> préfixe réseau</strong> ont une longueur variable déterminée par le nombre de bits positionnés à 1 dans une adresse particulière appelée <strong>masque de réseau</strong>, défini pour tout réseau.</p><p>Nous verrons par la suite que les machines sont identifiées par une seconde adresse appelée <strong>adresse MAC</strong>, gérée par la couche Liaison de données.</p><p><strong>Plan de données vs plan de contrôle.</strong> L’acheminement des données et la sélection des chemins qu’empruntent les données sont des fonctions réalisées par la couche Réseau (3). Les fonctions nécessaires à l’acheminement des données font partie du plan de données et celles nécessaires à la sélection des chemins font partie du plan de contrôle des routeurs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kRaa0y4EJ8wBiL5NS3HgZg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8JIm7csCagQMDouTKpl6HQ.png" /><figcaption>Plan de contrôle distribué vs. centralisé.</figcaption></figure><p><strong>Plan de gestion. </strong>En plus des plans de données et de contrôle, on trouve le <strong>plan de gestion</strong> qui réunit les fonctions nécessaires à la configuration et la supervision des plan de données et de contrôle des routeurs. C’est du plan de gestion que résulte par exemple la configuration du coût des liens nécessaire au protocole OSPF. Si les plans de données et de contrôle sont automatisés, le plan de gestion lui nécessite l’intervention manuelle d’un administrateur.</p><p>L’ensemble des autres fonctions nécessaires à la livraison des données sont prises en charge par les machines hôtes. Ces fonctions sont réalisées par la couche Transport, numérotée 4. Elles répondent aux besoins des applications qui s’exécutent au niveau 7. Ces fonctions incluent la fiabilisation des messages ou l’utilisation efficace et équitable de la bande passante du réseau.</p><p><strong>Fiabilisation. </strong>Au cours de leur acheminement, des messages peuvent être perdus ou reçus en erreur. Dans l’architecture Internet, la correction des pertes de messages et des messages en erreur est à la charge de la couche Transport (4). Ces pertes pouvant résulter de l’absence de ressources nécessaires pour traiter les messages si en surnombre, il est nécessaire d’ajuster le débit d’émission des sources de façon à éviter les pertes qui pourraient s’ensuivre. Cet ajustement se fait équitablement parmi l’ensemble des sources dont les messages empruntent le même chemin. La bande passante utilisée par chacune de ces sources est répartie équitablement.</p><p>La couche Réseau (3) se retrouve sur l’ensemble des machines de l’Internet y compris les machines hôtes, ces dernières étant responsables de définir les adresses IP source et destination des paquets. La couche Transport (4), quant à elle, est présente uniquement sur les machines hôtes. Ce choix résulte d’un principe de conception appelé le <strong>principe du bout en bout</strong>.</p><h3><strong>Principe de bout en bout</strong></h3><p>Le principe de bout en bout exerce une force centrifuge sur les fonctions nécessaires à la livraison des données. Lorsque le choix est donné de concevoir une fonction en faisant intervenir, soit toutes les machines du réseau y compris les routeurs, ou uniquement les machines hôtes de la périphérie, il est recommandé de privilégier en priorité la seconde solution.</p><p>La logique du principe de bout en bout est d’éviter l’exécution répétée d’une même fonction sur l’ensemble des routeurs situés le long du chemin que traverse un message. Dans le cas de l’Internet, la longueur d’un chemin alterne en moyenne entre 15 et 20 sauts. En cantonnant l’installation d’une fonction uniquement aux extrémités, cette même fonction est exécutée deux fois. C’est le cas des fonctions nécessaires à la réparation d’un message en erreur ou perdu.</p><h4><strong>Fiabilisation de bout en bout</strong></h4><p>Dans Internet, la détection des messages en erreur résulte de l’utilisation d’une somme de contrôle qui permet au récepteur de détecter les messages contenant des bits de données en erreur. Ces erreurs peuvent intervenir plus en amont le long du chemin mais ce n’est qu’une fois le message acheminé jusqu’à sa destination finale qu’il sera rejeté par le récepteur qui prétendra ainsi ne pas l’avoir reçu.</p><p>L’absence d’accusé de réception provoquera l’expiration d’un temporisateur armé par la source à l’émission du message et la retransmission du message. La valeur du temporisateur de retransmission est calculée de façon à refléter la durée d’un aller-retour entre source et récepteur du message. Pour garantir la validité de cette valeur, il est nécessaire de préserver la longueur du chemin entre source et récepteur. De ce fait, l’acheminement des paquets dans Internet se fait le long d’un chemin unique qui ne changera qu’en cas de défaillance.</p><p>En limitant l’exécution de ces fonctions aux seules extrémités, on retarde la réparation d’un message en erreur. Ce retard est cependant acceptable en comparaison au délai et à la charge qu’aurait induit l’exécution d’une fonction similaire mais implémentée sur l’ensemble des routeurs du réseau.</p><h4>Serveurs proxy</h4><p>Il en va de même pour la plupart des fonctions nécessaires à la livraison des données. Cependant, des exceptions existent, notamment sous la forme des serveurs dits mandataires, appelés <strong>proxy servers</strong> en anglais. Un proxy est un équipement installé le long des chemins entre clients et serveurs. Leur rôle est d’intercepter les requêtes des clients et de se substituer, lorsque possible, aux serveurs. C’est le cas des caches Web qui stockent temporairement les pages Web les plus populaires afin d’accélérer leur livraison, les caches Web étant situés au plus prêt des clients comparés aux serveurs auxquels ils se substituent. Les caches Web assurent des fonctions applicatives censées être cantonnées à la périphérie du réseau. C’est dans ce sens que les proxys font exception au principe de bout en bout.</p><h4><strong>Mode datagramme vs mode circuit virtuel</strong></h4><p>Il existe d’autres architectures de réseau qui, contrairement à Internet, ont fait le choix d’impliquer les nœuds internes de leur réseau dans la fiabilisation des messages échangés. C’est le cas de Transpac par exemple dont les nœuds internes appelés <strong>commutateurs </strong>réservent préalablement les ressources nécessaires à l’acheminement des messages en vue d’éviter leurs pertes, faute de ressources. Ces ressources sont réservées au niveau des commutateurs situés le long du chemin qu’emprunteront par la suite les messages et ce, invariablement. L’ensemble des ressources réservées forme une <strong>connexion </strong>et le chemin, un <strong>circuit virtuel</strong>. On parle de<strong> service en mode circuit virtuel</strong>. Une rupture de lien ou la perte d’un des commutateurs situés le long d’un circuit virtuel entraîne l’interruption de la communication. Pour la rétablir, une nouvelle connexion est nécessaire.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QXOgs01TLVjomgUWPE1xCA.png" /><figcaption>Mode circuit virtuel vs. datagramme.</figcaption></figure><p>Les mécanismes de réservation de ressources complexifient le fonctionnement des commutateurs et inexorablement, leur coût. Ce choix de conception n’a pas été suivi dans Internet. Le chemin n’étant pas fixé au préalable, on parle de service en <strong>mode datagramme</strong>. Un datagramme suit un chemin sans la garantie que les ressources nécessaires à son acheminement soient présentes. L’absence de ressources suffisantes fait référence à la <strong>congestion</strong> qui provoque la destruction des datagrammes en excès. Dans Internet, les datagrammes font référence aux paquets IP qu’on appelle aussi de ce fait, datagramme IP.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9b2f63a07430" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tips & Tricks for Writing Effective Fill-In-The-Blank Questions]]></title>
            <link>https://spathis.medium.com/tips-tricks-for-writing-effective-fill-in-the-blank-questions-2d843bdf6638?source=rss-2a130a6be6b5------2</link>
            <guid isPermaLink="false">https://medium.com/p/2d843bdf6638</guid>
            <category><![CDATA[quiz]]></category>
            <category><![CDATA[cloze]]></category>
            <category><![CDATA[fill-in-the-blank]]></category>
            <category><![CDATA[moodle]]></category>
            <category><![CDATA[education]]></category>
            <dc:creator><![CDATA[Promethee Spathis]]></dc:creator>
            <pubDate>Wed, 25 Aug 2021 09:29:37 GMT</pubDate>
            <atom:updated>2023-05-09T07:22:22.023Z</atom:updated>
            <content:encoded><![CDATA[<h4>A comprehensive guide to Moodle Embedded-Answers (Cloze) questions</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qdry1QhzATi0_z4K27yFHw.png" /></figure><p>Moodle as many other learning managing systems allows instructors to design online assessments. <a href="https://spathis.medium.com/making-the-transition-to-take-home-exams-with-moodle-c377d3d7ec90">In Moodle, online assessments are called <em>quizzes</em></a>. Quizzes can be used to administer tests, assignments, quizzes, or exams.</p><p>A quiz consists of questions you can either create from scratch or select from the question bank. <a href="https://link.medium.com/ZVvRmDSmYeb">You can also let Moodle randomly select previously created questions from the question bank</a>.</p><p>Moodle offers <a href="https://docs.moodle.org/310/en/Question_types">a wide variety of question types</a>. Multiple choice, true-false, and matching questions are the most common type of question as they are thought to be the only questions that can be graded automatically. However, other question types such as Fill in the blank questions can also be graded automatically while offering greater flexibility. In Moodle, Fill in the blank questions are called Embedded-Answers or Cloze questions.</p><p><strong>In this article, I present how to write effective Fill in the blank (aka Embedded-Answers) Questions with Moodle. You can also download </strong><a href="http://bit.ly/moodle-cloze"><strong>the cheat sheet for Embedded-Answers Questions</strong></a><strong> at </strong><a href="https://www-npa.lip6.fr/~spathis/moodle-cloze-cheatsheet.pdf"><strong>bit.ly/moodle-cloze</strong></a>.</p><ul><li><em>I first introduce the four (4) main types of Embedded-answers questions.</em></li><li><em>I then present the Moodle text editor and the markup language for writing Embedded-answers.</em></li><li><em>I show the various feedback that students will receive after answering an embedded-answers question.</em></li><li><em>I give a handful number of tips to consider when developing embedded-answers</em> <em>questions.</em></li><li><em>Finally, I conclude this article with </em><a href="https://bit.ly/3g4XaIv"><em>an example of quiz</em></a><em> I give to the undergraduates who take my introductory course to Computer Networking at NYU Shanghai and Sorbonne Université.</em></li></ul><h3><strong>The 4 Types of Embedded-Answers Questions</strong></h3><p>Moodle Embedded-Answers questions are similar to Fill in the Blank questions on Sakai and other LMSes. There are <strong>four (4) main types of embedded-answers questions</strong>:</p><ul><li>Short Answer;</li><li>Numerical;</li><li>Multi-Choice;</li><li>Multi-Response.</li></ul><p>Below I present a preview of each type of embedded-answers questions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N5eLYB3Bg6IVSSaCox90mw.png" /><figcaption>Moodle offers 4 main types of embedded-answer questions.</figcaption></figure><p>For instance, when students encounter a Short Answer (Question 1 in the above figure) or a Numerical question (Question 7 in the above figure), they are presented with a text box in which they can enter their answer. Their answers will be compared to a list of predetermined answers provided during the authoring of the question. All predetermined answers come with the number of points they are worth. You can update the list of predefined answers and/or their points after the quiz due date and ask Moodle to regrade all student attempts.</p><h3>Moodle Text Editor</h3><p>To create an embedded-answers question, Moodle will present you with a page comprised of two text areas. The first text area is a text editor where you will add the text of your question and the markup text for the answers. The second text area is where you can optionally add the general feedback students will see after submitting their answers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*d8pEEi9V4FhFQbQ8.png" /><figcaption>Moodle’s question text editor.</figcaption></figure><p>The top of the question text editor is a toolbar with a list of icons to create headings, bold or italic text, color and highlight text, create numbered and bulleted lists, or adding media or links to a page.</p><p>By default, the toolbar is collapsed with only one row of the most commonly used tools showing. The default toolbar can be expanded to show all of its features by clicking the “Show/hide advanced buttons” button (e.g., the first on the left of the collapsed toolbar).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*THZ9tSZmB1IwnpUzQ0yoZw.png" /><figcaption>Moodle’s text editor extended toolbar.</figcaption></figure><p>Contrary to the question itself which can be specified in a WYSIWYG way, the embedded-answers follow a WYSIWYM (What you see is what you mean) approach. You need to follow a strict syntax for Moodle to understand how to grade the question. I will present the syntax of Moodle markup language in the next section.</p><p>Once you have entered your question into the first text area, you can see a preview of your question: Click “Save changes and continue editing”; A clickable magnifying glass icon will appear followed by “Preview”. A pop-up window will show a preview of the question you are authoring. The bottom of the window will give the following choices:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yaN0oxyj5lMGMvylthfqhw.png" /><figcaption>The bottom of the Preview question window.</figcaption></figure><p>“Fill in correct answers” will let you preview the correct answers you have programmed. You can also fill arbitrary answers and check how Moodle will grade the question after clicking “Submit and finish”.</p><p>Below, I show on the left, the markup text of two Short Answer subquestions and on the right, the resulting output the students will see. This question consists of two subquestions, each followed by the expected embedded-answer. You can add as many embedded-answers as subquestions in the main question you are creating.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-AkGMmBzoaDD3Snt.png" /><figcaption>Short Answer Question text and preview.</figcaption></figure><h3>The Embedded-Answers Markup Language</h3><p>The minimal syntax of an embedded-answer is the following:</p><blockquote><em>{:SA:=Correct Answer}</em></blockquote><p>This corresponds to an embedded-answer accepting a single correct answer with no specific feedback. The maximum score will be awarded only if students give the answer “Correct Answer”. Any extra space or spelling mistakes will be counted as wrong.</p><p>The full syntax of an embedded-answer is the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LKx1djTPBGqqidMqbv2wpg.png" /><figcaption>Embedded Answer question markup breakdown.</figcaption></figure><p>An embedded-answer is delimited by an opening and a closing curly bracket ‘{’ … ‘}’. Inside the brackets there are four parts, the first and last being optional:</p><ul><li>The first part is a strictly positive integer (1, 2, 3, etc.) that indicates the weight of the answer. This weight is used in the calculation of the overall question grade. In case of a question with multiple subquestions, the total points for the question will be computed as the weighted sum of all subquestion points using the weight assigned to each subquestion. If all subquestions have the same weight, this first part may be skipped.</li><li>The second part is delimited by semicolons (‘:’) and indicates the type of the embedded-answer (SA, NM, MC, MCH, MCV, MR, and MRH).</li><li>The third part gives the predefined answer(s) against which students’ answers will be matched. Each answer is preceded by its score given as a percentage of the total score awarded for the correct answer. Consecutive predefined answers are separated by the tilde symbol (‘~’). A correct answer is preceded by the equal sign (‘=’) or by ‘%100%’. This will indicate that the corresponding answer will be awarded the maximum score. A partially correct answer is typically preceded by a value greater than 0 but lower than 100 (e.g. ‘%50%’). The wildcard character (‘*’) can be used as a catch-all for all wrong answers. If wrong answers are awarded zero points, ‘ ~%0%*’ is optional. You can also award a negative score in case of any wrong answer (e.g. ‘%-50%*’).</li><li>The fourth and last part is optional. It indicates the specific feedback students will receive if enabled in the Quiz settings. The hash symbol (‘#’) that follows a predefined answer indicates the specific feedback the students who gave that answer will receive.</li></ul><h4>Short Answer Questions</h4><p>The table below presents various combinations of correct, partially correct, and incorrect answers and specific feedback with the corresponding Moodle markup text.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2rnyWXte3bOV2-eR.png" /><figcaption>Types of answers and feedback for Short Answer questions.</figcaption></figure><p>Below, I explain the syntax of Moodle’s markup text for each type of answers and feedback listed in the previous table.</p><p><strong>One correct answer:</strong></p><blockquote><em>{1:SA:=correct answer}</em></blockquote><p>where ‘=’ marks the correct answer.</p><p><strong>Multiple correct answers:</strong></p><blockquote><em>{1:SA:%100%correct answer 1~%100%correct answer 2}</em></blockquote><p>where ‘~’ is the separator between each answer and %100% the percentage of the subquestion total points for the corresponding answer. Any other answer than ‘correct answer 1’ and ‘correct answer 2’ will be considered wrong and awarded 0 points.</p><p><strong>Correct and partially correct answers with specific feedback:</strong></p><blockquote><em>{1:SA:%100%answer1#Correct~%50%answer2#Partially correct}</em></blockquote><p>where ‘#’ marks the beginning of a specific feedback for the preceding answer. Specific feedback are shown to students if opt-in in the Review options of the quiz. Any other answer than ‘answer1’ and ‘answer2’ will be considered wrong and awarded 0 points.</p><p><strong>Correct, Partially correct, and incorrect answers with specific feedback:</strong></p><blockquote><em>{1:SA:%100%answer1#Correct~%50%answer2#Partially correct~%-50%*#Wrong answer}</em></blockquote><p>where ‘*#’ indicates the feedback students will receive in case of any answer other than the preceding listed answers. %-50% indicates that half of the points allotted to the subquestion will be deducted from the overall question score if the student selects any answer other that the correct and the partially correct answers.</p><h4>Embedded-Answers Questions</h4><p>The table below lists all types of embedded answers:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*s-U4lrqO3sBCdAqe.png" /><figcaption>Types of embedded-answers questions.</figcaption></figure><p>Below, I give the Moodle markup text for each type of embedded-answers and the preview of the question:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rNxRN4uRalXpecJgo7vHcQ.png" /><figcaption>Moodle markup and preview for all types of embedded-answers questions. Answer A is the correct answer, Answer B a partially correct answer, and Answer C the wrong answer. Answer A is awarded the maximum score, Answer B half of the maximum score, and Answer C no points.</figcaption></figure><h3>Embedded-Answers Tips and Considerations</h3><h4>Adjusting the Layout of Embedded-Answer Questions</h4><p>The length of the text box in SA and NM embedded-answers is computed based on the length of the longest answer including the wrong answers.</p><p>In case of multiple SA or NM subquestions, the trick to fix the length of all the text boxes is to add the same dummy wrong answer to all embedded-answers.</p><p>In the example below, I’ve added the dummy wrong answer ‘~%0%XXXX’. I also show the use of tables for a better control over the alignment of the subquestions and the corresponding answer boxes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gIDueaSiZ6-dN3jJ-_CqxQ.png" /><figcaption>Adjusting the length and layout of multiple embedded-answers questions with dummy answers (‘XXXX’) and tables.</figcaption></figure><p>You can also control the size and the borders of the table, by tweaking the HTML code of the question. Click the last icon in the text editor extended toolbar (&lt;/&gt;) to show the HTML code for the question you are authoring:</p><ul><li>To extend the width of the table, add tag <em>width</em> followed by the size in pixels (i.e., “500”).</li><li>To enable borders, add tag <em>border </em>followed by the thickness of the border lines in pixels (i.e., “1”).</li></ul><p>The HTML code should look like this:</p><blockquote>&lt;table width=&quot;500&quot; border=&quot;1&quot;&gt;</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-F24Zky7PfOsaAEPIw8ydw.png" /><figcaption>Adjusting the layout of a table.</figcaption></figure><h4>Use Keyword ‘Empty’ for Questions with Non-Applicable Answers</h4><p>Student answers are matched against the list of expected answers embedded in the Cloze question. To grade a question, Moodle expects to find an answer. A question submitted with no answer is considered as not answered and won’t be awarded any points.</p><p>To indicate to Moodle that the blank answer is a correct answer, you can define the use of a specific keyword such as ‘<em>empty</em>’ that Moodle will interpret as a blank answer. The points for this question will be awarded if ‘<em>empty</em>’ has been answered.</p><h4>Avoid Copy/Paste from MS Word</h4><p>If you copy the answers from a Microsoft Word document, this may add some unwanted code to the HTML code that Moodle will consider as part of the answer. As students fill their answer in plain text, Moodle may flag their answer as wrong because of the code wrongly added to your embedded-answer. To avoid having to clean the html code of your question, use a plain text editor.</p><h4>Keep Questions Short and Add Break Pages</h4><p>Once a question answered, there are two main ways for Moodle to store the answers. Students can either click “Submit all and Finish” or navigate within the quiz provided that questions are distributed on multiple pages. In the latter, Moodle will log the answers until submission. Depending on the Time setting of the quiz, answers can be submitted either automatically upon expiration of the quiz time limit or only if students click “Submit all and Finish” before the closing date of the quiz.</p><p><a href="https://spathis.medium.com/making-the-transition-to-take-home-exams-with-moodle-c377d3d7ec90">In the layout quiz settings</a>, you can ask Moodle to put one question per page. You can also add page breaks where needed in the ‘Edit quiz’ page. Adding page breaks will let Moodle log the answers as students navigate through the pages of the quiz.</p><h4>Regrade a Quiz after its Closing Date</h4><p>You can make changes to the quiz and have Moodle regrade all attempts. Such changes include changing the maximum points of a specific question or the maximum grade of the quiz. You can also add answer options to Short Answers and Numerical questions.</p><p>From the Quiz summary page, you can access the attempts summary page where a table will list all attempts and for each attempt, the detailed points awarded per question. You can review how the students performed for each question of the quiz.</p><p>If after reviewing student answers, you realize that a handful number of students responded with a partially correct answer you didn’t anticipate when creating the quiz, you can add that answer in the answer options of the embedded question. You can then have all attempts regraded to account for that additional answer.</p><h3>Review Options</h3><p>In the table below, I present what the student sees after answering an embedded-answers question depending on the review options of the quiz. In this example, the question has the two following subquestions:</p><blockquote>Subquestion 1: {1:SA:=Correct answer 1#Correct Answer!~%0%*#Wrong Answer!}</blockquote><blockquote>Subquestion 2: {1:SA:=Correct answer 2#Correct Answer!~%0%*#Wrong Answer!}</blockquote><p>Students who enter the correct answer will receive feedback ‘Correct Answer!’ and feedback ‘Wrong Answer!’, otherwise.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J35ylxpSPI_rRahtfLzCPQ.png" /><figcaption>Question text and preview.</figcaption></figure><p>For each example, I suppose that a student has answered the first subquestion with the correct answer (e.g., “Correct answer 1”) and the second with a wrong answer (e.g., “Wrong answer 2”).</p><p>In the left column, I show the Review options you can set in the Quiz settings and in the right column, the resulting output as seen by the students. These outputs are similar whether the review options are set to ‘During the attempt’, ‘Immediately after the attempt’, ‘Later, while the quiz is still open’, or ‘After the quiz is closed’. The only difference is when the various feedback will be available for review to the students.</p><p>The points awarded for the question (e.g., mark), whether the answer is correct or not, the specific feedback for the provided answer, and the right answer are shown in a yellow box revealed when passing the mouse over each answer. The general feedback is shown below the question in an orange text box.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SeQaflF6lFKjteFFbHv78w.png" /><figcaption>List of the review options for embedded-answers question and the resulting output as seen by students.</figcaption></figure><h3>A Comprehensive Example</h3><p>To show the range of possibilities embedded-answers questions can offer, I present a quiz I give in my introductory course to Computer Networking. The topics covered by this assessment include IP subnetting, ARP, ICMP, and Proxy ARP.</p><p>You can download this quiz in Moodle XML format <a href="https://bit.ly/3g4XaIv">here</a> (right-click and select ‘Save link as’) and import the quiz in your course question bank.</p><h4>Part 1</h4><p>Consider the network depicted in Figure 1. This network consists of two (2) Ethernet segments interconnected by a bridge noted <em>X</em>.</p><p><em>A</em>, <em>B</em>,<em> C</em>, and <em>D</em> are end hosts. The IP and MAC addresses are shown in the figure. The figure also shows two observation points which capture the traffic on both directions on each segment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yGzTa3X0LJdNWxcoQc876Q.png" /><figcaption><strong>Figure 1: </strong>X is a bridge.</figcaption></figure><p>Host A (172.16.10.100) wants to ping host D (172.16.20.200). The following command is run on Host A:</p><blockquote>ping –c 1 172.16.20.200</blockquote><h4>Question 1.1</h4><p>Host A starts by sending an ARP request. Complete Table 1.1 with the MAC addresses found <strong>in the Ethernet frame header</strong> encapsulating the ARP request and the ARP reply messages as captured at each Observation Point.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JMDR_KLcUpFEcu51wQh8hw.png" /><figcaption>Table 1.1.</figcaption></figure><h4>Question 1.2</h4><p>Complete Table 1.2 with the addresses found <strong>inside the ARP messages</strong> captured by Observation Points 1 and 2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*brun2_orMFfcSfC11-NkYg.png" /><figcaption>Table 1.2.</figcaption></figure><h4>Question 1.3</h4><p>Host A can now send its Echo Request to host D. Complete Table 1.3 with the addresses included in the Ethernet and IP headers of the Echo Request and the Echo Reply captured at Observation Point 1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VRIW7ZAJ142_NipcJOlkhA.png" /><figcaption>Table 1.3.</figcaption></figure><h4>Question 1.4</h4><p>Suppose host A has sent pings to all other machines in this network. Complete Table 1.4 with the entries that can be found in host A’s ARP table. Use keyword <em>empty</em> for cells with no applicable value.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mnnZ9vwbi3-Zs0fQPSvBcA.png" /><figcaption>Table 1.4.</figcaption></figure><h4>Part 2</h4><p>Consider now that the two segments are connected by a router noted <em>R</em>. The IP and MAC addresses of R are shown in Figure 2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j1NVHbaJzgLKqkUq4OH3Iw.png" /><figcaption><strong>Figure 2:</strong> X is a router.</figcaption></figure><p>Host A (172.16.10.100) wants to ping host D (172.16.20.200). The following command is run on Host A:</p><blockquote>ping –c 1 172.16.20.200</blockquote><h4>Question 2.1</h4><p>Host A starts by sending out an ARP request. Complete Table 2.1 with the MAC addresses found <strong>in the Ethernet frame header</strong> encapsulating the ARP request and the ARP reply messages as captured at each Observation Point.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uAWAntp67hdwlPnfzhQq4A.png" /><figcaption>Table 2.1.</figcaption></figure><h4>Question 2.2</h4><p>Complete Table 2.2 with the addresses found <strong>inside the ARP messages</strong> captured by Observation Points 1 and 2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bCwbAUKfEHkL0muO4J-uSw.png" /><figcaption>Table 2.2.</figcaption></figure><h4>Question 2.3</h4><p>Host A can now send its Echo Request to host D. Complete Table 2.3 with the addresses included in the Ethernet and IP headers of the Echo Request and the Echo Reply captured at Observation Point 1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x9YfXC6d6jmTMpzK9eqE8Q.png" /><figcaption>Table 2.3.</figcaption></figure><h4>Question 2.4</h4><p>Suppose host A has sent pings to all other machines in this network. Complete Table 2.4 with the entries that can be found in A’s ARP table. Use keyword <em>empty</em> for cells with non-applicable value.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yPj2HkT46uGWbEo5KyPElQ.png" /><figcaption>Table 2.4.</figcaption></figure><h4>Question 2.5</h4><p>Assume that host A is misconfigured with subnet mask 255.255.0.0. Which machines can host A ping?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n9jd4rk6PBN-zqIKsJqxMQ.png" /></figure><h4>Question 2.6</h4><p>We now assume R is configured as an ARP proxy. As in previous question, we assume host A is configured with subnet mask 255.255.0.0.<strong></strong></p><p>Host A (172.16.10.100) wants to ping host D (172.16.20.200). The following command is run on Host A:</p><blockquote>ping –c 1 172.16.20.200</blockquote><p>A starts by sending an ARP request.</p><p>Complete Table 2.6 with the addresses found <strong>inside the ARP messages</strong> captured by Observation Points 1 and 2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nLRRf3zwdxITB3-VGKXbpA.png" /><figcaption>Table 2.6.</figcaption></figure><p>Host A can now send its Echo Request to host D. Complete Table 2.7 with the addresses included in the Ethernet and IP headers of the Echo Request and the Echo Reply captured at Observation Points 1 and 2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0OMdismzRRNo66Sgf_aChQ.png" /><figcaption>Table 2.7.</figcaption></figure><p>Suppose host A has sent pings to all other machines in this network. Complete Table 2.8 with the entries that can be found in host A’s ARP table. Use keyword <em>empty</em> for cells with non-applicable value.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Agme5Gu6LIqtIA5iDU5bCQ.png" /><figcaption>Table 2.8.</figcaption></figure><h3>Final Words</h3><p>Moodle offers a wide variety of questions that Moodle can grade (and regrade) automatically. Once created, questions are added to a question bank from where they can be reused or exported. These questions include Multiple choice, true-false, and matching questions but also Embedded-answers questions which offer a great level of flexibility.</p><p>Embedded-answers aka Cloze questions allow instructors to assess student understanding of more advanced topics. Once submitted, instructors can update the predefined answers. They can for instance add more partially correct answers to account for unanticipated student answers. Moodle can then regrade the student attempts accordingly. Feedback include the overall score and the question points but also a general and specific feedback shown to students depending on their answers.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2d843bdf6638" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>