<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>BadproG</title>
    <link>https://www.badprog.com/</link>
    <description>Recent content on BadproG</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Wed, 10 Jun 2026 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://www.badprog.com/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Electronics - FreeRTOS - Scheduler, task and queue on STM32F3Discovery</title>
      <link>https://www.badprog.com/electronics-freertos-scheduler-task-and-queue-on-stm32f3discovery/</link>
      <pubDate>Wed, 10 Jun 2026 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-freertos-scheduler-task-and-queue-on-stm32f3discovery/</guid>
      <description>&lt;p&gt;When it comes to dividing the time to share tasks, a simple &lt;strong&gt;microcontroller&lt;/strong&gt; sometimes needs a friend.&lt;/p&gt;
&lt;p&gt;This friend is called &lt;strong&gt;FreeRTOS&lt;/strong&gt; and will help our dear &lt;strong&gt;STM32&lt;/strong&gt; to dispatch &lt;strong&gt;tasks&lt;/strong&gt; as if each one was written for the &lt;strong&gt;CPU&lt;/strong&gt; entirely.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see this.&lt;/p&gt;
&lt;h2 id=&#34;shopping-list&#34;&gt;Shopping list&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The &lt;strong&gt;Github&lt;/strong&gt; for the current tutorial with full files and code:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/badprog/badprog-electronics-freertos-scheduler-task-and-queue-on-stm32f3discovery&#34;&gt;https://github.com/badprog/badprog-electronics-freertos-scheduler-task-and-queue-on-stm32f3discovery&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;IDE:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;VSCode&lt;/li&gt;
&lt;li&gt;DevContainer extension&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Board:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;STM32F3Discovery&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;LSM303DLHC&lt;/strong&gt; accelerometer (U3, small black chip on the right, above the pins)&lt;/li&gt;
&lt;li&gt;Datasheet: &lt;a href=&#34;https://www.st.com/resource/en/reference_manual/rm0316-stm32f303xbcde-stm32f303x68-stm32f328x8-stm32f358xc-stm32f398xe-advanced-armbased-mcus-stmicroelectronics.pdf&#34;&gt;https://www.st.com/resource/en/reference_manual/rm0316-stm32f303xbcde-stm32f303x68-stm32f328x8-stm32f358xc-stm32f398xe-advanced-armbased-mcus-stmicroelectronics.pdf&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Logic Analyzer for &lt;strong&gt;I2C&lt;/strong&gt; and &lt;strong&gt;UART&lt;/strong&gt; bus communication&lt;/p&gt;</description>
    </item>
    <item>
      <title>Electronics - FreeRTOS - Semaphore and mutex on STM32F3Discovery with I2C and UART</title>
      <link>https://www.badprog.com/electronics-freertos-semaphore-and-mutex-on-stm32f3discovery-with-i2c-and-uart/</link>
      <pubDate>Wed, 10 Jun 2026 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-freertos-semaphore-and-mutex-on-stm32f3discovery-with-i2c-and-uart/</guid>
      <description>&lt;p&gt;&lt;strong&gt;Tasks&lt;/strong&gt; are great, &lt;strong&gt;queues&lt;/strong&gt; as well.&lt;/p&gt;
&lt;p&gt;But as soon as several &lt;strong&gt;tasks&lt;/strong&gt; want to use the same &lt;strong&gt;resource&lt;/strong&gt; at the same time, things get messy fast.&lt;/p&gt;
&lt;p&gt;This tutorial introduces 2 synchronisation mechanisms that keep everything in order: The &lt;strong&gt;mutex&lt;/strong&gt; and the &lt;strong&gt;binary semaphore&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s get started.&lt;/p&gt;
&lt;h2 id=&#34;shopping-list&#34;&gt;Shopping list&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The &lt;strong&gt;Github&lt;/strong&gt; for the current tutorial with full files and code:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/badprog/badprog-electronics-freertos-semaphore-and-mutex-on-stm32f3discovery-with-i2c-and-uart&#34;&gt;https://github.com/badprog/badprog-electronics-freertos-semaphore-and-mutex-on-stm32f3discovery-with-i2c-and-uart&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;IDE:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;VSCode&lt;/li&gt;
&lt;li&gt;DevContainer extension&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Board:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;STM32F3Discovery&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;LSM303DLHC&lt;/strong&gt; accelerometer  (U3, small black chip on the right, above the pins)&lt;/li&gt;
&lt;li&gt;Datasheet: &lt;a href=&#34;https://www.st.com/resource/en/reference_manual/rm0316-stm32f303xbcde-stm32f303x68-stm32f328x8-stm32f358xc-stm32f398xe-advanced-armbased-mcus-stmicroelectronics.pdf&#34;&gt;https://www.st.com/resource/en/reference_manual/rm0316-stm32f303xbcde-stm32f303x68-stm32f328x8-stm32f358xc-stm32f398xe-advanced-armbased-mcus-stmicroelectronics.pdf&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Logic Analyzer for &lt;strong&gt;I2C&lt;/strong&gt; and &lt;strong&gt;UART&lt;/strong&gt; bus communication&lt;/p&gt;</description>
    </item>
    <item>
      <title>Electronics - FreeRTOS - SPI, I2C, UART with stack watermark and IWDG watchdog on STM32F3Discovery</title>
      <link>https://www.badprog.com/electronics-freertos-spi-i2c-uart-with-stack-watermark-and-iwdg-watchdog-on-stm32f3discovery/</link>
      <pubDate>Wed, 10 Jun 2026 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-freertos-spi-i2c-uart-with-stack-watermark-and-iwdg-watchdog-on-stm32f3discovery/</guid>
      <description>&lt;p&gt;Two &lt;strong&gt;sensors&lt;/strong&gt;, two &lt;strong&gt;buses&lt;/strong&gt;, six &lt;strong&gt;tasks&lt;/strong&gt;, one &lt;strong&gt;watchdog&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;This tutorial makes a firmware production-ready: Strict periodic scheduling, stack size validation, and hardware-level crash recovery.&lt;/p&gt;
&lt;p&gt;Ready? Let&amp;rsquo;s go.&lt;/p&gt;
&lt;h2 id=&#34;shopping-list&#34;&gt;Shopping list&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The &lt;strong&gt;Github&lt;/strong&gt; for the current tutorial with full files and code:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/badprog/badprog-electronics-freertos-spi-i2c-uart-with-stack-watermark-and-iwdg-watchdog-on-stm32f3discovery&#34;&gt;https://github.com/badprog/badprog-electronics-freertos-spi-i2c-uart-with-stack-watermark-and-iwdg-watchdog-on-stm32f3discovery&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;IDE:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;VSCode&lt;/li&gt;
&lt;li&gt;DevContainer extension&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Board:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;STM32F3Discovery&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;LSM303DLHC&lt;/strong&gt; accelerometer (U3, small black chip on the right, above the pins)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;L3GD20&lt;/strong&gt; 3-axis MEMS &lt;strong&gt;gyroscope&lt;/strong&gt; (U5, small chip near center)&lt;/li&gt;
&lt;li&gt;Datasheet: &lt;a href=&#34;https://www.st.com/resource/en/reference_manual/rm0316-stm32f303xbcde-stm32f303x68-stm32f328x8-stm32f358xc-stm32f398xe-advanced-armbased-mcus-stmicroelectronics.pdf&#34;&gt;https://www.st.com/resource/en/reference_manual/rm0316-stm32f303xbcde-stm32f303x68-stm32f328x8-stm32f358xc-stm32f398xe-advanced-armbased-mcus-stmicroelectronics.pdf&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Logic Analyzer for &lt;strong&gt;I2C&lt;/strong&gt;, &lt;strong&gt;SPI&lt;/strong&gt; and &lt;strong&gt;UART&lt;/strong&gt; bus communication&lt;/p&gt;</description>
    </item>
    <item>
      <title>Electronics - FreeRTOS - Timer, task notification and event group on STM32F3Discovery with I2C and UART</title>
      <link>https://www.badprog.com/electronics-freertos-timer-task-notification-and-event-group-on-stm32f3discovery-with-i2c-and-uart/</link>
      <pubDate>Wed, 10 Jun 2026 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-freertos-timer-task-notification-and-event-group-on-stm32f3discovery-with-i2c-and-uart/</guid>
      <description>&lt;p&gt;&lt;strong&gt;Mutexes&lt;/strong&gt; protect, &lt;strong&gt;semaphores&lt;/strong&gt; signal.&lt;/p&gt;
&lt;p&gt;But in some situations you need a bit more: A callback that fires on its own schedule, a direct line between an &lt;strong&gt;ISR&lt;/strong&gt; and a &lt;strong&gt;task&lt;/strong&gt;, and a way to say &amp;ldquo;do not start until everything is ready.&amp;rdquo;&lt;/p&gt;
&lt;p&gt;This tutorial introduces 3 FreeRTOS mechanisms that round out the toolkit: &lt;strong&gt;software timers,&lt;/strong&gt; &lt;strong&gt;task notifications&lt;/strong&gt;, and &lt;strong&gt;event groups&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s get started.&lt;/p&gt;
&lt;h2 id=&#34;shopping-list&#34;&gt;Shopping list&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The &lt;strong&gt;Github&lt;/strong&gt; for the current tutorial with full files and code:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Electronics - STM32 - I2C communication between STM32F3Discovery and LSM303DLHC accelerometer</title>
      <link>https://www.badprog.com/electronics-stm32-i2c-communication-between-stm32f3discovery-and-lsm303dlhc-accelerometer/</link>
      <pubDate>Tue, 09 Jun 2026 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-stm32-i2c-communication-between-stm32f3discovery-and-lsm303dlhc-accelerometer/</guid>
      <description>&lt;p&gt;Every smartphone is nowadays provided with an accelerometer.&lt;/p&gt;
&lt;p&gt;In this tutorial we are going to see how to retrieve X, Y and Z values from the &lt;strong&gt;LSM303DLHC&lt;/strong&gt; accelerometer on the &lt;strong&gt;STM32F3Discovery&lt;/strong&gt; board.&lt;/p&gt;
&lt;p&gt;And to achieve this goal we&amp;rsquo;ll use &lt;strong&gt;I2C&lt;/strong&gt; bus communication.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s get started.&lt;/p&gt;
&lt;h2 id=&#34;shopping-list&#34;&gt;Shopping list&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;Github&lt;/strong&gt; for the current tutorial with full files and code:
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/badprog/badprog-electronics-stm32-i2c-communication-between-stm32f3discovery-and-lsm303dlhc-accelerometer&#34;&gt;https://github.com/badprog/badprog-electronics-stm32-i2c-communication-between-stm32f3discovery-and-lsm303dlhc-accelerometer&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;IDE:
&lt;ul&gt;
&lt;li&gt;VSCode&lt;/li&gt;
&lt;li&gt;DevContainer extension&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Board:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;STM32F3Discovery&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;LSM303DLHC&lt;/strong&gt; &lt;strong&gt;accelerometer&lt;/strong&gt; (U3, small black chip on the right, above the pins)&lt;/li&gt;
&lt;li&gt;Datasheet:
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://www.st.com/resource/en/reference_manual/rm0316-stm32f303xbcde-stm32f303x68-stm32f328x8-stm32f358xc-stm32f398xe-advanced-armbased-mcus-stmicroelectronics.pdf&#34;&gt;https://www.st.com/resource/en/reference_manual/rm0316-stm32f303xbcde-stm32f303x68-stm32f328x8-stm32f358xc-stm32f398xe-advanced-armbased-mcus-stmicroelectronics.pdf&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Logic Analyzer for I2C communication&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;first-things-first&#34;&gt;First things first&lt;/h2&gt;
&lt;p&gt;The &lt;strong&gt;LSM303DLHC&lt;/strong&gt; accelerometer sits on &lt;strong&gt;I2C1&lt;/strong&gt; register at address &lt;strong&gt;0x19&lt;/strong&gt;, connected to &lt;strong&gt;PB6&lt;/strong&gt; (&lt;strong&gt;SCL&lt;/strong&gt;) and &lt;strong&gt;PB7&lt;/strong&gt; (&lt;strong&gt;SDA&lt;/strong&gt;).&lt;/p&gt;</description>
    </item>
    <item>
      <title>Electronics - STM32 - Reading gyroscope data with SPI on STM32F3Discovery</title>
      <link>https://www.badprog.com/electronics-stm32-reading-gyroscope-data-with-spi-on-stm32f3discovery/</link>
      <pubDate>Fri, 05 Jun 2026 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-stm32-reading-gyroscope-data-with-spi-on-stm32f3discovery/</guid>
      <description>&lt;p&gt;So far we have blinked &lt;strong&gt;LEDs&lt;/strong&gt;, rotated them with a &lt;strong&gt;timer&lt;/strong&gt;, caught a button &lt;strong&gt;interrupt&lt;/strong&gt;, and sent text over &lt;strong&gt;UART&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Time to talk to an external chip.&lt;/p&gt;
&lt;p&gt;In this tutorial we are going to read angular velocity on X, Y, Z axes from the &lt;strong&gt;L3GD20 gyroscope&lt;/strong&gt; soldered on the &lt;strong&gt;STM32F3Discovery&lt;/strong&gt; board.&lt;/p&gt;
&lt;p&gt;We&amp;rsquo;ll use the &lt;strong&gt;SPI1&lt;/strong&gt; peripheral in bare metal C in order to decode a live transaction on a &lt;strong&gt;logic analyzer&lt;/strong&gt; but also directly from the &lt;strong&gt;OpenOCD&lt;/strong&gt; console.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Electronics - STM32 - UART printf debugging with FTDI on STM32F3Discovery</title>
      <link>https://www.badprog.com/electronics-stm32-uart-printf-debugging-with-ftdi-on-stm32f3discovery/</link>
      <pubDate>Thu, 04 Jun 2026 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-stm32-uart-printf-debugging-with-ftdi-on-stm32f3discovery/</guid>
      <description>&lt;p&gt;At some point, blinking LEDs are not enough to understand what your code is actually doing.&lt;/p&gt;
&lt;p&gt;You need to print things.&lt;/p&gt;
&lt;p&gt;This tutorial shows how to redirect &lt;strong&gt;printf()&lt;/strong&gt; to a serial port on the &lt;strong&gt;STM32F3Discovery&lt;/strong&gt; with a &lt;strong&gt;FTDI TTL&lt;/strong&gt; adapter.&lt;/p&gt;
&lt;h2 id=&#34;shopping-list&#34;&gt;Shopping list&lt;/h2&gt;
&lt;p&gt;The Github for the current tutorial with full files and code:&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/badprog/badprog-electronics-stm32-uart-printf-debugging-with-ftdi-on-stm32f3discovery&#34;&gt;https://github.com/badprog/badprog-electronics-stm32-uart-printf-debugging-with-ftdi-on-stm32f3discovery&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;IDE:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;VSCode&lt;/li&gt;
&lt;li&gt;DevContainer extension&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Board:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;STM32F3Discovery&lt;/li&gt;
&lt;li&gt;Datasheet: &lt;a href=&#34;https://www.st.com/resource/en/reference_manual/rm0316-stm32f303xbcde-stm32f303x68-stm32f328x8-stm32f358xc-stm32f398xe-advanced-armbased-mcus-stmicroelectronics.pdf&#34;&gt;https://www.st.com/resource/en/reference_manual/rm0316-stm32f303xbcde-stm32f303x68-stm32f328x8-stm32f358xc-stm32f398xe-advanced-armbased-mcus-stmicroelectronics.pdf&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Hardware for serial communication:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;FTDI TTL-232R-3V3&lt;/strong&gt; adapter (USB to TTL serial, 3.3V)&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;why-use-an-ftdi-cable&#34;&gt;Why use an FTDI cable?&lt;/h2&gt;
&lt;p&gt;There are 3 ways to get &lt;strong&gt;serial&lt;/strong&gt; output from the &lt;strong&gt;STM32F3Discovery&lt;/strong&gt;:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Electronics - STM32 - STM32F3Discovery LED ring rotation with TIM2 and NVIC</title>
      <link>https://www.badprog.com/electronics-stm32-stm32f3discovery-led-ring-rotation-with-tim2-and-nvic/</link>
      <pubDate>Wed, 03 Jun 2026 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-stm32-stm32f3discovery-led-ring-rotation-with-tim2-and-nvic/</guid>
      <description>&lt;p&gt;Our Christmas tree is almost ready.&lt;/p&gt;
&lt;p&gt;In our previous tutorial we saw how to blink all LEDs at the same time.&lt;/p&gt;
&lt;p&gt;The lights are blinking but Santa thinks it&amp;rsquo;s too static.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s make them rotate.&lt;/p&gt;
&lt;h2 id=&#34;shopping-list&#34;&gt;Shopping list&lt;/h2&gt;
&lt;p&gt;The previous &lt;strong&gt;tutorial&lt;/strong&gt; for this series:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;/electronics-stm32-blinking-all-f3discovery-leds-at-the-same-time&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The &lt;strong&gt;Github&lt;/strong&gt; for the current tutorial with full files and code:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/badprog/badprog-electronics-stm32-stm32f3discovery-led-ring-rotation-with-tim2-and-nvic&#34;&gt;https://github.com/badprog/badprog-electronics-stm32-stm32f3discovery-led-ring-rotation-with-tim2-and-nvic&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;IDE&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;VSCode&lt;/li&gt;
&lt;li&gt;DevContainer extension&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Board&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;STM32F3Discovery&lt;/li&gt;
&lt;li&gt;Datasheet: &lt;a href=&#34;https://www.st.com/resource/en/reference_manual/rm0316-stm32f303xbcde-stm32f303x68-stm32f328x8-stm32f358xc-stm32f398xe-advanced-armbased-mcus-stmicroelectronics.pdf&#34;&gt;https://www.st.com/resource/en/reference_manual/rm0316-stm32f303xbcde-stm32f303x68-stm32f328x8-stm32f358xc-stm32f398xe-advanced-armbased-mcus-stmicroelectronics.pdf&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;whats-new-compared-to-the-previous-tutorial&#34;&gt;What&amp;rsquo;s new compared to the previous tutorial&lt;/h2&gt;
&lt;p&gt;In the previous tutorial we used a software delay &lt;strong&gt;delay_ms()&lt;/strong&gt; to blink all 8 LEDs together.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Electronics - STM32 - User button as EXTI with the STM32F3Discovery board</title>
      <link>https://www.badprog.com/electronics-stm32-user-button-as-exti-with-the-stm32f3discovery-board/</link>
      <pubDate>Wed, 03 Jun 2026 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-stm32-user-button-as-exti-with-the-stm32f3discovery-board/</guid>
      <description>&lt;p&gt;Santa is impressed by the rotating LEDs but now he wants to control them.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s add a push button with the &lt;strong&gt;EXTI&lt;/strong&gt; (External Interrupt).&lt;/p&gt;
&lt;h2 id=&#34;shopping-list&#34;&gt;Shopping list&lt;/h2&gt;
&lt;p&gt;The previous tutorials for this series:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;/electronics-stm32-blinking-all-f3discovery-leds-at-the-same-time&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;/electronics-stm32-stm32f3discovery-led-ring-rotation-with-tim2-and-nvic&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The Github for the current tutorial with full files and code:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/badprog/badprog-electronics-stm32-user-button-as-exti-with-the-stm32f3discovery-board&#34;&gt;https://github.com/badprog/badprog-electronics-stm32-user-button-as-exti-with-the-stm32f3discovery-board&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;IDE:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;VSCode&lt;/li&gt;
&lt;li&gt;DevContainer extension&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Board:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;STM32F3Discovery&lt;/li&gt;
&lt;li&gt;Datasheet: &lt;a href=&#34;https://www.st.com/resource/en/reference_manual/rm0316-stm32f303xbcde-stm32f303x68-stm32f328x8-stm32f358xc-stm32f398xe-advanced-armbased-mcus-stmicroelectronics.pdf&#34;&gt;https://www.st.com/resource/en/reference_manual/rm0316-stm32f303xbcde-stm32f303x68-stm32f328x8-stm32f358xc-stm32f398xe-advanced-armbased-mcus-stmicroelectronics.pdf&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;what-this-tutorial-does&#34;&gt;What this tutorial does&lt;/h2&gt;
&lt;p&gt;Pressing the blue user button &lt;strong&gt;PA0&lt;/strong&gt; on the &lt;strong&gt;STM32F3Discovery&lt;/strong&gt; toggles between two LED modes:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Electronics - STM32 - Blinking all F3Discovery LEDs at the same time</title>
      <link>https://www.badprog.com/electronics-stm32-blinking-all-f3discovery-leds-at-the-same-time/</link>
      <pubDate>Tue, 02 Jun 2026 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-stm32-blinking-all-f3discovery-leds-at-the-same-time/</guid>
      <description>&lt;p&gt;Christmas is near (only 6 months), so we have to prepare our xmas tree.&lt;/p&gt;
&lt;p&gt;What a better option than using our dear &lt;strong&gt;STM32F3Discovery&lt;/strong&gt; board as a Christmas lights?&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see this in this tutorial.&lt;/p&gt;
&lt;p&gt;(And yes, Santa Claus is watching you, so be kind.)&lt;/p&gt;
&lt;h2 id=&#34;shopping-list&#34;&gt;Shopping list&lt;/h2&gt;
&lt;p&gt;The &lt;strong&gt;Github&lt;/strong&gt; for this tutorial with full files and code:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/badprog/badprog-electronics-stm32-blinking-all-f3discovery-leds-at-the-same-time&#34;&gt;https://github.com/badprog/badprog-electronics-stm32-blinking-all-f3discovery-leds-at-the-same-time&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;IDE:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;VSCode&lt;/li&gt;
&lt;li&gt;DevContainer extension&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Board:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;STM32F3Discovery&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;With Ubuntu 24.04 trying to install &lt;strong&gt;gcc-arm-none-eabi&lt;/strong&gt; compiler doesn&amp;rsquo;t work as expected.&lt;/p&gt;</description>
    </item>
    <item>
      <title>ROS2 - Humble - Action in action with Python</title>
      <link>https://www.badprog.com/ros2-humble-action-in-action-with-python/</link>
      <pubDate>Thu, 28 May 2026 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/ros2-humble-action-in-action-with-python/</guid>
      <description>&lt;p&gt;Ever wanted to control a satellite without leaving your comfortable Linux terminal?&lt;/p&gt;
&lt;p&gt;Today is your lucky day.&lt;/p&gt;
&lt;p&gt;Welcome to this cosmic guide where we are going to build a fully automated &lt;strong&gt;ROS2 Action&lt;/strong&gt; server and client in &lt;strong&gt;Python&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Grab your coffee, open your IDE, and let&amp;rsquo;s launch this code into the stratosphere.&lt;/p&gt;
&lt;h2 id=&#34;shopping-list&#34;&gt;Shopping list&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;The Github with the full code for this tutorial:
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/badprog/badprog-ros2-humble-action-in-action-with-python&#34;&gt;https://github.com/badprog/badprog-ros2-humble-action-in-action-with-python&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;IDE:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;VSCode&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Framework:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Robot Operating System 2&lt;/strong&gt; (AKA &lt;strong&gt;ROS2&lt;/strong&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;lets-code-a-bit&#34;&gt;Let&amp;rsquo;s code a bit&lt;/h2&gt;
&lt;p&gt;To keep our codebase clean and modular, we split our system into 4 distinct files:&lt;/p&gt;</description>
    </item>
    <item>
      <title>ROS2 - Humble - Basics with Node, Topic and Service in Python</title>
      <link>https://www.badprog.com/ros2-humble-basics-with-node-topic-and-service-in-python/</link>
      <pubDate>Sun, 19 Apr 2026 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/ros2-humble-basics-with-node-topic-and-service-in-python/</guid>
      <description>&lt;p&gt;We are going to walk through the essential building blocks of &lt;strong&gt;ROS2&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Rather than building a complex industrial system, we are using a battery simulator as a clear and practical example to master the three fundamental elements of robotic communication: &lt;strong&gt;Nodes&lt;/strong&gt;, &lt;strong&gt;Topics&lt;/strong&gt;, and &lt;strong&gt;Services&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s get started.&lt;/p&gt;
&lt;h2 id=&#34;shopping-list&#34;&gt;Shopping list&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;The GitHub of this tutorial:
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/badprog/badprog-ros2-humble-basics-with-node-topic-and-service-in-python.git&#34;&gt;https://github.com/badprog/badprog-ros2-humble-basics-with-node-topic-and-service-in-python.git&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;VSCode:
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://code.visualstudio.com/&#34;&gt;https://code.visualstudio.com/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;the-three-pillars-of-ros-2&#34;&gt;The Three Pillars of ROS 2&lt;/h2&gt;
&lt;p&gt;Before looking at the code, we must understand these three components, as they are the core of any &lt;strong&gt;ROS2&lt;/strong&gt; application:&lt;/p&gt;</description>
    </item>
    <item>
      <title>ROS2 - Humble - Starter kit</title>
      <link>https://www.badprog.com/ros2-humble-starter-kit/</link>
      <pubDate>Mon, 13 Apr 2026 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/ros2-humble-starter-kit/</guid>
      <description>&lt;p&gt;Every project has to start from somewhere.&lt;/p&gt;
&lt;p&gt;In this tutorial, we are going to see the minimal template to start any &lt;strong&gt;ROS 2 Humble&lt;/strong&gt; projects with style and stability.&lt;/p&gt;
&lt;p&gt;For that goal we’re going to use &lt;strong&gt;GitHub Actions&lt;/strong&gt; to automatically stress-test the &lt;strong&gt;Dockerfile&lt;/strong&gt; and &lt;strong&gt;devcontainer.json&lt;/strong&gt; files.&lt;/p&gt;
&lt;p&gt;Basically, we’re making sure your dev environment is always ready to roll before you even type your first node.&lt;/p&gt;
&lt;h2 id=&#34;shopping-list&#34;&gt;Shopping list&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;Github&lt;/strong&gt; of this tutorial: &lt;a href=&#34;https://github.com/badprog/badprog-ros2-humble-starter-kit&#34;&gt;https://github.com/badprog/badprog-ros2-humble-starter-kit&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;VSCode&lt;/strong&gt;: &lt;a href=&#34;https://code.visualstudio.com/&#34;&gt;https://code.visualstudio.com/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;1-the-dockerfile&#34;&gt;1. The Dockerfile&lt;/h2&gt;
&lt;p&gt;Think of your &lt;strong&gt;Dockerfile&lt;/strong&gt; as the DNA of your project.&lt;/p&gt;</description>
    </item>
    <item>
      <title>ROS2 - micro-ROS - Publisher, subscriber, node, topic with STM32 and Python</title>
      <link>https://www.badprog.com/ros2-micro-ros-publisher-subscriber-node-topic-with-stm32-and-python/</link>
      <pubDate>Wed, 01 Apr 2026 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/ros2-micro-ros-publisher-subscriber-node-topic-with-stm32-and-python/</guid>
      <description>&lt;p&gt;While receiving data from your microcontroller is great, what about sending data in the opposite direction?&lt;/p&gt;
&lt;p&gt;First, we need to understand the difference between a &lt;strong&gt;publisher&lt;/strong&gt; and a &lt;strong&gt;subscriber&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;In order to achieve this goal, we&amp;rsquo;ll need to use &lt;strong&gt;ROS2 topics&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Each node has to send and receive data to and from a topic, that is publishing and subscribing to a topic.&lt;/p&gt;
&lt;h2 id=&#34;shopping-list&#34;&gt;Shopping list&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Github&lt;/strong&gt; for the tutorial:
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/badprog/badprog-ros2-micro-ros-publisher-subscriber-node-topic-with-stm32-and-python&#34;&gt;https://github.com/badprog/badprog-ros2-micro-ros-publisher-subscriber-node-topic-with-stm32-and-python&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;STM32F3 Discovery&lt;/strong&gt; board &lt;strong&gt;STM32F303VC&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;microcontroller and &lt;strong&gt;Cortex M4&lt;/strong&gt; processor&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;Docker&lt;/strong&gt; container for the &lt;strong&gt;micro-ROS Agent&lt;/strong&gt; (&lt;strong&gt;Humble&lt;/strong&gt; version)
&lt;ul&gt;
&lt;li&gt;microros/micro-ros-agent:humble&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;Docker&lt;/strong&gt; container for &lt;strong&gt;ROS2&lt;/strong&gt; (&lt;strong&gt;Humble&lt;/strong&gt; version)
&lt;ul&gt;
&lt;li&gt;ros:humble-ros-base&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;VSCode&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;ROS2&lt;/strong&gt; will be installed inside a &lt;strong&gt;VSCode Dev Container&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;PIO&lt;/strong&gt; extension will be used and &lt;strong&gt;needs to know&lt;/strong&gt; where is the project directory:
&lt;ul&gt;
&lt;li&gt;From VSCode, select: File &amp;gt; Add Folder to Workspace&amp;hellip; &amp;gt; &lt;strong&gt;cpp_stm32_firmware&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;the-node&#34;&gt;The Node&lt;/h2&gt;
&lt;p&gt;In the &lt;strong&gt;ROS2&lt;/strong&gt; world, a node is a primary entry point (a program on a device) from which we can create other entities (in our tutorial it will be publishers, subscribers and topics).&lt;/p&gt;</description>
    </item>
    <item>
      <title>ROS2 - micro-ROS - Using STM32 USB serial port to communicate with a Linux host via WSL 2</title>
      <link>https://www.badprog.com/ros2-micro-ros-using-stm32-usb-serial-port-to-communicate-with-a-linux-host-via-wsl-2/</link>
      <pubDate>Wed, 18 Mar 2026 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/ros2-micro-ros-using-stm32-usb-serial-port-to-communicate-with-a-linux-host-via-wsl-2/</guid>
      <description>&lt;p&gt;Connecting a microcontroller to a modern robotics ecosystem can be a daunting task, especially when working across different operating systems.&lt;/p&gt;
&lt;p&gt;In this tutorial, we will explore how to transform an &lt;strong&gt;STM32F3 Discovery&lt;/strong&gt; board into a fully functional &lt;strong&gt;ROS 2&lt;/strong&gt; node with the help of &lt;strong&gt;micro-ROS&lt;/strong&gt; library.&lt;/p&gt;
&lt;p&gt;More specifically, we’ll use the STM32 native USB serial port to establish real-time communication with a &lt;strong&gt;Linux&lt;/strong&gt; host running inside &lt;strong&gt;WSL 2&lt;/strong&gt;.&lt;/p&gt;
&lt;h2 id=&#34;shopping-list&#34;&gt;Shopping list&lt;/h2&gt;
&lt;p&gt;Github of this tutorial :&lt;/p&gt;</description>
    </item>
    <item>
      <title>Electronics - STM32 - Setting up PlatformIO in ROS2 DevContainers</title>
      <link>https://www.badprog.com/electronics-stm32-setting-up-platformio-in-ros2-devcontainers/</link>
      <pubDate>Mon, 09 Mar 2026 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-stm32-setting-up-platformio-in-ros2-devcontainers/</guid>
      <description>&lt;p&gt;This guide provides a step-by-step workflow to bridge physical &lt;strong&gt;STM32&lt;/strong&gt; hardware into a virtualized &lt;strong&gt;ROS2&lt;/strong&gt; &lt;strong&gt;DevContainer&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;It leverages &lt;strong&gt;PlatformIO&lt;/strong&gt; and &lt;strong&gt;usbipd&lt;/strong&gt; to enable firmware flashing from a &lt;strong&gt;Docker&lt;/strong&gt; environment.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Github&lt;/strong&gt; project for this tutorial:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/badprog/badprog-electronics-stm32-setting-up-platformio-in-ros2-devcontainers&#34;&gt;https://github.com/badprog/badprog-electronics-stm32-setting-up-platformio-in-ros2-devcontainers&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Shopping list:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;An electronic board like the &lt;strong&gt;STM32F3Discovery&lt;/strong&gt; board (STM32F303VCT6 microcontroller)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Windows 10&lt;/strong&gt; or &lt;strong&gt;11&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;WSL 2&lt;/strong&gt; (Windows Subsytem for Linux)
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Ubuntu 24.04&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;usbipd-win:&lt;/strong&gt;&lt;a href=&#34;https://github.com/dorssel/usbipd-win/releases&#34;&gt;https://github.com/dorssel/usbipd-win/releases&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;Dockerfile&lt;/strong&gt; with&lt;strong&gt;ROS 2&lt;/strong&gt; image (osrf/ros:jazzy-desktop)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;VSCode&lt;/strong&gt; with extensions:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Dev Containers&lt;/strong&gt; (ms-vscode-remote.remote-containers)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Robot Developer Extensions for ROS 2&lt;/strong&gt; (Ranch-Hand-Robotics.rde-ros-2)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;PlatformIO IDE&lt;/strong&gt; (platformio.platformio-ide)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;wsl-windows-subsystem-for-linux&#34;&gt;WSL: Windows Subsystem for Linux&lt;/h2&gt;
&lt;p&gt;In order to get &lt;strong&gt;WSL&lt;/strong&gt;, simply open a &lt;strong&gt;PowerShell&lt;/strong&gt; terminal in &lt;strong&gt;Admin&lt;/strong&gt; mode:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Rust - Crate - Grcov demo</title>
      <link>https://www.badprog.com/rust-crate-grcov-demo/</link>
      <pubDate>Sun, 23 Nov 2025 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/rust-crate-grcov-demo/</guid>
      <description>&lt;p&gt;When your projects grow complex, ensuring that every single line of code is covered by your tests becomes critical.&lt;/p&gt;
&lt;p&gt;But how do you verify such a thing efficiently?&lt;/p&gt;
&lt;p&gt;Fortunately, the Rust ecosystem offers powerful crates for this purpose.&lt;/p&gt;
&lt;p&gt;This tutorial will guide you through setting up grcov for reliable code coverage.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;The complete source code for this tutorial is available on GitHub:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/badprog/badprog-grcov-demo&#34;&gt;https://github.com/badprog/badprog-grcov-demo&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;All required software will be installed within our Docker environment (Dockerfile).&lt;/p&gt;</description>
    </item>
    <item>
      <title>Rust - Python binding - Setting up PyO3 crate with Maturin</title>
      <link>https://www.badprog.com/rust-python-binding-setting-up-pyo3-crate-with-maturin/</link>
      <pubDate>Sun, 02 Nov 2025 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/rust-python-binding-setting-up-pyo3-crate-with-maturin/</guid>
      <description>&lt;p&gt;When you want to make large computations, using &lt;strong&gt;Python&lt;/strong&gt; may not be the best solution.&lt;/p&gt;
&lt;p&gt;By building a Python module from &lt;strong&gt;Rust&lt;/strong&gt;, we get the best of both worlds: Python productivity and Rust speed.&lt;/p&gt;
&lt;p&gt;In this tutorial we&amp;rsquo;ll cover the basic integration process using &lt;strong&gt;PyO3&lt;/strong&gt;, a Rust crate, for the bindings and &lt;strong&gt;Maturin&lt;/strong&gt;, a Python tool,for managing the dynamic library.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;Github of this tutorial: &lt;a href=&#34;https://github.com/badprog/badprog-rust-binding-python-with-pyo3&#34;&gt;https://github.com/badprog/badprog-rust-binding-python-with-pyo3&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;And versions used:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Rust - Exploration - Adding memory and performance mode to the Vec struct</title>
      <link>https://www.badprog.com/rust-exploration-adding-memory-and-performance-mode-to-the-vec-struct/</link>
      <pubDate>Sun, 14 Sep 2025 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/rust-exploration-adding-memory-and-performance-mode-to-the-vec-struct/</guid>
      <description>&lt;p&gt;The original Rust &lt;strong&gt;Vec&lt;/strong&gt; struct is already a fantastic growable array, easy to use.&lt;/p&gt;
&lt;p&gt;But what about adding a mode enabling to choose between memory and performance?&lt;/p&gt;
&lt;p&gt;Furthermore it&amp;rsquo;s a good way to understand why &lt;strong&gt;capacity&lt;/strong&gt; and &lt;strong&gt;len&lt;/strong&gt; aren&amp;rsquo;t the same thing.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see that in this tutorial.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;You can find the source code on my Github:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/badprog/badprog_vec_plus&#34;&gt;https://github.com/badprog/badprog_vec_plus&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;memory-vs-performance&#34;&gt;Memory vs performance&lt;/h2&gt;
&lt;p&gt;Sometimes you have to make a choice: memory or performance.&lt;/p&gt;</description>
    </item>
    <item>
      <title>PostgreSQL - Setting up - Linux Ubuntu</title>
      <link>https://www.badprog.com/postgresql-setting-up-linux-ubuntu/</link>
      <pubDate>Sat, 07 Jan 2023 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/postgresql-setting-up-linux-ubuntu/</guid>
      <description>&lt;p&gt;&lt;strong&gt;PostgreSQL&lt;/strong&gt; is one of the most known and used SQL server.&lt;/p&gt;
&lt;p&gt;We’re going to see how to install it on a &lt;strong&gt;Linux&lt;/strong&gt; opearting system, to be precise on Linux &lt;strong&gt;Ubuntu&lt;/strong&gt;.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;For this tutorial, our Linux distribution will be &lt;strong&gt;Ubuntu 22.04&lt;/strong&gt;: &lt;a href=&#34;https://ubuntu.com/&#34;&gt;https://ubuntu.com/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Then &lt;strong&gt;PostgreSQL 14.5&lt;/strong&gt;: &lt;a href=&#34;https://www.postgresql.org/&#34;&gt;https://www.postgresql.org/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;As a bonus we&amp;rsquo;ll use &lt;strong&gt;pgAdmin 4 v6.15&lt;/strong&gt; to manage PostgreSQL as a GUI: &lt;a href=&#34;https://www.pgadmin.org/&#34;&gt;https://www.pgadmin.org/&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;lets-get-started&#34;&gt;Let&amp;rsquo;s get started&lt;/h2&gt;
&lt;p&gt;To install PostgreSQL on Ubuntu, just follow the documentation.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - NVIDIA CUDA - Using the compute_xy and sm_xy compile options to generate an executable</title>
      <link>https://www.badprog.com/c-nvidia-cuda-using-the-compute-xy-and-sm-xy-compile-options-to-generate-an-executable/</link>
      <pubDate>Wed, 22 Jun 2022 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-nvidia-cuda-using-the-compute-xy-and-sm-xy-compile-options-to-generate-an-executable/</guid>
      <description>&lt;p&gt;To use an &lt;strong&gt;NVIDIA GPU&lt;/strong&gt; (the graphic card processor) you need a CUDA &lt;strong&gt;driver&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;And if you want to compile a program for a GPU you&amp;rsquo;ll have to use the CUDA &lt;strong&gt;toolkit&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;In this tutorial we&amp;rsquo;re going to see how to compile your project in order to generate an executable able to function on all available NVIDIA GPU (past, present and future).&lt;/p&gt;
&lt;p&gt;By saying &amp;ldquo;all&amp;rdquo; we say not deprecated yet of course.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Qt Framework - Mixing native OpenGL functions with Qt ones</title>
      <link>https://www.badprog.com/c-qt-framework-mixing-native-opengl-functions-with-qt-ones/</link>
      <pubDate>Fri, 20 May 2022 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-qt-framework-mixing-native-opengl-functions-with-qt-ones/</guid>
      <description>&lt;p&gt;Having the &lt;strong&gt;Qt Framework&lt;/strong&gt; as &lt;strong&gt;GUI&lt;/strong&gt; for &lt;strong&gt;OpenGL&lt;/strong&gt; can be helpful of course but sometimes it seems easier to use the native OpenGL functions directly.&lt;/p&gt;
&lt;p&gt;This is exactly what we are going to see in this tutorial by mixing Qt and native OpenGL functions.&lt;/p&gt;
&lt;h2 id=&#34;first-to-all&#34;&gt;First to all&lt;/h2&gt;
&lt;p&gt;For this tutorial recipe we are going to use:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;2 different pairs of shaders (vertex and fragment)&lt;/li&gt;
&lt;li&gt;2 VAOs&lt;/li&gt;
&lt;li&gt;2 VBOs&lt;/li&gt;
&lt;li&gt;2 EBOs&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Shaders will be placed in the &amp;ldquo;shader/&amp;rdquo; directory and other files directly at the root.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Qt Framework - Using QOpenGLWidget to display a shape with lighting and normal vectors</title>
      <link>https://www.badprog.com/c-qt-framework-using-qopenglwidget-to-display-a-shape-with-lighting-and-normal-vectors/</link>
      <pubDate>Thu, 28 Oct 2021 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-qt-framework-using-qopenglwidget-to-display-a-shape-with-lighting-and-normal-vectors/</guid>
      <description>&lt;p&gt;&lt;strong&gt;Lighting&lt;/strong&gt; is certainly one of the most interesting effect that we can make with OpenGL.&lt;/p&gt;
&lt;p&gt;Combined with colors and normal vectors, lighting becomes visually realistic.&lt;/p&gt;
&lt;p&gt;In this tutorial we are going to see how to draw a main shape (kind of a rectangular cube), another one inside the first one and a third representing our lighting source.&lt;/p&gt;
&lt;p&gt;We are also going to add normal vectors to these two shapes but with opposite directions.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - OpenCV - Hello world</title>
      <link>https://www.badprog.com/c-opencv-hello-world/</link>
      <pubDate>Tue, 12 Oct 2021 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-opencv-hello-world/</guid>
      <description>&lt;p&gt;In a previous &lt;a href=&#34;https://www.badprog.com/c-opencv-setting-up-with-visual-studio&#34;&gt;tutorial we set up OpenCV with Visual Studio&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This time we are going to make our first Hello world OpenCV project.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see that.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;Firs​t of all&lt;/h2&gt;
&lt;p&gt;In this tutorial we&amp;rsquo;ll change the color model of our image.&lt;/p&gt;
&lt;p&gt;Choose an image with colors because we are going to change them into a grayscale model.&lt;/p&gt;
&lt;p&gt;We&amp;rsquo;ll be able to come back to the original image colors.&lt;/p&gt;
&lt;p&gt;To achieve this 2 keys will be used:&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - OpenCV - Setting up with Visual Studio</title>
      <link>https://www.badprog.com/c-opencv-setting-up-with-visual-studio/</link>
      <pubDate>Sun, 10 Oct 2021 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-opencv-setting-up-with-visual-studio/</guid>
      <description>&lt;p&gt;&lt;strong&gt;OpenCV&lt;/strong&gt; is an interesting library aimed to computer vision.&lt;/p&gt;
&lt;p&gt;But before playing with it, it&amp;rsquo;s necessary to set up your IDE.&lt;/p&gt;
&lt;p&gt;This IDE will be Visual Studio for this tutorial.&lt;/p&gt;
&lt;p&gt;So let&amp;rsquo;s get started.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;Let&amp;rsquo;s start by downloading the OpenCV library from the official &lt;strong&gt;GitHub&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;For this tutorial we&amp;rsquo;ll use the &lt;strong&gt;4.5.3&lt;/strong&gt; version:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/opencv/opencv/releases/tag/4.5.3&#34;&gt;https://github.com/opencv/opencv/releases/tag/4.5.3&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For the latest version, it should be there:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/opencv/opencv/releases&#34;&gt;https://github.com/opencv/opencv/releases&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Take the following file for our tutorial:&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Qt Framework - Using QOpenGLWidget to display a window for moving shapes with keyboard and mouse</title>
      <link>https://www.badprog.com/c-qt-framework-using-qopenglwidget-to-display-a-window-for-moving-shapes-with-keyboard-and-mouse/</link>
      <pubDate>Tue, 06 Apr 2021 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-qt-framework-using-qopenglwidget-to-display-a-window-for-moving-shapes-with-keyboard-and-mouse/</guid>
      <description>&lt;p&gt;In the past tutorials about &lt;strong&gt;Qt&lt;/strong&gt; and &lt;strong&gt;OpenGL&lt;/strong&gt; we saw how to deal with some basic tasks.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see this time something a bit more advanced with the &lt;strong&gt;QOpenGLWidget&lt;/strong&gt; class in order to display a scene from a window with a shape.&lt;/p&gt;
&lt;p&gt;This shape (a cube) can be &lt;strong&gt;rotated&lt;/strong&gt;, &lt;strong&gt;translated&lt;/strong&gt;, &lt;strong&gt;zoomed&lt;/strong&gt; with the &lt;strong&gt;keyboard&lt;/strong&gt; and the &lt;strong&gt;mouse&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;I added some options to change this cube into a &lt;strong&gt;colored&lt;/strong&gt; or &lt;strong&gt;texured&lt;/strong&gt; shape directly from the GUI.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Qt Framework - Using OpenGL texture with index array</title>
      <link>https://www.badprog.com/c-qt-framework-using-opengl-texture-with-index-array/</link>
      <pubDate>Thu, 21 Jan 2021 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-qt-framework-using-opengl-texture-with-index-array/</guid>
      <description>&lt;p&gt;Playing with &lt;strong&gt;colors&lt;/strong&gt; can be fun but what about &lt;strong&gt;textures&lt;/strong&gt;?&lt;/p&gt;
&lt;p&gt;What about something really realistic?&lt;/p&gt;
&lt;p&gt;In this &lt;strong&gt;OpenGL&lt;/strong&gt; tutorial for &lt;strong&gt;Qt&lt;/strong&gt; we are going to apply a texture on our dear &lt;strong&gt;triangles&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Yes in OpenGL there are only triangles, no other kinds of shapes available but with some variations though (the famous &lt;strong&gt;primitives&lt;/strong&gt;).&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;We are going to see how to create a &lt;strong&gt;struct&lt;/strong&gt; named &lt;strong&gt;StructVertex&lt;/strong&gt; to handle a &lt;strong&gt;vertex&lt;/strong&gt; and its &lt;strong&gt;texture&lt;/strong&gt; in one &lt;strong&gt;object&lt;/strong&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Qt Framework - Using 1 OpenGL VAO and 2 VBOs with only 1 array for both position and color of each vertex</title>
      <link>https://www.badprog.com/c-qt-framework-using-1-opengl-vao-and-2-vbos-with-only-1-array-for-both-position-and-color-of-each/</link>
      <pubDate>Wed, 13 Jan 2021 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-qt-framework-using-1-opengl-vao-and-2-vbos-with-only-1-array-for-both-position-and-color-of-each/</guid>
      <description>&lt;p&gt;As we saw, &lt;a href=&#34;https://www.badprog.com/c-qt-framework-using-opengl-vao-and-vbo-to-handle-2-different-objects-on-the-scene&#34;&gt;in the last tutorial about using a VAO and VBO to handle 2 different objects on the scene with OpenGL&lt;/a&gt;, it&amp;rsquo;s possible to have 2 arrays of vertex: one to manage the position and one to deal with the color.&lt;/p&gt;
&lt;p&gt;This time we are going to see how to handle it with only one array.&lt;/p&gt;
&lt;p&gt;So let&amp;rsquo;s get started.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;It&amp;rsquo;s  an easy example with only 3 points on the screen and each one with one different color: &lt;strong&gt;red&lt;/strong&gt;, &lt;strong&gt;green&lt;/strong&gt; and &lt;strong&gt;blue&lt;/strong&gt; (the famous &lt;strong&gt;RGB&lt;/strong&gt;).&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Qt Framework - Using OpenGL VAO and VBO to handle 2 different objects on the scene</title>
      <link>https://www.badprog.com/c-qt-framework-using-opengl-vao-and-vbo-to-handle-2-different-objects-on-the-scene/</link>
      <pubDate>Fri, 01 Jan 2021 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-qt-framework-using-opengl-vao-and-vbo-to-handle-2-different-objects-on-the-scene/</guid>
      <description>&lt;p&gt;&lt;strong&gt;VAO&lt;/strong&gt; (Vertex Array Object) and &lt;strong&gt;VBO&lt;/strong&gt; (Vertex Buffer Object) were introduced to help programmers since &lt;strong&gt;OpenGL 3.0&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;So it’s not a recent features but if you just started learning OpenGL it could be very complex to understand.&lt;/p&gt;
&lt;p&gt;Furthermore if you are learning OpenGL and want to use it with &lt;strong&gt;Qt&lt;/strong&gt; together, it becomes a real nightmare.&lt;/p&gt;
&lt;p&gt;So what are these vertex objects and how to use them to manage two different objects on the scene?&lt;/p&gt;</description>
    </item>
    <item>
      <title>Android - API - Creating a Spinner with colors as choices</title>
      <link>https://www.badprog.com/android-api-creating-a-spinner-with-colors-as-choices/</link>
      <pubDate>Sun, 22 Mar 2020 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/android-api-creating-a-spinner-with-colors-as-choices/</guid>
      <description>&lt;p&gt;With &lt;strong&gt;Android&lt;/strong&gt; we haven&amp;rsquo;t a classic &lt;strong&gt;ComboBox&lt;/strong&gt; like in other frameworks but we have instead a &lt;strong&gt;Spinner&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Actually it&amp;rsquo;s exactly the same and only the name differs.&lt;/p&gt;
&lt;p&gt;In this Android Spinner tutorial we&amp;rsquo;re going to create our own cutom Spinner by replacing classic texts with squares of color.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;The minimum SDK for this tutorial is the API 14 (Android 4.0 or also known as IceCreamSandwich).&lt;/p&gt;
&lt;p&gt;Spinner, Object class and 2&amp;rsquo;s complement will be see in this example.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Python 3 - PySide2 - Setting up and using Qt Designer</title>
      <link>https://www.badprog.com/python-3-pyside2-setting-up-and-using-qt-designer/</link>
      <pubDate>Wed, 27 Nov 2019 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/python-3-pyside2-setting-up-and-using-qt-designer/</guid>
      <description>&lt;p&gt;&lt;strong&gt;PySide2&lt;/strong&gt; is a &lt;strong&gt;Python&lt;/strong&gt; API for the &lt;strong&gt;Qt framework&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;This API is made with &lt;strong&gt;Shiboken2&lt;/strong&gt;, the Python binding generator.&lt;/p&gt;
&lt;p&gt;It means that you can write your code in Python and use the Qt framework as you’d do with C++.&lt;/p&gt;
&lt;p&gt;Even building a GUI with the &lt;strong&gt;Qt Designer&lt;/strong&gt; is possible.&lt;/p&gt;
&lt;p&gt;So what do we wait to start using it?&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;We need to install &lt;strong&gt;Python 3&lt;/strong&gt;on your computer.&lt;/p&gt;
&lt;p&gt;So in order to have the exact same software and libraries installed in the exact same locations, I suggest to follow the following tutorial:&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Boost - Converting std::vector to Boost.Python Numpy ndarray</title>
      <link>https://www.badprog.com/c-boost-converting-stdvector-to-boost-python-numpy-ndarray/</link>
      <pubDate>Mon, 25 Nov 2019 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-boost-converting-stdvector-to-boost-python-numpy-ndarray/</guid>
      <description>&lt;p&gt;You have a &lt;strong&gt;C++ std::vector&lt;/strong&gt; and you want to convert it to a &lt;strong&gt;Boost.Python Numpy ndarray&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;But, once the ndarray got, you want to get back to the C++ array.&lt;/p&gt;
&lt;p&gt;How to do that?&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see that in this Boost.Python tutorial.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;We need to install &lt;strong&gt;Python 3&lt;/strong&gt; and &lt;strong&gt;Boost&lt;/strong&gt; on your computer.&lt;/p&gt;
&lt;p&gt;So in order to have the exact same software and libraries installed in the exact same locations, I suggest to follow the 2 following tutorials:&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Boost - Using Boost.Python Numpy from_data()</title>
      <link>https://www.badprog.com/c-boost-using-boost-python-numpy-from-data/</link>
      <pubDate>Sun, 24 Nov 2019 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-boost-using-boost-python-numpy-from-data/</guid>
      <description>&lt;p&gt;If you are using &lt;strong&gt;Python&lt;/strong&gt; then &lt;strong&gt;NumPy&lt;/strong&gt; is quite interesting for manipulating &lt;strong&gt;arrays&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;But how do we do that with &lt;strong&gt;C++&lt;/strong&gt; and &lt;strong&gt;Boost.Python NumPy&lt;/strong&gt; extension?&lt;/p&gt;
&lt;p&gt;That&amp;rsquo;s what we are going to see in this &lt;strong&gt;Windows&lt;/strong&gt; tutorial with an easy example of the &lt;strong&gt;from_data()&lt;/strong&gt; method.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;We need to install &lt;strong&gt;Python 3&lt;/strong&gt; and &lt;strong&gt;Boost&lt;/strong&gt; on your computer.&lt;/p&gt;
&lt;p&gt;So in order to have the exact same software and libraries installed in the exact same locations, I suggest to follow the 2 following tutorials:&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Boost - Building the Boost.Python NumPy extension as a library</title>
      <link>https://www.badprog.com/c-boost-building-the-boost-python-numpy-extension-as-a-library/</link>
      <pubDate>Tue, 19 Nov 2019 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-boost-building-the-boost-python-numpy-extension-as-a-library/</guid>
      <description>&lt;p&gt;If you are a scientist and interested in &lt;strong&gt;Python&lt;/strong&gt;, you certainly already know the &lt;strong&gt;NumPy&lt;/strong&gt; package.&lt;/p&gt;
&lt;p&gt;In this tutorial I&amp;rsquo;ll propose to explain how to install it on &lt;strong&gt;Windows&lt;/strong&gt; in order to be used with the &lt;strong&gt;Boost.Python&lt;/strong&gt; library.&lt;/p&gt;
&lt;p&gt;We&amp;rsquo;ll also make an Hello world example.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;We need to install &lt;strong&gt;Python 3&lt;/strong&gt; and &lt;strong&gt;Boost&lt;/strong&gt; on your computer.&lt;/p&gt;
&lt;p&gt;So in order to have the exact same software and libraries installed in the exact same locations, I suggest to follow the 2 following tutorials:&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Boost - Using Boost.Python library on Windows to create a DLL</title>
      <link>https://www.badprog.com/c-boost-using-boost-python-library-on-windows-to-create-a-dll/</link>
      <pubDate>Wed, 13 Nov 2019 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-boost-using-boost-python-library-on-windows-to-create-a-dll/</guid>
      <description>&lt;p&gt;Communication between 2 different language isn&amp;rsquo;t so easy.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s often possible to find libraries to help us achieve this behaviour.&lt;/p&gt;
&lt;p&gt;That&amp;rsquo;s what we are going to see in this &lt;strong&gt;Boost.Python&lt;/strong&gt; tutorial for &lt;strong&gt;Windows&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s get started.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;We need to install Python 3 and Boost on your computer.&lt;/p&gt;
&lt;p&gt;So in order to have the exact same software and libraries installed in the exact same locations, I suggest to follow the 2 following tutorials:&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Boost - Setting up on Windows 10</title>
      <link>https://www.badprog.com/c-boost-setting-up-on-windows-10/</link>
      <pubDate>Sun, 10 Nov 2019 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-boost-setting-up-on-windows-10/</guid>
      <description>&lt;p&gt;&lt;strong&gt;Boost&lt;/strong&gt; libraries are some of the famous ones in the &lt;strong&gt;C++&lt;/strong&gt; world.&lt;/p&gt;
&lt;p&gt;They contain tons of functionalities but aren&amp;rsquo;t so easy to use or even understand.&lt;/p&gt;
&lt;p&gt;First things first, let&amp;rsquo;s try to install it in on our dear &lt;strong&gt;Windows 10&lt;/strong&gt; operating system (it should work as well on &lt;strong&gt;Windows 11&lt;/strong&gt;).&lt;/p&gt;
&lt;p&gt;And test it with &lt;strong&gt;Visual Studio 2017&lt;/strong&gt; and  &lt;strong&gt;Visual Studio 2019&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Ready? Let&amp;rsquo;s do it in this Boost installation tutorial for Windows 10.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Python 3 - Installing - On Windows 10</title>
      <link>https://www.badprog.com/python-3-installing-on-windows-10/</link>
      <pubDate>Sun, 10 Nov 2019 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/python-3-installing-on-windows-10/</guid>
      <description>&lt;p&gt;&lt;strong&gt;Python 3&lt;/strong&gt; has become an important language nowadays.&lt;/p&gt;
&lt;p&gt;So if you haven&amp;rsquo;t installed it yet on your &lt;strong&gt;Windows 10&lt;/strong&gt; operating system, it&amp;rsquo;s time (it should work as well on &lt;strong&gt;Windows 11&lt;/strong&gt;).&lt;/p&gt;
&lt;p&gt;We are going to setup a complete installation in order to be ready using it later.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see that in this Python 3 setting up tutorial.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;We are going to set up our computer in order to use the following software:&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Qt Framework - Using QStyledItemDelegate for displaying a QCheckBox in a QTableView</title>
      <link>https://www.badprog.com/c-qt-framework-using-qstyleditemdelegate-for-displaying-a-qcheckbox-in-a-qtableview/</link>
      <pubDate>Fri, 15 Mar 2019 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-qt-framework-using-qstyleditemdelegate-for-displaying-a-qcheckbox-in-a-qtableview/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;https://www.badprog.com/c-qt-framework-using-qabstractitemmodel-with-qtableview-and-qlistview&#34;&gt;Adding text and numbers in an QAbstractItemModel&lt;/a&gt; was the easy part of the Qt Model/View design.&lt;/p&gt;
&lt;p&gt;In this tutorial we are going a bit further by adding a &lt;strong&gt;QCheckBox&lt;/strong&gt; directly on each item of a column.&lt;/p&gt;
&lt;p&gt;But instead of using the &lt;strong&gt;createEditor()&lt;/strong&gt; method we&amp;rsquo;re going to use only the &lt;strong&gt;paint()&lt;/strong&gt; one.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s painting.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;For this example adding a visual QObject is generally made with the createEditor() method.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Windows - Creating a dynamic-link library (DLL)</title>
      <link>https://www.badprog.com/c-windows-creating-a-dynamic-link-library-dll/</link>
      <pubDate>Thu, 14 Mar 2019 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-windows-creating-a-dynamic-link-library-dll/</guid>
      <description>&lt;p&gt;Creating a &lt;strong&gt;.DLL&lt;/strong&gt; is an interesting process that allows a better comprehension how a &lt;strong&gt;dynamic-link library&lt;/strong&gt; works on Windows.&lt;/p&gt;
&lt;p&gt;No need to say that we&amp;rsquo;ll use Visual Studio for that.&lt;/p&gt;
&lt;p&gt;Ready to dynamic linking?&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s link.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;We need of course Visual Studio 2017 but feel free to use the version of your choice.&lt;/p&gt;
&lt;p&gt;We&amp;rsquo;are going to create a dynamic-link library, at first, then create an application that&amp;rsquo;ll use this library.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Qt Framework - Using QAbstractItemModel with QTableView and QListView</title>
      <link>https://www.badprog.com/c-qt-framework-using-qabstractitemmodel-with-qtableview-and-qlistview/</link>
      <pubDate>Mon, 11 Mar 2019 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-qt-framework-using-qabstractitemmodel-with-qtableview-and-qlistview/</guid>
      <description>&lt;p&gt;The &lt;strong&gt;QAbstractItemModel&lt;/strong&gt; is usually used with views like &lt;strong&gt;QTableView&lt;/strong&gt;, &lt;strong&gt;QTreeView&lt;/strong&gt; or &lt;strong&gt;QListView&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;We’re going to see how to use this class in a very easy example.&lt;/p&gt;
&lt;p&gt;To be honest nothing is easy but we’ll use the minimum elements in order to have something useful for every new project.&lt;/p&gt;
&lt;p&gt;Let’s see that in this QAbstractItemModel tutorial.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;The &lt;strong&gt;Model/View&lt;/strong&gt; design is quite different from the classic &lt;strong&gt;Widgets&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Indeed, here the view and the model are separated in at least two different classes.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Python 3 - Generating get and set for C&#43;&#43;</title>
      <link>https://www.badprog.com/python-3-generating-get-and-set-for-c/</link>
      <pubDate>Sat, 09 Feb 2019 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/python-3-generating-get-and-set-for-c/</guid>
      <description>&lt;p&gt;Creating get and set can be a tough task.&lt;/p&gt;
&lt;p&gt;Indeed if you have like dozen of new properties to add to new classes, it could take hours.&lt;/p&gt;
&lt;p&gt;So what about generating them in few minutes with a script?&lt;/p&gt;
&lt;p&gt;Let’s see that in this Python scripting tutorial for the C++ language.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;Fell free to adapt the code for your own language such as Java, PHP or C# for example.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Qt Framework - Using QDataStream</title>
      <link>https://www.badprog.com/c-qt-framework-using-qdatastream/</link>
      <pubDate>Mon, 04 Feb 2019 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-qt-framework-using-qdatastream/</guid>
      <description>&lt;p&gt;The &lt;strong&gt;QDataStream&lt;/strong&gt; class allows to stock data from an input and give back this data to an output.&lt;/p&gt;
&lt;p&gt;Quite interesting when you want, for example, to transfer data from a computer to another.&lt;/p&gt;
&lt;p&gt;Let’s see that in this QDataStream tutorial.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;In this tutorial we’re going to create a custom object (BadprogDS) and transfer it to another one.&lt;/p&gt;
&lt;p&gt;It’ll involve overload stream operators such as &amp;ldquo;&amp;laquo;&amp;rdquo; and &amp;ldquo;&amp;raquo;&amp;rdquo;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - SSH - Communication between client and server</title>
      <link>https://www.badprog.com/unix-gnu-linux-ssh-communication-between-client-and-server/</link>
      <pubDate>Thu, 17 Jan 2019 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-ssh-communication-between-client-and-server/</guid>
      <description>&lt;p&gt;In this tutorial we are going to see how two computers can communicate with each other through the &lt;strong&gt;SSH&lt;/strong&gt; protocol.&lt;/p&gt;
&lt;p&gt;Why do we need SSH keys and how to use them?&lt;/p&gt;
&lt;p&gt;We will use one computer as Server and another one as Client.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Ubuntu 18.04.01 (LTS): &lt;a href=&#34;https://www.ubuntu.com/&#34;&gt;https://www.ubuntu.com/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;openssh-server: directly from Ubuntu (more details in the tutorial)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Before starting we need some useful tools that we are going to install on Ubuntu:&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Visual Studio IDE - Sharing project property sheets on many projects</title>
      <link>https://www.badprog.com/c-visual-studio-ide-sharing-project-property-sheets-on-many-projects/</link>
      <pubDate>Wed, 09 Jan 2019 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-visual-studio-ide-sharing-project-property-sheets-on-many-projects/</guid>
      <description>&lt;p&gt;What is really annoying is to do again and again the same task without having something new to do.&lt;/p&gt;
&lt;p&gt;Set a Visual Studio project is one of this thing that you would like to automatize.&lt;/p&gt;
&lt;p&gt;The property manager allows us to do this kind of mechanism.&lt;/p&gt;
&lt;p&gt;We, indeed, are going to see how to share configurations from many C++ projects.&lt;/p&gt;
&lt;p&gt;Let’s get started.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;Visual Studio IDE: &lt;a href=&#34;https://visualstudio.microsoft.com/&#34;&gt;https://visualstudio.microsoft.com/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Let’s create a solution and 3 projects:&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Design pattern - Command</title>
      <link>https://www.badprog.com/c-design-pattern-command/</link>
      <pubDate>Tue, 14 Aug 2018 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-design-pattern-command/</guid>
      <description>&lt;p&gt;The &lt;strong&gt;Command&lt;/strong&gt; design pattern creates a list of objects on which we&amp;rsquo;re going to apply a generic method.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s a bit unusal because an object will request a method as parameter.&lt;/p&gt;
&lt;p&gt;This makes the Command design pattern a versatile one but maybe not so easy to handle at first.&lt;/p&gt;
&lt;p&gt;Once again an interesting study case.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see that in this Command design pattern tutorial.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;GitHub&lt;/strong&gt;: &lt;a href=&#34;https://github.com/badprog/badprog-design-pattern-command&#34;&gt;https://github.com/badprog/badprog-design-pattern-command&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;There are many ways to use this Command design pattern.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Design pattern - Memento</title>
      <link>https://www.badprog.com/c-design-pattern-memento/</link>
      <pubDate>Wed, 06 Jun 2018 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-design-pattern-memento/</guid>
      <description>&lt;p&gt;The &lt;strong&gt;Memento&lt;/strong&gt; design pattern allows an object to retrieve last states of another object.&lt;/p&gt;
&lt;p&gt;This is used for example in the undo mechanism.&lt;/p&gt;
&lt;p&gt;So it&amp;rsquo;s a very interesting pattern that doesn&amp;rsquo;t use any interface.&lt;/p&gt;
&lt;p&gt;But instead it uses an opaque pointer in order to store old states of the main object.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see that in this Memento design pattern tutorial.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;GitHub&lt;/strong&gt;: &lt;a href=&#34;https://github.com/badprog/badprog-design-pattern-memento&#34;&gt;https://github.com/badprog/badprog-design-pattern-memento&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This pattern may seem obscur at first glance and maybe you have some questions such as: Why do we have to use three classes to save states of an object?&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Design pattern - Strategy</title>
      <link>https://www.badprog.com/c-design-pattern-strategy/</link>
      <pubDate>Sun, 13 May 2018 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-design-pattern-strategy/</guid>
      <description>&lt;p&gt;The &lt;strong&gt;Strategy&lt;/strong&gt; design pattern allows to change behaviour of a program depending on a context.&lt;/p&gt;
&lt;p&gt;It means that a single class can manage many others without knowing that those classes even exist.&lt;/p&gt;
&lt;p&gt;Interesting isn&amp;rsquo;t it?&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see that in this Strategy design pattern tutorial.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;GitHub&lt;/strong&gt;: &lt;a href=&#34;https://github.com/badprog/badprog-design-pattern-strategy&#34;&gt;https://github.com/badprog/badprog-design-pattern-strategy&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In this example we are going to use a &lt;strong&gt;Context&lt;/strong&gt; as a manager, an &lt;strong&gt;IStrategy&lt;/strong&gt; as interface, &lt;strong&gt;Strategy1&lt;/strong&gt; and &lt;strong&gt;Strategy2&lt;/strong&gt; as dashboards.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Design pattern - Proxy</title>
      <link>https://www.badprog.com/c-design-pattern-proxy/</link>
      <pubDate>Thu, 10 May 2018 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-design-pattern-proxy/</guid>
      <description>&lt;p&gt;The &lt;strong&gt;Proxy&lt;/strong&gt; design pattern is in charge of managing another class.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s like a firewall that you cannot overstep.&lt;/p&gt;
&lt;p&gt;There are several reasons to use a Proxy instead of directly another class.&lt;/p&gt;
&lt;p&gt;For example it can check if a client accessing an object has permission to do that or it can substitute to this object until someone really needs it (in order to avoid useless memory loading).&lt;/p&gt;
&lt;p&gt;So it&amp;rsquo;s a more complex object than the real one.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Design pattern - Mediator</title>
      <link>https://www.badprog.com/c-design-pattern-mediator/</link>
      <pubDate>Tue, 08 May 2018 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-design-pattern-mediator/</guid>
      <description>&lt;p&gt;The &lt;strong&gt;Mediator&lt;/strong&gt; design pattern allows to unlink objects from each other.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s like a manager that centralizes every action performed by a component in order to dispatch these events to all other objects that need to know information.&lt;/p&gt;
&lt;p&gt;It could be seen as a design pattern quite accessible in term of complexity.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s try it in an example.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;GitHub&lt;/strong&gt;: &lt;a href=&#34;https://github.com/badprog/badprog-design-pattern-mediator&#34;&gt;https://github.com/badprog/badprog-design-pattern-mediator&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;What&amp;rsquo;s interesting in this design pattern is that each Ship doesn&amp;rsquo;t know who are other Ships.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Standard library - move</title>
      <link>https://www.badprog.com/c-standard-library-move/</link>
      <pubDate>Sun, 29 Apr 2018 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-standard-library-move/</guid>
      <description>&lt;p&gt;The &lt;strong&gt;move&lt;/strong&gt; template function allows to change an object owner.&lt;/p&gt;
&lt;p&gt;We&amp;rsquo;re not going to dive in the heart of the move semantics.&lt;/p&gt;
&lt;p&gt;Instead we&amp;rsquo;re going to see a really easy example of how it works.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s get started.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;In this &lt;em&gt;move&lt;/em&gt; tutorial we&amp;rsquo;re going to create 3 Ships, check their memory address then pass them to a Manager in order to add them to the Manager list.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Design pattern - Decorator</title>
      <link>https://www.badprog.com/c-design-pattern-decorator/</link>
      <pubDate>Wed, 11 Apr 2018 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-design-pattern-decorator/</guid>
      <description>&lt;p&gt;The &lt;strong&gt;Decorator&lt;/strong&gt; design pattern allows an object to be decorated in different ways not by inheriting from another class but by adding features directly to this object.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s main interest is to avoid multiplication of classes that would be almost the same as the main one.&lt;/p&gt;
&lt;p&gt;This design pattern has an interesting architecture even if not so easy to understand at first.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see how this Decorator design pattern works.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Design pattern - Prototype</title>
      <link>https://www.badprog.com/c-design-pattern-prototype/</link>
      <pubDate>Thu, 05 Apr 2018 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-design-pattern-prototype/</guid>
      <description>&lt;p&gt;The &lt;strong&gt;Prototype&lt;/strong&gt; design pattern is used in order to &lt;strong&gt;clone an object&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Main goal to prototype design pattern is to create new objects with default values.&lt;/p&gt;
&lt;p&gt;This cloning operation is actually a copy of an object and can be made with a shallow or a deep copy.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see that in this Prototype design pattern tutorial.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;Find the complete code on &lt;strong&gt;GitHub&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;https://github.com/badprog/badprog-design-pattern-prototype&#34;&gt;https://github.com/badprog/badprog-design-pattern-prototype&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;There are two different ways to copy an object: &lt;strong&gt;shallow&lt;/strong&gt; and &lt;strong&gt;deep&lt;/strong&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Design pattern - Factory method</title>
      <link>https://www.badprog.com/c-design-pattern-factory-method/</link>
      <pubDate>Sun, 04 Mar 2018 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-design-pattern-factory-method/</guid>
      <description>&lt;p&gt;The &lt;strong&gt;Factory method&lt;/strong&gt; design pattern is a really helpful one and a great dive into the world of design patterns.&lt;/p&gt;
&lt;p&gt;In our example we are going to use an interface and some concrete classes.&lt;/p&gt;
&lt;p&gt;If by reading this you are still interested in the concept, let&amp;rsquo;s see the Factory method design pattern in this tutorial.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;GitHub: &lt;a href=&#34;https://github.com/badprog/badprog-design-pattern-singleton-factory-method&#34;&gt;https://github.com/badprog/badprog-design-pattern-singleton-factory-method&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In the following tutorial we are going to use an interface class called &lt;strong&gt;IShip&lt;/strong&gt; that three other classes will inherit: &lt;strong&gt;ShipTiny&lt;/strong&gt;, &lt;strong&gt;ShipNormal&lt;/strong&gt; and &lt;strong&gt;ShipEnormous&lt;/strong&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Design pattern - Singleton</title>
      <link>https://www.badprog.com/c-design-pattern-singleton/</link>
      <pubDate>Wed, 14 Feb 2018 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-design-pattern-singleton/</guid>
      <description>&lt;p&gt;This &lt;strong&gt;Singleton&lt;/strong&gt; design pattern is certainly the most known and maybe the most easiest to understand.&lt;/p&gt;
&lt;p&gt;Its goal is to guarantee that an object will be created only once through all the program.&lt;/p&gt;
&lt;p&gt;So this object has to be unique, can&amp;rsquo;t even be created twice nor copied and it must be accessible through the entire application.&lt;/p&gt;
&lt;p&gt;This is for example the case when you have a logging class that must be accessible by almost every class in your program.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Design pattern - Observer</title>
      <link>https://www.badprog.com/c-design-pattern-observer/</link>
      <pubDate>Wed, 31 Jan 2018 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-design-pattern-observer/</guid>
      <description>&lt;p&gt;The &lt;strong&gt;Observer&lt;/strong&gt; design pattern allows an object (often called Subject) to inform other objects (Observers) that an event has occurred.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s particularly useful when you have data from a Subject but you don&amp;rsquo;t know how this data will be used by the Observers.&lt;/p&gt;
&lt;p&gt;For example, data from a Subject can be used to display a text in an Observer and a chart in another Observer (even if data is the same).&lt;/p&gt;</description>
    </item>
    <item>
      <title>Android - API - Creating a GridView</title>
      <link>https://www.badprog.com/android-api-creating-a-gridview/</link>
      <pubDate>Sun, 17 Dec 2017 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/android-api-creating-a-gridview/</guid>
      <description>&lt;p&gt;The &lt;strong&gt;GridView&lt;/strong&gt; is a bit like the &lt;strong&gt;ListView&lt;/strong&gt;&amp;rsquo;s sibling.&lt;/p&gt;
&lt;p&gt;A lot of concepts are shared with those similar components.&lt;/p&gt;
&lt;p&gt;We&amp;rsquo;re going to see how to create an easy GridView with almost the same code as the &lt;a href=&#34;https://www.badprog.com/android-api-creating-a-listview&#34;&gt;ListView tutorial&lt;/a&gt; but with some differences.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s get started.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;The GridView is often used to displays images as in a portfolio.&lt;/p&gt;
&lt;p&gt;But in our tutorial we will use Strings and Integers because they are easier to use.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Android - API - Creating a ListView</title>
      <link>https://www.badprog.com/android-api-creating-a-listview/</link>
      <pubDate>Sat, 16 Dec 2017 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/android-api-creating-a-listview/</guid>
      <description>&lt;p&gt;The &lt;strong&gt;ListView&lt;/strong&gt; is certainly one of the most used components by Android programmers in their applications.&lt;/p&gt;
&lt;p&gt;Why? Because the concept is easy to understand and the result looks nice.&lt;/p&gt;
&lt;p&gt;But a lot of tutorials are made with complicated ListView examples.&lt;/p&gt;
&lt;p&gt;In this tutorial we are going to see how to use it in the most easy way.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;We will display &lt;strong&gt;2 ListViews&lt;/strong&gt;, one with &lt;strong&gt;Strings&lt;/strong&gt; and the other one with &lt;strong&gt;Integers&lt;/strong&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - CMake - Setup with Cygwin</title>
      <link>https://www.badprog.com/c-cmake-setup-with-cygwin/</link>
      <pubDate>Fri, 18 Aug 2017 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-cmake-setup-with-cygwin/</guid>
      <description>&lt;p&gt;There are many ways to create a &lt;strong&gt;Makefile&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;In this tutorial we are going to see how to generate a Makefile with &lt;strong&gt;CMake&lt;/strong&gt; on Windows.&lt;/p&gt;
&lt;p&gt;Indeed, CMake is a complex but interesting tool that can generate native Makefiles for the compiler of your choice.&lt;/p&gt;
&lt;p&gt;But it&amp;rsquo;s not all, CMake can also create some useful project files, for a lot of IDE (such as Visual Studio or Eclipse for example) and almost every OS (like GNU/Linux, Windows, Mac, etc.).&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Google Test - Set up projects to use the gtest library</title>
      <link>https://www.badprog.com/c-google-test-set-up-projects-to-use-the-gtest-library/</link>
      <pubDate>Thu, 10 Aug 2017 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-google-test-set-up-projects-to-use-the-gtest-library/</guid>
      <description>&lt;p&gt;Creating a library for your Google Test framework is a good practise.&lt;/p&gt;
&lt;p&gt;It separates your main project, your library and your tests code.&lt;/p&gt;
&lt;p&gt;A great way to deal with your dev team and your test team.&lt;/p&gt;
&lt;p&gt;Visual Studio will be our IDE for this tutorial.&lt;/p&gt;
&lt;p&gt;So let&amp;rsquo;s get started.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;For this tutorial we need:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Visual Studio 2017 Community&lt;/strong&gt;: &lt;a href=&#34;https://www.visualstudio.com/downloads/&#34;&gt;https://www.visualstudio.com/downloads/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Google Test 1.8.0&lt;/strong&gt;: &lt;a href=&#34;https://github.com/google/googletest/releases&#34;&gt;https://github.com/google/googletest/releases&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Google Test will be installed in this directory:&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Google Test - Generating the gtest.lib from gtest.sln with Visual Studio</title>
      <link>https://www.badprog.com/c-google-test-generating-the-gtest-lib-from-gtest-sln-with-visual-studio/</link>
      <pubDate>Mon, 07 Aug 2017 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-google-test-generating-the-gtest-lib-from-gtest-sln-with-visual-studio/</guid>
      <description>&lt;p&gt;Google Test framework is provided with a solution already generated that we can use with Visual Studio.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s the &lt;strong&gt;gtest.sln&lt;/strong&gt; file.&lt;/p&gt;
&lt;p&gt;But to use it we have to accomplish some steps in order to having it working properly.&lt;/p&gt;
&lt;p&gt;This is what we will see in this Google Test tutorial.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s get started.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;For this tutorial we need:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Visual Studio 2017 Community&lt;/strong&gt;: &lt;a href=&#34;https://www.visualstudio.com/downloads/&#34;&gt;https://www.visualstudio.com/downloads/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Google Test 1.8.0&lt;/strong&gt;: &lt;a href=&#34;https://github.com/google/googletest/releases&#34;&gt;https://github.com/google/googletest/releases&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Google Test will be installed in this directory:&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Google Test - Using a Makefile to generate tests</title>
      <link>https://www.badprog.com/c-google-test-using-a-makefile-to-generate-tests/</link>
      <pubDate>Sun, 06 Aug 2017 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-google-test-using-a-makefile-to-generate-tests/</guid>
      <description>&lt;p&gt;After succeeded in accomplishing the &lt;a href=&#34;https://www.badprog.com/c-google-test-setup-visual-studio-by-hand&#34;&gt;Google Test setup by hand&lt;/a&gt; we are going to see how to use a Makefile to create our running tests.&lt;/p&gt;
&lt;p&gt;Of course, this time, we will use the &lt;strong&gt;Cygwin&lt;/strong&gt; CLI in order to create our tests example.&lt;/p&gt;
&lt;p&gt;So don&amp;rsquo;t wait anymore, let&amp;rsquo;s get started.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;For this Google Test tutorial, we need some useful tools to create an example:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Google Test&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Cygwin&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;google-test&#34;&gt;Google Test&lt;/h3&gt;
&lt;p&gt;Of course, we need the Google Test framework.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Google Test - Setup Visual Studio by hand</title>
      <link>https://www.badprog.com/c-google-test-setup-visual-studio-by-hand/</link>
      <pubDate>Thu, 03 Aug 2017 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-google-test-setup-visual-studio-by-hand/</guid>
      <description>&lt;p&gt;Before playing with the Google Test library, it&amp;rsquo;s necessary to install it.&lt;/p&gt;
&lt;p&gt;This is what this tutorial is made of, a bunch of elements in order to set up it.&lt;/p&gt;
&lt;p&gt;In our example, we are going to use Visual Studio 2017, so on Windows, without any Command-Line Interface (CLI) nor the RUN_ALL_TESTS() macro.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;Two tools are necessary to realise this Google Test tutorial:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Visual Studio&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Google Test&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;visual-studio&#34;&gt;Visual Studio&lt;/h3&gt;
&lt;p&gt;We admit you have already downloaded &lt;strong&gt;Visual Studio 2017&lt;/strong&gt;, but if not you can always do it.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Qt Framework - Using Jenkins to generate an .EXE file</title>
      <link>https://www.badprog.com/c-qt-framework-using-jenkins-to-generate-an-exe-file/</link>
      <pubDate>Mon, 10 Jul 2017 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-qt-framework-using-jenkins-to-generate-an-exe-file/</guid>
      <description>&lt;p&gt;In this tutorial we are going to see how to download a project directly on GitHub, generate makefiles of this project, compile it and copy several dynamic-link libraries from a directory to another one.&lt;/p&gt;
&lt;p&gt;And all that automatically!&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see this in this Jenkins setup for Qt on Windows with MinGW.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;We&amp;rsquo;ll use one of my project that I already put on GitHub in order to use it as an example:&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - SSH - Generating the public and private keys with a CLI</title>
      <link>https://www.badprog.com/unix-gnu-linux-ssh-generating-the-public-and-private-keys-with-a-cli/</link>
      <pubDate>Thu, 29 Jun 2017 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-ssh-generating-the-public-and-private-keys-with-a-cli/</guid>
      <description>&lt;p&gt;Using SSH is helpful in many situations.&lt;/p&gt;
&lt;p&gt;But before using it, it&amp;rsquo;s essential to have the famous &lt;strong&gt;public and private keys&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;This SSH tutorial is for Windows and Linux users but feel free to inspire yourself for another operating system.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see that.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;In this SSH tutorial we are going to use a CLI (Command Line Interface).&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ve chosen Git Bash but of course you can use the CLI of your choice (Cygwin for example) on Windows or simply your usual terminal on Linux.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Qt Framework - Moving a shape with arrow keys</title>
      <link>https://www.badprog.com/c-qt-framework-moving-a-shape-with-arrow-keys/</link>
      <pubDate>Wed, 14 Jun 2017 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-qt-framework-moving-a-shape-with-arrow-keys/</guid>
      <description>&lt;p&gt;Playing with the keyboard is an interesting way of learning the Qt framework.&lt;/p&gt;
&lt;p&gt;In this tutorial we are going see, indeed, how to use the arrow keys in order to move a shape.&lt;/p&gt;
&lt;p&gt;This shape is a circle, with only few properties to handle with.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s get started.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;In this Qt example we are going to use an &lt;strong&gt;interface&lt;/strong&gt; to specify that our shape is &lt;strong&gt;movable&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;We&amp;rsquo;ll also define a constructor for this shape in order to set their useful properties.&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - Kernel - Hello world Linux kernel compilation</title>
      <link>https://www.badprog.com/unix-gnu-linux-kernel-hello-world-linux-kernel-compilation/</link>
      <pubDate>Mon, 12 Dec 2016 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-kernel-hello-world-linux-kernel-compilation/</guid>
      <description>&lt;p&gt;If you read this tutorial it&amp;rsquo;s because you are curious about how to compile a Linux kernel.&lt;/p&gt;
&lt;p&gt;There is plenty of reasons you might want to learn this procedure.&lt;/p&gt;
&lt;p&gt;Even if you are a beginner, you will understand each step for building your first &lt;strong&gt;Linux kernel&lt;/strong&gt;.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;To compile a Linux kernel, you have to have a Linux distribution installed on your computer.&lt;/p&gt;
&lt;p&gt;So if you don&amp;rsquo;t know how, I recommend to start by using a virtual machine, such as &lt;strong&gt;VirtualBox&lt;/strong&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - Gentoo - Basis for setting it up</title>
      <link>https://www.badprog.com/unix-gnu-linux-gentoo-basis-for-setting-it-up/</link>
      <pubDate>Sun, 11 Dec 2016 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-gentoo-basis-for-setting-it-up/</guid>
      <description>&lt;p&gt;In the Linux world, there are two types of distributions.&lt;/p&gt;
&lt;p&gt;First the monolithic ones, such as Ubuntu, where you don&amp;rsquo;t have to set anything before using it.&lt;/p&gt;
&lt;p&gt;Everything (or almost) is included to begin.&lt;/p&gt;
&lt;p&gt;Second, the specific ones, that on calls &lt;strong&gt;meta-distributions&lt;/strong&gt;, where you have to select only packages and options you want to have.&lt;/p&gt;
&lt;p&gt;Of course, the first is easier to use for a current usage but there is no optimization at all.&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - bash - Setting a profile with the Git prompt</title>
      <link>https://www.badprog.com/unix-gnu-linux-bash-setting-a-profile-with-the-git-prompt/</link>
      <pubDate>Sun, 06 Nov 2016 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-bash-setting-a-profile-with-the-git-prompt/</guid>
      <description>&lt;p&gt;You have downloaded and installed your Git Bash on Windows.&lt;/p&gt;
&lt;p&gt;That&amp;rsquo;s a good thing.&lt;/p&gt;
&lt;p&gt;But if you want to change your prompt as your favorite one, you have to create a file and add your own settings.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see this.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;After &lt;a href=&#34;https://git-scm.com/download/win&#34;&gt;downloading Git bash&lt;/a&gt; and installed it, if you launch it you&amp;rsquo;ll have a classic prompt.&lt;/p&gt;
&lt;p&gt;To have something different, you have to create a new file &lt;strong&gt;.profile&lt;/strong&gt; to override the default settings.&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - Raspberry Pi - Set up for a connection with a desktop PC</title>
      <link>https://www.badprog.com/unix-gnu-linux-raspberry-pi-set-up-for-a-connection-with-a-desktop-pc/</link>
      <pubDate>Sun, 16 Oct 2016 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-raspberry-pi-set-up-for-a-connection-with-a-desktop-pc/</guid>
      <description>&lt;p&gt;Since its launch, the Raspberry Pi has a very huge impact in the world.&lt;/p&gt;
&lt;p&gt;You have certainly one in your hands but maybe you don&amp;rsquo;t really know how to use it.&lt;/p&gt;
&lt;p&gt;In this tutorial, we are going to see how to send commands directly from your PC without having a specific screen, keyboard and mouse connected onto the board.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s totally possible! For that the only thing to have is an Ethernet cable connected to your network.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Android - API - Classic methods during a life cycle with one activity</title>
      <link>https://www.badprog.com/android-api-classic-methods-during-a-life-cycle-with-one-activity/</link>
      <pubDate>Sun, 21 Aug 2016 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/android-api-classic-methods-during-a-life-cycle-with-one-activity/</guid>
      <description>&lt;p&gt;In this tutorial we will see how and when Activity main methods are called during a classic life cycle.&lt;/p&gt;
&lt;p&gt;Only one activity will be used in this example in order to have something easy to understand.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see that.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;During this video, I launched the application then I clicked on the home button to pause it.&lt;/p&gt;
&lt;p&gt;After I clicked the application again from the list and it came back with the methods called.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Android - API - Life cycle of 2 activities with the Intent class</title>
      <link>https://www.badprog.com/android-api-life-cycle-of-2-activities-with-the-intent-class/</link>
      <pubDate>Sun, 21 Aug 2016 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/android-api-life-cycle-of-2-activities-with-the-intent-class/</guid>
      <description>&lt;p&gt;One important step in Android development is to understand how to deal with many activities.&lt;/p&gt;
&lt;p&gt;This is what we are going to see in this Activity tutorial with an example of the famous Intent class.&lt;/p&gt;
&lt;p&gt;Stop talking, let&amp;rsquo;s get coded.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;In the video you can see, in orange, the MainActivity and, in green, the Activity_2.&lt;/p&gt;
&lt;p&gt;The title also changes with the corresponding activity.&lt;/p&gt;
&lt;p&gt;To go to the second activity, I push the Button &amp;ldquo;GO TO ACTIVITY 2&amp;rdquo;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Android - API - Getting the current method name with StackTraceElement</title>
      <link>https://www.badprog.com/android-api-getting-the-current-method-name-with-stacktraceelement/</link>
      <pubDate>Sat, 20 Aug 2016 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/android-api-getting-the-current-method-name-with-stacktraceelement/</guid>
      <description>&lt;p&gt;Always dreamed to see the stack without your debugger?&lt;/p&gt;
&lt;p&gt;Maybe this tutorial will help you with the StackTraceElement Java class.&lt;/p&gt;
&lt;p&gt;Of course we are going to use an Android application to see all that on our screen!&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s get started.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;I&amp;rsquo;ve created a while loop in order to use every element in the stack until the last one.&lt;/p&gt;
&lt;p&gt;A special classe has been created (BadprogHelper) in order to use a specific method to have a delay between each element.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Android - Tips&#39;n Tricks - Hiding/Showing the Notification bar</title>
      <link>https://www.badprog.com/android-tips-n-tricks-hiding-showing-the-notification-bar/</link>
      <pubDate>Tue, 16 Aug 2016 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/android-tips-n-tricks-hiding-showing-the-notification-bar/</guid>
      <description>&lt;p&gt;Maybe you don&amp;rsquo;t know that but it&amp;rsquo;s possible to remove the Notification bar programmatically.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s quite useful if you don&amp;rsquo;t really need it for your custom application.&lt;/p&gt;
&lt;p&gt;It takes a little bit portion of your screen but why let it?&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see that in this Notification bar tutorial.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;We&amp;rsquo;re going to create a Button to hide and display the NotificationBar.&lt;/p&gt;
&lt;p&gt;Each time you click the Button, the state changes by toggling the features of this Button.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Electronics - STM32 - GPIO overview with the STM32F3-Discovery board</title>
      <link>https://www.badprog.com/electronics-stm32-gpio-overview-with-the-stm32f3-discovery-board/</link>
      <pubDate>Mon, 11 Apr 2016 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-stm32-gpio-overview-with-the-stm32f3-discovery-board/</guid>
      <description>&lt;p&gt;GPIO is one of the most easy peripheral to understand in a microcontroller.&lt;/p&gt;
&lt;p&gt;But of course it demands a bit of practice to handle it with ease.&lt;/p&gt;
&lt;p&gt;That&amp;rsquo;s the purpose of this STM32F303-Discovery board tutorial.&lt;/p&gt;
&lt;p&gt;We are going to blink 4 LEDS in order to get how the basics work.&lt;/p&gt;
&lt;h2 id=&#34;github&#34;&gt;GitHub&lt;/h2&gt;
&lt;p&gt;Retrieve this example with full code on my GitHub:&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/badprog/badprog-stm32f303vct6-blinking-led&#34;&gt;https://github.com/badprog/badprog-stm32f303vct6-blinking-led&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;registers&#34;&gt;Registers&lt;/h2&gt;
&lt;p&gt;In the STM32F303VCT6, there are of course some GPIOs.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Electronics - STM32 - Using the push button to switch on the LED6 on the STM32F3-Discovery board</title>
      <link>https://www.badprog.com/electronics-stm32-using-the-push-button-to-switch-on-the-led6-on-the-stm32f3-discovery-board/</link>
      <pubDate>Thu, 24 Mar 2016 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-stm32-using-the-push-button-to-switch-on-the-led6-on-the-stm32f3-discovery-board/</guid>
      <description>&lt;p&gt;This tutorial may be seen as a HelloWorld project.&lt;/p&gt;
&lt;p&gt;Indeed we are going to switch on the LED6 of the STM32F3-Discovery board with the push button.&lt;/p&gt;
&lt;p&gt;The code has been reduced to its minimum in order to get the most important elements in this example.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;You can find the whole project on my GitHub:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/badprog/badprog-stm32f303vct6-pushbutton-led&#34;&gt;https://github.com/badprog/badprog-stm32f303vct6-pushbutton-led&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The project has been made with Atollic TrueStudio, but the code in the main.c file is the same, if you use another IDE such as Keil uVision, IAR EW and so on.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Electronics - Atollic - Code completion and content assist</title>
      <link>https://www.badprog.com/electronics-atollic-code-completion-and-content-assist/</link>
      <pubDate>Tue, 22 Mar 2016 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-atollic-code-completion-and-content-assist/</guid>
      <description>&lt;p&gt;As Atollic is based on the Eclipse IDE, this tutorial is so also available for Eclipse.&lt;/p&gt;
&lt;p&gt;We are going to see how to add the completion to the Atollic TrueStudio IDE.&lt;/p&gt;
&lt;p&gt;Of course, this turorial admits that you have a project where the code completion is missing because you don&amp;rsquo;t have the correct libraries.&lt;/p&gt;
&lt;p&gt;If you have set correctly your project, and still have a completion problem, then I suggest to &lt;strong&gt;close and reopen it&lt;/strong&gt;, it could solve this issue.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C# - Visual Studio - Adding a custom ICO file to an application</title>
      <link>https://www.badprog.com/c-visual-studio-adding-a-custom-ico-file-to-an-application/</link>
      <pubDate>Wed, 16 Mar 2016 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-visual-studio-adding-a-custom-ico-file-to-an-application/</guid>
      <description>&lt;p&gt;It&amp;rsquo;s always a good thing to personalise applications we make, especially when there is a graphical user interface.&lt;/p&gt;
&lt;p&gt;The idea here is to change the default icon of your C# application with Visual Studio.&lt;/p&gt;
&lt;p&gt;We also use the Gimp software to create the .ico file.&lt;/p&gt;
&lt;p&gt;So let&amp;rsquo;s get started.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;We will use for this tutorial:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://www.visualstudio.com/&#34;&gt;Microsoft Visual Studio Community 2015 version&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.gimp.org/&#34;&gt;Gimp 2.8.16&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;creating-the-ico-file-with-gimp&#34;&gt;Creating the .ico file with Gimp&lt;/h2&gt;
&lt;p&gt;Create the icon you want.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Electronics - MSP430 - Using timer and interruption to generate a delay of 1 second</title>
      <link>https://www.badprog.com/electronics-msp430-using-timer-and-interruption-to-generate-a-delay-of-1-second/</link>
      <pubDate>Mon, 04 Jan 2016 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-msp430-using-timer-and-interruption-to-generate-a-delay-of-1-second/</guid>
      <description>&lt;p&gt;The first two features to understand in a microcontroller are timers and interruptions.&lt;/p&gt;
&lt;p&gt;Indeed, without a timer nor interruptions, it&amp;rsquo;s quite impossible to have an accurate timing in a program.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see that in this tutorial and let&amp;rsquo;s generate a &lt;strong&gt;timing of 1 second&lt;/strong&gt; with the &lt;strong&gt;G2553&lt;/strong&gt; microcontroller.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;The essential documents needed for any project with a &lt;strong&gt;MSP430&lt;/strong&gt; microcontroller are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;datasheet &amp;ndash;&amp;gt; &lt;a href=&#34;http://www.ti.com/lit/ds/symlink/msp430g2553.pdf&#34;&gt;http://www.ti.com/lit/ds/symlink/msp430g2553.pdf&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;user guide &amp;ndash;&amp;gt; &lt;a href=&#34;http://www.ti.com/lit/ug/slau144j/slau144j.pdf&#34;&gt;http://www.ti.com/lit/ug/slau144j/slau144j.pdf&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The main goal of  a timer is to generate a counter and check if a particular number in this counter has been reached.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - OpenGL - Using the OR and LEFT SHIFT operators to retrieve the display mode with strings</title>
      <link>https://www.badprog.com/c-opengl-using-the-or-and-left-shift-operators-to-retrieve-the-display-mode-with-strings/</link>
      <pubDate>Sun, 30 Aug 2015 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-opengl-using-the-or-and-left-shift-operators-to-retrieve-the-display-mode-with-strings/</guid>
      <description>&lt;p&gt;The following tutorial will show you how to exploit data taken from a binary variable.&lt;/p&gt;
&lt;p&gt;In order to explain it, we are going to use the &lt;strong&gt;GLUT OpenGL&lt;/strong&gt; library.&lt;/p&gt;
&lt;p&gt;The display mode uses indeed this kind of mechanism with the &lt;strong&gt;OR operator&lt;/strong&gt;, symbolized with the famous &lt;strong&gt;pipe: &amp;ldquo;|&amp;rdquo;&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;And we&amp;rsquo;ll use the &lt;strong&gt;LEFT SHIFT operator &amp;ldquo;&amp;laquo;&amp;rdquo;&lt;/strong&gt; to check data.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s dive into these binary operators.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;In the GLUT library there are defines in the &lt;strong&gt;freeglut_std.h&lt;/strong&gt; file such as &lt;strong&gt;GLUT_RBG, GLUT_INDEX, GLUT_DOUBLE, GLUT_DEPTH&lt;/strong&gt;, etc.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - OpenGL - Checking the FreeGLUT, GLEW and OpenGL version</title>
      <link>https://www.badprog.com/c-opengl-checking-the-freeglut-glew-and-opengl-version/</link>
      <pubDate>Mon, 10 Aug 2015 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-opengl-checking-the-freeglut-glew-and-opengl-version/</guid>
      <description>&lt;p&gt;First thing to deal with OpenGL is to know which version you have on your operating system.&lt;/p&gt;
&lt;p&gt;For this tutorial we will test it on Windows.&lt;/p&gt;
&lt;p&gt;And because we are testing the OpenGL version, we will also check what is the FreeGLUT and GLEW version.&lt;/p&gt;
&lt;h2 id=&#34;explanation&#34;&gt;Explanation&lt;/h2&gt;
&lt;p&gt;To create code for OpenGL 3.3, you have to have a graphic card that handles OpenGL 3.3.&lt;/p&gt;
&lt;p&gt;If you don&amp;rsquo;t know which version you have, the code below will show you this.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - OpenGL - Adding an icon to the executable with Visual Studio</title>
      <link>https://www.badprog.com/c-opengl-adding-an-icon-to-the-executable-with-visual-studio/</link>
      <pubDate>Sun, 02 Aug 2015 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-opengl-adding-an-icon-to-the-executable-with-visual-studio/</guid>
      <description>&lt;p&gt;To have an executable file that seems professional, it&amp;rsquo;s necessary to have your own icon when someone launches your program.&lt;/p&gt;
&lt;p&gt;This tutorial could easily adapted to any application generated from Visual Studio on Windows.&lt;/p&gt;
&lt;p&gt;This icon is generally the logo of the software, game or application you created.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;h3 id=&#34;creating-an-ico-file&#34;&gt;Creating an ICO file&lt;/h3&gt;
&lt;p&gt;The icon for the program must be an ICO format.&lt;/p&gt;
&lt;p&gt;It means that the extension must be .ico, like for example &lt;strong&gt;icon.ico&lt;/strong&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - OpenGL - Setting up Visual Studio</title>
      <link>https://www.badprog.com/c-opengl-setting-up-visual-studio/</link>
      <pubDate>Sun, 26 Jul 2015 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-opengl-setting-up-visual-studio/</guid>
      <description>&lt;p&gt;The &lt;strong&gt;Visual Studio&lt;/strong&gt; version for this tutorial will be the &lt;strong&gt;2017&lt;/strong&gt;(seems to work with the &lt;strong&gt;2015&lt;/strong&gt; and &lt;strong&gt;2019&lt;/strong&gt; as well).&lt;br&gt;
The &lt;strong&gt;glew&lt;/strong&gt; version will be the &lt;strong&gt;2.2.0&lt;/strong&gt;.&lt;br&gt;
The &lt;strong&gt;freeglut&lt;/strong&gt; version will be the &lt;strong&gt;3.0.0&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The glew library stands for &lt;strong&gt;GL&lt;/strong&gt; &lt;strong&gt;E&lt;/strong&gt; xtension &lt;strong&gt;W&lt;/strong&gt; rangler.&lt;/p&gt;
&lt;p&gt;At the end of this OpenGL tutorial you will be able to display a window with a white square displayed on a black background.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;We are going to use the &lt;strong&gt;32-bit&lt;/strong&gt; or the &lt;strong&gt;64-bit&lt;/strong&gt; version.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Android - Android Studio - Generating an unsigned release .apk</title>
      <link>https://www.badprog.com/android-android-studio-generating-an-unsigned-release-apk/</link>
      <pubDate>Mon, 15 Jun 2015 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/android-android-studio-generating-an-unsigned-release-apk/</guid>
      <description>&lt;p&gt;If you come from the Eclipse world, you should be lost because it&amp;rsquo;s not very clear how to generate a &lt;strong&gt;release&lt;/strong&gt; build version of an &lt;strong&gt;.apk&lt;/strong&gt; file.&lt;/p&gt;
&lt;p&gt;In this Android Studio tutorial, we are thus going to see how to resolve this release build generation.&lt;/p&gt;
&lt;h2 id=&#34;generating-the-debug-build-apk&#34;&gt;Generating the debug build .apk&lt;/h2&gt;
&lt;p&gt;First of all, click &lt;strong&gt;&amp;gt; Build &amp;gt; Make Project&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Then &lt;strong&gt;&amp;gt; Run &amp;gt; Run nameOfYourApp&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Your project should be built and of course in the debug version.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Algorithm - Using min(), max(), minmax() functions</title>
      <link>https://www.badprog.com/c-algorithm-using-min-max-minmax-functions/</link>
      <pubDate>Sun, 31 May 2015 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-algorithm-using-min-max-minmax-functions/</guid>
      <description>&lt;p&gt;To be precise, in this tutorial, we are going to see the &lt;strong&gt;min()&lt;/strong&gt;, &lt;strong&gt;max()&lt;/strong&gt;, &lt;strong&gt;minmax()&lt;/strong&gt;, &lt;strong&gt;min_element()&lt;/strong&gt;, &lt;strong&gt;max_element()&lt;/strong&gt; and &lt;strong&gt;minmax_element()&lt;/strong&gt; functions.&lt;/p&gt;
&lt;p&gt;You&amp;rsquo;ll have no excuse anymore to get the minimum and maximum value from an array or when comparing two variables.&lt;/p&gt;
&lt;p&gt;Oh by the way, two functions are taken from the C++ 11: minmax() and minmax_element().&lt;/p&gt;
&lt;h2 id=&#34;explanation&#34;&gt;Explanation&lt;/h2&gt;
&lt;p&gt;The minmax() is a unique function to retrieve min and max values from 2 values or from an entire array.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Electronics - STM32 - Setting up the Nucleo board with IAR</title>
      <link>https://www.badprog.com/electronics-stm32-setting-up-the-nucleo-board-with-iar/</link>
      <pubDate>Sat, 15 Nov 2014 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-stm32-setting-up-the-nucleo-board-with-iar/</guid>
      <description>&lt;p&gt;The Nucleo wants to be a concurrent of Arduino. You had probably tested the &lt;a href=&#34;http://developer.mbed.org/handbook/mbed-Compiler&#34;&gt;mbed.org&lt;/a&gt; compiler. But you would like to program a firmware without any online IDE (that comes with some advantages and drawbacks).&lt;/p&gt;
&lt;p&gt;In this tutorial, we&amp;rsquo;ll use the IAR Embedded Workbench for ARM, well known as EWARM, in order to program the STM32 microcontroller (in our case the STM32-&lt;strong&gt;L053R8&lt;/strong&gt;).&lt;/p&gt;
&lt;p&gt;So let&amp;rsquo;s get started.&lt;/p&gt;
&lt;h2 id=&#34;iar-installation&#34;&gt;IAR installation&lt;/h2&gt;
&lt;h3 id=&#34;ide&#34;&gt;IDE&lt;/h3&gt;
&lt;p&gt;First of all we need to download the new IAR ARM version (7.30.1) because older versions are missing some functionalities to use projects provided by STMicroelectronics.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Electronics - Verilog -  Turning off 7-segment displays</title>
      <link>https://www.badprog.com/electronics-verilog-turning-off-7-segment-displays/</link>
      <pubDate>Tue, 22 Apr 2014 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-verilog-turning-off-7-segment-displays/</guid>
      <description>&lt;p&gt;A quick code to turn off every single segment onto a FPGA board.&lt;/p&gt;
&lt;p&gt;For this tutorial we use the Altera DE1 board.&lt;/p&gt;
&lt;p&gt;So if you have another one, just replace HEX0, HEX1, HEX2, HEX3 by your assignment.&lt;/p&gt;
&lt;h2 id=&#34;explanation&#34;&gt;Explanation&lt;/h2&gt;
&lt;p&gt;Each number is a pin onto the board.&lt;br&gt;
As there are 4 * 7 segments = 28 segments to light, so 28 pins.&lt;/p&gt;
&lt;p&gt;So, to turn off all segments of a display, it&amp;rsquo;s necessary to use 7&amp;rsquo;b1111111 as value.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Electronics - Verilog - Blinking a LED with GPIOs</title>
      <link>https://www.badprog.com/electronics-verilog-blinking-a-led-with-gpios/</link>
      <pubDate>Sat, 19 Apr 2014 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-verilog-blinking-a-led-with-gpios/</guid>
      <description>&lt;p&gt;As you certainly liked this &lt;a href=&#34;https://www.badprog.com/electronics-verilog-blinking-a-led&#34;&gt;Altera DE1 tutorial for blinking a LED on the board&lt;/a&gt;, you will love this one by doing the same easy thing but with &lt;strong&gt;GPIOs&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m sure you are really excited about that. So let&amp;rsquo;s go.&lt;/p&gt;
&lt;h2 id=&#34;explanation&#34;&gt;Explanation&lt;/h2&gt;
&lt;p&gt;On the DE1 board, there are many GPIOs.&lt;/p&gt;
&lt;p&gt;What is a GPIO? &amp;ndash;&amp;gt; GPIO stands for General Purpose Input Output.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s a group of pins that you can set to &lt;strong&gt;input&lt;/strong&gt; or &lt;strong&gt;output&lt;/strong&gt; individually.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Electronics - Quartus II - Creating your first SoPC with Qsys and Nios II software</title>
      <link>https://www.badprog.com/electronics-quartus-ii-creating-your-first-sopc-with-qsys-and-nios-ii-software/</link>
      <pubDate>Sun, 06 Apr 2014 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-quartus-ii-creating-your-first-sopc-with-qsys-and-nios-ii-software/</guid>
      <description>&lt;p&gt;&lt;strong&gt;Qsys&lt;/strong&gt; is the new &lt;strong&gt;Altera SOPC Builder&lt;/strong&gt; tool. So if you are using &lt;strong&gt;Quartus 13.0.x,&lt;/strong&gt; you should have it.&lt;/p&gt;
&lt;p&gt;Then, don&amp;rsquo;t be surprised not having, for example, the simple SOPC Builder tool in your Quartus version.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s just normal because Qsys is the new name of the SOPC Builder and its improvement.&lt;/p&gt;
&lt;p&gt;That said, let&amp;rsquo;s get started with this tutorial and let&amp;rsquo;s create your first &lt;strong&gt;System on Programmable Chip (SoPC)&lt;/strong&gt; or &lt;strong&gt;System on Chip (SoC)&lt;/strong&gt; with Qsys.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Electronics - Verilog - Instantiating a module from another module</title>
      <link>https://www.badprog.com/electronics-verilog-instantiating-a-module-from-another-module/</link>
      <pubDate>Sat, 29 Mar 2014 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-verilog-instantiating-a-module-from-another-module/</guid>
      <description>&lt;p&gt;You understood the &lt;a href=&#34;https://www.badprog.com/electronics-verilog-structural-description&#34;&gt;structural description in Verilog&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;You are currently using the Altera DE1 board.&lt;/p&gt;
&lt;p&gt;Fine.&lt;/p&gt;
&lt;p&gt;But you want more because you really want to understand how it works through a real example with your board.&lt;/p&gt;
&lt;p&gt;And not a difficult one of course, a beginner tutorial with an easy example of instantiating a module from another module.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s get started.&lt;/p&gt;
&lt;h2 id=&#34;explanation&#34;&gt;Explanation&lt;/h2&gt;
&lt;p&gt;We are going to create two files: an &lt;strong&gt;abstract&lt;/strong&gt; and an &lt;strong&gt;object&lt;/strong&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Electronics - Verilog - Structural description</title>
      <link>https://www.badprog.com/electronics-verilog-structural-description/</link>
      <pubDate>Wed, 19 Mar 2014 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-verilog-structural-description/</guid>
      <description>&lt;p&gt;In classic software programming there are a way to split whole code into several parts.&lt;/p&gt;
&lt;p&gt;In Verilog there is also a technic to do the same. One calls that &lt;strong&gt;structural description&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s like in C language, to talk outside the main function, it&amp;rsquo;s necessary to have functions.&lt;/p&gt;
&lt;p&gt;But the difference in this case is that parameters (&lt;strong&gt;ports&lt;/strong&gt;) don&amp;rsquo;t have to be called in the same order as the &lt;strong&gt;module&lt;/strong&gt; requires.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Electronics - Quartus II - Using command-line interface (CLI)</title>
      <link>https://www.badprog.com/electronics-quartus-ii-using-command-line-interface-cli/</link>
      <pubDate>Tue, 04 Mar 2014 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-quartus-ii-using-command-line-interface-cli/</guid>
      <description>&lt;p&gt;After &lt;a href=&#34;https://www.badprog.com/electronics-quartus-ii-setting-up-command-line-interface-cli&#34;&gt;installing Quartus II command-line interface for Windows&lt;/a&gt; you&amp;rsquo;re ready to play with it.&lt;/p&gt;
&lt;p&gt;The board used in this tutorial is the &lt;strong&gt;DE1&lt;/strong&gt; (EP2C20F484C7) with a Cycl0ne II FPGA.&lt;/p&gt;
&lt;p&gt;The langage will be Verilog.&lt;/p&gt;
&lt;p&gt;First of all&lt;/p&gt;
&lt;p&gt;We&amp;rsquo;re going to create a project from Quartus GUI, write a file in Verilog and just after use the command-line interface (CLI) to make all stuff necessary to have a functional project.&lt;/p&gt;
&lt;h2 id=&#34;creating-a-project&#34;&gt;Creating a project&lt;/h2&gt;
&lt;p&gt;From Quartus &amp;gt; File New Project Wizard:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Electronics - Quartus II - Setting up command-line interface (CLI)</title>
      <link>https://www.badprog.com/electronics-quartus-ii-setting-up-command-line-interface-cli/</link>
      <pubDate>Sun, 02 Mar 2014 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-quartus-ii-setting-up-command-line-interface-cli/</guid>
      <description>&lt;p&gt;As I&amp;rsquo;ve noticed some bugs with the &lt;strong&gt;Linux&lt;/strong&gt; version, I&amp;rsquo;ve decided to start using &lt;strong&gt;Altera Quartus II&lt;/strong&gt; for &lt;strong&gt;Windows&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Some examples of bugs: the Altera Simulator doesn&amp;rsquo;t start when you try to launch it or when you want to set the clock with ModelSim, some windows are not well designed and you can&amp;rsquo;t see anything.&lt;/p&gt;
&lt;p&gt;Well, Linux is cool but Windows can be also a good alternative.&lt;/p&gt;
&lt;p&gt;The Quartus II version is the &lt;strong&gt;13.0.sp1&lt;/strong&gt; or simply &lt;strong&gt;13.0.1&lt;/strong&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Electronics - Quartus II - Using ModelSim-Altera Starter Edition</title>
      <link>https://www.badprog.com/electronics-quartus-ii-using-modelsim-altera-starter-edition/</link>
      <pubDate>Thu, 27 Feb 2014 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-quartus-ii-using-modelsim-altera-starter-edition/</guid>
      <description>&lt;p&gt;After &lt;a href=&#34;https://www.badprog.com/electronics-quartus-ii-installing-modelsim-altera-starter-edition&#34;&gt;installing&lt;/a&gt; and having an &lt;a href=&#34;https://www.badprog.com/electronics-quartus-ii-introduction-to-modelsim-altera-starter-edition&#34;&gt;introduction&lt;/a&gt; to the ModelSim-Altera Starter Edition, it&amp;rsquo;s time to see a really easy example by coding some lines.&lt;/p&gt;
&lt;p&gt;This code will be a simple counter with an enable input.&lt;/p&gt;
&lt;h2 id=&#34;code&#34;&gt;Code&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// easy counter to test ModelSim
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;module hello&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_model&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_sim&lt;/span&gt; (enable, clock, counter);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#75715e&#34;&gt;// declaration
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    input enable;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    input clock;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    output reg [&lt;span style=&#34;color:#ae81ff&#34;&gt;7&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;] counter;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#75715e&#34;&gt;// always
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    always &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;@&lt;/span&gt;(posedge clock) begin
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (enable) begin
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            counter &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; counter &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&amp;#39;&lt;/span&gt;b1;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        end
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;else&lt;/span&gt; begin
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            counter &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        end
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    end
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;endmodule
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;modelsim-wave&#34;&gt;ModelSim wave&lt;/h2&gt;
&lt;p&gt;Let&amp;rsquo;s see how this code will generate a waveform.&lt;br&gt;
First of all, let&amp;rsquo;s start a general compilation:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Electronics - Quartus II - Introduction to ModelSim-Altera Starter Edition</title>
      <link>https://www.badprog.com/electronics-quartus-ii-introduction-to-modelsim-altera-starter-edition/</link>
      <pubDate>Sun, 23 Feb 2014 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-quartus-ii-introduction-to-modelsim-altera-starter-edition/</guid>
      <description>&lt;p&gt;After &lt;a href=&#34;https://www.badprog.com/electronics-quartus-ii-installing-modelsim-altera-starter-edition&#34;&gt;installing ModelSim-Altera Starter Edition&lt;/a&gt;, what&amp;rsquo;s better than testing it?&lt;/p&gt;
&lt;p&gt;This is what we&amp;rsquo;re going to see in this ModelSim-Altera Starter Edition introduction.&lt;/p&gt;
&lt;p&gt;To be honest a simulation tool is really complex to handle, so this tutorial will be most an introduction than exhaustive examples.&lt;/p&gt;
&lt;p&gt;You could use it with any HDL such as VHDL, Verilog or SystemVerilog.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s get started.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;There are two different types of simulation:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Electronics - Quartus II - Installing ModelSim-Altera Starter Edition</title>
      <link>https://www.badprog.com/electronics-quartus-ii-installing-modelsim-altera-starter-edition/</link>
      <pubDate>Sat, 15 Feb 2014 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-quartus-ii-installing-modelsim-altera-starter-edition/</guid>
      <description>&lt;p&gt;Simulation in HDL system is essential.&lt;/p&gt;
&lt;p&gt;One calls that &lt;strong&gt;EDA&lt;/strong&gt; for &lt;strong&gt;Electronic Design Automation&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s like a debugger for a software program.&lt;/p&gt;
&lt;p&gt;In this tutorial, we&amp;rsquo;re going to see how to install &lt;strong&gt;ModelSim-Altera Starter Edition 10.1d&lt;/strong&gt; simulation tool.&lt;/p&gt;
&lt;p&gt;The Quartus II version used in this tutorial is the &lt;strong&gt;13.0.1 Web Edition&lt;/strong&gt;.&lt;/p&gt;
&lt;h2 id=&#34;difference-between-modelsim-and-modelsim-altera&#34;&gt;Difference between ModelSim and ModelSim-Altera&lt;/h2&gt;
&lt;p&gt;To be honest is not so easy to understand what are differences between ModelSim simulation tools.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Electronics - Verilog - Blinking a LED</title>
      <link>https://www.badprog.com/electronics-verilog-blinking-a-led/</link>
      <pubDate>Tue, 04 Feb 2014 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-verilog-blinking-a-led/</guid>
      <description>&lt;p&gt;Blinking a LED, a basic step.&lt;/p&gt;
&lt;p&gt;But without this first step, there won&amp;rsquo;t be a second.&lt;/p&gt;
&lt;p&gt;And without second, no third and so on.&lt;/p&gt;
&lt;p&gt;This simple tutorial will explain basics in order to program a blinking system.&lt;/p&gt;
&lt;p&gt;Thus this timer example in Verilog could be seen as an Hello World exercise.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s get started.&lt;/p&gt;
&lt;h2 id=&#34;explanation&#34;&gt;Explanation&lt;/h2&gt;
&lt;p&gt;This tutorial has been made with the Altera DE1 board.&lt;/p&gt;
&lt;p&gt;In Verilog, every program starts by a module.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Electronics - SystemVerilog - Numbers, radix and bases</title>
      <link>https://www.badprog.com/electronics-systemverilog-numbers-radix-and-bases/</link>
      <pubDate>Sun, 02 Feb 2014 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-systemverilog-numbers-radix-and-bases/</guid>
      <description>&lt;p&gt;Every language needs to handle numbers.&lt;/p&gt;
&lt;p&gt;With Verilog we&amp;rsquo;re going to see that numbers need to have an explicit &lt;strong&gt;base system&lt;/strong&gt; to avoid errors.&lt;/p&gt;
&lt;p&gt;Each base system has a &lt;strong&gt;radix&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;This radix is the number of unique digits making up a base system.&lt;/p&gt;
&lt;p&gt;For example the radix of the &lt;strong&gt;hexadecimal&lt;/strong&gt; system is &lt;strong&gt;16&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;So all digits of the hexadecimal base are: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E and F.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Electronics - VHDL - Hello World tutorial for beginners</title>
      <link>https://www.badprog.com/electronics-vhdl-hello-world-tutorial-for-beginners/</link>
      <pubDate>Sun, 10 Nov 2013 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-vhdl-hello-world-tutorial-for-beginners/</guid>
      <description>&lt;p&gt;VHDL is one of the most famous design hardware description languages.&lt;/p&gt;
&lt;p&gt;If you are interested to know how to switch on your first LED in VHDL, let&amp;rsquo;s get started!&lt;/p&gt;
&lt;p&gt;For this tutorial we are going to use the Altera DE1 FPGA board.&lt;br&gt;
And we&amp;rsquo;ll switch on LED 0 and 1, to understand how it works.&lt;/p&gt;
&lt;h2 id=&#34;how-it-works&#34;&gt;How it works&lt;/h2&gt;
&lt;p&gt;First of all, we have to tells which library and packages to use.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Electronics - Eagle - Basics to set up and create schematics</title>
      <link>https://www.badprog.com/electronics-eagle-basics-to-set-up-and-create-schematics/</link>
      <pubDate>Wed, 14 Aug 2013 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-eagle-basics-to-set-up-and-create-schematics/</guid>
      <description>&lt;p&gt;It may be possible that one day you said to yourself: &amp;ldquo;I would like to design my own schematics for my electronic integrated circuits&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;But you didn&amp;rsquo;t know how to start.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see this by learning basics in this Eagle design tutorial.&lt;/p&gt;
&lt;h2 id=&#34;first-of-all&#34;&gt;First of all&lt;/h2&gt;
&lt;p&gt;Let’s start by downloading the Eagle software on the official CAD website at the following URL:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;http://www.cadsoftusa.com/download-eagle/?language=en&#34;&gt;http://www.cadsoftusa.com/download-eagle/?language=en&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Then install it, for our tutorial we’ll use the directory:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Java - Tips&#39;n Tricks - Sorting a text file and writing the result into a sorted file</title>
      <link>https://www.badprog.com/java-tips-n-tricks-sorting-a-text-file-and-writing-the-result-into-a-sorted-file/</link>
      <pubDate>Sat, 03 Aug 2013 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/java-tips-n-tricks-sorting-a-text-file-and-writing-the-result-into-a-sorted-file/</guid>
      <description>&lt;p&gt;How to read, sort and write a new file with a specific text file?&lt;br&gt;
A great question, isn&amp;rsquo;t it?&lt;/p&gt;
&lt;p&gt;What about a Java example to show how to read a file, sorting it and writing the result into a new text file?&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see that in this tutorial with a classic exercise, to manipulate inputs and outputs files.&lt;/p&gt;
&lt;h2 id=&#34;explanation&#34;&gt;Explanation&lt;/h2&gt;
&lt;p&gt;Create your project with a &lt;strong&gt;package&lt;/strong&gt; named &lt;strong&gt;badprog&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Inside this package, create your &lt;strong&gt;Main.java&lt;/strong&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C - Type - Converting two uint8_t words into one of uint16_t and one of uint16_t into two of uint8_t</title>
      <link>https://www.badprog.com/c-type-converting-two-uint8-t-words-into-one-of-uint16-t-and-one-of-uint16-t-into-two-of-uint8-t/</link>
      <pubDate>Thu, 18 Jul 2013 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-type-converting-two-uint8-t-words-into-one-of-uint16-t-and-one-of-uint16-t-into-two-of-uint8-t/</guid>
      <description>&lt;p&gt;Sometimes you need to convert one uint16_t variable into two uint8_t.&lt;/p&gt;
&lt;p&gt;As we manipulate binaries, it&amp;rsquo;s impossible to do something like that: 0xAB + 0xCD = &lt;strong&gt;0xABCD&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Indeed, the result of 0xAB + 0xCD = &lt;strong&gt;0x178&lt;/strong&gt; because 0xAB = &lt;strong&gt;171&lt;/strong&gt; and 0xCD = &lt;strong&gt;205&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;So 0xAB + 0xCD = &lt;strong&gt;376&lt;/strong&gt; in decimal but 0x178 in hexadecimal.&lt;/p&gt;
&lt;p&gt;Furthermore, we cannot add more than 255 value inside a byte, because this is a 8-bit long number.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Android - SQLite - Basics</title>
      <link>https://www.badprog.com/android-sqlite-basics/</link>
      <pubDate>Wed, 17 Jul 2013 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/android-sqlite-basics/</guid>
      <description>&lt;p&gt;A classic way to deal with database, with Android, it&amp;rsquo;s to use the &lt;strong&gt;SQLite&lt;/strong&gt; classes.&lt;/p&gt;
&lt;p&gt;What&amp;rsquo;s unique in SQLite is that you don&amp;rsquo;t need a server where running your database.&lt;br&gt;
Indeed, everything is already inside your Android application.&lt;/p&gt;
&lt;p&gt;And of course impossible to another application to read this database.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s have a look in this Android SQLite tutorial to learn basics with an example.&lt;br&gt;
A bit like an Hello World SQLite.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Android - API Google Maps - Using MapType</title>
      <link>https://www.badprog.com/android-api-google-maps-using-maptype/</link>
      <pubDate>Sun, 07 Jul 2013 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/android-api-google-maps-using-maptype/</guid>
      <description>&lt;p&gt;I think the MapType is certainly the most fascinating feature of GoogleMaps and also one of the most easy to understand and make alive in an Android application.&lt;/p&gt;
&lt;p&gt;With one click it&amp;rsquo;s possible to change the display of the map such as hybrid, none, normal, satellite or terrain.&lt;/p&gt;
&lt;p&gt;And this is exactly what we are going to see in this &lt;strong&gt;Android Tutorial 5&lt;/strong&gt;.&lt;/p&gt;
&lt;h2 id=&#34;explanation&#34;&gt;Explanation&lt;/h2&gt;
&lt;p&gt;The setMapType() method is the key of this feature.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Android - API Google Maps - Using Google Maps API v2</title>
      <link>https://www.badprog.com/android-api-google-maps-using-google-maps-api-v2/</link>
      <pubDate>Sat, 15 Jun 2013 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/android-api-google-maps-using-google-maps-api-v2/</guid>
      <description>&lt;p&gt;Google made a new version of its famous Google Maps API, called Google Maps API v2.&lt;/p&gt;
&lt;p&gt;Things are new, such as the OpenGL ES version 2.&lt;/p&gt;
&lt;p&gt;But let&amp;rsquo;s try to create an application, in this Google Maps API v2 tutorial for Windows 7 and less or more.&lt;/p&gt;
&lt;h2 id=&#34;google-play-services-library&#34;&gt;Google Play Services library&lt;/h2&gt;
&lt;p&gt;Your &lt;strong&gt;Android SDK Manager&lt;/strong&gt; has to be updated.&lt;/p&gt;
&lt;p&gt;Especially you need to install or update: &lt;strong&gt;Extras &amp;gt; Google Play Services&lt;/strong&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Oracle - VirtualBox - A better resolution with a guest Ubuntu</title>
      <link>https://www.badprog.com/oracle-virtualbox-a-better-resolution-with-a-guest-ubuntu/</link>
      <pubDate>Sun, 02 Jun 2013 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/oracle-virtualbox-a-better-resolution-with-a-guest-ubuntu/</guid>
      <description>&lt;p&gt;By installing a Ubuntu guest with VirtualBox on Windows, you likely found a basic resolution, such as 1024*768.&lt;/p&gt;
&lt;p&gt;Unfortunately, you have a screen with a 1920*1200 resolution, it&amp;rsquo;s impossible to let this like that.&lt;/p&gt;
&lt;p&gt;There is of course a solution to increase this basic setup, but with a maximum of 1440*1050.&lt;/p&gt;
&lt;p&gt;Better than nothing.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s do it.&lt;/p&gt;
&lt;h2 id=&#34;what-to-do&#34;&gt;What to do?&lt;/h2&gt;
&lt;p&gt;Open a Terminal and write it down this line:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt&lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;get&lt;/span&gt; install virtualbox&lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;guest&lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;x11
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Restart your Linux, and you&amp;rsquo;re done.&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - Tips and tricks - Having more than 4 workspaces with Ubuntu 13.04</title>
      <link>https://www.badprog.com/unix-gnu-linux-tips-and-tricks-having-more-than-4-workspaces-with-ubuntu-13-04/</link>
      <pubDate>Sun, 02 Jun 2013 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-tips-and-tricks-having-more-than-4-workspaces-with-ubuntu-13-04/</guid>
      <description>&lt;p&gt;With Ubuntu 13.04, you certainly found out that there is, by default, only one workspace.&lt;/p&gt;
&lt;p&gt;If you want more, there are solutions.&lt;/p&gt;
&lt;p&gt;First of all enable workspaces, then change (if you want) the number of workspaces.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see this in this tutorial.&lt;/p&gt;
&lt;h2 id=&#34;where-to-find-it&#34;&gt;Where to find it?&lt;/h2&gt;
&lt;p&gt;Click &lt;strong&gt;Settings &amp;gt; Appareance &amp;gt; Behavior &amp;gt; Enable workspaces&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;You have now 4 workspaces.&lt;/p&gt;
&lt;p&gt;But if you want more you have to install &lt;strong&gt;ccsm&lt;/strong&gt;, the CompizConfig Settings Manager.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Electronics - MSP430 - Using P1OUT and P2OUT registers of the LaunchPad to manipulate LEDs with bit shifting</title>
      <link>https://www.badprog.com/electronics-msp430-using-p1out-and-p2out-registers-of-the-launchpad-to-manipulate-leds-with-bit/</link>
      <pubDate>Sun, 12 May 2013 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-msp430-using-p1out-and-p2out-registers-of-the-launchpad-to-manipulate-leds-with-bit/</guid>
      <description>&lt;p&gt;After &lt;a href=&#34;https://www.badprog.com/electronics-msp430-using-p1out-pins-and-leds-to-count-in-binary&#34;&gt;creating a software to count in binary&lt;/a&gt;, let&amp;rsquo;s see how bit shifting works.&lt;/p&gt;
&lt;p&gt;In this tutorial we are going to see how to turn on and off a single LED each time we will be using the left bit shifting.&lt;/p&gt;
&lt;p&gt;But what is interesting, in this video example, it&amp;rsquo;s that we will be manipulate GPIOs with P1OUT and P2OUT registers.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s get started.&lt;/p&gt;
&lt;h2 id=&#34;what-do-we-need&#34;&gt;What do we need?&lt;/h2&gt;
&lt;p&gt;In order to have exactly the same example as in the video, let&amp;rsquo;s see which electronic stuff we need:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Electronics - MSP430 - Using P1OUT pins and LEDs to count in binary</title>
      <link>https://www.badprog.com/electronics-msp430-using-p1out-pins-and-leds-to-count-in-binary/</link>
      <pubDate>Fri, 10 May 2013 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-msp430-using-p1out-pins-and-leds-to-count-in-binary/</guid>
      <description>&lt;p&gt;Maybe you&amp;rsquo;ve always dreamed to understand how to count in binary.&lt;/p&gt;
&lt;p&gt;What do you think about learning it with a MSP430 LaunchPad and LEDs?&lt;/p&gt;
&lt;p&gt;If you are still interested, that&amp;rsquo;s what we are going to see with this tutorial and a video.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s get started.&lt;/p&gt;
&lt;h2 id=&#34;what-do-we-need&#34;&gt;What do we need?&lt;/h2&gt;
&lt;p&gt;If you would like to reproduce exactly this example, let&amp;rsquo;s see which electronic stuff we need:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;1 MSP430 LaunchPad with a M430G2553 microcontroller;&lt;/li&gt;
&lt;li&gt;9 LEDs (1 green, 4 red and 4 orange);&lt;/li&gt;
&lt;li&gt;9 resistors of 330 ohm;&lt;/li&gt;
&lt;li&gt;4 breadboards;&lt;/li&gt;
&lt;li&gt;28 wires (10 red, 4 tiny and 4 long orange, 8 yellow, 2 black);&lt;/li&gt;
&lt;li&gt;1 USB mini cable.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Of course, it&amp;rsquo;s possible to do the same with less parts.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Electronics - MSP430 - Switching on a LED with a breadboard</title>
      <link>https://www.badprog.com/electronics-msp430-switching-on-a-led-with-a-breadboard/</link>
      <pubDate>Wed, 01 May 2013 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-msp430-switching-on-a-led-with-a-breadboard/</guid>
      <description>&lt;p&gt;In this MSP430 tutorial we will see how to use the LaunchPad to switch on a LED with a breadboard.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s an easy tutorial for beginners. Simple, easy and useful.&lt;/p&gt;
&lt;p&gt;You can watch the result of the tutorial directly with the video below:&lt;/p&gt;
&lt;h2 id=&#34;what-we-need-to-achieve-this-tutorial&#34;&gt;What we need to achieve this tutorial&lt;/h2&gt;
&lt;p&gt;For our example, we need:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;one MSP430 LaunchPad board&lt;/li&gt;
&lt;li&gt;one or two breadboards&lt;/li&gt;
&lt;li&gt;two wires&lt;/li&gt;
&lt;li&gt;one resistor (150 ohms)&lt;/li&gt;
&lt;li&gt;one LED&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;We could do this tutorial without any resistor, but it&amp;rsquo;s a good practice to use one and it always reduce the current through the LED.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Electronics - IAR Systems - Setting up the IAR Embedded Workbench for the STM32L-DISCOVERY board</title>
      <link>https://www.badprog.com/electronics-iar-systems-setting-up-the-iar-embedded-workbench-for-the-stm32l-discovery-board/</link>
      <pubDate>Tue, 23 Apr 2013 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-iar-systems-setting-up-the-iar-embedded-workbench-for-the-stm32l-discovery-board/</guid>
      <description>&lt;p&gt;It&amp;rsquo;s not essentially easy to set up the IAR Embedded Workbench for a new project.&lt;/p&gt;
&lt;p&gt;All boards are different and all microcontrollers too.&lt;/p&gt;
&lt;p&gt;In our case we will be using the STM32L152RBT6 one.&lt;/p&gt;
&lt;p&gt;So, if you didn&amp;rsquo;t use neither IAR nor the STM32L-DISCOVERY board, it would be a bit complicated to begin playing with your new toys.&lt;/p&gt;
&lt;p&gt;Fortunately everything has a solution.&lt;/p&gt;
&lt;p&gt;So, let&amp;rsquo;s get started with this new tutorial!&lt;/p&gt;</description>
    </item>
    <item>
      <title>Electronics - MSP430 - Managing P1DIR and P1OUT registers to blink the red and green LEDs</title>
      <link>https://www.badprog.com/electronics-msp430-managing-p1dir-and-p1out-registers-to-blink-the-red-and-green-leds/</link>
      <pubDate>Sun, 21 Apr 2013 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-msp430-managing-p1dir-and-p1out-registers-to-blink-the-red-and-green-leds/</guid>
      <description>&lt;p&gt;This tutorial has to be seen as the most easy code that is possible to do with a &lt;strong&gt;MSP430 LaunchPad&lt;/strong&gt; and then totally adapted for beginners.&lt;/p&gt;
&lt;p&gt;Indeed, we are going to blink together the red and the green LEDs by explaining what we are doing with the famous P1DIR and P1OUT registers.&lt;/p&gt;
&lt;p&gt;Ready?&lt;br&gt;
So, let&amp;rsquo;s do it!&lt;/p&gt;
&lt;h2 id=&#34;explanation&#34;&gt;Explanation&lt;/h2&gt;
&lt;h3 id=&#34;good-to-know&#34;&gt;Good to know&lt;/h3&gt;
&lt;p&gt;In the MSP430 Launchpad there are a few microcontrollers possible to use.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Electronics - MSP430 - Restoring the default software</title>
      <link>https://www.badprog.com/electronics-msp430-restoring-the-default-software/</link>
      <pubDate>Sun, 14 Apr 2013 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-msp430-restoring-the-default-software/</guid>
      <description>&lt;p&gt;Once you&amp;rsquo;ve received your MSP430 board, you couldn&amp;rsquo;t stop playing with it, clicking on every button, downloading all software you could find.&lt;/p&gt;
&lt;p&gt;But at a moment, you said to yourself: &amp;ldquo;Eh, how can I do to restore the default software?&amp;rdquo;&lt;/p&gt;
&lt;p&gt;That&amp;rsquo;s what we&amp;rsquo;re going to see in this tutorial to restore the demo default software.&lt;/p&gt;
&lt;h2 id=&#34;with-iar-embedded-workbench-ide&#34;&gt;With IAR Embedded Workbench IDE&lt;/h2&gt;
&lt;p&gt;Go where you installed your IAR IDE.&lt;/p&gt;
&lt;p&gt;For example, let&amp;rsquo;s assume this location:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Electronics - MSP430 - Using the temperature demo GUI</title>
      <link>https://www.badprog.com/electronics-msp430-using-the-temperature-demo-gui/</link>
      <pubDate>Sun, 14 Apr 2013 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-msp430-using-the-temperature-demo-gui/</guid>
      <description>&lt;p&gt;Without changing anything, it&amp;rsquo;s possible to check the current temperature with the MSP430 board and the default software.&lt;/p&gt;
&lt;p&gt;Indeed, Texas Instruments provides a tool to display the temperature on your computer&amp;rsquo;s screen.&lt;/p&gt;
&lt;p&gt;So, let&amp;rsquo;s go and display temperature with the Graphical User Interface (GUI).&lt;/p&gt;
&lt;h2 id=&#34;installation&#34;&gt;Installation&lt;/h2&gt;
&lt;p&gt;First of all, we need the Temperature Demo GUI.&lt;/p&gt;
&lt;p&gt;Two ways are possible.&lt;/p&gt;
&lt;h3 id=&#34;from-the-tis-official-website&#34;&gt;From the TI&amp;rsquo;s official website&lt;/h3&gt;
&lt;p&gt;You could download it directly from the TI&amp;rsquo;s website:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Electronics - IAR Systems - Enabling the download binary file option to the board</title>
      <link>https://www.badprog.com/electronics-iar-systems-enabling-the-download-binary-file-option-to-the-board/</link>
      <pubDate>Sat, 13 Apr 2013 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-iar-systems-enabling-the-download-binary-file-option-to-the-board/</guid>
      <description>&lt;p&gt;Maybe you tried to compile a project. All was OK.&lt;/p&gt;
&lt;p&gt;But when you wanted to download the binary into the board, nothing happened.&lt;/p&gt;
&lt;p&gt;What&amp;rsquo;s going on?!&lt;/p&gt;
&lt;p&gt;The debugger has to be configured!&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see this in this tutorial to enable the downloading of binary files.&lt;/p&gt;
&lt;h2 id=&#34;explanation&#34;&gt;Explanation&lt;/h2&gt;
&lt;p&gt;The debugger is not necessarily well configured.&lt;br&gt;
So we have to do it.&lt;/p&gt;
&lt;p&gt;For that, click &amp;gt; Project &amp;gt; Option &amp;gt; Debugger &amp;gt; Setup &amp;gt; Driver &amp;gt; Select &lt;strong&gt;your debugger&lt;/strong&gt; (instead of Simulator).&lt;/p&gt;</description>
    </item>
    <item>
      <title>Electronics - IAR Systems - Errors using the Embedded Workbench IDE</title>
      <link>https://www.badprog.com/electronics-iar-systems-errors-using-the-embedded-workbench-ide/</link>
      <pubDate>Sat, 13 Apr 2013 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-iar-systems-errors-using-the-embedded-workbench-ide/</guid>
      <description>&lt;p&gt;Using the IAR Embedded Workbench can be really helpful.&lt;/p&gt;
&lt;p&gt;But what happens when come errors during development?&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s try to solve problems encounter with this IDE.&lt;/p&gt;
&lt;h2 id=&#34;chosen-derivative-f20x1_g2x0x_g2x1x-and-actual-hardware-msp430g2xx3-do-not-match&#34;&gt;Chosen derivative (F20X1_G2X0X_G2X1X) and actual hardware (MSP430G2XX3) do not match&lt;/h2&gt;
&lt;p&gt;This kind of error appers when the IDE is not already setup with the correct microcontroller.&lt;/p&gt;
&lt;p&gt;In our case, we would like to use the &lt;strong&gt;MSP430G2553&lt;/strong&gt; microcontroller board in order to compile a project.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Electronics - STM32 - Using the ADC peripheral with a potentiometer</title>
      <link>https://www.badprog.com/electronics-stm32-using-the-adc-peripheral-with-a-potentiometer/</link>
      <pubDate>Fri, 12 Apr 2013 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-stm32-using-the-adc-peripheral-with-a-potentiometer/</guid>
      <description>&lt;p&gt;ADC is one on the most famous peripheral on a microcontroller.&lt;br&gt;
In this tutorial we will see that it&amp;rsquo;s possible to retrieve data from a potentiometer and send them in an array.&lt;/p&gt;
&lt;p&gt;You are certainly wondering how to use a such thing on a STM32?&lt;/p&gt;
&lt;p&gt;That&amp;rsquo;s a good question.&lt;/p&gt;
&lt;p&gt;To see this, let&amp;rsquo;s use the &lt;strong&gt;STM32F103ZE-SK&lt;/strong&gt; board, and guess what?&lt;br&gt;
There is already a potentiometer on it!&lt;/p&gt;
&lt;p&gt;What a wonderful world (that&amp;rsquo;s what Louis Armstrong would have said) isn&amp;rsquo;t it?&lt;/p&gt;</description>
    </item>
    <item>
      <title>Electronics - Keil - Creating a project by copying a default example</title>
      <link>https://www.badprog.com/electronics-keil-creating-a-project-by-copying-a-default-example/</link>
      <pubDate>Mon, 01 Apr 2013 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-keil-creating-a-project-by-copying-a-default-example/</guid>
      <description>&lt;p&gt;You are likely playing with your MDK-ARM uVision4 IDE with default examples provided by the ST firmware.&lt;/p&gt;
&lt;p&gt;But each time you try to change something you see a message saying that the project is read only.&lt;/p&gt;
&lt;p&gt;Therefor in this tutorial we will create our own project by copying an example provided in order to customize it.&lt;/p&gt;
&lt;p&gt;All the tutorial will use the &lt;strong&gt;STM32F3-DISCOVERY board&lt;/strong&gt; but it should of course work with other boards.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Electronics - IAR Systems - Installing IAR Embedded Workbench and activate a license</title>
      <link>https://www.badprog.com/electronics-iar-systems-installing-iar-embedded-workbench-and-activate-a-license/</link>
      <pubDate>Sat, 30 Mar 2013 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-iar-systems-installing-iar-embedded-workbench-and-activate-a-license/</guid>
      <description>&lt;p&gt;If you already had some difficulties to install the IAR Embedded Workbench, let me explain how to get a time limited or a code size limited license.&lt;/p&gt;
&lt;p&gt;This tutorial will help you to remove this kind of error when trying build a project without a license:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Fatal Error[LMS001]: No license found. Use the IAR License Manager to resolve the problem.[LicenseCheck:2.13.8.154, RMS:3.4.2.0085, Feature:ARM.EW.COMPILER, Version:1.00]&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Not so hard, but setting up IDEs is sometimes not so easy.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Electronics - Keil - Errors using uVision4 MDK-Lite</title>
      <link>https://www.badprog.com/electronics-keil-errors-using-uvision4-mdk-lite/</link>
      <pubDate>Sat, 30 Mar 2013 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-keil-errors-using-uvision4-mdk-lite/</guid>
      <description>&lt;p&gt;In this tutorial we will see errors discovered by playing with the IDE uVision4 MDK-Lite.&lt;/p&gt;
&lt;p&gt;Of course detailed errors and solutions are provided and will be added if more errors would be found.&lt;/p&gt;
&lt;p&gt;Simple and easy, so let&amp;rsquo;s get started.&lt;/p&gt;
&lt;h2 id=&#34;unknow-target-connected&#34;&gt;Unknow target connected&lt;/h2&gt;
&lt;p&gt;If, when you tried to download code to flash memory, you encountered this error:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Unknow target connected
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;from the Debugger - Cortex-M Error popup.&lt;/p&gt;
&lt;p&gt;And just after a new popup saying:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Electronics - STM32 - Installation on Windows</title>
      <link>https://www.badprog.com/electronics-stm32-installation-on-windows/</link>
      <pubDate>Sat, 30 Mar 2013 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-stm32-installation-on-windows/</guid>
      <description>&lt;p&gt;Before going mad, by installing a STM32 board on your Windows OS, let&amp;rsquo;s see how to install it with a simple way.&lt;/p&gt;
&lt;p&gt;If you asked yourself what was going on, don&amp;rsquo;t worry, you are not alone in this case.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see how to resolve this problem with this tutorial.&lt;/p&gt;
&lt;h2 id=&#34;how-it-works&#34;&gt;How it works&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;: here&amp;rsquo;s maybe the weird but working solution if you&amp;rsquo;ve more than one USB connection.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Plug&lt;/strong&gt; your device into your &lt;strong&gt;first&lt;/strong&gt; USB connector;&lt;/li&gt;
&lt;li&gt;Install the &lt;strong&gt;driver&lt;/strong&gt;;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Remove&lt;/strong&gt; your device from your &lt;strong&gt;first&lt;/strong&gt; USB connector;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Plug&lt;/strong&gt; your device into your &lt;strong&gt;second&lt;/strong&gt; USB connector;&lt;/li&gt;
&lt;li&gt;Oh miracle it works!&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&amp;mdash;&amp;mdash;&amp;mdash;&amp;ndash; come back to others solutions.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Electronics - STM32 - Initializing and enabling default LEDs, LCD screen and buzzer with STM32F103ZE-SK</title>
      <link>https://www.badprog.com/electronics-stm32-initializing-and-enabling-default-leds-lcd-screen-and-buzzer-with-stm32f103ze-sk/</link>
      <pubDate>Tue, 05 Mar 2013 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-stm32-initializing-and-enabling-default-leds-lcd-screen-and-buzzer-with-stm32f103ze-sk/</guid>
      <description>&lt;p&gt;In a previously &lt;a href=&#34;https://www.badprog.com/electronics-stm32-initializing-and-enabling-all-pins-at-the-same-time-on-the-stm32f103ze-sk-board&#34;&gt;STM32F103ZE-SK&amp;rsquo;s tutorial&lt;/a&gt; we created a program to initialize and enable all GPIOs on the board.&lt;br&gt;
This time, we will just initialize and enable default &lt;strong&gt;LEDs&lt;/strong&gt; of the board, the &lt;strong&gt;LCD&lt;/strong&gt; screen and the &lt;strong&gt;buzzer&lt;/strong&gt;.&lt;br&gt;
Making them blinking.&lt;/p&gt;
&lt;p&gt;That&amp;rsquo;s why we disable the &lt;strong&gt;GPIO D, E and G&lt;/strong&gt;.&lt;br&gt;
Indeed, there is no peripheral of LED, LCD or buzzer types on those ports.&lt;/p&gt;
&lt;p&gt;So the code is the same, except that the &lt;strong&gt;badprogInitOnlyBoardDefault()&lt;/strong&gt; function is replaced with &lt;strong&gt;badprogInitAllGPIO()&lt;/strong&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Electronics - STM32 - Initializing and enabling all pins at the same time on the STM32F103ZE-SK board</title>
      <link>https://www.badprog.com/electronics-stm32-initializing-and-enabling-all-pins-at-the-same-time-on-the-stm32f103ze-sk-board/</link>
      <pubDate>Mon, 04 Mar 2013 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-stm32-initializing-and-enabling-all-pins-at-the-same-time-on-the-stm32f103ze-sk-board/</guid>
      <description>&lt;p&gt;You probably won&amp;rsquo;t use directly this code, but it&amp;rsquo;s always interesting to know how to initialize all pins and activate them.&lt;br&gt;
So let&amp;rsquo;s see how to do this, in this STM32F103ZE-SK tutorial.&lt;/p&gt;
&lt;p&gt;We are of course free to plug or weld LEDs on some ports in order to see then blink.&lt;/p&gt;
&lt;h2 id=&#34;explanation&#34;&gt;Explanation&lt;/h2&gt;
&lt;p&gt;In the example below, an array of GPIOs is created in order to handle them easily in the code.&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - LAMP - Installation</title>
      <link>https://www.badprog.com/unix-gnu-linux-lamp-installation/</link>
      <pubDate>Mon, 04 Mar 2013 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-lamp-installation/</guid>
      <description>&lt;p&gt;For a reason or for another, you need a server. You could install Apache, why not? But you want more! You want Apache2, PHP and MySQL in a bundle. For the same price we&amp;rsquo;re going to add phpMyAdmin.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see how to install LAMP and phpMyAdmin in this Ubuntu tutorial.&lt;/p&gt;
&lt;h2 id=&#34;lamp-linux-apache-http-mysql-php&#34;&gt;LAMP: Linux, Apache HTTP, MySQL, PHP&lt;/h2&gt;
&lt;p&gt;We have to download and install LAMP with the following command line in our terminal:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Electronics - STM32 - Using the User button to play with the LCD screen and the STM32F103ZE-SK board</title>
      <link>https://www.badprog.com/electronics-stm32-using-the-user-button-to-play-with-the-lcd-screen-and-the-stm32f103ze-sk-board/</link>
      <pubDate>Sun, 03 Mar 2013 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/electronics-stm32-using-the-user-button-to-play-with-the-lcd-screen-and-the-stm32f103ze-sk-board/</guid>
      <description>&lt;p&gt;In this &lt;strong&gt;STM32F103ZE-SK&lt;/strong&gt; tutorial we are going to see how to use the &lt;strong&gt;User button&lt;/strong&gt; of the board by turning on and off the &lt;strong&gt;LCD screen&lt;/strong&gt;.&lt;br&gt;
The &lt;strong&gt;LCD screen&lt;/strong&gt; is on the &lt;strong&gt;GPIO B&lt;/strong&gt; peripheral and on the &lt;strong&gt;GPIO_Pin_5&lt;/strong&gt; port.&lt;br&gt;
The &lt;strong&gt;User button&lt;/strong&gt; is on the &lt;strong&gt;GPIO G&lt;/strong&gt; and on the &lt;strong&gt;GPIO_Pin_8&lt;/strong&gt; port.&lt;/p&gt;
&lt;h2 id=&#34;explanation&#34;&gt;Explanation&lt;/h2&gt;
&lt;p&gt;We have:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;PB5 -&amp;gt; LCD&lt;/li&gt;
&lt;li&gt;PG8 -&amp;gt; User button&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The &lt;strong&gt;lightToMe()&lt;/strong&gt; function initializes both GPIO B and G, being respectively the LCD&lt;br&gt;
screen and the User button.&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - Tips and tricks - Installing Google Chrome on Ubuntu</title>
      <link>https://www.badprog.com/unix-gnu-linux-tips-and-tricks-installing-google-chrome-on-ubuntu/</link>
      <pubDate>Sat, 02 Mar 2013 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-tips-and-tricks-installing-google-chrome-on-ubuntu/</guid>
      <description>&lt;p&gt;What would we do without Google? Who knows. But this is not the question. In this tutorial we will see how to install Google Chrome on Ubuntu 12.04.&lt;/p&gt;
&lt;p&gt;It may seem easy like that, but it isn&amp;rsquo;t. And I&amp;rsquo;m a bit surprise about that. But anyway, let&amp;rsquo;s see this.&lt;/p&gt;
&lt;h2 id=&#34;downloading&#34;&gt;Downloading&lt;/h2&gt;
&lt;p&gt;Open your favorite terminal and if you have a &lt;strong&gt;64-bit&lt;/strong&gt; OS, type this:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;wget https://dl.google.com/linux/direct/google-chrome-stable&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;current&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;amd64.deb
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If your system is a &lt;strong&gt;32-bit&lt;/strong&gt; (or if you don&amp;rsquo;t know) you have to type this:&lt;/p&gt;</description>
    </item>
    <item>
      <title>C - Binary - Operation with decimals</title>
      <link>https://www.badprog.com/c-binary-operation-with-decimals/</link>
      <pubDate>Mon, 18 Feb 2013 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-binary-operation-with-decimals/</guid>
      <description>&lt;p&gt;A good way to understand binary operations is to play with decimals.&lt;br&gt;
What?!&lt;/p&gt;
&lt;p&gt;Yes, if you can manipulate decimals like binaries, then you can say &amp;ldquo;OK! I&amp;rsquo;ve understood how binary works&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s check this with this binary-operation tutorial with decimal numbers.&lt;/p&gt;
&lt;h2 id=&#34;explanation&#34;&gt;Explanation&lt;/h2&gt;
&lt;p&gt;In the code below I&amp;rsquo;m starting with a XOR operation.&lt;br&gt;
I&amp;rsquo;m doing number XOR mask.&lt;br&gt;
number = 4.&lt;br&gt;
mask = 7.&lt;/p&gt;
&lt;p&gt;And the result is 3.&lt;/p&gt;
&lt;p&gt;What happened exactly?&lt;/p&gt;</description>
    </item>
    <item>
      <title>C - Type - What are uint8_t, uint16_t, uint32_t and uint64_t?</title>
      <link>https://www.badprog.com/c-type-what-are-uint8-t-uint16-t-uint32-t-and-uint64-t/</link>
      <pubDate>Thu, 14 Feb 2013 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-type-what-are-uint8-t-uint16-t-uint32-t-and-uint64-t/</guid>
      <description>&lt;p&gt;You are likely wondering what are &lt;strong&gt;uint8_t&lt;/strong&gt;, &lt;strong&gt;uint16_t&lt;/strong&gt;, &lt;strong&gt;uint32_t&lt;/strong&gt; and &lt;strong&gt;uint64_t&lt;/strong&gt;.&lt;br&gt;
That&amp;rsquo;s a good question. Because it could be really helpul!&lt;/p&gt;
&lt;p&gt;It turns out that they are equal respectively to: &lt;strong&gt;unsigned char&lt;/strong&gt;, &lt;strong&gt;unsigned short&lt;/strong&gt;, &lt;strong&gt;unsigned int&lt;/strong&gt; and &lt;strong&gt;unsigned long long&lt;/strong&gt;.&lt;br&gt;
But what are ranges of all these types?&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s test it in this C type tutorial.&lt;/p&gt;
&lt;h2 id=&#34;explanation&#34;&gt;Explanation&lt;/h2&gt;
&lt;p&gt;We&amp;rsquo;re going to use a variable called &lt;strong&gt;testValue&lt;/strong&gt; equal to &lt;strong&gt;0xFFFFFFFFFFFFFFFF&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Notice that &lt;strong&gt;0xFFFFFFFFFFFFFFFF&lt;/strong&gt; is the same as &lt;strong&gt;18&lt;/strong&gt;**,&lt;strong&gt;&lt;strong&gt;446&lt;/strong&gt;&lt;/strong&gt;,&lt;strong&gt;&lt;strong&gt;744&lt;/strong&gt;&lt;/strong&gt;,&lt;strong&gt;&lt;strong&gt;073&lt;/strong&gt;&lt;/strong&gt;,&lt;strong&gt;&lt;strong&gt;709&lt;/strong&gt;&lt;/strong&gt;,**&lt;strong&gt;551,615&lt;/strong&gt; and this is the maximum value possible for an &lt;strong&gt;unsigned long long&lt;/strong&gt;, depending on your processor architecture (as gineera said in its comment).&lt;/p&gt;</description>
    </item>
    <item>
      <title>Android - Installation - On Linux Ubuntu 64-bit with a 32-bit ADT version</title>
      <link>https://www.badprog.com/android-installation-on-linux-ubuntu-64-bit-with-a-32-bit-adt-version/</link>
      <pubDate>Sun, 20 Jan 2013 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/android-installation-on-linux-ubuntu-64-bit-with-a-32-bit-adt-version/</guid>
      <description>&lt;p&gt;You can easily use the following &lt;a href=&#34;https://www.badprog.com/android-installation-on-windows-os-and-eclipse&#34;&gt;Windows Android setup tutorial&lt;/a&gt; to install the Android Development Tools on your Linux system except that you will need the &lt;strong&gt;32-bit libraries&lt;/strong&gt; and install a &lt;strong&gt;JDK&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Note that all these things, could be done by simply download a bundle especially made by &lt;a href=&#34;http://developer.android.com/sdk/index.html&#34;&gt;Google&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;the-32-bit-libraries&#34;&gt;The 32-bit libraries&lt;/h2&gt;
&lt;p&gt;So open your favorite shell and type this:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-java&#34; data-lang=&#34;java&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt&lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;get install ia32&lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;libs
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;A huge list of libraries will be available. Select all and continue.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Eclipse - Arduino - Installation</title>
      <link>https://www.badprog.com/eclipse-arduino-installation/</link>
      <pubDate>Sun, 20 Jan 2013 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/eclipse-arduino-installation/</guid>
      <description>&lt;p&gt;You would like to program with Arduino but you can&amp;rsquo;t do this with the Arduino Software provided.&lt;/p&gt;
&lt;p&gt;Instead you would prefer to use your favorite IDE: &lt;strong&gt;Eclipse&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;That&amp;rsquo;s what we&amp;rsquo;re going to see in this Eclipse and Arduino setup tutorial from scratch.&lt;/p&gt;
&lt;p&gt;We are going to see settings for the &lt;strong&gt;Arduino ADK ATmega 2560&lt;/strong&gt; and the &lt;strong&gt;Arduino Uno&lt;/strong&gt;.&lt;/p&gt;
&lt;h2 id=&#34;installation-on-linux-ubuntu&#34;&gt;Installation on Linux Ubuntu&lt;/h2&gt;
&lt;h3 id=&#34;what-we-need&#34;&gt;What we need&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Linux Ubuntu 12.04&lt;/li&gt;
&lt;li&gt;The avr-gcc compiler&lt;/li&gt;
&lt;li&gt;Openjdk, the open source version of the JDK (Java Development Kit)&lt;/li&gt;
&lt;li&gt;Eclipse Juno CDT (or JavaEE)&lt;/li&gt;
&lt;li&gt;Arduino library&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;java&#34;&gt;Java&lt;/h3&gt;
&lt;p&gt;We need the JDK and we will use the open source version. I invite you to install the &lt;strong&gt;version 6&lt;/strong&gt; (and not the 7) due to security issues in the seventh one.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Tips&#39;n Tricks - Using interface and abstract classes to compute the shape&#39;s area</title>
      <link>https://www.badprog.com/c-tips-n-tricks-using-interface-and-abstract-classes-to-compute-the-shape-s-area/</link>
      <pubDate>Sun, 04 Nov 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-tips-n-tricks-using-interface-and-abstract-classes-to-compute-the-shape-s-area/</guid>
      <description>&lt;p&gt;You&amp;rsquo;re maybe wondering what are interface and abstract classes? That&amp;rsquo;s a good point.&lt;/p&gt;
&lt;p&gt;In this tutorial we&amp;rsquo;re going to see how to compute the area of a shape by declaring an array of undefined shapes.&lt;/p&gt;
&lt;p&gt;After this, we will be able to use this shape as an object with this kind of Factory design pattern.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see how with this example of using interface and abstract classes in C++.&lt;/p&gt;
&lt;h2 id=&#34;explanation&#34;&gt;Explanation&lt;/h2&gt;
&lt;p&gt;First of all, let&amp;rsquo;s create two directories, one for the &lt;strong&gt;.hh&lt;/strong&gt; (headers) and the other for the &lt;strong&gt;.cpp&lt;/strong&gt; (bodies):&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - awk - Count number of words in a file and check a name in another</title>
      <link>https://www.badprog.com/unix-gnu-linux-awk-count-number-of-words-in-a-file-and-check-a-name-in-another/</link>
      <pubDate>Sat, 27 Oct 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-awk-count-number-of-words-in-a-file-and-check-a-name-in-another/</guid>
      <description>&lt;p&gt;In this &lt;strong&gt;awk&lt;/strong&gt; tutorial we&amp;rsquo;re going to see how to count words in a file and display it.&lt;/p&gt;
&lt;p&gt;And in a second time, we will see how to check if a name, inside a file, is present in the first file.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s check it.&lt;/p&gt;
&lt;h2 id=&#34;explanation&#34;&gt;Explanation&lt;/h2&gt;
&lt;p&gt;In the &lt;strong&gt;BEGIN&lt;/strong&gt; pattern we specify the separator with the &lt;strong&gt;FS&lt;/strong&gt; builtin variable. In our case, it will be the default one, the space character.&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - awk - Read a file and computing the average of students&#39; marks</title>
      <link>https://www.badprog.com/unix-gnu-linux-awk-read-a-file-and-computing-the-average-of-students-marks/</link>
      <pubDate>Sat, 27 Oct 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-awk-read-a-file-and-computing-the-average-of-students-marks/</guid>
      <description>&lt;p&gt;The awk user command is made to read a file and check each column, one by one.&lt;/p&gt;
&lt;p&gt;We need to compute the average of students&amp;rsquo; marks and to display the total of their average.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s go.&lt;/p&gt;
&lt;h2 id=&#34;explanation&#34;&gt;Explanation&lt;/h2&gt;
&lt;p&gt;In the BEGIN pattern we specify the separator with the &lt;strong&gt;FS&lt;/strong&gt; builtin variable. In our case, it will be the default one: &amp;quot; &amp;quot; (the &lt;strong&gt;space&lt;/strong&gt; character).&lt;/p&gt;
&lt;p&gt;In the dev pattern, we are going to retrieve marks of each student and make an average of them.&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - awk - Using getline to retrieve data</title>
      <link>https://www.badprog.com/unix-gnu-linux-awk-using-getline-to-retrieve-data/</link>
      <pubDate>Sat, 27 Oct 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-awk-using-getline-to-retrieve-data/</guid>
      <description>&lt;p&gt;We&amp;rsquo;ve already played with awk, passing it a file, but we&amp;rsquo;re going now to see how to retrieve data from the user with the command line.&lt;/p&gt;
&lt;p&gt;We would like to know what&amp;rsquo;s the name of the user.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s ask him.&lt;/p&gt;
&lt;h2 id=&#34;explanation&#34;&gt;Explanation&lt;/h2&gt;
&lt;p&gt;The &lt;strong&gt;-f&lt;/strong&gt; flag is normally to tell awk that we&amp;rsquo;re going to pass a file as argument. But if we don&amp;rsquo;t, the shell will wait for a file.&lt;br&gt;
Instead of a file, we will give to awk a string that we&amp;rsquo;ll retrieve thanks to the &lt;strong&gt;getline&lt;/strong&gt; function.&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - awk - Using matching expressions and operators to find a pattern</title>
      <link>https://www.badprog.com/unix-gnu-linux-awk-using-matching-expressions-and-operators-to-find-a-pattern/</link>
      <pubDate>Sat, 27 Oct 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-awk-using-matching-expressions-and-operators-to-find-a-pattern/</guid>
      <description>&lt;p&gt;The user command awk enables to check if an expression could be found in a file.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s a kind of regex, with classic operators, such as: **? . ***.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s do it.&lt;/p&gt;
&lt;h2 id=&#34;explanation&#34;&gt;Explanation&lt;/h2&gt;
&lt;p&gt;We would like to find every line where there is an &amp;ldquo;e&amp;rdquo; followed by any character and a &amp;ldquo;4&amp;rdquo;.&lt;br&gt;
For example, the following line matches the pattern.:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;awdawekoodk d ekokd &lt;span style=&#34;color:#ae81ff&#34;&gt;93239&lt;/span&gt; 93994543z k
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;To find it, we have to use &lt;em&gt;&lt;em&gt;($0 ~/e.&lt;em&gt;4/)&lt;/em&gt;&lt;/em&gt; because we tell that we want that in each column of the file ($0), we would like to find the pattern &amp;ldquo;e.*4&amp;rdquo;.&lt;br&gt;
For that we use the tilde (&lt;/em&gt;&lt;em&gt;~&lt;/em&gt;&lt;em&gt;) and slashes (&lt;/em&gt;&lt;em&gt;/&lt;/em&gt;*) at the beginning and at the end of our pattern.&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - awk - Using the FILENAME variable</title>
      <link>https://www.badprog.com/unix-gnu-linux-awk-using-the-filename-variable/</link>
      <pubDate>Sat, 27 Oct 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-awk-using-the-filename-variable/</guid>
      <description>&lt;p&gt;With the awk &lt;strong&gt;FILENAME&lt;/strong&gt; builtin variable, we are able to retrieve the name of the file passed as argument during the execution.&lt;/p&gt;
&lt;p&gt;It will avoid us to use a regex command line. Sometimes interesting.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see this.&lt;/p&gt;
&lt;h2 id=&#34;explanation&#34;&gt;Explanation&lt;/h2&gt;
&lt;p&gt;In the example below, we&amp;rsquo;re going to retrieve the name of the file used as argument and display it. But only if we are scanning the first line.&lt;br&gt;
For that, we&amp;rsquo;re going to use the FNR variable, also a awk builtin variable, to check where we are.&lt;br&gt;
If we&amp;rsquo;re in the first line, we will display the file name.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Tips&#39;n Tricks - Creating an object onto the stack and into the heap</title>
      <link>https://www.badprog.com/c-tips-n-tricks-creating-an-object-onto-the-stack-and-into-the-heap/</link>
      <pubDate>Fri, 26 Oct 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-tips-n-tricks-creating-an-object-onto-the-stack-and-into-the-heap/</guid>
      <description>&lt;p&gt;&lt;strong&gt;Stack&lt;/strong&gt; and &lt;strong&gt;heap&lt;/strong&gt; enable data management inside the memory.&lt;/p&gt;
&lt;p&gt;But some data are added onto the stack and the other into the heap.&lt;/p&gt;
&lt;p&gt;For the stack, there is a stack pointer that enables to catch the last data added onto the stack.&lt;/p&gt;
&lt;p&gt;It means that the last data added will be the first used by the program. We call that a &lt;strong&gt;LIFO&lt;/strong&gt; (last in, first out) system.&lt;/p&gt;
&lt;p&gt;For the heap, this is quite different. Indeed, data added into the heap are added randomly in the RAM by the OS.&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - awk - Using NR to display line numbers before each line from a file</title>
      <link>https://www.badprog.com/unix-gnu-linux-awk-using-nr-to-display-line-numbers-before-each-line-from-a-file/</link>
      <pubDate>Fri, 26 Oct 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-awk-using-nr-to-display-line-numbers-before-each-line-from-a-file/</guid>
      <description>&lt;p&gt;We have a file with customers inside.&lt;/p&gt;
&lt;p&gt;We would like to display all the file with line numbers before each line.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see this in this &lt;strong&gt;awk&lt;/strong&gt; tutorial.&lt;/p&gt;
&lt;h2 id=&#34;explanation&#34;&gt;Explanation&lt;/h2&gt;
&lt;p&gt;The &lt;strong&gt;NR&lt;/strong&gt; variable is a awk builtin variable, to display the number (a sort of static variable).&lt;br&gt;
The &lt;strong&gt;$0&lt;/strong&gt; represents every column separated by default by the space character.&lt;br&gt;
The coma between will create a space character for our output.&lt;/p&gt;
&lt;p&gt;All the code inside the dev statement, will be executed until there is no line.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Java - Tips&#39;n Tricks - Printing four patterns using loops</title>
      <link>https://www.badprog.com/java-tips-n-tricks-printing-four-patterns-using-loops/</link>
      <pubDate>Mon, 22 Oct 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/java-tips-n-tricks-printing-four-patterns-using-loops/</guid>
      <description>&lt;p&gt;In this Java tutorial we are going to see how to display four patterns using the &lt;strong&gt;while&lt;/strong&gt; and &lt;strong&gt;for&lt;/strong&gt; loops.&lt;/p&gt;
&lt;p&gt;Notice that this example works in every language as well, just change the &lt;em&gt;print()&lt;/em&gt; method depending on yours.&lt;/p&gt;
&lt;p&gt;It seems easy, but it demands a certain reflection before finding the solution.&lt;/p&gt;
&lt;p&gt;Of course if you are a beginner, don&amp;rsquo;t be afraid, practising is the key of everything!&lt;/p&gt;
&lt;h2 id=&#34;code&#34;&gt;Code&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-java&#34; data-lang=&#34;java&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;public&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;class&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;PrintingFourPatternUsingLoops&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#75715e&#34;&gt;/**
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;     * @param args
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;     */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;public&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;static&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;main&lt;/span&gt;(String&lt;span style=&#34;color:#f92672&#34;&gt;[]&lt;/span&gt; args)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#75715e&#34;&gt;/**
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;         * First with for
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;         */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; (&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; i &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; 1; i &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; 7; i&lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; (&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; j &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; 1; j &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; i &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; 1; j&lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                System.&lt;span style=&#34;color:#a6e22e&#34;&gt;out&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;print&lt;/span&gt;(j);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            System.&lt;span style=&#34;color:#a6e22e&#34;&gt;out&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;println&lt;/span&gt;();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#75715e&#34;&gt;/**
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;         * Second with for
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;         */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        System.&lt;span style=&#34;color:#a6e22e&#34;&gt;out&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;println&lt;/span&gt;();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; k &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; 8; k &lt;span style=&#34;color:#f92672&#34;&gt;&amp;gt;&lt;/span&gt; 1; k&lt;span style=&#34;color:#f92672&#34;&gt;--&lt;/span&gt;) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; l &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; 1; l &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; k &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt; 1; l&lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;){
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                System.&lt;span style=&#34;color:#a6e22e&#34;&gt;out&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;print&lt;/span&gt;(l);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            System.&lt;span style=&#34;color:#a6e22e&#34;&gt;out&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;println&lt;/span&gt;();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#75715e&#34;&gt;/**
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;         * Third with while
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;         */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; i &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; 1;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; j &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; 1;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; k &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; 1;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; max &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; 7;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;while&lt;/span&gt; (i &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; max) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            k &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; 1;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            &lt;span style=&#34;color:#66d9ef&#34;&gt;while&lt;/span&gt; (k &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; max &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt; i) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                System.&lt;span style=&#34;color:#a6e22e&#34;&gt;out&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;print&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39; &amp;#39;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                &lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;k;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            &lt;span style=&#34;color:#66d9ef&#34;&gt;while&lt;/span&gt; (j &lt;span style=&#34;color:#f92672&#34;&gt;&amp;gt;&lt;/span&gt; 0) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                System.&lt;span style=&#34;color:#a6e22e&#34;&gt;out&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;print&lt;/span&gt;(max &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt; (max &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt; j));
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                &lt;span style=&#34;color:#f92672&#34;&gt;--&lt;/span&gt;j;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            &lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;i;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            j&lt;span style=&#34;color:#f92672&#34;&gt;+=&lt;/span&gt;i;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            System.&lt;span style=&#34;color:#a6e22e&#34;&gt;out&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;println&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        System.&lt;span style=&#34;color:#a6e22e&#34;&gt;out&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;println&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#75715e&#34;&gt;/**
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;         * Fourth with while
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;         */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        i &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; 1;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        j &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; 1;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        k &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; 1;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        max &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; 7;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; max2 &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; 8;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; tmp &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; 0;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;while&lt;/span&gt; (i &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; max) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            k &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; 1;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            &lt;span style=&#34;color:#66d9ef&#34;&gt;while&lt;/span&gt; (k &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; max &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt; (max &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt; i)) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                System.&lt;span style=&#34;color:#a6e22e&#34;&gt;out&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;print&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39; &amp;#39;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                &lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;k;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            tmp &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; max2 &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt; i;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            j &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; 1;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            &lt;span style=&#34;color:#66d9ef&#34;&gt;while&lt;/span&gt; (j &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; tmp) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                System.&lt;span style=&#34;color:#a6e22e&#34;&gt;out&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;print&lt;/span&gt;(max &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt; (max &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt; j));
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                &lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;j;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            &lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;i;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            System.&lt;span style=&#34;color:#a6e22e&#34;&gt;out&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;println&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;output&#34;&gt;Output&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-java&#34; data-lang=&#34;java&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;12
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;123
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1234
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;12345
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;123456
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;123456
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;12345
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1234
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;123
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;12
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;     1
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    21
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;   321
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  4321
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; 54321
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;654321
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;123456
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; 12345
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  1234
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;   123
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    12
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;     1
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;finally&#34;&gt;Finally&lt;/h2&gt;
&lt;p&gt;Once again, nothing is impossible, this example shows it.&lt;br&gt;
Great job, you made it! 😈&lt;/p&gt;</description>
    </item>
    <item>
      <title>Perl - OOP - Creating classes with methods</title>
      <link>https://www.badprog.com/perl-oop-creating-classes-with-methods/</link>
      <pubDate>Thu, 18 Oct 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/perl-oop-creating-classes-with-methods/</guid>
      <description>&lt;p&gt;As every language, OOP is a plus. And who says OOP, says classes and methods.&lt;/p&gt;
&lt;p&gt;Perl is able to manage such of things. That&amp;rsquo;s what we are going to see in this Perl tutorial.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s create classes and their methods.&lt;/p&gt;
&lt;h2 id=&#34;explanation&#34;&gt;Explanation&lt;/h2&gt;
&lt;p&gt;Our Perl program will show us who is the boss and who is the employee. And who the boss is hiring.&lt;/p&gt;
&lt;p&gt;In Perl, a &lt;strong&gt;class&lt;/strong&gt; is called a &lt;strong&gt;Package&lt;/strong&gt;.&lt;br&gt;
The name of the package is the same as the file name.&lt;br&gt;
Its extension is &lt;strong&gt;&amp;quot;.pm&lt;/strong&gt;&amp;quot;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Perl - Native functions - Using print()</title>
      <link>https://www.badprog.com/perl-native-functions-using-print/</link>
      <pubDate>Thu, 11 Oct 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/perl-native-functions-using-print/</guid>
      <description>&lt;p&gt;The Perl print() function is used to display a string.&lt;/p&gt;
&lt;p&gt;In our example, we are going to display the content of two variables previously declared and initialized.&lt;/p&gt;
&lt;p&gt;So, let&amp;rsquo;s go to our first Perl HelloWorld! tutorial!&lt;/p&gt;
&lt;h2 id=&#34;explanation&#34;&gt;Explanation&lt;/h2&gt;
&lt;p&gt;We have to create a file named &lt;strong&gt;helloWorld.pl&lt;/strong&gt; because we will use this file with the &lt;strong&gt;perl&lt;/strong&gt; command.&lt;/p&gt;
&lt;p&gt;All comments are beginning by a sharp (&lt;strong&gt;#&lt;/strong&gt;).&lt;/p&gt;
&lt;p&gt;The code is quite easy, we have two &lt;strong&gt;pragmas&lt;/strong&gt; (&lt;em&gt;strict&lt;/em&gt; and &lt;em&gt;warnings&lt;/em&gt;).&lt;/p&gt;</description>
    </item>
    <item>
      <title>Oracle - VirtualBox - Installation</title>
      <link>https://www.badprog.com/oracle-virtualbox-installation/</link>
      <pubDate>Mon, 24 Sep 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/oracle-virtualbox-installation/</guid>
      <description>&lt;p&gt;VirtualBox is a virtualization manager that enables to add different OS on other OS.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s admit you have a PC with Windows 7 installed. In the past, if you wanted to have a Linux, you were obliged to install it like any OS with a DVD and boot on it.&lt;/p&gt;
&lt;p&gt;And then, reboot each time you wanted to use one of them.&lt;/p&gt;
&lt;p&gt;Now, with virtualization, you just have to download a software and while you are still on an OS you can install another one, without rebooting your machine!&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - OpenGL - Using glRotatef() to animate shapes</title>
      <link>https://www.badprog.com/c-opengl-using-glrotatef-to-animate-shapes/</link>
      <pubDate>Sat, 14 Jul 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-opengl-using-glrotatef-to-animate-shapes/</guid>
      <description>&lt;p&gt;Rotating a shape is fun, but rotating it with animation is really great.&lt;/p&gt;
&lt;p&gt;That&amp;rsquo;s what we are going to see in this &lt;strong&gt;glRotatef()&lt;/strong&gt; tutorial for animating shapes on a window.&lt;/p&gt;
&lt;p&gt;Our shape is made up of 3 squares with 3 different colours:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;the white&lt;/li&gt;
&lt;li&gt;the burgundy&lt;/li&gt;
&lt;li&gt;the green&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;maincpp&#34;&gt;main.cpp&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cpp&#34; data-lang=&#34;cpp&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;/*
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;* main.cpp
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;*/&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; &lt;span style=&#34;color:#75715e&#34;&gt;&amp;#34;BadprogRotate.h&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;/*
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;* Main
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;*/&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;main&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; ac, &lt;span style=&#34;color:#66d9ef&#34;&gt;char&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt; av[])
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;BadprogRotate go(&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;∾&lt;/span&gt;, av);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;badprogrotateh&#34;&gt;BadprogRotate.h&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cpp&#34; data-lang=&#34;cpp&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;/*
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;* BadprogRotate.h
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;*/&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#ifndef BADPROGROTATE\_H\_
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#define BADPROGROTATE\_H\_
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; &lt;span style=&#34;color:#75715e&#34;&gt;&amp;#34;GL/freeglut.h&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include 
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#define SCREEN\_TITLE &amp;#34;Square rotation by BadproG! :D&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#define SCREEN\_WIDTH 600
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#define SCREEN\_HEIGHT 600
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#define SCREEN\_POSITION\_X 100
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#define SCREEN\_POSITION\_Y 100
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;class&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;BadprogRotate&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;public&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;static&lt;/span&gt; GLfloat S&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_ANGLE;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;BadprogRotate(&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;ac, &lt;span style=&#34;color:#66d9ef&#34;&gt;char&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;av[]);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;virtual&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;~&lt;/span&gt;BadprogRotate();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;init&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;static&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;managerDisplay&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;static&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;managerIdle&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;static&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;managerResize&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;, &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;static&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;managerMouse&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;, &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;, &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;, &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;static&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;managerKeyboard&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;unsigned&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;char&lt;/span&gt;, &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;, &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;};
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#endif &lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;/* BADPROGROTATE\_H\_ */&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;badprogrotatecpp&#34;&gt;BadprogRotate.cpp&lt;/h2&gt;
&lt;p&gt;Add the &lt;strong&gt;unistd.h&lt;/strong&gt; file for &lt;strong&gt;Windows&lt;/strong&gt; OS in order to change &lt;strong&gt;usleep()&lt;/strong&gt; by &lt;strong&gt;Sleep()&lt;/strong&gt; in the following &lt;strong&gt;managerIdle()&lt;/strong&gt; method.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Errors / Warnings - Cannot declare member function ‘static void MyClass::myMethod()’ to have static linkage [-fpermissive]</title>
      <link>https://www.badprog.com/c-errors-warnings-cannot-declare-member-function-static-void-myclassmymethod-to-have-static-linkage/</link>
      <pubDate>Thu, 12 Jul 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-errors-warnings-cannot-declare-member-function-static-void-myclassmymethod-to-have-static-linkage/</guid>
      <description>&lt;p&gt;In C++, we don&amp;rsquo;t need to specify the &lt;strong&gt;static&lt;/strong&gt; keyword in the declaration of the header and in the definition in the class.&lt;/p&gt;
&lt;p&gt;It means that this &lt;strong&gt;keyword&lt;/strong&gt; has to be added only in the &lt;strong&gt;header&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;You probably know that using the static keyword means that the function is unique in program.&lt;br&gt;
So if you add static in the .h and in the .cpp, you will have like two methods with the same name.&lt;br&gt;
And the compiler won&amp;rsquo;t appreciate it.&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - bash - Setting the colour prompt with PS1</title>
      <link>https://www.badprog.com/unix-gnu-linux-bash-setting-the-colour-prompt-with-ps1/</link>
      <pubDate>Mon, 09 Jul 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-bash-setting-the-colour-prompt-with-ps1/</guid>
      <description>&lt;p&gt;You like your shell but you think that some colours would be better.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see how to set colours of the bash prompt with the PS1 variable.&lt;br&gt;
Notice that this tutorial has been made with &lt;strong&gt;Ubuntu 12&lt;/strong&gt;.&lt;br&gt;
Some syntaxes may change depending on the operating system.&lt;/p&gt;
&lt;p&gt;First of all, at your home directory, that you can have with the command &amp;ldquo;~/&amp;rdquo;, there is a configuration file named: &lt;strong&gt;.bashrc&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;If you don&amp;rsquo;t see it, type this:&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - OpenGL - Creating an equilateral triangle</title>
      <link>https://www.badprog.com/c-opengl-creating-an-equilateral-triangle/</link>
      <pubDate>Sat, 07 Jul 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-opengl-creating-an-equilateral-triangle/</guid>
      <description>&lt;p&gt;You succeeded to &lt;a href=&#34;https://www.badprog.com/c-opengl-hello-world&#34;&gt;display a white square on a black background with OpenGL&lt;/a&gt;.&lt;br&gt;
Great.&lt;br&gt;
Let&amp;rsquo;s see now how to render an equilateral triangle and changing some data.&lt;/p&gt;
&lt;p&gt;In this example we are going to:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;create a Makefile&lt;/li&gt;
&lt;li&gt;set the background color to purple&lt;/li&gt;
&lt;li&gt;set the drawing color to green (for the triangle)&lt;/li&gt;
&lt;li&gt;draw an equilateral triangle on the scene (thanks to the Pythagorean theorem)&lt;/li&gt;
&lt;li&gt;put this triangle in the middle of the window&lt;/li&gt;
&lt;li&gt;close the window by pressing the ESC key&lt;/li&gt;
&lt;li&gt;resize the window on the fly&lt;/li&gt;
&lt;li&gt;displaying the x and y of the mouse in the console during a mouse moving&lt;/li&gt;
&lt;li&gt;displaying the x and y of the mouse with the state (0 down and 1 up) and which button clicked&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;All these things are basic to develop a program in OpenGL.&lt;br&gt;
It&amp;rsquo;s like a super &lt;em&gt;Hello World!&lt;/em&gt; tutorial.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C - Tips&#39;n Tricks - Creating a clock with six numbers after the decimal point</title>
      <link>https://www.badprog.com/c-tips-n-tricks-creating-a-clock-with-six-numbers-after-the-decimal-point/</link>
      <pubDate>Thu, 05 Jul 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-tips-n-tricks-creating-a-clock-with-six-numbers-after-the-decimal-point/</guid>
      <description>&lt;p&gt;Everyone knows that a clock is essential in a video game.&lt;/p&gt;
&lt;p&gt;And the more the clock is precise, the more we can do things.&lt;/p&gt;
&lt;p&gt;That&amp;rsquo;s what we are going to see in this clock tutorial by creating a clock with six numbers after the decimal point.&lt;/p&gt;
&lt;h2 id=&#34;the-code&#34;&gt;The code&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;/* BadproG.com */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;clockTime&lt;/span&gt;();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;main&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (&lt;span style=&#34;color:#a6e22e&#34;&gt;clockTime&lt;/span&gt;())
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; (&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; EXIT&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_SUCCESS;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;/**
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;* A clock with six numbers after the decimal point
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;*/&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;clockTime&lt;/span&gt;()
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;time&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_t t;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;struct&lt;/span&gt; timeval tv;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;double&lt;/span&gt; gtod;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;double&lt;/span&gt; theTime;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;theTime &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;gtod &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;t &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;time&lt;/span&gt;(NULL);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;while&lt;/span&gt; (t &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;2000000000&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;t &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;time&lt;/span&gt;(NULL);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;gtod &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;gettimeofday&lt;/span&gt;(&lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;tv, NULL);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (gtod &lt;span style=&#34;color:#f92672&#34;&gt;!=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;fprintf&lt;/span&gt;(stderr, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Error: clockTime().&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; (&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;theTime &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; (&lt;span style=&#34;color:#66d9ef&#34;&gt;double&lt;/span&gt;)tv.tv&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_sec &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; (&lt;span style=&#34;color:#66d9ef&#34;&gt;double&lt;/span&gt;)tv.tv&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_usec &lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1000000&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;theTime = %f&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, theTime);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; (&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;the-result&#34;&gt;The result&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;...
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;theTime &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1341489768.809641&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;theTime &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1341489768.809655&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;theTime &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1341489768.809670&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;theTime &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1341489768.809684&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;theTime &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1341489768.809698&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;theTime &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1341489768.809712&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;theTime &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1341489768.809726&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;theTime &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1341489768.809740&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;theTime &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1341489768.809755&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;theTime &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1341489768.809769&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;theTime &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1341489768.809783&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;theTime &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1341489768.809798&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;theTime &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1341489768.809812&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;theTime &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1341489768.809826&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;theTime &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1341489768.809840&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;theTime &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1341489768.809855&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;theTime &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1341489768.809869&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;theTime &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1341489768.809884&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;...
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You can now check an action more quickly than before.&lt;br&gt;
You made it, well done. 😜&lt;/p&gt;</description>
    </item>
    <item>
      <title>C - Tips&#39;n Tricks - Retrieve temperature of hardware devices</title>
      <link>https://www.badprog.com/c-tips-n-tricks-retrieve-temperature-of-hardware-devices/</link>
      <pubDate>Thu, 05 Jul 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-tips-n-tricks-retrieve-temperature-of-hardware-devices/</guid>
      <description>&lt;p&gt;The file from where we can retrieve &lt;strong&gt;temperature&lt;/strong&gt; depends on the operating system.&lt;br&gt;
For this tutorial I used &lt;strong&gt;Ubuntu 12&lt;/strong&gt;.&lt;br&gt;
The file on which I took temperature is &lt;strong&gt;/sys/class/thermal/thermal_zone8/temp&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;So you can test temperature of each file present in &lt;strong&gt;/sys/class/thermal/thermal_zone[0-9]/temp.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;On some GNU/Linux systems, files needed are sometimes in the &lt;strong&gt;/proc/acpi/thermal_zone/&lt;/strong&gt; directory.&lt;/p&gt;
&lt;p&gt;In the example below the heart of the code is in the &lt;strong&gt;main&lt;/strong&gt;() function.&lt;br&gt;
All other functions are for testing that &lt;strong&gt;malloc&lt;/strong&gt;(), &lt;strong&gt;open&lt;/strong&gt;(), &lt;strong&gt;read&lt;/strong&gt;(), &lt;strong&gt;close&lt;/strong&gt;() and &lt;strong&gt;free&lt;/strong&gt;() are called without any error.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - OpenGL - Using glRotatef() to rotate around the X, Y and Z axis</title>
      <link>https://www.badprog.com/c-opengl-using-glrotatef-to-rotate-around-the-x-y-and-z-axis/</link>
      <pubDate>Mon, 04 Jun 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-opengl-using-glrotatef-to-rotate-around-the-x-y-and-z-axis/</guid>
      <description>&lt;p&gt;In this &lt;strong&gt;OpenGL 2.1&lt;/strong&gt; tutorial we are going to use the &lt;strong&gt;glRotatef()&lt;/strong&gt; method.&lt;/p&gt;
&lt;p&gt;This method is designed to rotate around the 3 axis: X, Y and Z.&lt;br&gt;
In the example below I will use a black background and draw 3 triangles.&lt;/p&gt;
&lt;p&gt;The green will rotate around the X axis.&lt;br&gt;
The blue will rotate around the Y axis.&lt;br&gt;
The red will rotate around the Z axis.&lt;/p&gt;
&lt;p&gt;To better understand it, we have to imagine an eye seeing a point.&lt;br&gt;
Now around this point all triangles will rotate.&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - gcc - Option -I for adding includes to the compilation</title>
      <link>https://www.badprog.com/unix-gnu-linux-gcc-option-i-for-adding-includes-to-the-compilation/</link>
      <pubDate>Mon, 04 Jun 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-gcc-option-i-for-adding-includes-to-the-compilation/</guid>
      <description>&lt;p&gt;During the compilation step, we can add includes that will be added to the .o generated.&lt;/p&gt;
&lt;p&gt;For that, we use the &lt;strong&gt;-I option&lt;/strong&gt; (this is an uppercase &amp;ldquo;i&amp;rdquo;, standing for &amp;ldquo;include&amp;rdquo;) with the path to the includes we want to add.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s suppose we want to add personal includes previously added in a directory.&lt;br&gt;
So it can be something like that:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;gcc -c -o main.o main.c -I&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;/home/soft/library/personal/include&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;With a Makefile, we can use this example:&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - gcc - Option -L for adding libraries during linking</title>
      <link>https://www.badprog.com/unix-gnu-linux-gcc-option-l-for-adding-libraries-during-linking/</link>
      <pubDate>Mon, 04 Jun 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-gcc-option-l-for-adding-libraries-during-linking/</guid>
      <description>&lt;p&gt;We can add libraries during the linking step.&lt;br&gt;
This tutorial is the same for &lt;strong&gt;g++&lt;/strong&gt; of course.&lt;/p&gt;
&lt;p&gt;We use for that the &lt;strong&gt;-L option&lt;/strong&gt; and add just after (without any space) the path of the libraries.&lt;br&gt;
Libraries are generally prefixed with &amp;ldquo;&lt;strong&gt;lib&lt;/strong&gt;&amp;rdquo; and suffixed with the &lt;strong&gt;.a&lt;/strong&gt; extension.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s suppose we previously created a library named &lt;strong&gt;libgreatone.a&lt;/strong&gt; in /soft/personal/lib.&lt;br&gt;
We have so: &lt;strong&gt;/soft/personal/lib/libgreatone.a&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;OK, to call this lib, we have first to specify the path and then the name of this library witout the prefix &amp;ldquo;lib&amp;rdquo;.&lt;br&gt;
For the first step, let&amp;rsquo;s use the -L option and for the second one use the -l (an &amp;ldquo;L&amp;rdquo; lowercase).&lt;br&gt;
Notice that there is no space after the -L nor the -l option.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Eclipse - Debugger - An easy example</title>
      <link>https://www.badprog.com/eclipse-debugger-an-easy-example/</link>
      <pubDate>Sat, 02 Jun 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/eclipse-debugger-an-easy-example/</guid>
      <description>&lt;p&gt;Using the debugger is just essantial in a huge complex project.&lt;/p&gt;
&lt;p&gt;But even for a tiny program, it is also useful.&lt;/p&gt;
&lt;p&gt;For this Eclipse debugguer tutorial we are going to test it with the C++ programming language.&lt;/p&gt;
&lt;p&gt;Of course you know how to install Eclipse on Windows, if not, follow this &lt;a href=&#34;https://www.badprog.com/c-eclipse-installation-of-c-c-development-tools-cdt-and-cygwin-for-windows&#34;&gt;Eclipse installation tutorial for Windows&lt;/a&gt;.&lt;br&gt;
If you prefer GNU/Linux or MAC it is a bit much easy because all libraries are already installed on your OS.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Python 3 - Data types - Using a dictionary</title>
      <link>https://www.badprog.com/python-3-data-types-using-a-dictionary/</link>
      <pubDate>Sat, 02 Jun 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/python-3-data-types-using-a-dictionary/</guid>
      <description>&lt;p&gt;A &lt;strong&gt;dictionary&lt;/strong&gt; is useful when you want to associate a &lt;strong&gt;key&lt;/strong&gt; with a &lt;strong&gt;value&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;A key is for example the first name of a person and the value his last name.&lt;br&gt;
But this is the same for a car and its color.&lt;/p&gt;
&lt;p&gt;Of course, it is possible to have a dictionary of dictionaries of dictionaries of dictionaries.&lt;br&gt;
This is a bit more complex for your brain although it works as well.&lt;br&gt;
In this context, a dictionary is like a database that contains all data necessary.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Python 3 - Data types - Using a set</title>
      <link>https://www.badprog.com/python-3-data-types-using-a-set/</link>
      <pubDate>Sun, 27 May 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/python-3-data-types-using-a-set/</guid>
      <description>&lt;p&gt;A &lt;strong&gt;set&lt;/strong&gt; is a container that enables a way to retrieve unique data inside this container.&lt;/p&gt;
&lt;p&gt;It means that if you want to be sure that only one occurrence is present in a container, you have to choose the set one.&lt;/p&gt;
&lt;p&gt;For the form, we have to use the &lt;strong&gt;curly brackets&lt;/strong&gt; to declare a set.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see examples in detail with this tutorial of the Python 3 set data type.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Python 3 - Data types - Using a tuple</title>
      <link>https://www.badprog.com/python-3-data-types-using-a-tuple/</link>
      <pubDate>Sun, 27 May 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/python-3-data-types-using-a-tuple/</guid>
      <description>&lt;p&gt;A &lt;strong&gt;tuple&lt;/strong&gt; is like a &lt;strong&gt;list&lt;/strong&gt; but without possibility to modify it.&lt;/p&gt;
&lt;p&gt;We can see a tuple like something declared once to be sure data inside won&amp;rsquo;t be modified in the future.&lt;/p&gt;
&lt;p&gt;A bit like a &lt;strong&gt;#define&lt;/strong&gt; or &lt;strong&gt;const&lt;/strong&gt; in &lt;strong&gt;C/C++&lt;/strong&gt; or the &lt;strong&gt;final&lt;/strong&gt; keyword in Java.&lt;/p&gt;
&lt;p&gt;So there are only two methods for the tuple data type.&lt;br&gt;
Let&amp;rsquo;s see this in this Python 3 data type tuple tutorial.&lt;/p&gt;
&lt;p&gt;In the form, there is also a difference with a list or a set, we declare it with parentheses:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Python 3 - Data types - Using a list</title>
      <link>https://www.badprog.com/python-3-data-types-using-a-list/</link>
      <pubDate>Sat, 26 May 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/python-3-data-types-using-a-list/</guid>
      <description>&lt;p&gt;The &lt;strong&gt;list&lt;/strong&gt; data type is like a container.&lt;/p&gt;
&lt;p&gt;So we can manage it like an array in other programming languages.&lt;/p&gt;
&lt;p&gt;In this tutorial of the Python 3 data type list, we are going to play with all methods of the list.&lt;/p&gt;
&lt;p&gt;You can find the &lt;strong&gt;count()&lt;/strong&gt; and &lt;strong&gt;index()&lt;/strong&gt; methods in the &lt;strong&gt;listManager()&lt;/strong&gt; function that I created below.&lt;/p&gt;
&lt;h2 id=&#34;code&#34;&gt;Code&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;&amp;#39;&amp;#39; Display what there is into myList &amp;#39;&amp;#39;&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;def&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;listManager&lt;/span&gt;(myType, myList):
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;i &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;name &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;50&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;listSize &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; myList&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;\_\_len\_\_()
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;print(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;--&amp;gt; &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; myType)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;print(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Number of items = &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; str(listSize))
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;print(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Number of &lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; str(name) &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt; value = &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; str(theList&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;count(name)) &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;.&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;try&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;occurrence &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; theList&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;index(name)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;except&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;ValueError&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;as&lt;/span&gt; myError:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;print(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Error:&amp;#34;&lt;/span&gt;, myError)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;print(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;The first occurrence of &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; str(name) &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34; is at index: &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; str(occurrence) &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;.&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; i &lt;span style=&#34;color:#f92672&#34;&gt;in&lt;/span&gt; myList:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;print(i)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;&amp;#39;&amp;#39; End of listManager &amp;#39;&amp;#39;&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;theList &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; [&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Hello&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;World&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;50&lt;/span&gt;]
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;listManager(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;classic&amp;#34;&lt;/span&gt;, theList)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;theList&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;append(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Hello&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;listManager(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;append&amp;#34;&lt;/span&gt;, theList)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;theList[&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;] &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;21&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;listManager(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;adding by index&amp;#34;&lt;/span&gt;, theList)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;theList&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;insert(&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;John&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;listManager(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;insert&amp;#34;&lt;/span&gt;, theList)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;secondList &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; [&lt;span style=&#34;color:#ae81ff&#34;&gt;34&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;12&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;57&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Gorgeous&amp;#34;&lt;/span&gt;]
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;theList&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;extend(secondList)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;listManager(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;extend&amp;#34;&lt;/span&gt;, theList)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;theList&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;pop()
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;listManager(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;pop&amp;#34;&lt;/span&gt;, theList)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;theList&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;remove(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;World&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;theList&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;remove(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;John&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;theList&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;remove(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Hello&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;listManager(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;remove&amp;#34;&lt;/span&gt;, theList)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;theList&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;sort(key&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;None&lt;/span&gt;, reverse&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;False&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;listManager(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;sort&amp;#34;&lt;/span&gt;, theList)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;theList&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;reverse()
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;listManager(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;reverse&amp;#34;&lt;/span&gt;, theList)
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;result&#34;&gt;Result&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;--&amp;gt;&lt;/span&gt; classic
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Number of items &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;3&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Number of &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;50&amp;#34;&lt;/span&gt; value &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;The first occurrence of &lt;span style=&#34;color:#ae81ff&#34;&gt;50&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;is&lt;/span&gt; at index: &lt;span style=&#34;color:#ae81ff&#34;&gt;2.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Hello
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;World
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;50&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;--&amp;gt;&lt;/span&gt; append
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Number of items &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;4&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Number of &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;50&amp;#34;&lt;/span&gt; value &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;The first occurrence of &lt;span style=&#34;color:#ae81ff&#34;&gt;50&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;is&lt;/span&gt; at index: &lt;span style=&#34;color:#ae81ff&#34;&gt;2.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Hello
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;World
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;50&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Hello
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;--&amp;gt;&lt;/span&gt; adding by index
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Number of items &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;4&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Number of &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;50&amp;#34;&lt;/span&gt; value &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;The first occurrence of &lt;span style=&#34;color:#ae81ff&#34;&gt;50&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;is&lt;/span&gt; at index: &lt;span style=&#34;color:#ae81ff&#34;&gt;2.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;21&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;World
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;50&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Hello
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;--&amp;gt;&lt;/span&gt; insert
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Number of items &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;5&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Number of &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;50&amp;#34;&lt;/span&gt; value &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;The first occurrence of &lt;span style=&#34;color:#ae81ff&#34;&gt;50&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;is&lt;/span&gt; at index: &lt;span style=&#34;color:#ae81ff&#34;&gt;3.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;21&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;John
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;World
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;50&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Hello
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;--&amp;gt;&lt;/span&gt; extend
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Number of items &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;9&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Number of &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;50&amp;#34;&lt;/span&gt; value &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;The first occurrence of &lt;span style=&#34;color:#ae81ff&#34;&gt;50&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;is&lt;/span&gt; at index: &lt;span style=&#34;color:#ae81ff&#34;&gt;3.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;21&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;John
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;World
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;50&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Hello
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;34&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;12&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;57&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Gorgeous
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;--&amp;gt;&lt;/span&gt; pop
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Number of items &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;8&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Number of &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;50&amp;#34;&lt;/span&gt; value &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;The first occurrence of &lt;span style=&#34;color:#ae81ff&#34;&gt;50&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;is&lt;/span&gt; at index: &lt;span style=&#34;color:#ae81ff&#34;&gt;3.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;21&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;John
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;World
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;50&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Hello
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;34&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;12&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;57&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;--&amp;gt;&lt;/span&gt; remove
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Number of items &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;5&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Number of &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;50&amp;#34;&lt;/span&gt; value &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;The first occurrence of &lt;span style=&#34;color:#ae81ff&#34;&gt;50&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;is&lt;/span&gt; at index: &lt;span style=&#34;color:#ae81ff&#34;&gt;1.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;21&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;50&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;34&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;12&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;57&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;--&amp;gt;&lt;/span&gt; sort
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Number of items &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;5&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Number of &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;50&amp;#34;&lt;/span&gt; value &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;The first occurrence of &lt;span style=&#34;color:#ae81ff&#34;&gt;50&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;is&lt;/span&gt; at index: &lt;span style=&#34;color:#ae81ff&#34;&gt;3.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;12&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;21&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;34&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;50&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;57&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;--&amp;gt;&lt;/span&gt; reverse
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Number of items &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;5&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Number of &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;50&amp;#34;&lt;/span&gt; value &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;The first occurrence of &lt;span style=&#34;color:#ae81ff&#34;&gt;50&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;is&lt;/span&gt; at index: &lt;span style=&#34;color:#ae81ff&#34;&gt;1.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;57&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;50&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;34&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;21&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;12&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;A great data type, isn&amp;rsquo;t it?&lt;/p&gt;</description>
    </item>
    <item>
      <title>Python 3 - General programming - Statements</title>
      <link>https://www.badprog.com/python-3-general-programming-statements/</link>
      <pubDate>Sat, 26 May 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/python-3-general-programming-statements/</guid>
      <description>&lt;p&gt;In Python 3 we cannot increment a variable directly with &lt;strong&gt;&amp;quot;++&amp;quot;&lt;/strong&gt; before or after this variable.&lt;/p&gt;
&lt;p&gt;We have to add + 1 on the variable to increment it.&lt;br&gt;
That&amp;rsquo;s a bit annoying but life is life.&lt;/p&gt;
&lt;p&gt;In this tutorial we are going to see examples of the Python 3 statements.&lt;/p&gt;
&lt;h2 id=&#34;while-statement&#34;&gt;While statement&lt;/h2&gt;
&lt;p&gt;We use the &lt;strong&gt;while&lt;/strong&gt; statement to iterate through a number. An int for example.&lt;/p&gt;
&lt;h3 id=&#34;code&#34;&gt;Code&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;i &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;end &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;10&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;while&lt;/span&gt; i &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; end:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;print(i)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;i &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; i &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;result&#34;&gt;Result&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;3&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;4&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;5&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;6&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;7&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;8&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;9&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;for-statement&#34;&gt;For statement&lt;/h2&gt;
&lt;p&gt;We use the &lt;strong&gt;for&lt;/strong&gt; statement to iterate through something that have data such a string (has characters), an or a list (have items) for example.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - OpenGL - Hello World!</title>
      <link>https://www.badprog.com/c-opengl-hello-world/</link>
      <pubDate>Thu, 03 May 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-opengl-hello-world/</guid>
      <description>&lt;p&gt;After &lt;a href=&#34;https://www.badprog.com/c-opengl-installation&#34;&gt;installing the OpenGL libraries&lt;/a&gt; on your system, you would definitely want to display something on the screen.&lt;/p&gt;
&lt;p&gt;You are right!&lt;/p&gt;
&lt;p&gt;So let&amp;rsquo;s see this with an &lt;strong&gt;&lt;em&gt;Hello World!&lt;/em&gt; OpenGL 2.1&lt;/strong&gt; tutorial.&lt;/p&gt;
&lt;p&gt;This is really a basic code to display a window and saying: &amp;ldquo;Great I can do it&amp;rdquo;.&lt;br&gt;
Such basic that it seems C implementation (indeed we don&amp;rsquo;t have any class in this example).&lt;/p&gt;
&lt;h2 id=&#34;code&#34;&gt;Code&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cpp&#34; data-lang=&#34;cpp&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// badprog.com
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include 
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;displayMe&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;glClear(GL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_COLOR&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_BUFFER&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_BIT);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;glBegin(GL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_POLYGON);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;glVertex3f(&lt;span style=&#34;color:#ae81ff&#34;&gt;0.0&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;0.0&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;0.0&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;glVertex3f(&lt;span style=&#34;color:#ae81ff&#34;&gt;0.5&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;0.0&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;0.0&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;glVertex3f(&lt;span style=&#34;color:#ae81ff&#34;&gt;0.5&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;0.5&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;0.0&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;glVertex3f(&lt;span style=&#34;color:#ae81ff&#34;&gt;0.0&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;0.5&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;0.0&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;glEnd();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;glFlush();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;main&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; argc, &lt;span style=&#34;color:#66d9ef&#34;&gt;char&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;**&lt;/span&gt; argv)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;glutInit(&lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;argc, argv);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;glutInitDisplayMode(GLUT&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_SINGLE);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;glutInitWindowSize(&lt;span style=&#34;color:#ae81ff&#34;&gt;300&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;300&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;glutInitWindowPosition(&lt;span style=&#34;color:#ae81ff&#34;&gt;100&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;100&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;glutCreateWindow(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Hello world from Badprog.com :D&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;glutDisplayFunc(displayMe);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;glutMainLoop();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;compiling&#34;&gt;Compiling&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cpp&#34; data-lang=&#34;cpp&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;g&lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt; main.cpp &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;o lookAtThis &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;lglut ; .&lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt;lookAtThis
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;result&#34;&gt;Result&lt;/h2&gt;
&lt;p&gt;A black window with a white square displayed.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - OpenGL - Installation</title>
      <link>https://www.badprog.com/c-opengl-installation/</link>
      <pubDate>Thu, 03 May 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-opengl-installation/</guid>
      <description>&lt;p&gt;For this first &lt;strong&gt;OpenGL&lt;/strong&gt; tutorial, we are going to see how to install OpenGL on &lt;strong&gt;GNU/Linux&lt;/strong&gt; and &lt;strong&gt;Windows&lt;/strong&gt; operating system.&lt;/p&gt;
&lt;p&gt;We need the OpenGL files, but also those from the &lt;strong&gt;GLU&lt;/strong&gt; and &lt;strong&gt;GLUT&lt;/strong&gt; for GNU/Linux and &lt;strong&gt;freeGLUT&lt;/strong&gt; for Windows.&lt;br&gt;
The last ones, GLU and GLUT are libraries that add functionnalities from the basic OpenGL.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;OpenGL&lt;/strong&gt; = &lt;strong&gt;O&lt;/strong&gt; pen &lt;strong&gt;G&lt;/strong&gt; raphics &lt;strong&gt;L&lt;/strong&gt; ibrary&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;GLU&lt;/strong&gt; = &lt;strong&gt;G&lt;/strong&gt; raphic &lt;strong&gt;L&lt;/strong&gt; ibrary &lt;strong&gt;U&lt;/strong&gt; tility&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;GLUT&lt;/strong&gt; = &lt;strong&gt;G&lt;/strong&gt; raphic &lt;strong&gt;L&lt;/strong&gt; ibrary &lt;strong&gt;U&lt;/strong&gt; tility &lt;strong&gt;T&lt;/strong&gt; oolkit&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;installing-opengl-on-gnulinux&#34;&gt;Installing OpenGL on GNU/Linux&lt;/h2&gt;
&lt;h3 id=&#34;fedora&#34;&gt;Fedora&lt;/h3&gt;
&lt;p&gt;If you do not have the &lt;strong&gt;glut.h&lt;/strong&gt; file in your &lt;strong&gt;/usr/include/GL/&lt;/strong&gt; directory, let&amp;rsquo;s install it with the following command on your favorite shell:&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - System calls - Difference between fork() and vfork()</title>
      <link>https://www.badprog.com/unix-gnu-linux-system-calls-difference-between-fork-and-vfork/</link>
      <pubDate>Tue, 01 May 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-system-calls-difference-between-fork-and-vfork/</guid>
      <description>&lt;p&gt;The &lt;strong&gt;fork()&lt;/strong&gt; and &lt;strong&gt;vfork()&lt;/strong&gt; syscalls are different.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;fork()&lt;/strong&gt; syscall generates two identical processes with separate memory.&lt;br&gt;
The &lt;strong&gt;vfork()&lt;/strong&gt; syscall generates two processes that share the same memory.&lt;/p&gt;
&lt;p&gt;With &lt;strong&gt;vfork()&lt;/strong&gt; the parent will wait for the child terminates.&lt;br&gt;
The parent inherites from the variables that the program is sharing.&lt;br&gt;
So after the child was called, all variables modified inside the child will still be modified inside the parent.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see an example with this tutorial of both fork() and vfork() syscalls.&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - System calls - Using wait()</title>
      <link>https://www.badprog.com/unix-gnu-linux-system-calls-using-wait/</link>
      <pubDate>Tue, 01 May 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-system-calls-using-wait/</guid>
      <description>&lt;p&gt;The &lt;strong&gt;wait()&lt;/strong&gt; syscall is often used with the &lt;strong&gt;fork()&lt;/strong&gt; syscall.&lt;/p&gt;
&lt;p&gt;Indeed, with the &lt;strong&gt;wait()&lt;/strong&gt; syscall we can be sure that the child will be executed before the parent process.&lt;br&gt;
In a trivial vision, this is like mutexes for threads.&lt;/p&gt;
&lt;p&gt;It means that without the following line, the parent and the child will be executed at the same time:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;wait&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&amp;amp;status&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If you want to try it, change the line:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;while&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;i &amp;lt; 10&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;by this one on both parent and child loops:&lt;/p&gt;</description>
    </item>
    <item>
      <title>C - Mathematics - Using the Luhn algorithm</title>
      <link>https://www.badprog.com/c-mathematics-using-the-luhn-algorithm/</link>
      <pubDate>Tue, 24 Apr 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-mathematics-using-the-luhn-algorithm/</guid>
      <description>&lt;p&gt;Maybe you wonder if your credit card has a correct number?&lt;/p&gt;
&lt;p&gt;How to know that?&lt;br&gt;
With the &lt;strong&gt;Luhn&lt;/strong&gt; formula!&lt;br&gt;
This is what we are going to see in this &lt;strong&gt;Luhn&lt;/strong&gt; tutorial.&lt;/p&gt;
&lt;p&gt;This algorithm can say if it is a good or a bad credit card number.&lt;/p&gt;
&lt;p&gt;Indeed, for that we first of all have to reverse the complete number.&lt;/p&gt;
&lt;p&gt;For example, the number to test is 1234567897.&lt;/p&gt;
&lt;p&gt;Once reversed, we have 7987654321.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C - Mathematics - Find prime numbers</title>
      <link>https://www.badprog.com/c-mathematics-find-prime-numbers/</link>
      <pubDate>Mon, 23 Apr 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-mathematics-find-prime-numbers/</guid>
      <description>&lt;p&gt;If you have a good computer, you can maybe try to find the last &lt;strong&gt;prime number&lt;/strong&gt; that nobody found yet.&lt;/p&gt;
&lt;p&gt;Indeed, you can even win a prize for that!&lt;br&gt;
But you have to find a number with more than millions of digits.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m sure you can do it.&lt;/p&gt;
&lt;p&gt;For the moment, let&amp;rsquo;s see how to find these numbers in this &lt;strong&gt;prime number&lt;/strong&gt; tutorial.&lt;/p&gt;
&lt;p&gt;Arguments are a range: the minimum and the maximum numbers.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C - Mathematics - Fraction simplifier</title>
      <link>https://www.badprog.com/c-mathematics-fraction-simplifier/</link>
      <pubDate>Mon, 23 Apr 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-mathematics-fraction-simplifier/</guid>
      <description>&lt;p&gt;Today, I inaugurate a new C section: &lt;strong&gt;mathematics&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The first tutorial is a way to &lt;strong&gt;simplify a fraction&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;I put all data in a structure that I typedefined as &lt;em&gt;t_bp&lt;/em&gt;.&lt;br&gt;
I also made 3 files: &lt;em&gt;main.c&lt;/em&gt;, &lt;em&gt;misc.c&lt;/em&gt; and &lt;em&gt;h.h&lt;/em&gt;.&lt;br&gt;
There is also an error manager inside the code.&lt;/p&gt;
&lt;p&gt;For example, the numbers allowed are 1 until 9. So if you type something else, it will generate an error.&lt;/p&gt;
&lt;p&gt;And of course, you have to enter 2 arguments: the &lt;strong&gt;numerator&lt;/strong&gt; and the &lt;strong&gt;denominator&lt;/strong&gt;.&lt;br&gt;
Notice that in this program you can use negative numbers.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C - Library functions - Using inet_ntoa()</title>
      <link>https://www.badprog.com/c-library-functions-using-inet-ntoa/</link>
      <pubDate>Fri, 20 Apr 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-library-functions-using-inet-ntoa/</guid>
      <description>&lt;p&gt;The &lt;strong&gt;inet_ntoa()&lt;/strong&gt; function C returns the address of a client side, for example.&lt;/p&gt;
&lt;p&gt;We give to the unique &lt;strong&gt;inet_ntoa()&lt;/strong&gt; parameter, a &lt;strong&gt;struct in_addr&lt;/strong&gt;.&lt;br&gt;
We can then retrieve the address of this parameter.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s look it in this tutorial with an example of code.&lt;/p&gt;
&lt;h2 id=&#34;using-inet_ntoa&#34;&gt;Using inet_ntoa()&lt;/h2&gt;
&lt;h3 id=&#34;serverc&#34;&gt;server.c&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;/* server.c */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &amp;#34;h.h&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; my&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_socket&lt;/span&gt;(t&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_s &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;s)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;name    &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;TCP&amp;#34;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;domain    &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; AF&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_INET;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;type    &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; SOCK&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_STREAM;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;pe        &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;getprotobyname&lt;/span&gt;(s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;name);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;fd        &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;socket&lt;/span&gt;(s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;domain, s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;type, s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;pe&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;p&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_proto);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    check&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_error&lt;/span&gt;(s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;fd, &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; my&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_bind&lt;/span&gt;(t&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_s &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;s, &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; port)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;sockfd                &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;fd;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;addr.sin&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_family        &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;domain;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;addr.sin&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_addr.s&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_addr &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; INADDR&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_ANY;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;addr.sin&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_port        &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;htons&lt;/span&gt;(port);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;addrlen                &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;sizeof&lt;/span&gt;(s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;addr);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;bindValue            &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;bind&lt;/span&gt;(s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;fd, (&lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;struct&lt;/span&gt; sockaddr &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;)&lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;addr, s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;addrlen);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    check&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_error&lt;/span&gt;(s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;bindValue, &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; my&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_listen&lt;/span&gt;(t&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_s &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;s, &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; backlog)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;listenValue &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;listen&lt;/span&gt;(s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;sockfd, backlog);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    check&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_error&lt;/span&gt;(s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;listenValue, &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; my&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_accept&lt;/span&gt;(t&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_s &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;s)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;addrlenAccept &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;sizeof&lt;/span&gt;(s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;addrAccept);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;acceptValue &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;accept&lt;/span&gt;(s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;sockfd, (&lt;span style=&#34;color:#66d9ef&#34;&gt;struct&lt;/span&gt; sockaddr &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;)&lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;addrAccept, &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;addrlenAccept);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    check&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_error&lt;/span&gt;(s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;acceptValue, &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;acceptAddr &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; inet&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_ntoa&lt;/span&gt;(s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;addrAccept.sin&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_addr);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    check&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_null&lt;/span&gt;(s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;acceptAddr);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;main&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; ac, &lt;span style=&#34;color:#66d9ef&#34;&gt;char&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;av[])
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    t&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_s s;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    check&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_arg&lt;/span&gt;(ac, ARG&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_SIZE);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    my&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_socket&lt;/span&gt;(&lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;s);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    my&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_bind&lt;/span&gt;(&lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;s, &lt;span style=&#34;color:#a6e22e&#34;&gt;atoi&lt;/span&gt;(av[&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;]));
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    my&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_listen&lt;/span&gt;(&lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;s, BACKLOG);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    my&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_accept&lt;/span&gt;(&lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;s);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;debug&lt;/span&gt;(&lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;s);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    check&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_error&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;close&lt;/span&gt;(s.acceptValue), &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    check&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_error&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;close&lt;/span&gt;(s.fd), &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;debugc&#34;&gt;debug.c&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;/* debug.c */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &amp;#34;h.h&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;debug&lt;/span&gt;(t&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_s &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;s)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;===== socket() =====&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;domain = %d&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;domain);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;type = %d&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;type);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;fd = %d&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;fd);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;name = %s&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;name);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;p\_proto = %d&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;pe&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;p&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_proto);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;===== bind() =====&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;sockfd = %d&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;sockfd);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;sin\_family = %d&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;addr.sin&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_family);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;sin\_addr.s\_addr = %d&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;addr.sin&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_addr.s&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_addr);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;sin\_port = %d&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;addr.sin&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_port);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;addrlen = %d&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;addrlen);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;bindValue = %d&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;bindValue);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;===== listen() =====&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;listenValue = %d&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;listenValue);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;===== accept() =====&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;addrlenAccept = %d&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;addrlenAccept);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;acceptValue = %d&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;acceptValue);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;s-&amp;gt;acceptAddr = %s&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;acceptAddr);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; check&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_error&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; test, &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; error)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (test &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; error)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#a6e22e&#34;&gt;fprintf&lt;/span&gt;(stderr, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;ERROR: %s&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;strerror&lt;/span&gt;(errno));
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#a6e22e&#34;&gt;exit&lt;/span&gt;(EXIT&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_FAILURE);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; check&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_null&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;char&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;test)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (test &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; NULL)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#a6e22e&#34;&gt;fprintf&lt;/span&gt;(stderr, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;ERROR: %s&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;strerror&lt;/span&gt;(errno));
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#a6e22e&#34;&gt;exit&lt;/span&gt;(EXIT&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_FAILURE);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; check&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_arg&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; ac, &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; number)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (ac &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; number)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Usage: ./server [PORT]&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#a6e22e&#34;&gt;exit&lt;/span&gt;(EXIT&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_FAILURE);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;hh&#34;&gt;h.h&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#ifndef H\_H\_
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#define H\_H\_
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;/**&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt; Define
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;*/&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#define ARG\_SIZE 2
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#define BACKLOG 10
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#define BUF\_SIZE 255
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;/**
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt; * Structure
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt; */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;typedef&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;struct&lt;/span&gt; mystruct
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#75715e&#34;&gt;/* socket */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; domain;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; type;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; fd;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;char&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;name;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;struct&lt;/span&gt; protoent &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;pe;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#75715e&#34;&gt;/* bind */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; sockfd;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    socklen&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_t addrlen;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;struct&lt;/span&gt; sockaddr&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_in addr;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; bindValue;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#75715e&#34;&gt;/* listen */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; listenValue;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#75715e&#34;&gt;/* accept */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; acceptValue;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    socklen&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_t addrlenAccept;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;struct&lt;/span&gt; sockaddr&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_in addrAccept;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;char&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;acceptAddr;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#75715e&#34;&gt;/* read &amp;amp; write */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; readValue;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; writeValue;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;char&lt;/span&gt; buf[&lt;span style=&#34;color:#ae81ff&#34;&gt;256&lt;/span&gt;];
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;} t&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_s;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;/**
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt; * Prototype
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt; */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;debug&lt;/span&gt;(t&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_s &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; check&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_error&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;, &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; check&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_null&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;char&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; check&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_arg&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;, &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#endif &lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;/* H\_H\_ */&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;compiling&#34;&gt;Compiling&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ gcc server.c debug.c -o server ; ./server &lt;span style=&#34;color:#ae81ff&#34;&gt;5000&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now that the server is launched, it&amp;rsquo;s waiting a connection from a client on the port 5000.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C - TCP/IP - Writing and reading on a socket</title>
      <link>https://www.badprog.com/c-tcp-ip-writing-and-reading-on-a-socket/</link>
      <pubDate>Fri, 20 Apr 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-tcp-ip-writing-and-reading-on-a-socket/</guid>
      <description>&lt;p&gt;This tutorial will help us to understand how to write and read on a client side and display the result on the server side.&lt;/p&gt;
&lt;p&gt;So, for that, we have to create a server and a client.&lt;br&gt;
The client will be the &lt;strong&gt;nc&lt;/strong&gt; tool (or &lt;strong&gt;telnet&lt;/strong&gt; if you prefer, this is the same for this example).&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see this with an example.&lt;/p&gt;
&lt;h2 id=&#34;writing-and-reading-on-a-socket&#34;&gt;Writing and reading on a socket&lt;/h2&gt;
&lt;h3 id=&#34;serverc&#34;&gt;server.c&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;/* server.c */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &amp;#34;h.h&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; my&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_socket&lt;/span&gt;(t&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_s &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;s)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;name    &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;TCP&amp;#34;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;domain    &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; AF&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_INET;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;type    &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; SOCK&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_STREAM;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;pe        &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;getprotobyname&lt;/span&gt;(s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;name);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;fd        &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;socket&lt;/span&gt;(s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;domain, s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;type, s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;pe&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;p&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_proto);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    check&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_error&lt;/span&gt;(s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;fd, &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; my&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_bind&lt;/span&gt;(t&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_s &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;s, &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; port)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;sockfd                &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;fd;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;addr.sin&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_family        &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;domain;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;addr.sin&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_addr.s&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_addr &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; INADDR&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_ANY;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;addr.sin&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_port        &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;htons&lt;/span&gt;(port);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;addrlen                &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;sizeof&lt;/span&gt;(s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;addr);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;bindValue            &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;bind&lt;/span&gt;(s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;fd, (&lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;struct&lt;/span&gt; sockaddr &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;)&lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;addr, s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;addrlen);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    check&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_error&lt;/span&gt;(s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;bindValue, &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; my&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_listen&lt;/span&gt;(t&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_s &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;s, &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; backlog)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;listenValue &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;listen&lt;/span&gt;(s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;sockfd, backlog);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    check&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_error&lt;/span&gt;(s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;listenValue, &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; my&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_accept&lt;/span&gt;(t&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_s &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;s)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;addrlenAccept &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;sizeof&lt;/span&gt;(s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;addrAccept);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;acceptValue &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;accept&lt;/span&gt;(s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;sockfd, (&lt;span style=&#34;color:#66d9ef&#34;&gt;struct&lt;/span&gt; sockaddr &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;)&lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;addrAccept, &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;addrlenAccept);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    check&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_error&lt;/span&gt;(s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;acceptValue, &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;acceptAddr &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; inet&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_ntoa&lt;/span&gt;(s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;addrAccept.sin&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_addr);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    check&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_null&lt;/span&gt;(s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;acceptAddr);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; my&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_write&lt;/span&gt;(t&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_s &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;s)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;char&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;message &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Hello, please enter your name: &amp;#34;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;writeValue &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;write&lt;/span&gt;(s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;acceptValue, message, &lt;span style=&#34;color:#a6e22e&#34;&gt;strlen&lt;/span&gt;(message));
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    check&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_error&lt;/span&gt;(s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;writeValue, &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; my&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_read&lt;/span&gt;(t&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_s &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;s)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;bzero&lt;/span&gt;(s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;buf,&lt;span style=&#34;color:#ae81ff&#34;&gt;256&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;readValue &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;read&lt;/span&gt;(s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;acceptValue, s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;buf, BUF&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_SIZE);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    check&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_error&lt;/span&gt;(s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;readValue, &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;main&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; ac, &lt;span style=&#34;color:#66d9ef&#34;&gt;char&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;av[])
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    t&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_s s;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    check&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_arg&lt;/span&gt;(ac, ARG&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_SIZE);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    my&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_socket&lt;/span&gt;(&lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;s);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    my&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_bind&lt;/span&gt;(&lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;s, &lt;span style=&#34;color:#a6e22e&#34;&gt;atoi&lt;/span&gt;(av[&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;]));
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    my&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_listen&lt;/span&gt;(&lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;s, BACKLOG);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    my&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_accept&lt;/span&gt;(&lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;s);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    my&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_write&lt;/span&gt;(&lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;s);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    my&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_read&lt;/span&gt;(&lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;s);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;debug&lt;/span&gt;(&lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;s);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    check&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_error&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;close&lt;/span&gt;(s.acceptValue), &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    check&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_error&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;close&lt;/span&gt;(s.fd), &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;debugc&#34;&gt;debug.c&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;/* debug.c */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &amp;#34;h.h&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;debug&lt;/span&gt;(t&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_s &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;s)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;===== socket() =====&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;domain = %d&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;domain);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;type = %d&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;type);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;fd = %d&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;fd);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;name = %s&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;name);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;p\_proto = %d&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;pe&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;p&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_proto);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;===== bind() =====&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;sockfd = %d&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;sockfd);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;sin\_family = %d&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;addr.sin&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_family);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;sin\_addr.s\_addr = %d&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;addr.sin&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_addr.s&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_addr);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;sin\_port = %d&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;addr.sin&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_port);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;addrlen = %d&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;addrlen);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;bindValue = %d&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;bindValue);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;===== listen() =====&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;listenValue = %d&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;listenValue);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;===== accept() =====&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;addrlenAccept = %d&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;addrlenAccept);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;acceptValue = %d&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;acceptValue);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;s-&amp;gt;acceptAddr = %s&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;acceptAddr);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;===== write() &amp;amp; read() =====&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;s-&amp;gt;buf = %s&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, s&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;buf);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; check&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_error&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; test, &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; error)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (test &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; error)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#a6e22e&#34;&gt;fprintf&lt;/span&gt;(stderr, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;ERROR: %s&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;strerror&lt;/span&gt;(errno));
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#a6e22e&#34;&gt;exit&lt;/span&gt;(EXIT&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_FAILURE);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; check&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_null&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;char&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;test)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (test &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; NULL)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#a6e22e&#34;&gt;fprintf&lt;/span&gt;(stderr, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;ERROR: %s&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;strerror&lt;/span&gt;(errno));
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#a6e22e&#34;&gt;exit&lt;/span&gt;(EXIT&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_FAILURE);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; check&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_arg&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; ac, &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; number)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (ac &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; number)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Usage: ./server [PORT]&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#a6e22e&#34;&gt;exit&lt;/span&gt;(EXIT&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_FAILURE);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;hh&#34;&gt;h.h&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#ifndef H\_H\_
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#define H\_H\_
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;/**&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt; Define
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;*/&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#define ARG\_SIZE 2
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#define BACKLOG 10
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#define BUF\_SIZE 255
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;/**
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt; * Structure
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt; */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;typedef&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;struct&lt;/span&gt; mystruct
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#75715e&#34;&gt;/* socket */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; domain;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; type;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; fd;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;char&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;name;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;struct&lt;/span&gt; protoent &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;pe;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#75715e&#34;&gt;/* bind */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; sockfd;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    socklen&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_t addrlen;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;struct&lt;/span&gt; sockaddr&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_in addr;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; bindValue;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#75715e&#34;&gt;/* listen */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; listenValue;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#75715e&#34;&gt;/* accept */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; acceptValue;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    socklen&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_t addrlenAccept;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;struct&lt;/span&gt; sockaddr&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_in addrAccept;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;char&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;acceptAddr;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#75715e&#34;&gt;/* read &amp;amp; write */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; readValue;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; writeValue;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;char&lt;/span&gt; buf[&lt;span style=&#34;color:#ae81ff&#34;&gt;256&lt;/span&gt;];
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;} t&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_s;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;/**
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt; * Prototype
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt; */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;debug&lt;/span&gt;(t&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_s &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; check&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_error&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;, &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; check&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_null&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;char&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; check&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_arg&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;, &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#endif &lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;/* H\_H\_ */&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;compiling&#34;&gt;Compiling&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ gcc server.c debug.c -o server ; ./server &lt;span style=&#34;color:#ae81ff&#34;&gt;5000&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now that the server is launched, it&amp;rsquo;s waiting a connection from a client on the port 5000.&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - System calls - Using accept()</title>
      <link>https://www.badprog.com/unix-gnu-linux-system-calls-using-accept/</link>
      <pubDate>Thu, 19 Apr 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-system-calls-using-accept/</guid>
      <description>&lt;p&gt;The &lt;strong&gt;accept()&lt;/strong&gt; system call waits a connection from a client.&lt;/p&gt;
&lt;p&gt;For the example above, we are going to take the &lt;strong&gt;nc&lt;/strong&gt; tool (you can use &lt;strong&gt;telnet&lt;/strong&gt;, it is the same).&lt;/p&gt;
&lt;p&gt;If we reach the server through the nc connection, the server will shutdown.&lt;br&gt;
But that&amp;rsquo;s what we want to do.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see it in this &lt;strong&gt;accept()&lt;/strong&gt; tutorial.&lt;/p&gt;
&lt;h2 id=&#34;using-accept&#34;&gt;Using accept()&lt;/h2&gt;
&lt;h3 id=&#34;serverc&#34;&gt;server.c&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/* server.c */
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &amp;#34;h.h&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;void my&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;socket&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;t&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;s *s&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;s-&amp;gt;name &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;TCP&amp;#34;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;s-&amp;gt;domain &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; AF&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;INET;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;s-&amp;gt;type &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; SOCK&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;STREAM;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;s-&amp;gt;pe &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; getprotobyname&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;s-&amp;gt;name&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;s-&amp;gt;fd &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; socket&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;s-&amp;gt;domain, s-&amp;gt;type, s-&amp;gt;pe-&amp;gt;p&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;proto&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;check&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;error&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;s-&amp;gt;fd, -1&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;void my&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;bind&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;t&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;s *s, int port&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;s-&amp;gt;sockfd &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; s-&amp;gt;fd;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;s-&amp;gt;addr.sin&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;family &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; s-&amp;gt;domain;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;s-&amp;gt;addr.sin&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;addr.s&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;addr &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; INADDR&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;ANY;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;s-&amp;gt;addr.sin&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;port &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; htons&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;port&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;s-&amp;gt;addrlen &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; sizeof&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;s-&amp;gt;addr&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;s-&amp;gt;bindValue &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; bind&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;s-&amp;gt;fd, &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;const struct sockaddr *&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&amp;amp;s-&amp;gt;addr, s-&amp;gt;addrlen&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;check&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;error&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;s-&amp;gt;bindValue, -1&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;void my&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;listen&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;t&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;s *s, int backlog&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;s-&amp;gt;listenValue &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; listen&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;s-&amp;gt;sockfd, backlog&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;check&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;error&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;s-&amp;gt;listenValue, -1&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;void my&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;accept&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;t&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;s *s&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;s-&amp;gt;addrlenAccept &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; sizeof&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;s-&amp;gt;addrAccept&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;s-&amp;gt;acceptValue &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; accept&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;s-&amp;gt;sockfd, &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;struct sockaddr *&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&amp;amp;s-&amp;gt;addrAccept, &amp;amp;s-&amp;gt;addrlenAccept&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;check&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;error&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;s-&amp;gt;acceptValue, -1&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;int main&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;int ac, char *av&lt;span style=&#34;color:#f92672&#34;&gt;[])&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;t&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;s s;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;check&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;arg&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;ac, ARG&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;SIZE&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;my&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;socket&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&amp;amp;s&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;my&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;bind&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&amp;amp;s, atoi&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;av&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;1&lt;span style=&#34;color:#f92672&#34;&gt;]))&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;my&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;listen&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&amp;amp;s, BACKLOG&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;my&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;accept&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&amp;amp;s&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;debug&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&amp;amp;s&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;check&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;error&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;close&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;s.acceptValue&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;, -1&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;check&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;error&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;close&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;s.fd&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;, -1&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; 0;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;debugc&#34;&gt;debug.c&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/* debug.c */
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &amp;#34;h.h&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;void debug&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;t&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;s *s&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;\n===== socket() =====\n&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;domain = %d\n&amp;#34;&lt;/span&gt;, s-&amp;gt;domain&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;type = %d\n&amp;#34;&lt;/span&gt;, s-&amp;gt;type&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;fd = %d\n&amp;#34;&lt;/span&gt;, s-&amp;gt;fd&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;name = %s\n&amp;#34;&lt;/span&gt;, s-&amp;gt;name&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;p\_proto = %d\n&amp;#34;&lt;/span&gt;, s-&amp;gt;pe-&amp;gt;p&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;proto&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;\n===== bind() =====\n&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;sockfd = %d\n&amp;#34;&lt;/span&gt;, s-&amp;gt;sockfd&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;sin\_family = %d\n&amp;#34;&lt;/span&gt;, s-&amp;gt;addr.sin&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;family&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;sin\_addr.s\_addr = %d\n&amp;#34;&lt;/span&gt;, s-&amp;gt;addr.sin&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;addr.s&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;addr&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;sin\_port = %d\n&amp;#34;&lt;/span&gt;, s-&amp;gt;addr.sin&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;port&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;addrlen = %d\n&amp;#34;&lt;/span&gt;, s-&amp;gt;addrlen&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;bindValue = %d\n&amp;#34;&lt;/span&gt;, s-&amp;gt;bindValue&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;\n===== listen() =====\n&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;listenValue = %d\n&amp;#34;&lt;/span&gt;, s-&amp;gt;listenValue&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;\n===== accept() =====\n&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;addrlenAccept = %d\n&amp;#34;&lt;/span&gt;, s-&amp;gt;addrlenAccept&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;acceptValue = %d\n\n&amp;#34;&lt;/span&gt;, s-&amp;gt;acceptValue&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;void check&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;error&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;int test, int error&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;test &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; error&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;fprintf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;stderr, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;ERROR: %s\n&amp;#34;&lt;/span&gt;, strerror&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;errno&lt;span style=&#34;color:#f92672&#34;&gt;))&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;exit&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;EXIT&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;FAILURE&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;void check&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;arg&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;int ac, int number&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;ac &amp;lt; number&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Usage: ./server [PORT]\n&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;exit&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;EXIT&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;FAILURE&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;hh&#34;&gt;h.h&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#ifndef H\_H\_&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#define H\_H\_&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/**
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;* Define
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;*/
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#define ARG\_SIZE 2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#define BACKLOG 10&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#define BUF\_SIZE 255&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/**
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;* Structure
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;*/
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;typedef struct mystruct
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/* socket */
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;int domain;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;int type;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;int fd;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;char *name;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;struct protoent *pe;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/* bind */
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;int sockfd;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;socklen&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;t addrlen;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;struct sockaddr&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;in addr;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;int bindValue;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/* listen */
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;int listenValue;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/* accept */
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;int acceptValue;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;socklen&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;t addrlenAccept;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;struct sockaddr&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;in addrAccept;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt; t&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;s;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/**
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;* Prototype
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;*/
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;void debug&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;t&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;s *&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;void check&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;error&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;int, int&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;void check&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;arg&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;int, int&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#endif /* H\_H\_ */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;compiling&#34;&gt;Compiling&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ gcc server.c debug.c -o server ; ./server &lt;span style=&#34;color:#ae81ff&#34;&gt;5000&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now that the server is launched, it&amp;rsquo;s waiting a connection from a client on the port 5000.&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - System calls - Using bind()</title>
      <link>https://www.badprog.com/unix-gnu-linux-system-calls-using-bind/</link>
      <pubDate>Thu, 19 Apr 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-system-calls-using-bind/</guid>
      <description>&lt;p&gt;The &lt;strong&gt;bind()&lt;/strong&gt; system call function is used with &lt;strong&gt;socket()&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;It assigns the address of the second argument to the file descriptor retrieved by &lt;strong&gt;socket()&lt;/strong&gt;.&lt;br&gt;
Of course before using &lt;strong&gt;bind()&lt;/strong&gt;, we must have a valid fd generated by &lt;strong&gt;socket()&lt;/strong&gt;.&lt;/p&gt;
&lt;h2 id=&#34;using-bind&#34;&gt;Using bind()&lt;/h2&gt;
&lt;h3 id=&#34;serverc&#34;&gt;server.c&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/* server.c */
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &amp;#34;h.h&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;void my&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;socket&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;t&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;s *s&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    s-&amp;gt;name    &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;TCP&amp;#34;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    s-&amp;gt;domain    &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; AF&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;INET;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    s-&amp;gt;type    &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; SOCK&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;STREAM;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    s-&amp;gt;pe        &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; getprotobyname&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;s-&amp;gt;name&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    s-&amp;gt;fd        &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; socket&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;s-&amp;gt;domain, s-&amp;gt;type, s-&amp;gt;pe-&amp;gt;p&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;proto&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    check&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;error&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;s-&amp;gt;fd, -1&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;void my&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;bind&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;t&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;s *s, int port&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    s-&amp;gt;sockfd                &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; s-&amp;gt;fd;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    s-&amp;gt;addr.sin&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;family        &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; s-&amp;gt;domain;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    s-&amp;gt;addr.sin&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;addr.s&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;addr &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; INADDR&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;ANY;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    s-&amp;gt;addr.sin&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;port        &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; htons&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;port&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    s-&amp;gt;addrlen                &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; sizeof&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;s-&amp;gt;addr&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    s-&amp;gt;bindValue            &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; bind&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;s-&amp;gt;fd, &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;const struct sockaddr *&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&amp;amp;s-&amp;gt;addr, s-&amp;gt;addrlen&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    check&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;error&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;s-&amp;gt;bindValue, -1&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;int main&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;int ac, char *av&lt;span style=&#34;color:#f92672&#34;&gt;[])&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    t&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;s s;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    check&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;arg&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;ac, 2&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    my&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;socket&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&amp;amp;s&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    my&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;bind&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&amp;amp;s, atoi&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;av&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;1&lt;span style=&#34;color:#f92672&#34;&gt;]))&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    debug&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&amp;amp;s&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    check&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;error&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;close&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;s.fd&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;, -1&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; 0;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;debugc&#34;&gt;debug.c&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/* debug.c */
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &amp;#34;h.h&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;void debug&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;t&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;s *s&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;\n===== socket() =====\n&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;domain = %d\n&amp;#34;&lt;/span&gt;, s-&amp;gt;domain&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;type = %d\n&amp;#34;&lt;/span&gt;, s-&amp;gt;type&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;fd = %d\n&amp;#34;&lt;/span&gt;, s-&amp;gt;fd&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;name = %s\n&amp;#34;&lt;/span&gt;, s-&amp;gt;name&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;p\_proto = %d\n&amp;#34;&lt;/span&gt;, s-&amp;gt;pe-&amp;gt;p&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;proto&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;\n===== bind() =====\n&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;sockfd = %d\n&amp;#34;&lt;/span&gt;, s-&amp;gt;sockfd&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;sin\_family = %d\n&amp;#34;&lt;/span&gt;, s-&amp;gt;addr.sin&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;family&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;sin\_addr.s\_addr = %d\n&amp;#34;&lt;/span&gt;, s-&amp;gt;addr.sin&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;addr.s&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;addr&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;sin\_port = %d\n&amp;#34;&lt;/span&gt;, s-&amp;gt;addr.sin&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;port&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;addrlen = %d\n&amp;#34;&lt;/span&gt;, s-&amp;gt;addrlen&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;bindValue = %d\n\n&amp;#34;&lt;/span&gt;, s-&amp;gt;bindValue&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;void check&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;error&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;int test, int error&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;test &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; error&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        fprintf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;stderr, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;ERROR: %s\n&amp;#34;&lt;/span&gt;, strerror&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;errno&lt;span style=&#34;color:#f92672&#34;&gt;))&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        exit&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;EXIT&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;FAILURE&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;void check&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;arg&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;int ac, int number&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;ac &amp;lt; number&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Usage: ./server [PORT]\n&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        exit&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;EXIT&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;FAILURE&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;hh&#34;&gt;h.h&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#ifndef H\_H\_&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#define H\_H\_&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/**
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; * Structure
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; */
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;typedef struct mystruct
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    int domain;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    int type;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    int fd;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    char *name;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    struct protoent *pe;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    int sockfd;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    socklen&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;t addrlen;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    struct sockaddr&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;in addr;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    int bindValue;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt; t&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;s;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/**
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; * Prototype
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; */
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;void debug&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;t&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;s *&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;void check&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;error&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;int, int&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;void check&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;arg&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;int, int&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#endif /* H\_H\_ */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;compiling&#34;&gt;Compiling&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ gcc server.c debug.c -o server ; ./server &lt;span style=&#34;color:#ae81ff&#34;&gt;5000&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;result&#34;&gt;Result&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=====&lt;/span&gt; socket&lt;span style=&#34;color:#f92672&#34;&gt;()&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=====&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;domain &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;type &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;fd &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;3&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;name &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; TCP
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;p&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;proto &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; 6
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=====&lt;/span&gt; bind&lt;span style=&#34;color:#f92672&#34;&gt;()&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=====&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sockfd &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;3&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sin&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;family &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sin&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;addr.s&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;addr &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sin&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;port &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;34835&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;addrlen &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;16&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;bindValue &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Good job! 😈&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - System calls - Using listen()</title>
      <link>https://www.badprog.com/unix-gnu-linux-system-calls-using-listen/</link>
      <pubDate>Thu, 19 Apr 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-system-calls-using-listen/</guid>
      <description>&lt;p&gt;The &lt;strong&gt;listen()&lt;/strong&gt; system call is designed to tell that a socket is ready to accept incoming connection.&lt;/p&gt;
&lt;p&gt;Of course, we need first implementing the &lt;strong&gt;socket()&lt;/strong&gt; and &lt;strong&gt;bind()&lt;/strong&gt; system calls.&lt;/p&gt;
&lt;p&gt;We are talking here about the server side.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see how to use the &lt;strong&gt;listen()&lt;/strong&gt; system call with this tutorial.&lt;/p&gt;
&lt;h2 id=&#34;using-listen&#34;&gt;Using listen()&lt;/h2&gt;
&lt;h3 id=&#34;serverc&#34;&gt;server.c&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/* server.c */
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &amp;#34;h.h&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;void my&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;socket&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;t&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;s *s&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;s-&amp;gt;name &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;TCP&amp;#34;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;s-&amp;gt;domain &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; AF&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;INET;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;s-&amp;gt;type &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; SOCK&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;STREAM;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;s-&amp;gt;pe &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; getprotobyname&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;s-&amp;gt;name&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;s-&amp;gt;fd &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; socket&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;s-&amp;gt;domain, s-&amp;gt;type, s-&amp;gt;pe-&amp;gt;p&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;proto&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;check&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;error&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;s-&amp;gt;fd, -1&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;void my&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;bind&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;t&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;s *s, int port&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;s-&amp;gt;sockfd &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; s-&amp;gt;fd;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;s-&amp;gt;addr.sin&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;family &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; s-&amp;gt;domain;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;s-&amp;gt;addr.sin&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;addr.s&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;addr &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; INADDR&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;ANY;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;s-&amp;gt;addr.sin&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;port &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; htons&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;port&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;s-&amp;gt;addrlen &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; sizeof&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;s-&amp;gt;addr&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;s-&amp;gt;bindValue &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; bind&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;s-&amp;gt;fd, &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;const struct sockaddr *&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&amp;amp;s-&amp;gt;addr, s-&amp;gt;addrlen&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;check&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;error&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;s-&amp;gt;bindValue, -1&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;void my&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;listen&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;t&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;s *s, int backlog&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;s-&amp;gt;listenValue &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; listen&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;s-&amp;gt;sockfd, backlog&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;check&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;error&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;s-&amp;gt;listenValue, -1&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;int main&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;int ac, char *av&lt;span style=&#34;color:#f92672&#34;&gt;[])&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;t&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;s s;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;check&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;arg&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;ac, ARG&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;SIZE&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;my&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;socket&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&amp;amp;s&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;my&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;bind&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&amp;amp;s, atoi&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;av&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;1&lt;span style=&#34;color:#f92672&#34;&gt;]))&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;my&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;listen&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&amp;amp;s, BACKLOG&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;debug&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&amp;amp;s&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;check&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;error&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;close&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;s.fd&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;, -1&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; 0;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;debugc&#34;&gt;debug.c&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/* debug.c */
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &amp;#34;h.h&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;void debug&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;t&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;s *s&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;\n===== socket() =====\n&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;domain = %d\n&amp;#34;&lt;/span&gt;, s-&amp;gt;domain&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;type = %d\n&amp;#34;&lt;/span&gt;, s-&amp;gt;type&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;fd = %d\n&amp;#34;&lt;/span&gt;, s-&amp;gt;fd&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;name = %s\n&amp;#34;&lt;/span&gt;, s-&amp;gt;name&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;p\_proto = %d\n&amp;#34;&lt;/span&gt;, s-&amp;gt;pe-&amp;gt;p&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;proto&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;\n===== bind() =====\n&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;sockfd = %d\n&amp;#34;&lt;/span&gt;, s-&amp;gt;sockfd&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;sin\_family = %d\n&amp;#34;&lt;/span&gt;, s-&amp;gt;addr.sin&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;family&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;sin\_addr.s\_addr = %d\n&amp;#34;&lt;/span&gt;, s-&amp;gt;addr.sin&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;addr.s&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;addr&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;sin\_port = %d\n&amp;#34;&lt;/span&gt;, s-&amp;gt;addr.sin&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;port&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;addrlen = %d\n&amp;#34;&lt;/span&gt;, s-&amp;gt;addrlen&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;bindValue = %d\n&amp;#34;&lt;/span&gt;, s-&amp;gt;bindValue&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;\n===== listen() =====\n&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;listenValue = %d\n\n&amp;#34;&lt;/span&gt;, s-&amp;gt;listenValue&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;void check&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;error&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;int test, int error&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;test &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; error&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;fprintf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;stderr, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;ERROR: %s\n&amp;#34;&lt;/span&gt;, strerror&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;errno&lt;span style=&#34;color:#f92672&#34;&gt;))&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;exit&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;EXIT&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;FAILURE&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;void check&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;arg&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;int ac, int number&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;ac &amp;lt; number&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Usage: ./server [PORT]\n&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;exit&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;EXIT&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;FAILURE&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;hh&#34;&gt;h.h&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#ifndef H\_H\_&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#define H\_H\_&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/**
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;* Define
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;*/
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#define ARG\_SIZE 2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#define BACKLOG 10&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/**
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;* Structure
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;*/
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;typedef struct mystruct
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;int domain;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;int type;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;int fd;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;char *name;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;struct protoent *pe;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;int sockfd;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;socklen&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;t addrlen;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;struct sockaddr&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;in addr;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;int bindValue;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;int listenValue;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt; t&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;s;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/**
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;* Prototype
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;*/
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;void debug&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;t&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;s *&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;void check&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;error&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;int, int&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;void check&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;arg&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;int, int&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#endif /* H\_H\_ */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;compiling&#34;&gt;Compiling&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ gcc server.c debug.c -o server ; ./server &lt;span style=&#34;color:#ae81ff&#34;&gt;5000&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;result&#34;&gt;Result&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=====&lt;/span&gt; socket&lt;span style=&#34;color:#f92672&#34;&gt;()&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=====&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;domain &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;type &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;fd &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;3&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;name &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; TCP
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;p&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;proto &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; 6
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=====&lt;/span&gt; bind&lt;span style=&#34;color:#f92672&#34;&gt;()&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=====&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sockfd &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;3&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sin&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;family &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sin&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;addr.s&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;addr &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sin&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;port &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;34835&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;addrlen &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;16&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;bindValue &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; 0
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=====&lt;/span&gt; listen&lt;span style=&#34;color:#f92672&#34;&gt;()&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=====&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;listenValue &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Great! 😱&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - System calls - Using socket()</title>
      <link>https://www.badprog.com/unix-gnu-linux-system-calls-using-socket/</link>
      <pubDate>Thu, 19 Apr 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-system-calls-using-socket/</guid>
      <description>&lt;p&gt;The &lt;strong&gt;socket()&lt;/strong&gt; system call function will help us to create an end point.&lt;/p&gt;
&lt;p&gt;This end point will allow for example to connect a client to a server.&lt;br&gt;
Indeed, both of them (client and server) will have a &lt;strong&gt;socket()&lt;/strong&gt; system call function on their implementation.&lt;/p&gt;
&lt;p&gt;In this tutorial of &lt;strong&gt;socket()&lt;/strong&gt; we are going to see how to create a socket for a client and for a server.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see first of all with the server snippet.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Tips&#39;n Tricks - Using a list of pairs</title>
      <link>https://www.badprog.com/c-tips-n-tricks-using-a-list-of-pairs/</link>
      <pubDate>Wed, 11 Apr 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-tips-n-tricks-using-a-list-of-pairs/</guid>
      <description>&lt;p&gt;The container &lt;strong&gt;list&lt;/strong&gt; may accept another container.&lt;br&gt;
For example a &lt;strong&gt;pair&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;So we are trying to add pairs inside a list. It will become a list of pairs!&lt;/p&gt;
&lt;p&gt;In the snippet below, I&amp;rsquo;m using only one file.&lt;br&gt;
So just compile and execute it to see the result.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see this by creating a list of pairs in this tutorial.&lt;/p&gt;
&lt;h2 id=&#34;the-file&#34;&gt;The file&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cpp&#34; data-lang=&#34;cpp&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;/* main.c */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include 
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include 
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include 
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;class&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;My&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;private&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;list &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;pair &lt;span style=&#34;color:#f92672&#34;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_container;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;public&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    My() {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;cout &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;My created.&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;endl;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;this&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;containerManager();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;virtual&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;~&lt;/span&gt;My() {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;cout &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;My destroyed.&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;endl;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;containerManager&lt;/span&gt;() {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;cout &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Size of \_container = &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;this&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_container.size() &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;endl;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;this&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;containerAddElement(std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;pair(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;John&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Gray&amp;#34;&lt;/span&gt;));
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;this&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;containerAddElement(std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;pair(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;William&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Blue&amp;#34;&lt;/span&gt;));
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;this&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;containerAddElement(std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;pair(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Charles&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Green&amp;#34;&lt;/span&gt;));
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;cout &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Size of \_container = &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;this&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_container.size() &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;endl &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;endl;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;this&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;containerDisplayElements();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;this&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;containerUseFirstElement();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;this&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;containerDisplayElements();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;this&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;containerUseFirstElement();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;this&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;containerDisplayElements();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;containerAddElement&lt;/span&gt;(std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;pair myPair) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;cout &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Adding &lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; myPair.first &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt; and &lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; myPair.second &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt; in \_container.&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;endl;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;this&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_container.push&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_back(std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;pair(myPair.first, myPair.second));
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;containerDisplayElements&lt;/span&gt;() {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; k;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;list &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;pair &lt;span style=&#34;color:#f92672&#34;&gt;&amp;gt;::&lt;/span&gt;iterator it;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        k &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; (it &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;this&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_container.begin(); it &lt;span style=&#34;color:#f92672&#34;&gt;!=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;this&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_container.end(); &lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;it) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;cout &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;*it &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; k &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34; = &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; (&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;it).first &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34; - &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; (&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;it).second &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;endl;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            &lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;k;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;cout &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;First element in \_container = &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;this&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_container.front().first &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34; - &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;this&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_container.front().second &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;endl &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;endl;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;containerUseFirstElement&lt;/span&gt;() {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;cout &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Pop!&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;endl;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;this&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_container.pop&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_front();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;};
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;main&lt;/span&gt;() {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    My &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;my &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;new&lt;/span&gt; My();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;delete&lt;/span&gt; my;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;while&lt;/span&gt; (&lt;span style=&#34;color:#ae81ff&#34;&gt;1337&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;result&#34;&gt;Result&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cpp&#34; data-lang=&#34;cpp&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;My created.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Size of &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_container &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Adding &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;John&amp;#34;&lt;/span&gt; and &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Gray&amp;#34;&lt;/span&gt; in &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_container.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Adding &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;William&amp;#34;&lt;/span&gt; and &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Blue&amp;#34;&lt;/span&gt; in &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_container.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Adding &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Charles&amp;#34;&lt;/span&gt; and &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Green&amp;#34;&lt;/span&gt; in &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_container.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Size of &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_container &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;3&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;it &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; John &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt; Gray
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;it &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; William &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt; Blue
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;it &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; Charles &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt; Green
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;First element in &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_container &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; John &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt; Gray
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Pop&lt;span style=&#34;color:#f92672&#34;&gt;!&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;it &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; William &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt; Blue
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;it &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; Charles &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt; Green
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;First element in &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_container &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; William &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt; Blue
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Pop&lt;span style=&#34;color:#f92672&#34;&gt;!&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;it &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; Charles &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt; Green
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;First element in &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_container &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; Charles &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt; Green
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;My destroyed.
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Well done! 🤩&lt;/p&gt;</description>
    </item>
    <item>
      <title>C - Character manipulation - Converting a char into an int</title>
      <link>https://www.badprog.com/c-character-manipulation-converting-a-char-into-an-int/</link>
      <pubDate>Tue, 10 Apr 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-character-manipulation-converting-a-char-into-an-int/</guid>
      <description>&lt;p&gt;We can of course transform a &lt;strong&gt;char&lt;/strong&gt; into an &lt;strong&gt;int&lt;/strong&gt; with the atoi() function.&lt;/p&gt;
&lt;p&gt;But what we are going to do now it&amp;rsquo;s to create our own function to transform a &lt;strong&gt;string (several char)&lt;/strong&gt; into a &lt;strong&gt;number&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The string passed as the first argument will be our string.&lt;br&gt;
We are going to choose &amp;ldquo;140&amp;rdquo; for this example.&lt;br&gt;
To be sure we type a string, we had the double quotes around it.&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - System calls - Using read()</title>
      <link>https://www.badprog.com/unix-gnu-linux-system-calls-using-read/</link>
      <pubDate>Tue, 10 Apr 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-system-calls-using-read/</guid>
      <description>&lt;p&gt;We are going to use the &lt;strong&gt;read()&lt;/strong&gt; function to read on the standard input from our favorite shell.&lt;/p&gt;
&lt;p&gt;So each time you will write something then type ENTER, the text written will be display on the shell.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see this, with this tiny tutorial of the &lt;strong&gt;read()&lt;/strong&gt; function with a C example.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#define BUF\_SIZE         1024&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;void empty&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;buf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;char *buf&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    int i;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    i &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; 0;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;while&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;buf&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;i&lt;span style=&#34;color:#f92672&#34;&gt;])&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        buf&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;i&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;\0&amp;#39;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        ++i;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    buf&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;i&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;\0&amp;#39;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;int main&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;void&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    int gogogo;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    int fd;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    char *buf;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    buf &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; malloc&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;sizeof&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;*buf&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt; * BUF&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;SIZE + 1&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;buf &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; NULL&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        fprintf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;stderr, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Error: %s\n&amp;#34;&lt;/span&gt;, strerror&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;errno&lt;span style=&#34;color:#f92672&#34;&gt;))&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        exit&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;EXIT&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;FAILURE&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    fd &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; 0;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    gogogo &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; 1;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;while&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;gogogo&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        read&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;fd, buf, BUF&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;SIZE&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;buf = %s\n&amp;#34;&lt;/span&gt;, buf&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        empty&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;buf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;buf&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    exit&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;EXIT&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;SUCCESS&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Good job. 😜&lt;/p&gt;</description>
    </item>
    <item>
      <title>C - Keyword - Using extern</title>
      <link>https://www.badprog.com/c-keyword-using-extern/</link>
      <pubDate>Mon, 09 Apr 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-keyword-using-extern/</guid>
      <description>&lt;p&gt;The &lt;strong&gt;extern&lt;/strong&gt; keyword is designed to explicitely tells someone, being watching a variable in a code, that this variable has been firstly declared in another file.&lt;/p&gt;
&lt;p&gt;The extern keyword works also with C++.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s take an example.&lt;br&gt;
In the code below, I use 2 files.&lt;br&gt;
The first &lt;em&gt;main.c&lt;/em&gt; where I declared the global_var variable.&lt;br&gt;
And &lt;em&gt;file1.c&lt;/em&gt; where I redeclared it as an extern variable.&lt;/p&gt;
&lt;p&gt;So we can see that I can change the value of this variable from both files.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Algorithm - Using the for_each() function</title>
      <link>https://www.badprog.com/c-algorithm-using-the-for-each-function/</link>
      <pubDate>Thu, 05 Apr 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-algorithm-using-the-for-each-function/</guid>
      <description>&lt;p&gt;An example of how using the for_each() function.&lt;/p&gt;
&lt;p&gt;Notice that you can have the same result with an iterator, &lt;a href=&#34;https://www.badprog.com/c-stl-standard-template-library-using-the-vector-container&#34;&gt;here an example&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cpp&#34; data-lang=&#34;cpp&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include 
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include 
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include 
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;myFunction&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; myInt)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;cout &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;myInt = &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; myInt &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;endl;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;main&lt;/span&gt;()
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;vector myVector;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;vector&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;iterator myIterator;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; i;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    i &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;while&lt;/span&gt; (i &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;10&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        myVector.push&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_back(i&lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt;(myIterator &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; myVector.begin(); myIterator &lt;span style=&#34;color:#f92672&#34;&gt;!=&lt;/span&gt; myVector.end(); &lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;myIterator)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;myIterator &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            myVector.erase(myIterator);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            myVector.insert(myIterator,  &lt;span style=&#34;color:#ae81ff&#34;&gt;80&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_each(myVector.begin(), myVector.end(), myFunction);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Result:&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Standard library - Using the pair container</title>
      <link>https://www.badprog.com/c-standard-library-using-the-pair-container/</link>
      <pubDate>Thu, 05 Apr 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-standard-library-using-the-pair-container/</guid>
      <description>&lt;p&gt;The pair container cannot be iterated.&lt;/p&gt;
&lt;p&gt;So we can use it for example to return a double value at the end of a function.&lt;/p&gt;
&lt;p&gt;In the snippet below we are going to use it to change the first and the second value.&lt;br&gt;
This, respectively with the pair.first and pair.second methods:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cpp&#34; data-lang=&#34;cpp&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include 
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include 
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;main&lt;/span&gt;()
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;pair myPair(&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;John&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;cout &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Id: &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; myPair.first &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34; - Name: &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; myPair.second &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;endl;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;myPair.first &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;38&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;myPair.second &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;William&amp;#34;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;cout &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Id: &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; myPair.first &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34; - Name: &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; myPair.second &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;endl;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Result:&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - STL (Standard Template Library) - Using the queue container</title>
      <link>https://www.badprog.com/c-stl-standard-template-library-using-the-queue-container/</link>
      <pubDate>Thu, 05 Apr 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-stl-standard-template-library-using-the-queue-container/</guid>
      <description>&lt;p&gt;We are going to see in this queue tutorial, how to use it.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see it with this first snippet.&lt;br&gt;
In the easy example below, we add 10 elements in the queue before displaying its content.&lt;br&gt;
We have to notice that we cannot iterate through a queue.&lt;/p&gt;
&lt;p&gt;So we have to use the couple queue.front() and queue.pop() to loop inside the queue.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cpp&#34; data-lang=&#34;cpp&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include 
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include 
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;main&lt;/span&gt;()
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;queue myQueue;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; i;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;i &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;while&lt;/span&gt; (i &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;10&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;myQueue.push(i&lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;cout &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Size of the queue: &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; myQueue.size() &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;endl;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;cout &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;First element of the queue: &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; myQueue.front() &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;endl;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;cout &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Last element of the queue: &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; myQueue.back() &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;endl;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;while&lt;/span&gt; (&lt;span style=&#34;color:#f92672&#34;&gt;!&lt;/span&gt;myQueue.empty())
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;cout &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; myQueue.front() &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;endl;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;myQueue.pop();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Result:&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - STL (Standard Template Library) - Using the vector container</title>
      <link>https://www.badprog.com/c-stl-standard-template-library-using-the-vector-container/</link>
      <pubDate>Thu, 05 Apr 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-stl-standard-template-library-using-the-vector-container/</guid>
      <description>&lt;p&gt;The vector container is the most classic STL container.&lt;/p&gt;
&lt;p&gt;In the snippet below, I can iterate through the vector, so I use an iterator to erase an element of the vector.&lt;br&gt;
In our case, I removed the number 2 from the container and I added 80 to this place.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see this example of the vector container.&lt;/p&gt;
&lt;h2 id=&#34;code&#34;&gt;Code&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cpp&#34; data-lang=&#34;cpp&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include 
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include 
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;main&lt;/span&gt;()
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;vector myVector;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;vector&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;iterator myIterator;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; i;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  i &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;while&lt;/span&gt; (i &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;10&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      myVector.push&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_back(i&lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt;(myIterator &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; myVector.begin(); myIterator &lt;span style=&#34;color:#f92672&#34;&gt;!=&lt;/span&gt; myVector.end(); &lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;myIterator)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;myIterator &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          myVector.erase(myIterator);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          myVector.insert(myIterator,  &lt;span style=&#34;color:#ae81ff&#34;&gt;80&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt;(myIterator &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; myVector.begin(); myIterator &lt;span style=&#34;color:#f92672&#34;&gt;!=&lt;/span&gt; myVector.end(); &lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;myIterator)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;cout &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;*myIterator = &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;myIterator &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; std&lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt;endl;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;result&#34;&gt;Result:&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cpp&#34; data-lang=&#34;cpp&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;myIterator &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;myIterator &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;myIterator &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;80&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;myIterator &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;3&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;myIterator &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;4&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;myIterator &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;5&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;myIterator &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;6&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;myIterator &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;7&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;myIterator &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;8&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;myIterator &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;9&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;A really helpful container! 😇&lt;/p&gt;</description>
    </item>
    <item>
      <title>C - SDL (Simple Directmedia Layer) - Creating a multicolored window</title>
      <link>https://www.badprog.com/c-sdl-simple-directmedia-layer-creating-a-multicolored-window/</link>
      <pubDate>Thu, 22 Mar 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-sdl-simple-directmedia-layer-creating-a-multicolored-window/</guid>
      <description>&lt;p&gt;May you want to create a night club with the SDL library?&lt;/p&gt;
&lt;p&gt;It is maybe possible.&lt;br&gt;
With the code below of this tutorial, you can generate a different color every millisecond.&lt;/p&gt;
&lt;p&gt;So, why waiting?&lt;br&gt;
Let&amp;rsquo;s dance!&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;typedef struct s\_sdl&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_Surface &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;screen;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_Surface &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;rectangle;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_Rect &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;position;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;} t&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_sdl;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; creation&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_rect&lt;/span&gt;(t&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_sdl &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;sdl, &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; r1, &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; r2, &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; r3)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sdl&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;rectangle &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; NULL;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_FillRect&lt;/span&gt;(sdl&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;screen, NULL, SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_MapRGB&lt;/span&gt;(sdl&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;screen&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;format, r1, r2, r3)) &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;fprintf&lt;/span&gt;(stderr, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Error: %s&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_GetError&lt;/span&gt;());
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; (&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_Flip&lt;/span&gt;(sdl&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;screen) &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;fprintf&lt;/span&gt;(stderr, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Error: %s&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_GetError&lt;/span&gt;());
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; (&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; (&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;init&lt;/span&gt;(t&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_sdl &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;sdl)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; i &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_Init&lt;/span&gt;(SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_INIT&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_EVERYTHING) &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;fprintf&lt;/span&gt;(stderr, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Error: %s&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;strerror&lt;/span&gt;(errno));
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; (&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; ((sdl&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;screen &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_SetVideoMode&lt;/span&gt;(&lt;span style=&#34;color:#ae81ff&#34;&gt;800&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;600&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;32&lt;/span&gt;, SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_HWSURFACE)) &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; NULL)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;fprintf&lt;/span&gt;(stderr, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Error: %s&amp;#34;&lt;/span&gt;, SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_GetError&lt;/span&gt;());
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; (&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_WM&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_SetCaption&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Night club! :D&amp;#34;&lt;/span&gt;, NULL);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_FillRect&lt;/span&gt;(sdl&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;screen, NULL, SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_MapRGB&lt;/span&gt;(sdl&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;screen&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;format, &lt;span style=&#34;color:#ae81ff&#34;&gt;255&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;32&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;45&lt;/span&gt;)) &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;fprintf&lt;/span&gt;(stderr, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Error: %s&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_GetError&lt;/span&gt;());
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; (&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_Flip&lt;/span&gt;(sdl&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;screen) &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;fprintf&lt;/span&gt;(stderr, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Error: %s&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_GetError&lt;/span&gt;());
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; (&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;while&lt;/span&gt; (i &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;100&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;creation&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_rect&lt;/span&gt;(sdl, my&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_random&lt;/span&gt;(), my&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_random&lt;/span&gt;(), my&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_random&lt;/span&gt;());
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;i;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_FreeSurface&lt;/span&gt;(sdl&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;rectangle);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; (&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; my&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_random&lt;/span&gt;()
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;double&lt;/span&gt; seed;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; fp;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;time&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_t t1;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;struct&lt;/span&gt; timeval tv;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;gettimeofday&lt;/span&gt;(&lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;tv, NULL);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;seed &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; (tv.tv&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_sec) &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1000&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; (tv.tv&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_usec) &lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1000&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;srand&lt;/span&gt;(seed);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;usleep&lt;/span&gt;(&lt;span style=&#34;color:#ae81ff&#34;&gt;10000&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; (&lt;span style=&#34;color:#a6e22e&#34;&gt;rand&lt;/span&gt;() &lt;span style=&#34;color:#f92672&#34;&gt;%&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;255&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;main&lt;/span&gt; ()
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;t&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_sdl sdl;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sdl.screen &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; NULL;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;init&lt;/span&gt;(&lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;sdl))
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; (&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; (&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Of course, we need to run this:&lt;/p&gt;</description>
    </item>
    <item>
      <title>C - SDL (Simple Directmedia Layer) - Creating a rectangle and moving it</title>
      <link>https://www.badprog.com/c-sdl-simple-directmedia-layer-creating-a-rectangle-and-moving-it/</link>
      <pubDate>Thu, 22 Mar 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-sdl-simple-directmedia-layer-creating-a-rectangle-and-moving-it/</guid>
      <description>&lt;p&gt;We are going to see, with this tutorial, how to create a shape on a window and how to move it with keyboard arrows.&lt;/p&gt;
&lt;p&gt;We need, for this example, three files that we are going to create to dispatch the code:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;main.c&lt;/li&gt;
&lt;li&gt;manager_sdl.c&lt;/li&gt;
&lt;li&gt;h.h&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Of course, you can add a Makefile to easily compile and link files.&lt;br&gt;
But to link the .o, you need to add the &lt;strong&gt;-lSDL&lt;/strong&gt; command.&lt;/p&gt;
&lt;h2 id=&#34;1-mainc&#34;&gt;1. main.c&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; &lt;span style=&#34;color:#75715e&#34;&gt;&amp;#34;h.h&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;init&lt;/span&gt;(t&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_sdl &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;sdl)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_Init&lt;/span&gt;(SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_INIT&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_EVERYTHING) &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;fprintf&lt;/span&gt;(stderr, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Error: %s&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;strerror&lt;/span&gt;(errno));
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; (&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; ((sdl&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;screen &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_SetVideoMode&lt;/span&gt;(&lt;span style=&#34;color:#ae81ff&#34;&gt;800&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;600&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;32&lt;/span&gt;, SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_HWSURFACE)) &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; NULL)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;fprintf&lt;/span&gt;(stderr, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Error: %s&amp;#34;&lt;/span&gt;, SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_GetError&lt;/span&gt;());
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; (&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_WM&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_SetCaption&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Hello World! :D&amp;#34;&lt;/span&gt;, NULL);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_FillRect&lt;/span&gt;(sdl&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;screen, NULL, SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_MapRGB&lt;/span&gt;(sdl&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;screen&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;format, &lt;span style=&#34;color:#ae81ff&#34;&gt;255&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;32&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;45&lt;/span&gt;)) &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;fprintf&lt;/span&gt;(stderr, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Error: %s&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_GetError&lt;/span&gt;());
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; (&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_Flip&lt;/span&gt;(sdl&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;screen) &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;fprintf&lt;/span&gt;(stderr, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Error: %s&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_GetError&lt;/span&gt;());
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; (&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sdl&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;position&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;x &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sdl&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;position&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;y &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (manager&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_event&lt;/span&gt;(sdl))
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;fprintf&lt;/span&gt;(stderr, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Error: %s&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_GetError&lt;/span&gt;());
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; (&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_FreeSurface&lt;/span&gt;(sdl&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;rectangle);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; (&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;main&lt;/span&gt; ()
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;t&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_sdl sdl;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sdl.screen &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; NULL;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;init&lt;/span&gt;(&lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;sdl))
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; (&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; (&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;2-manager_sdlc&#34;&gt;2. manager_sdl.c&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &amp;#34;h.h&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; manager&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_event&lt;/span&gt;(t&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_sdl &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;sdl)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; gogogo;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_Event event;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;gogogo &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;while&lt;/span&gt; (gogogo)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_WaitEvent&lt;/span&gt;(&lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;event);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (event.type &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_QUIT)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;gogogo &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;else&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;if&lt;/span&gt; (event.type &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_KEYDOWN)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (event.key.keysym.sym &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; SDLK&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_ESCAPE)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;ESC&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;gogogo &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (event.key.keysym.sym &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; SDLK&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_RIGHT)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;RIGHT&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sdl&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;position&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;x &lt;span style=&#34;color:#f92672&#34;&gt;+=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;10&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (event.key.keysym.sym &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; SDLK&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_LEFT)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;LEFT&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sdl&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;position&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;x &lt;span style=&#34;color:#f92672&#34;&gt;-=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;10&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (event.key.keysym.sym &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; SDLK&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_UP)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;UP&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sdl&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;position&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;y &lt;span style=&#34;color:#f92672&#34;&gt;-=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;10&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (event.key.keysym.sym &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; SDLK&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_DOWN)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;DOWN&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sdl&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;position&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;y &lt;span style=&#34;color:#f92672&#34;&gt;+=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;10&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;creation&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_rect&lt;/span&gt;(sdl);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; (&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; creation&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_rect&lt;/span&gt;(t&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_sdl &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;sdl)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sdl&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;rectangle &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; NULL;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_FillRect&lt;/span&gt;(sdl&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;screen, NULL, SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_MapRGB&lt;/span&gt;(sdl&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;screen&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;format, &lt;span style=&#34;color:#ae81ff&#34;&gt;255&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;32&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;45&lt;/span&gt;)) &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;fprintf&lt;/span&gt;(stderr, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Error: %s&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_GetError&lt;/span&gt;());
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; (&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; ((sdl&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;rectangle &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_CreateRGBSurface&lt;/span&gt;(SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_HWSURFACE, &lt;span style=&#34;color:#ae81ff&#34;&gt;220&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;180&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;32&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;)) &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; NULL)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;fprintf&lt;/span&gt;(stderr, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Error: %s&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_GetError&lt;/span&gt;());
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; (&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_FillRect&lt;/span&gt;(sdl&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;rectangle, NULL, SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_MapRGB&lt;/span&gt;(sdl&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;screen&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;format, &lt;span style=&#34;color:#ae81ff&#34;&gt;255&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;255&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;45&lt;/span&gt;)) &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;fprintf&lt;/span&gt;(stderr, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Error: %s&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_GetError&lt;/span&gt;());
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; (&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_BlitSurface&lt;/span&gt;(sdl&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;rectangle, NULL, sdl&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;screen, sdl&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;position) &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;fprintf&lt;/span&gt;(stderr, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Error: %s&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_GetError&lt;/span&gt;());
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; (&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_Flip&lt;/span&gt;(sdl&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;screen) &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;fprintf&lt;/span&gt;(stderr, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Error: %s&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_GetError&lt;/span&gt;());
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; (&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; (&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;3-hh&#34;&gt;3. h.h&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#ifndef H\_H\_
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#define H\_H\_
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;/**
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;* STRUCTURE
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;*/&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;typedef&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;struct&lt;/span&gt; s&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_sdl
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_Surface &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;screen;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_Surface &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;rectangle;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;SDL&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_Rect &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;position;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;} t&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_sdl;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;/**
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;* PROTOTYPE
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;*/&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;/* main.c */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;init&lt;/span&gt;(t&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_sdl &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;sdl);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;/* manager\_sdl.c */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; manager&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_event&lt;/span&gt;(t&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_sdl &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;sdl);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; creation&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_rect&lt;/span&gt;(t&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_sdl &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;sdl);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#endif &lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;/* H\_H\_ */&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;4-compiling-linking-running-playing&#34;&gt;4. Compiling, linking, running, playing&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ gcc main.c manager&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;sdl.c -c ; gcc main.o manager&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;sdl.o -lSDL -o go ; ./go
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Well done, you made it. 😜&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - System calls - Using gettimeofday()</title>
      <link>https://www.badprog.com/unix-gnu-linux-system-calls-using-gettimeofday/</link>
      <pubDate>Thu, 22 Mar 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-system-calls-using-gettimeofday/</guid>
      <description>&lt;p&gt;The system call function &lt;strong&gt;gettimeofday()&lt;/strong&gt; is a really helpful one.&lt;/p&gt;
&lt;p&gt;Indeed, we can retrieve milliseconds of the time.&lt;/p&gt;
&lt;p&gt;But in this tutorial, we are going to see how to generate random numbers every millisecond.&lt;/p&gt;
&lt;p&gt;Here the code:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;int my&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;random&lt;span style=&#34;color:#f92672&#34;&gt;()&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    double seed;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    struct timeval  tv;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    gettimeofday&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&amp;amp;tv, NULL&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    seed &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;tv.tv&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;sec&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt; * &lt;span style=&#34;color:#ae81ff&#34;&gt;1000&lt;/span&gt; + &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;tv.tv&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;usec&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt; / 1000;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    srand&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;seed&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    usleep&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;10000&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;rand&lt;span style=&#34;color:#f92672&#34;&gt;()&lt;/span&gt; % 255&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;int main &lt;span style=&#34;color:#f92672&#34;&gt;()&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    int i &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; 0;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;while&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;i &amp;lt; 10&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;R = %d\n&amp;#34;&lt;/span&gt;, my&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;random&lt;span style=&#34;color:#f92672&#34;&gt;())&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        ++i;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;0&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Nice example of random every millisecond.&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - System calls - Using semget()</title>
      <link>https://www.badprog.com/unix-gnu-linux-system-calls-using-semget/</link>
      <pubDate>Wed, 21 Mar 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-system-calls-using-semget/</guid>
      <description>&lt;p&gt;Today a tutorial to learn how to use &lt;strong&gt;semget()&lt;/strong&gt;, &lt;strong&gt;semctl()&lt;/strong&gt; and &lt;strong&gt;semop()&lt;/strong&gt; system calls.&lt;/p&gt;
&lt;p&gt;What are these functions?&lt;/p&gt;
&lt;p&gt;They help to share data and control access to these data.&lt;br&gt;
One calls them &lt;strong&gt;semaphore&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;We can for example use them to access a data from different process.&lt;/p&gt;
&lt;p&gt;In the example below, we will create two process with the same code, except for the  &lt;strong&gt;sb.sem_op&lt;/strong&gt; value.&lt;/p&gt;
&lt;p&gt;For the first program the value will be 1 and for the second, this value will be -1.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C - Library functions - Using srand() and rand()</title>
      <link>https://www.badprog.com/c-library-functions-using-srand-and-rand/</link>
      <pubDate>Fri, 09 Mar 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-library-functions-using-srand-and-rand/</guid>
      <description>&lt;p&gt;Today a tiny tutorial to see how using &lt;strong&gt;srand()&lt;/strong&gt; and &lt;strong&gt;rand()&lt;/strong&gt; from the &lt;strong&gt;libc&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;We will generate a number in a range between 0 and 2.&lt;br&gt;
For that, we will use the functions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;time()&lt;/li&gt;
&lt;li&gt;srand()&lt;/li&gt;
&lt;li&gt;rand()&lt;/li&gt;
&lt;li&gt;sleep()&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The &lt;strong&gt;time()&lt;/strong&gt; function because we want a random number that changes every second.&lt;br&gt;
We will use it with the &lt;strong&gt;sleep()&lt;/strong&gt; function.&lt;/p&gt;
&lt;p&gt;We put a seed, generated by the &lt;strong&gt;time()&lt;/strong&gt; function), into the &lt;strong&gt;srand()&lt;/strong&gt; one.&lt;br&gt;
Then we display this number with the &lt;strong&gt;rand()&lt;/strong&gt; function.&lt;br&gt;
And as we want a number between 0 and 2, we use the &lt;strong&gt;modulo&lt;/strong&gt; operator (%).&lt;/p&gt;</description>
    </item>
    <item>
      <title>C - Errors - Handling errors</title>
      <link>https://www.badprog.com/c-errors-handling-errors/</link>
      <pubDate>Thu, 08 Mar 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-errors-handling-errors/</guid>
      <description>&lt;p&gt;In this tutorial we will how to easily manage errors in C programming language.&lt;/p&gt;
&lt;p&gt;That is we will try to open a file and if this file doesn&amp;rsquo;t exist we will trigger an error.&lt;br&gt;
If the file exists, we will tell its name with a message to say that the file really exist.&lt;/p&gt;
&lt;p&gt;We have to notice that for handling errors correctly, we have to use the &lt;strong&gt;fprintf()&lt;/strong&gt; function to indeed display error on the &lt;strong&gt;error output&lt;/strong&gt;.&lt;br&gt;
For the &lt;strong&gt;standard output&lt;/strong&gt;, we will use the classical &lt;strong&gt;printf()&lt;/strong&gt; function.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Eclipse - Errors - While coding</title>
      <link>https://www.badprog.com/eclipse-errors-while-coding/</link>
      <pubDate>Thu, 08 Mar 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/eclipse-errors-while-coding/</guid>
      <description>&lt;p&gt;This section will gather all errors found when you were coding in Eclipse.&lt;br&gt;
It is really hard sometimes to find what is the problem when you get an exception.&lt;/p&gt;
&lt;p&gt;I will also give a solution of the problem.&lt;/p&gt;
&lt;h2 id=&#34;error-1-javalangarrayindexoutofboundsexception&#34;&gt;Error 1. java.lang.ArrayIndexOutOfBoundsException&lt;/h2&gt;
&lt;p&gt;I had a hard reboot and when I came back to Eclipse (it was opened during this reboot), completion didn&amp;rsquo;t work anymore.&lt;br&gt;
I trying some stuff, but nothing.&lt;br&gt;
Finally I erased the &lt;strong&gt;.metadata&lt;/strong&gt; directory included in all projects generated by Eclipse.&lt;br&gt;
I know it is a bit radical, but it works. 😜&lt;/p&gt;</description>
    </item>
    <item>
      <title>OCaml - List - Creating a list</title>
      <link>https://www.badprog.com/ocaml-list-creating-a-list/</link>
      <pubDate>Wed, 29 Feb 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/ocaml-list-creating-a-list/</guid>
      <description>&lt;p&gt;As all programming languages, it is possible to create lists in OCaml.&lt;/p&gt;
&lt;p&gt;So, let&amp;rsquo;s see this, right now with new examples.&lt;br&gt;
We will indeed create two functions, one of &lt;strong&gt;ints&lt;/strong&gt; and another of &lt;strong&gt;strings&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;For the ints:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-ocaml&#34; data-lang=&#34;ocaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;#&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;let&lt;/span&gt; number &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;1&lt;span style=&#34;color:#f92672&#34;&gt;;&lt;/span&gt; 2&lt;span style=&#34;color:#f92672&#34;&gt;;&lt;/span&gt; 3&lt;span style=&#34;color:#f92672&#34;&gt;;&lt;/span&gt; 4&lt;span style=&#34;color:#f92672&#34;&gt;];;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;For the strings:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-ocaml&#34; data-lang=&#34;ocaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;#&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;let&lt;/span&gt; fruits &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;apricot&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;raspberry&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;cherry&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;tomato&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;];;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;As you can see, there is no need to tell to the interpreter the type of elements in the list.&lt;br&gt;
It&amp;rsquo;s automatic! 😊&lt;/p&gt;</description>
    </item>
    <item>
      <title>OCaml - List - Iterating through a list and displaying all elements inside</title>
      <link>https://www.badprog.com/ocaml-list-iterating-through-a-list-and-displaying-all-elements-inside/</link>
      <pubDate>Wed, 29 Feb 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/ocaml-list-iterating-through-a-list-and-displaying-all-elements-inside/</guid>
      <description>&lt;p&gt;As you already saw it, creating a list in OCaml is not so difficult.&lt;br&gt;
But this time, we will see how to iterate through a list and display all elements inside.&lt;/p&gt;
&lt;p&gt;We will create two arrays, one of ints, the other of strings.&lt;br&gt;
Once done, we will display their elements.&lt;br&gt;
Let&amp;rsquo;s see it with this OCaml list tutorial.&lt;/p&gt;
&lt;h2 id=&#34;creating-lists&#34;&gt;Creating lists&lt;/h2&gt;
&lt;p&gt;List of ints:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-ocaml&#34; data-lang=&#34;ocaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;#&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;let&lt;/span&gt; number &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;1&lt;span style=&#34;color:#f92672&#34;&gt;;&lt;/span&gt; 2&lt;span style=&#34;color:#f92672&#34;&gt;;&lt;/span&gt; 3&lt;span style=&#34;color:#f92672&#34;&gt;;&lt;/span&gt; 4&lt;span style=&#34;color:#f92672&#34;&gt;];;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;List of strings:&lt;/p&gt;</description>
    </item>
    <item>
      <title>OCaml - Function - Creating a getter to retrieve an element of a tuple</title>
      <link>https://www.badprog.com/ocaml-function-creating-a-getter-to-retrieve-an-element-of-a-tuple/</link>
      <pubDate>Tue, 28 Feb 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/ocaml-function-creating-a-getter-to-retrieve-an-element-of-a-tuple/</guid>
      <description>&lt;p&gt;OK, this is not really a getter implementation like we can have it in other object-oriented programming, but it is close of it.&lt;/p&gt;
&lt;p&gt;We have first to create an human variable with a tuple (&amp;ldquo;name&amp;rdquo;, age).&lt;br&gt;
Then we have to create two getter functions to retrieve the first and the second parameter of this human variable.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s begin by the human variable:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-ocaml&#34; data-lang=&#34;ocaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;#&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;let&lt;/span&gt; human &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;John&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;,&lt;/span&gt; 50&lt;span style=&#34;color:#f92672&#34;&gt;);;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;val&lt;/span&gt; human &lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;string&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;John&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;,&lt;/span&gt; 50&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Let&amp;rsquo;s continue by the getName function:&lt;/p&gt;</description>
    </item>
    <item>
      <title>OCaml - Function - Creating an easy function</title>
      <link>https://www.badprog.com/ocaml-function-creating-an-easy-function/</link>
      <pubDate>Tue, 28 Feb 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/ocaml-function-creating-an-easy-function/</guid>
      <description>&lt;p&gt;In this tutorial we will see how to create a function in OCaml language.&lt;br&gt;
It will be an easy function to understand how it works.&lt;/p&gt;
&lt;p&gt;We will create a function that returns an int + 1.&lt;br&gt;
Here the code:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-ocaml&#34; data-lang=&#34;ocaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;#&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;let&lt;/span&gt; myFunc myVar &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; myVar &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; 1&lt;span style=&#34;color:#f92672&#34;&gt;;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Notice that you can also create a function like this:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-ocaml&#34; data-lang=&#34;ocaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;#&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;let&lt;/span&gt; myFunc &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;fun&lt;/span&gt; myVar &lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt; myVar &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; 1&lt;span style=&#34;color:#f92672&#34;&gt;;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Press enter, it will display:&lt;/p&gt;
&lt;p&gt;val myFunc : int -&amp;gt; int = &lt;fun&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>OCaml - Function - Using recursion</title>
      <link>https://www.badprog.com/ocaml-function-using-recursion/</link>
      <pubDate>Tue, 28 Feb 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/ocaml-function-using-recursion/</guid>
      <description>&lt;p&gt;OCaml is a fully recursive language. So using recursion is completely natural.&lt;br&gt;
We will see in this example how to create an easy recursion of a classic factorial. This in two different manners.&lt;br&gt;
These two ways of using recursion are strictely the same, the type of the function and the result as well of course.&lt;/p&gt;
&lt;h2 id=&#34;the-first-manner-to-create-a-recursion-function&#34;&gt;The first manner to create a recursion function&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-ocaml&#34; data-lang=&#34;ocaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;#&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;let&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;rec&lt;/span&gt; factorial n &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; n &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; 0 &lt;span style=&#34;color:#66d9ef&#34;&gt;then&lt;/span&gt; 1 &lt;span style=&#34;color:#66d9ef&#34;&gt;else&lt;/span&gt; n &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt; factorial&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;n &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt; 1&lt;span style=&#34;color:#f92672&#34;&gt;);;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You can split it to have a better indentation:&lt;/p&gt;</description>
    </item>
    <item>
      <title>OCaml - Utilities - Using the rlwrap command</title>
      <link>https://www.badprog.com/ocaml-utilities-using-the-rlwrap-command/</link>
      <pubDate>Mon, 27 Feb 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/ocaml-utilities-using-the-rlwrap-command/</guid>
      <description>&lt;p&gt;When you use OCaml on Linux for example, you cannot by default using the arrow from your keyboard, neither the completion.&lt;br&gt;
If you try to use them you will have something like that:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-ocaml&#34; data-lang=&#34;ocaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;#&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;^[[&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;A&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;^[[&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;D&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;^[[&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;C&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;^[[&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;B&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;^[[&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;D&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;^[[&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;A&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;^[[&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;C&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;^[[&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;D&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;^[[&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;B&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;^[[&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;C&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;But there is readline wrapper named rlwrap that will help us in this task!&lt;/p&gt;
&lt;p&gt;Just write it before starting your OCaml interpreter, like this:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ rlwrap ocaml
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Thus your arrows will work and completion too.&lt;/p&gt;</description>
    </item>
    <item>
      <title>OCaml - Variable - Creating variables</title>
      <link>https://www.badprog.com/ocaml-variable-creating-variables/</link>
      <pubDate>Mon, 27 Feb 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/ocaml-variable-creating-variables/</guid>
      <description>&lt;p&gt;For creating variables in OCaml we need to use the &lt;strong&gt;let&lt;/strong&gt; keyword.&lt;/p&gt;
&lt;p&gt;The syntax to create a variable is the following:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-ocaml&#34; data-lang=&#34;ocaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;#&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;let&lt;/span&gt; myVar &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; 90&lt;span style=&#34;color:#f92672&#34;&gt;;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When you type enter, it will be displayed the type of your variable:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-ocaml&#34; data-lang=&#34;ocaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;val&lt;/span&gt; myVar &lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; 90
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The OCaml interpreter will find the type by itself.&lt;br&gt;
This mechanism is called the inference. 😊&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - System calls - Using time()</title>
      <link>https://www.badprog.com/unix-gnu-linux-system-calls-using-time/</link>
      <pubDate>Wed, 22 Feb 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-system-calls-using-time/</guid>
      <description>&lt;p&gt;It is sometimes useful to display the current date in your terminal.&lt;br&gt;
For that the time() system call function is the best one.&lt;br&gt;
Let&amp;rsquo;s see an example within this tiny tutorial of C programming language:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;// main.c
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;int main &lt;span style=&#34;color:#f92672&#34;&gt;()&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;time&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;t myTime;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;time&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&amp;amp;myTime&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;The time is: %s&amp;#34;&lt;/span&gt;, ctime&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&amp;amp;myTime&lt;span style=&#34;color:#f92672&#34;&gt;))&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; 0;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Compiling and executing.&lt;br&gt;
And the result is:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ The time is: Wed Feb &lt;span style=&#34;color:#ae81ff&#34;&gt;22&lt;/span&gt; 14:36:43 &lt;span style=&#34;color:#ae81ff&#34;&gt;2012&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;All simply!&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Tips&#39;n Tricks - Converting a std:string into an int and converting an int to a std::string</title>
      <link>https://www.badprog.com/c-tips-n-tricks-converting-a-stdstring-into-an-int-and-converting-an-int-to-a-stdstring/</link>
      <pubDate>Fri, 10 Feb 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-tips-n-tricks-converting-a-stdstring-into-an-int-and-converting-an-int-to-a-stdstring/</guid>
      <description>&lt;p&gt;For the C, we had the famous atoi() function, but for C++, how can I convert a std::string into an int?&lt;/p&gt;
&lt;p&gt;That&amp;rsquo;s a great question, and the answer is easy, with the std::stringstream type element.&lt;/p&gt;
&lt;p&gt;In this tutorial, we will see how to convert a std::string into an int and how to convert an int to a std::string.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s start by converting a string into a number (an int):&lt;/p&gt;
&lt;h2 id=&#34;1-converting-a-stdstring-into-an-int&#34;&gt;1. Converting a std::string into an int&lt;/h2&gt;
&lt;p&gt;So, let&amp;rsquo;s take an example of this conversion:&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Errors / Warnings - After compiling</title>
      <link>https://www.badprog.com/c-errors-warnings-after-compiling-0/</link>
      <pubDate>Sun, 15 Jan 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-errors-warnings-after-compiling-0/</guid>
      <description>&lt;p&gt;As the same for the &lt;a href=&#34;https://www.badprog.com/c-errors-warnings-after-compiling&#34;&gt;C - Error / Warning&lt;/a&gt; section, I made this one to summarize common mistakes when I tried to compile my code.&lt;/p&gt;
&lt;p&gt;So let&amp;rsquo;s go to see some good errors and warnings in C++ (I&amp;rsquo;m sure it is also a great moment for you when you discovered these errors).&lt;/p&gt;
&lt;h2 id=&#34;1-maincpptext0x1f-undefined-reference-to-parentparent&#34;&gt;1. Main.cpp:(.text+0x1f): undefined reference to `Parent::Parent()&#39;&lt;/h2&gt;
&lt;h3 id=&#34;a-the-problem&#34;&gt;A. The problem&lt;/h3&gt;
&lt;p&gt;A very common error!&lt;br&gt;
Did you include the &lt;strong&gt;parent.cpp&lt;/strong&gt; file in your Makefile?&lt;br&gt;
Did you compile with this parent.cpp?&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Keyword - virtual</title>
      <link>https://www.badprog.com/c-keyword-virtual/</link>
      <pubDate>Sun, 15 Jan 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-keyword-virtual/</guid>
      <description>&lt;p&gt;The &lt;strong&gt;virtual&lt;/strong&gt; keyword is used in different ways in C++.&lt;/p&gt;
&lt;p&gt;The most common way to use it is before a destructor.&lt;br&gt;
Indeed, with this virtual keyword we can specified that the children of a class will be deleted before its parent.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see it with a tutorial.&lt;/p&gt;
&lt;h2 id=&#34;1-virtual-before-a-destructor&#34;&gt;1. virtual before a destructor&lt;/h2&gt;
&lt;p&gt;In this example, I created two classes, a Parent and a Child. So Child inherits from Parent.&lt;/p&gt;
&lt;p&gt;The headers:&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Makefile - Adding flags</title>
      <link>https://www.badprog.com/c-makefile-adding-flags/</link>
      <pubDate>Sun, 15 Jan 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-makefile-adding-flags/</guid>
      <description>&lt;p&gt;A personal Makefile is sometimes better than a Makefile generated by default by your IDE, such Eclipse or Visual Studio C++ for example.&lt;/p&gt;
&lt;p&gt;If you don&amp;rsquo;t know how to create one, let&amp;rsquo;s see it in this easy example of Makefile for C++.&lt;br&gt;
I added some flags for the variable &lt;strong&gt;CXXFLAGS&lt;/strong&gt;, it is different from the C language, where it is &lt;strong&gt;CFLAGS&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;With g++, you do not have to write the variable CXXFLAGS in your compilation line, but if you prefer, you can add it.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C - Errors / Warnings - After compiling</title>
      <link>https://www.badprog.com/c-errors-warnings-after-compiling/</link>
      <pubDate>Sun, 08 Jan 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-errors-warnings-after-compiling/</guid>
      <description>&lt;p&gt;Errors and warnings generally encountered by a coder during his hard life of coder will be added here, in this special section.&lt;/p&gt;
&lt;p&gt;I will not make difference between errors and warnings, because I always compile with CFLAGS such as &lt;strong&gt;-Wall -Werror -Wextra&lt;/strong&gt; and thus warnings are treated as errors.&lt;/p&gt;
&lt;p&gt;These errors will be those appearing after compiling a program.&lt;/p&gt;
&lt;p&gt;So we assume that we will just try to compile and of course it will fail.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C - Recursion - Classical recursion of a factorial</title>
      <link>https://www.badprog.com/c-recursion-classical-recursion-of-a-factorial/</link>
      <pubDate>Sun, 08 Jan 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-recursion-classical-recursion-of-a-factorial/</guid>
      <description>&lt;p&gt;A classical example of recursions is of course the factorial one.&lt;/p&gt;
&lt;p&gt;If you want to know the result of a factorial, do not hesitate to use a recursive function.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see it:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;int doIt(int nb) {&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (nb &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;nb = %d&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, nb);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; nb &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;doIt&lt;/span&gt;(nb &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;main&lt;/span&gt;() {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; first &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;5&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Last = %d&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;doIt&lt;/span&gt;(first));
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The render:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;nb &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;5&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;nb &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;4&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;nb &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;3&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;nb &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Final result &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;120&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
    </item>
    <item>
      <title>C - Recursion - Finding a number until a variable reaches another one</title>
      <link>https://www.badprog.com/c-recursion-finding-a-number-until-a-variable-reaches-another-one/</link>
      <pubDate>Sun, 08 Jan 2012 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-recursion-finding-a-number-until-a-variable-reaches-another-one/</guid>
      <description>&lt;p&gt;The code below display the &lt;strong&gt;nb&lt;/strong&gt; variable until it reaches the number ten.&lt;/p&gt;
&lt;p&gt;But the &lt;strong&gt;recursion&lt;/strong&gt; will display the phrase in the &lt;em&gt;printf(),&lt;/em&gt; of the &lt;em&gt;main()&lt;/em&gt;, at &lt;strong&gt;the end&lt;/strong&gt; of the while inside the &lt;em&gt;r()&lt;/em&gt; function.&lt;/p&gt;
&lt;p&gt;So the code inside the &lt;em&gt;r()&lt;/em&gt; function will be executed &lt;strong&gt;before&lt;/strong&gt; the printf() of the main().&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see this easy example:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;int r(int nb) {&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;while&lt;/span&gt; (nb &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;10&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;nb = %d&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, nb);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;r&lt;/span&gt;(&lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;nb);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;10&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;main&lt;/span&gt;() {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; first &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Last = %d&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;r&lt;/span&gt;(first));
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;And the result:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Android - MediaPlayer - Example of playing sounds</title>
      <link>https://www.badprog.com/android-mediaplayer-example-of-playing-sounds/</link>
      <pubDate>Fri, 23 Dec 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/android-mediaplayer-example-of-playing-sounds/</guid>
      <description>&lt;p&gt;Maybe you are wondering how to play a MP3 sound by clicking a simple Button on Android.&lt;/p&gt;
&lt;p&gt;Eh, you know what? You are in the right place!&lt;/p&gt;
&lt;p&gt;Note that this tutorial for MP3 sounds works as well with MP3 musics and of course a lot of different types of format such as WAVE or MIDI.&lt;/p&gt;
&lt;p&gt;A complete list can be found on the official website of Android developpers:&lt;br&gt;
&lt;a href=&#34;http://developer.android.com/guide/appendix/media-formats.html&#34;&gt;http://developer.android.com/guide/appendix/media-formats.html&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;After a presention of which MP3 we will need, we will show the source code needed for this tutorial.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Java - Tips&#39;n Tricks - Source attachment</title>
      <link>https://www.badprog.com/java-tips-n-tricks-source-attachment/</link>
      <pubDate>Thu, 15 Dec 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/java-tips-n-tricks-source-attachment/</guid>
      <description>&lt;p&gt;You are maybe searching for the Sourch Attachment in Java and Eclipse.&lt;/p&gt;
&lt;p&gt;If yes, just follow this link: &lt;/eclipse-java-source-attachment&gt;&lt;/p&gt;
&lt;p&gt;Enjoy.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Apache - Ant - Errors</title>
      <link>https://www.badprog.com/apache-ant-errors/</link>
      <pubDate>Thu, 08 Dec 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/apache-ant-errors/</guid>
      <description>&lt;p&gt;You were compiling on Windows 7 when suddenly you are getting this error:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-xml&#34; data-lang=&#34;xml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[ERROR] com.sun.tools.javac.Main is not on the classpath.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[ERROR] Perhaps JAVA\_HOME does not point to the JDK.
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then maybe something like that:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-xml&#34; data-lang=&#34;xml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[ERROR] It is currently set to &amp;#34;C:\soft\java32\jdk1.7.0\jre&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;So the JRE instead of the JDK?&lt;br&gt;
What&amp;rsquo;s going on?&lt;/p&gt;
&lt;p&gt;Ant needs a file named &lt;strong&gt;tools.jar&lt;/strong&gt; that it searches in the JRE but this file is in the JDK!&lt;/p&gt;</description>
    </item>
    <item>
      <title>Apache - Continuum - Configuration</title>
      <link>https://www.badprog.com/apache-continuum-configuration/</link>
      <pubDate>Wed, 30 Nov 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/apache-continuum-configuration/</guid>
      <description>&lt;p&gt;After &lt;a href=&#34;https://www.badprog.com/apache-continuum-installation&#34;&gt;installing Apache Continuum continuous integration tool&lt;/a&gt;, you may want to configure it and of course, build your first project with Maven and Continuum.&lt;br&gt;
But you already have a project on SVN, and you wish to use it as well.&lt;/p&gt;
&lt;p&gt;No problem you are in the right place.&lt;/p&gt;
&lt;p&gt;Software used in this tutorial:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Apache Maven 3&lt;/li&gt;
&lt;li&gt;Apache Continuum 1.4.0&lt;/li&gt;
&lt;li&gt;Subversion 1.7&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;configuration-of-continuum-with-maven-and-svn-on-windows&#34;&gt;Configuration of Continuum with Maven and SVN on Windows&lt;/h2&gt;
&lt;h3 id=&#34;prerequisites&#34;&gt;Prerequisites&lt;/h3&gt;
&lt;p&gt;If you don&amp;rsquo;t have a project built with Maven, I suggest to follow this &lt;a href=&#34;https://www.badprog.com/apache-maven-what-is-maven&#34;&gt;tutorial of &amp;ldquo;What is Maven?&amp;rdquo;&lt;/a&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Apache - Continuum - Installation</title>
      <link>https://www.badprog.com/apache-continuum-installation/</link>
      <pubDate>Wed, 30 Nov 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/apache-continuum-installation/</guid>
      <description>&lt;p&gt;Apache Continuum is a continuous integration tool.&lt;/p&gt;
&lt;p&gt;You can download a copy on the official webpage of Apache Continuum:&lt;a href=&#34;http://continuum.apache.org/&#34;&gt;http://continuum.apache.org/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Or with one of mirrors with this Apache mirrors&amp;rsquo; page: &lt;a href=&#34;http://www.apache.org/dyn/closer.cgi&#34;&gt;http://www.apache.org/dyn/closer.cgi&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;installation-of-apache-continuum-on-windows&#34;&gt;Installation of Apache Continuum on Windows&lt;/h2&gt;
&lt;p&gt;We will take the &lt;strong&gt;apache-continuum-1.4.0-bin.zip&lt;/strong&gt; version.&lt;/p&gt;
&lt;p&gt;It will be installed by the console with the JVM.&lt;br&gt;
And of course, you need a JDK, who do not have it?&lt;/p&gt;
&lt;p&gt;I extracted all files, from the .ZIP, in this directory:&lt;br&gt;
&lt;strong&gt;C:\soft\apache\continuum-1.4.0&lt;/strong&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Apache - Maven - What is Maven?</title>
      <link>https://www.badprog.com/apache-maven-what-is-maven/</link>
      <pubDate>Tue, 29 Nov 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/apache-maven-what-is-maven/</guid>
      <description>&lt;p&gt;Maven is a tool, mainly developed for Java developments.&lt;br&gt;
This is a complete software so it is not so easy to understand when you start developing, even with the official website of Maven: &lt;a href=&#34;http://maven.apache.org/&#34;&gt;http://maven.apache.org/&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;But I will try to reduce the explanation of what is Maven with some examples.&lt;/p&gt;
&lt;p&gt;You can start by following this tiny &lt;a href=&#34;https://www.badprog.com/apache-maven-installation&#34;&gt;installation tutorial of Maven for Windows&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;OK, let&amp;rsquo;s see in details what Maven is.&lt;br&gt;
First of all, every project with Maven has a &lt;strong&gt;pom.xml&lt;/strong&gt; file.&lt;br&gt;
POM means &lt;strong&gt;Project Object Model&lt;/strong&gt;.&lt;br&gt;
With this XML file, a team manager can configure a project and how Maven will interact with this project.&lt;br&gt;
It means that if a project contains subprojects, we will have more than one pom.xml.&lt;br&gt;
In fact, one for each project.&lt;br&gt;
The POM into sub projects will inherite from the S&lt;strong&gt;uper POM&lt;/strong&gt; and so on for others child projects.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Apache - Archiva - Installation</title>
      <link>https://www.badprog.com/apache-archiva-installation/</link>
      <pubDate>Mon, 28 Nov 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/apache-archiva-installation/</guid>
      <description>&lt;p&gt;To download the last stable &lt;strong&gt;Archiva&lt;/strong&gt; release, let&amp;rsquo;s go on the official website: &lt;a href=&#34;http://archiva.apache.org/&#34;&gt;http://archiva.apache.org/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;For this Archiva installation tutorial, we will install the &lt;strong&gt;Archiva 1.3.5 Standalone&lt;/strong&gt; version.&lt;/p&gt;
&lt;p&gt;Do not hesitate to test the &lt;strong&gt;MD5&lt;/strong&gt; checksum.&lt;/p&gt;
&lt;h2 id=&#34;installation-of-archiva-on-windows&#34;&gt;Installation of Archiva on Windows&lt;/h2&gt;
&lt;p&gt;OK, extract the files into a directory, I chose this one:&lt;br&gt;
&lt;strong&gt;C:\soft\artefact-manager\apache-archiva-1.3.5&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Now open this file:&lt;br&gt;
&lt;strong&gt;C:\soft\artefact-manager\apache-archiva-1.3.5\conf\jetty.xml&lt;/strong&gt;.&lt;br&gt;
And go until the line &lt;strong&gt;66&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;You will have something like that:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-xml&#34; data-lang=&#34;xml&#34;&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Just change the &lt;strong&gt;8080&lt;/strong&gt; by &lt;strong&gt;8082&lt;/strong&gt;.&lt;br&gt;
You are probably wondering why?&lt;br&gt;
This is because the default port, in our case 8080, is often already taken by another device or software.&lt;br&gt;
So to be sure it works, we change this for 8082.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C - SDL (Simple Directmedia Layer) - Errors</title>
      <link>https://www.badprog.com/c-sdl-simple-directmedia-layer-errors/</link>
      <pubDate>Fri, 25 Nov 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-sdl-simple-directmedia-layer-errors/</guid>
      <description>&lt;p&gt;Here a list of errors from the SDL library.&lt;br&gt;
These errors can be found from any circumstance, such as before compilation, after or during the linkage.&lt;/p&gt;
&lt;h2 id=&#34;error-1&#34;&gt;Error 1&lt;/h2&gt;
&lt;p&gt;Description    Resource    Path    Location    Type&lt;br&gt;
&lt;strong&gt;undefined reference to `SDL_main&amp;rsquo;&lt;/strong&gt;&lt;br&gt;
line 315, external location:&lt;br&gt;
&lt;strong&gt;\Users\hercules\trunk\SDL-1.2\src\main\win32\SDL_win32_main.c&lt;/strong&gt;&lt;br&gt;
C/C++ Problem&lt;/p&gt;
&lt;p&gt;To resolve this error on Windows, you have to pass the classic arguments &lt;strong&gt;int argc&lt;/strong&gt; and *&lt;em&gt;char &lt;em&gt;argv[]&lt;/em&gt;&lt;/em&gt; to your main() function, just like this:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;main&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; argc, &lt;span style=&#34;color:#66d9ef&#34;&gt;char&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;argv[]) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
    </item>
    <item>
      <title>Eclipse - CppUnit - Installation</title>
      <link>https://www.badprog.com/eclipse-cppunit-installation/</link>
      <pubDate>Wed, 23 Nov 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/eclipse-cppunit-installation/</guid>
      <description>&lt;p&gt;It is a bit complex to know how to install CppUnit and how to use it with Eclipse.&lt;/p&gt;
&lt;p&gt;That&amp;rsquo;s why I make this tutorial about CppUnit and Eclipse.&lt;br&gt;
I hope it will be easy enough even for beginners, if not, do not hesitate to post a comment, I will help if I can.&lt;/p&gt;
&lt;p&gt;This installation will be done on Windows OS, I am sure if you are a Linux addict or a Mac fan, this explanation will help you as well.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Eclipse - Tips&#39;n Tricks - Adding flags to the GCC compiler</title>
      <link>https://www.badprog.com/eclipse-tips-n-tricks-adding-flags-to-the-gcc-compiler/</link>
      <pubDate>Sat, 19 Nov 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/eclipse-tips-n-tricks-adding-flags-to-the-gcc-compiler/</guid>
      <description>&lt;p&gt;You may want to add some commands to your GCC flag settings.&lt;/p&gt;
&lt;p&gt;No problem, Eclipse can allow you this.&lt;/p&gt;
&lt;p&gt;Right click on your project &amp;gt; &lt;strong&gt;Properties&lt;/strong&gt; &amp;gt; &lt;strong&gt;C/C++ Build&lt;/strong&gt; &amp;gt; &lt;strong&gt;Settings&lt;/strong&gt; &amp;gt; &lt;strong&gt;Tool Settings&lt;/strong&gt; &amp;gt; &lt;strong&gt;GCC C++ Compiler&lt;/strong&gt; &amp;gt; &lt;strong&gt;Miscellaneous&lt;/strong&gt;.&lt;br&gt;
On the right, there is an input with the name &lt;strong&gt;Other flags&lt;/strong&gt;.&lt;br&gt;
Enter your command there.&lt;/p&gt;
&lt;p&gt;For example, if when you compiling you have this error:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;em&gt;deprecated conversion from string constant to &amp;lsquo;char&lt;/em&gt;&amp;rsquo; [-Wwrite-strings]&lt;/em&gt;*&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can add this command to remove it:&lt;/p&gt;</description>
    </item>
    <item>
      <title>C - SDL (Simple Directmedia Layer) - Hello World!</title>
      <link>https://www.badprog.com/c-sdl-simple-directmedia-layer-hello-world/</link>
      <pubDate>Thu, 17 Nov 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-sdl-simple-directmedia-layer-hello-world/</guid>
      <description>&lt;p&gt;You probably already installed SDL library on your computer.&lt;br&gt;
If not, you can follow this &lt;a href=&#34;https://www.badprog.com/eclipse-sdl-simple-directmedia-layer-installation&#34;&gt;SDL tutorial setup on Eclipse&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s test it with a Hello World! tutorial.&lt;/p&gt;
&lt;p&gt;For Windows OS, do not forget to add the &lt;strong&gt;SDL.dll&lt;/strong&gt; in the folder where there is your &lt;strong&gt;.exe&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;To have an easy application than ever beginners can make, we need to follow five steps:&lt;/p&gt;
&lt;h2 id=&#34;include-the-right-library&#34;&gt;Include the right library&lt;/h2&gt;
&lt;p&gt;In our case, we have to include the SDL/SDL.h header.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Eclipse - Java - Source attachment</title>
      <link>https://www.badprog.com/eclipse-java-source-attachment/</link>
      <pubDate>Mon, 14 Nov 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/eclipse-java-source-attachment/</guid>
      <description>&lt;p&gt;It&amp;rsquo;s really annoying when you want to browse throw a javadoc but Eclipse doesn&amp;rsquo;t know where to find these sources.&lt;/p&gt;
&lt;p&gt;The more difficult thing is to find these source files.&lt;/p&gt;
&lt;p&gt;But with the JDK7 it is now easy.&lt;br&gt;
Go until your directory where you have installed it.&lt;br&gt;
For example, let&amp;rsquo;s assume it is &lt;strong&gt;C:/soft/java32/jdk1.7.0.&lt;/strong&gt;&lt;br&gt;
You will find a &lt;strong&gt;src.zip&lt;/strong&gt; file.&lt;/p&gt;
&lt;p&gt;This is the file to open all classes present in your, for example, &lt;strong&gt;rt.jar&lt;/strong&gt; file.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Eclipse - JUnit - Installation</title>
      <link>https://www.badprog.com/eclipse-junit-installation/</link>
      <pubDate>Mon, 14 Nov 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/eclipse-junit-installation/</guid>
      <description>&lt;p&gt;It&amp;rsquo;s time for you to play with Unit testing, especially with JUnit.&lt;/p&gt;
&lt;p&gt;OK, let&amp;rsquo;s see how to install it on Eclipse.&lt;/p&gt;
&lt;p&gt;First of all, you need a version of JUnit.&lt;br&gt;
Let&amp;rsquo;s go on the official website to download it: &lt;a href=&#34;http://www.junit.org/&#34;&gt;http://www.junit.org/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;In the last version, for our example, the &lt;strong&gt;junit4.10&lt;/strong&gt; one.&lt;/p&gt;
&lt;p&gt;Open the .zip. Inside there is a &lt;strong&gt;junit-4.10.jar&lt;/strong&gt; file.&lt;/p&gt;
&lt;p&gt;In Eclipse, select a project then &amp;gt; &lt;strong&gt;Project&lt;/strong&gt; &amp;gt; &lt;strong&gt;Properties&lt;/strong&gt; &amp;gt; &lt;strong&gt;Java Build Path&lt;/strong&gt; &amp;gt; &lt;strong&gt;Libraries&lt;/strong&gt; tab &amp;gt; &lt;strong&gt;Add Jars&lt;/strong&gt; &amp;gt; Select the &lt;strong&gt;junit-4.10.jar&lt;/strong&gt; &amp;gt; &lt;strong&gt;OK&lt;/strong&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Java - JUnit - Hello World!</title>
      <link>https://www.badprog.com/java-junit-hello-world/</link>
      <pubDate>Mon, 14 Nov 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/java-junit-hello-world/</guid>
      <description>&lt;p&gt;Now that you have installed &lt;a href=&#34;https://www.badprog.com/eclipse-junit-installation&#34;&gt;JUnit with the last tutorial&lt;/a&gt;, we will be ready to test it.&lt;/p&gt;
&lt;p&gt;So, go!&lt;/p&gt;
&lt;p&gt;Open Eclipse, select a project, then create a new Class.&lt;br&gt;
In your example, it will be a class with classical mathematical operations.&lt;br&gt;
So let&amp;rsquo;s name it &lt;strong&gt;MyOperations&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;We don&amp;rsquo;t need a package for this tutorial JUnit for beginners, so here the code of this class:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-java&#34; data-lang=&#34;java&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;/**
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;*
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;* Classical mathematical operations
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;* @author BadproG
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;*
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;*/&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;public&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;class&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;MyOperations&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;/**
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;* Classical addition
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;* @param x
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;* @param y
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;* @return
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;*/&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;public&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;addition&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; x, &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; y) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; x &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; y;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;/**
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;* Classical division
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;* @param x
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;* @param y
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;* @return
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;*/&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;public&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;division&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; x, &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; y) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; x &lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt; y;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;/**
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;* Classical modulo
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;* @param x
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;* @param y
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;* @return
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;*/&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;public&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;modulo&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; x, &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; y) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; x &lt;span style=&#34;color:#f92672&#34;&gt;%&lt;/span&gt; y;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;/**
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;* Classical multiplication
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;* @param x
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;* @param y
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;* @return
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;*/&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;public&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;multiplication&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; x, &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; y) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; x &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt; y;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;/**
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;* Classical subtraction
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;* @param x
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;* @param y
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;* @return
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;*/&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;public&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;subtraction&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; x, &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; y) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; x &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt; y;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;As you can see, these methods are really easy to understand.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Eclipse - SDL (Simple Directmedia Layer) - Installation</title>
      <link>https://www.badprog.com/eclipse-sdl-simple-directmedia-layer-installation/</link>
      <pubDate>Fri, 11 Nov 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/eclipse-sdl-simple-directmedia-layer-installation/</guid>
      <description>&lt;p&gt;You like C and C++ but you need some help to access audio, joystick, keyboard, video framebuffer, etc.&lt;br&gt;
That&amp;rsquo;s why you would like to use the SDL library.&lt;/p&gt;
&lt;p&gt;But, there is still a problem, you don&amp;rsquo;t know how to install it with Eclipse.&lt;/p&gt;
&lt;p&gt;OK, let&amp;rsquo;s try it with this tutorial installation.&lt;/p&gt;
&lt;h2 id=&#34;1-installation-of-sdl-with-eclipse-on-windows&#34;&gt;1. Installation of SDL with Eclipse on Windows&lt;/h2&gt;
&lt;h3 id=&#34;a-outside-eclipse&#34;&gt;A. Outside Eclipse&lt;/h3&gt;
&lt;p&gt;We assume that you have already installed &lt;strong&gt;MinGW&lt;/strong&gt; in this directory: &lt;strong&gt;C:\soft\mingw&lt;/strong&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Apache - Maven - Installation</title>
      <link>https://www.badprog.com/apache-maven-installation/</link>
      <pubDate>Tue, 08 Nov 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/apache-maven-installation/</guid>
      <description>&lt;p&gt;Maven is a great tool that can really help you to manage a project.&lt;br&gt;
Its main goal is to building projects, publishing project information and a sharing JARs across several projects.&lt;/p&gt;
&lt;p&gt;We will see, in this tutorial, the installation of Maven 3 on Windows.&lt;/p&gt;
&lt;h2 id=&#34;installation-of-maven-3-on-windows-operating-system&#34;&gt;Installation of Maven 3 on Windows operating system&lt;/h2&gt;
&lt;p&gt;Let&amp;rsquo;s first download the latest version from the official website of Apache Maven: &lt;a href=&#34;http://maven.apache.org/download.html&#34;&gt;http://maven.apache.org/download.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Then extract files in the directory of your choice.&lt;br&gt;
For our example, we will assume this one: &lt;strong&gt;C:\soft\apache\maven-3&lt;/strong&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>UML - Diagram class - Relationships</title>
      <link>https://www.badprog.com/uml-diagram-class-relationships/</link>
      <pubDate>Wed, 26 Oct 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/uml-diagram-class-relationships/</guid>
      <description>&lt;p&gt;This is not so easy to know which relationships and graphic to use to describe a situation.&lt;br&gt;
But what we know for sure, is that the classes are linked.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see this in details.&lt;/p&gt;
&lt;h2 id=&#34;association&#34;&gt;Association&lt;/h2&gt;
&lt;p&gt;An association is graphically represented by a simple line.&lt;br&gt;
This is a weak link between two or more classes.&lt;br&gt;
For example a customer can make an order.&lt;br&gt;
In this case, the customer is linked by this order, and the order as well by the customer.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Eclipse - Tips&#39;n tricks - Open Element</title>
      <link>https://www.badprog.com/eclipse-tips-n-tricks-open-element/</link>
      <pubDate>Tue, 25 Oct 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/eclipse-tips-n-tricks-open-element/</guid>
      <description>&lt;p&gt;This &lt;strong&gt;Open Element&lt;/strong&gt; option allows to find a specific element in a project with the beginning of its name.&lt;/p&gt;
&lt;p&gt;For that, open a class and type &lt;strong&gt;SHIFT + CTRL + T&lt;/strong&gt; and a popup will open to find the correct element of your dreams.&lt;/p&gt;
&lt;p&gt;Very useful.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Eclipse - Standard Widget Toolkit (SWT) - Installation</title>
      <link>https://www.badprog.com/eclipse-standard-widget-toolkit-swt-installation/</link>
      <pubDate>Fri, 21 Oct 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/eclipse-standard-widget-toolkit-swt-installation/</guid>
      <description>&lt;p&gt;SWT, the Standard Widget Toolkit, will help us to draw windows for the Java platform.&lt;/p&gt;
&lt;p&gt;On this webpage you will find links to download last stable releases &lt;a href=&#34;http://www.eclipse.org/swt/&#34;&gt;http://www.eclipse.org/swt/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Once downloaded, open Eclipse, right click on the Explorer tab, then : &lt;strong&gt;Import&amp;hellip;&lt;/strong&gt; &amp;gt; &lt;strong&gt;General&lt;/strong&gt; &amp;gt; &lt;strong&gt;Existing Projects into Workspace&lt;/strong&gt;.&lt;br&gt;
Click Next then select the &lt;strong&gt;Select archive file&lt;/strong&gt; option and browse until, for example for Windows OS, your  &lt;strong&gt;swt-3.7.1-win32-win32-x86.zip&lt;/strong&gt; file.&lt;/p&gt;
&lt;p&gt;Click &lt;strong&gt;Finish&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Now in your Package Explorer you can see the &lt;strong&gt;org.eclipse.swt&lt;/strong&gt; project.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Eclipse - Tips&#39;n tricks - Open Type</title>
      <link>https://www.badprog.com/eclipse-tips-n-tricks-open-type/</link>
      <pubDate>Fri, 21 Oct 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/eclipse-tips-n-tricks-open-type/</guid>
      <description>&lt;p&gt;This &lt;strong&gt;Open Type&lt;/strong&gt; option allows to find a specific class in a project with the beginning of its name.&lt;/p&gt;
&lt;p&gt;For that, use the &lt;strong&gt;SHIFT + CTRL + H&lt;/strong&gt; and a popup will open in front of your eyes.&lt;br&gt;
Start writing and all types with matching name will appear.&lt;/p&gt;
&lt;p&gt;😭&lt;/p&gt;</description>
    </item>
    <item>
      <title>Java - SWT - Hello World tutorial</title>
      <link>https://www.badprog.com/java-swt-hello-world-tutorial/</link>
      <pubDate>Fri, 21 Oct 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/java-swt-hello-world-tutorial/</guid>
      <description>&lt;p&gt;Hello World!&lt;br&gt;
It seems to me that I already seen this expression somewhere.&lt;/p&gt;
&lt;p&gt;Well, let&amp;rsquo;s go?&lt;/p&gt;
&lt;p&gt;First thing to know is that we need two SWT widgets to make a window appear:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Display&lt;/li&gt;
&lt;li&gt;Shell&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Then a loop while to tell the program to continue displaying the window until someone close it.&lt;br&gt;
Now, the code.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-java&#34; data-lang=&#34;java&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;import&lt;/span&gt; org.eclipse.swt.widgets.Display;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;import&lt;/span&gt; org.eclipse.swt.widgets.Shell;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;public&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;class&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;Helloworld&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;public&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;static&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;main&lt;/span&gt;(String&lt;span style=&#34;color:#f92672&#34;&gt;[]&lt;/span&gt; args) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Display display &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;new&lt;/span&gt; Display();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Shell shell &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;new&lt;/span&gt; Shell(display);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;shell.&lt;span style=&#34;color:#a6e22e&#34;&gt;setSize&lt;/span&gt;(300, 300);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;shell.&lt;span style=&#34;color:#a6e22e&#34;&gt;setText&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Hello World&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;shell.&lt;span style=&#34;color:#a6e22e&#34;&gt;open&lt;/span&gt;();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;while&lt;/span&gt;(&lt;span style=&#34;color:#f92672&#34;&gt;!&lt;/span&gt;shell.&lt;span style=&#34;color:#a6e22e&#34;&gt;isDisposed&lt;/span&gt;())
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (&lt;span style=&#34;color:#f92672&#34;&gt;!&lt;/span&gt;display.&lt;span style=&#34;color:#a6e22e&#34;&gt;readAndDispatch&lt;/span&gt;())
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;display.&lt;span style=&#34;color:#a6e22e&#34;&gt;sleep&lt;/span&gt;();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;display.&lt;span style=&#34;color:#a6e22e&#34;&gt;dispose&lt;/span&gt;();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Right click on the HelloWorld class and run it as a Java Application.&lt;br&gt;
The window is coming and displays the title Hello World.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Qt Framework - Hello World</title>
      <link>https://www.badprog.com/c-qt-framework-hello-world/</link>
      <pubDate>Tue, 18 Oct 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-qt-framework-hello-world/</guid>
      <description>&lt;p&gt;Now that you have already &lt;a href=&#34;https://www.badprog.com/eclipse-qt-framework-installation&#34;&gt;installed Eclipse, Qt Framework Open Source and MinGW with the this tutorial&lt;/a&gt;, we will create our first program window.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s go.&lt;/p&gt;
&lt;h2 id=&#34;1-hello-world-on-windows-os&#34;&gt;1. Hello World on Windows OS&lt;/h2&gt;
&lt;p&gt;Open Eclipse, on the Explorer &amp;gt; Right Click &amp;gt; New Project &amp;gt; Qt &amp;gt; Qt Gui Project.&lt;br&gt;
Write a project name such as &lt;strong&gt;hello-world&lt;/strong&gt;, then Next, Next, Finish.&lt;/p&gt;
&lt;p&gt;A lot of files and directories are created for you.&lt;br&gt;
Delete all.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Eclipse - Qt Framework - Installation</title>
      <link>https://www.badprog.com/eclipse-qt-framework-installation/</link>
      <pubDate>Tue, 18 Oct 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/eclipse-qt-framework-installation/</guid>
      <description>&lt;p&gt;You like Qt framework and you like Eclipse as well.&lt;br&gt;
So you already developed with Qt Creator, but your favorite IDE is missing you.&lt;/p&gt;
&lt;p&gt;I understand.&lt;/p&gt;
&lt;p&gt;That&amp;rsquo;s why I will show you how to use Eclipse to compile a project with Qt framework.&lt;/p&gt;
&lt;h2 id=&#34;1-using-eclipse-and-qt-framework-on-windows-os&#34;&gt;1. Using Eclipse and Qt framework on Windows OS&lt;/h2&gt;
&lt;h3 id=&#34;a-qt-for-open-source-c-development-on-windows&#34;&gt;A. Qt for open source C++ development on Windows&lt;/h3&gt;
&lt;p&gt;Let&amp;rsquo;s start by install the open source Qt libraries.&lt;br&gt;
I suggest you to downlod the &lt;strong&gt;.exe&lt;/strong&gt; with this link: &lt;a href=&#34;http://qt.nokia.com/downloads/windows-cpp&#34;&gt;http://qt.nokia.com/downloads/windows-cpp&lt;/a&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Eclipse - Tips&#39;n tricks - Creating a Code Style</title>
      <link>https://www.badprog.com/eclipse-tips-n-tricks-creating-a-code-style/</link>
      <pubDate>Tue, 11 Oct 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/eclipse-tips-n-tricks-creating-a-code-style/</guid>
      <description>&lt;p&gt;You can easily manage the &lt;strong&gt;Code Style&lt;/strong&gt; of your pages in &lt;strong&gt;Eclipse&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;For example, for C++ (this is exactly the same for all others languages), simply do this:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Window&lt;/strong&gt; &amp;gt; &lt;strong&gt;Preferences&lt;/strong&gt; &amp;gt; &lt;strong&gt;C/C++&lt;/strong&gt; &amp;gt; &lt;strong&gt;Code Style&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Under classic built-in choices, click &lt;strong&gt;New&amp;hellip;&lt;/strong&gt; and create your own &lt;strong&gt;Code Style&lt;/strong&gt;!&lt;/p&gt;
&lt;p&gt;Yeah!&lt;/p&gt;</description>
    </item>
    <item>
      <title>Eclipse - Tips&#39;n tricks - Generating getters and setters from the Source menu</title>
      <link>https://www.badprog.com/eclipse-tips-n-tricks-generating-getters-and-setters-from-the-source-menu/</link>
      <pubDate>Tue, 11 Oct 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/eclipse-tips-n-tricks-generating-getters-and-setters-from-the-source-menu/</guid>
      <description>&lt;p&gt;An easy way to &lt;strong&gt;generate getters and setters&lt;/strong&gt; is to use the &lt;strong&gt;Source&lt;/strong&gt; option within &lt;strong&gt;Eclipse Indigo&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;For example, create a new file, add the following lines and &lt;strong&gt;select them&lt;/strong&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-xml&#34; data-lang=&#34;xml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;int nbPeople;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;int nbAnimal;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then right click.&lt;br&gt;
On the menu select &lt;strong&gt;Source&lt;/strong&gt; &amp;gt; &lt;strong&gt;Generate getters and setters&lt;/strong&gt;.&lt;br&gt;
On the new window, click on the right &lt;strong&gt;Select All&lt;/strong&gt;, then Next and &lt;strong&gt;Finish&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Your getters and setters are generated for you as follows:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Apache - Ant - Installation</title>
      <link>https://www.badprog.com/apache-ant-installation/</link>
      <pubDate>Tue, 04 Oct 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/apache-ant-installation/</guid>
      <description>&lt;p&gt;Ant is a &lt;strong&gt;Java&lt;/strong&gt; tool that can help you building projects and setting them correctly.&lt;br&gt;
It can generates files and directory from simple XML files.&lt;br&gt;
So, let&amp;rsquo;s get started with this tutorial of &lt;strong&gt;Apache Ant&lt;/strong&gt; on Windows operating system.&lt;/p&gt;
&lt;h2 id=&#34;1-apache-ant-installation-on-windows&#34;&gt;1. Apache Ant installation on Windows&lt;/h2&gt;
&lt;p&gt;So, we will install Ant on Windows and for that we will use in this tutorial:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Windows 7&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;http://ant.apache.org/&#34;&gt;Ant 1.8.2&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Two things are important, the &lt;strong&gt;path for the directory&lt;/strong&gt; and the &lt;strong&gt;path for the environment variables&lt;/strong&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Oracle - GlassFish Server Open Source Edition - Installation</title>
      <link>https://www.badprog.com/oracle-glassfish-server-open-source-edition-installation/</link>
      <pubDate>Tue, 04 Oct 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/oracle-glassfish-server-open-source-edition-installation/</guid>
      <description>&lt;p&gt;A new tutorial to explain how to install the &lt;strong&gt;Oracle GlassFish server Open Source Edition 3.1.1&lt;/strong&gt; on &lt;strong&gt;Windows&lt;/strong&gt; directly by running it and with the &lt;strong&gt;Eclipse&lt;/strong&gt; IDE.&lt;/p&gt;
&lt;h2 id=&#34;1-installation-on-windows-by-running-it&#34;&gt;1. Installation on Windows by running it&lt;/h2&gt;
&lt;p&gt;Let&amp;rsquo;s start by download it on the official website: &lt;a href=&#34;http://glassfish.java.net/&#34;&gt;http://glassfish.java.net/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Once downloaded, run it.&lt;br&gt;
Choose: Custom Installation &amp;gt; Next &amp;gt; Install and Configure &amp;gt; Next &amp;gt; Select a directory &amp;gt; Next &amp;gt; Select your Java SDK folder &amp;gt; Next &amp;gt; Check Install Update Tool and Enable Update Tool &amp;gt; Install&lt;/p&gt;</description>
    </item>
    <item>
      <title>Security - Checksum - MD5</title>
      <link>https://www.badprog.com/security-checksum-md5/</link>
      <pubDate>Tue, 04 Oct 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/security-checksum-md5/</guid>
      <description>&lt;p&gt;You just download a new file and you want to know if this file is really the good one.&lt;/p&gt;
&lt;p&gt;How to do that?&lt;/p&gt;
&lt;p&gt;With checksum of course!&lt;/p&gt;
&lt;p&gt;Of course, this is not a 100% secure way, but it is better than nothing!&lt;/p&gt;
&lt;p&gt;Why it is not a perfect secure way?&lt;br&gt;
Because someone may have hacked the website where is the file to download, and generate the checksum of its own hacked file.&lt;br&gt;
So if you try to check this checksum, you will have exactly the same, but the file will be hacked.&lt;br&gt;
But as I said, this is better than nothing!&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Windows - Hello World!</title>
      <link>https://www.badprog.com/c-windows-hello-world/</link>
      <pubDate>Sun, 02 Oct 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-windows-hello-world/</guid>
      <description>&lt;p&gt;Let&amp;rsquo;s create our first C++ application.&lt;/p&gt;
&lt;p&gt;For this tutorial, we will use:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Eclipse Indigo CDT&lt;/li&gt;
&lt;li&gt;Cygwin&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you install your Cygwin binary into a different drive than from your development directory you can still use it.&lt;br&gt;
For example if you have installed Cygwin in &lt;strong&gt;C:/soft/&lt;/strong&gt; and want to work in &lt;strong&gt;D:/dev/&lt;/strong&gt;, go until C:/soft/ and run your Cygwin.bat file.&lt;br&gt;
Once open, write it:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cpp&#34; data-lang=&#34;cpp&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cd &lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt;cygdrive&lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;then press the TAB key on your keyboard.&lt;br&gt;
You have now access to all your drives.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Eclipse - Subversion - Installing SVN on Windows</title>
      <link>https://www.badprog.com/eclipse-subversion-installing-svn-on-windows/</link>
      <pubDate>Sun, 02 Oct 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/eclipse-subversion-installing-svn-on-windows/</guid>
      <description>&lt;p&gt;You already have Eclipse Indigo, but you want more. That is a good thing.&lt;br&gt;
Indeed, you want be able to connect your projects with a software versioning and a revision control system, and this directly from Eclipse.&lt;/p&gt;
&lt;p&gt;You need SVN!&lt;/p&gt;
&lt;p&gt;Open Eclipse:&lt;/p&gt;
&lt;p&gt;Help &amp;gt; Eclipse Market Place&amp;hellip; &amp;gt; Write Subclipse in the Find input area.&lt;/p&gt;
&lt;p&gt;Click Install on the right of the Subclipse details.&lt;/p&gt;
&lt;p&gt;Accept all and restart Eclipse.&lt;/p&gt;
&lt;p&gt;If you have a 64 bits Java Virtual Machine, you must download the JavaHL for 64 bits.&lt;br&gt;
Here the website: &lt;a href=&#34;http://www.sliksvn.com/en/download&#34;&gt;http://www.sliksvn.com/en/download&lt;/a&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Apache - Tomcat - Installation</title>
      <link>https://www.badprog.com/apache-tomcat-installation/</link>
      <pubDate>Sun, 25 Sep 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/apache-tomcat-installation/</guid>
      <description>&lt;p&gt;Today a new tutorial for installing Tomcat 7 on Windows 7.&lt;br&gt;
You must have, at least, the JRE 6.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Apache Tomcat installation on Windows 7&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Let&amp;rsquo;s get started by downloading the last version on the official Apache Tomcat website:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;http://tomcat.apache.org/&#34;&gt;http://tomcat.apache.org/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Choose the &lt;strong&gt;32-bit/64-bit Windows Service Installer&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Run it and in the Choose Components choices, select the type of install &lt;strong&gt;Full&lt;/strong&gt; in the combo box.&lt;br&gt;
Click Next and in Configuration, let all ports by default.&lt;br&gt;
In the Tomcat Administrator Login set a User Name and a Password if you want, or let it empty.&lt;br&gt;
Then Next &amp;gt; Next &amp;gt; Install.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Symfony 2 - Installation - On Windows Operating System</title>
      <link>https://www.badprog.com/symfony-2-installation-on-windows-operating-system/</link>
      <pubDate>Sat, 24 Sep 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/symfony-2-installation-on-windows-operating-system/</guid>
      <description>&lt;p&gt;You already played with Symfony 1 or you never used it (SHAME ON YOU), and you want to install a fresh new 2.0.1 version of Symfony2 on Windows 7.&lt;/p&gt;
&lt;p&gt;You are in the right place!&lt;/p&gt;
&lt;p&gt;To be honest this new version is really easy to install.&lt;/p&gt;
&lt;p&gt;Download a copy on the official website of Symfony2: &lt;a href=&#34;http://symfony.com/download&#34;&gt;http://symfony.com/download&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;We will install the 2.0.1 in the ZIP format.&lt;/p&gt;
&lt;p&gt;Symply open the ZIP file and place all in the root of your web server, generally it is &lt;strong&gt;C:\www&lt;/strong&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C&#43;&#43; - Eclipse - Installation of C/C&#43;&#43; Development Tools (CDT) and Cygwin for Windows</title>
      <link>https://www.badprog.com/c-eclipse-installation-of-c-c-development-tools-cdt-and-cygwin-for-windows/</link>
      <pubDate>Tue, 20 Sep 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-eclipse-installation-of-c-c-development-tools-cdt-and-cygwin-for-windows/</guid>
      <description>&lt;p&gt;In this tutorial of Eclipse, we will install C and C++ on Windows with some examples.&lt;/p&gt;
&lt;p&gt;Easy?&lt;/p&gt;
&lt;p&gt;Not really, but nothing is impossible of course!&lt;/p&gt;
&lt;p&gt;Why?&lt;/p&gt;
&lt;p&gt;Because Windows needs another software to create and manipulate C and C++.&lt;br&gt;
This software is &lt;strong&gt;Cygwin&lt;/strong&gt;.&lt;/p&gt;
&lt;h2 id=&#34;1-installing-cygwin&#34;&gt;1. Installing Cygwin&lt;/h2&gt;
&lt;p&gt;So let&amp;rsquo;s download it on the official website: &lt;a href=&#34;http://www.cygwin.com/&#34;&gt;http://www.cygwin.com/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If you download all files available with Cygwin, prepare yourself to wait several hours.&lt;br&gt;
Indeed, you will need at least 7GB of data.&lt;/p&gt;</description>
    </item>
    <item>
      <title>JavaScript - Tips&#39;n Tricks - Manipulate a child element by reaching the parent with the getElementsByClassName method of the Document Object</title>
      <link>https://www.badprog.com/javascript-tips-n-tricks-manipulate-a-child-element-by-reaching-the-parent-with-the/</link>
      <pubDate>Mon, 19 Sep 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/javascript-tips-n-tricks-manipulate-a-child-element-by-reaching-the-parent-with-the/</guid>
      <description>&lt;p&gt;It is sometimes useful to reach a child element with its parent.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see this with an example by using the &lt;strong&gt;getElementsByClassName&lt;/strong&gt; method of the &lt;strong&gt;Document&lt;/strong&gt; Object.&lt;/p&gt;
&lt;p&gt;The code below will display an image with a red border.&lt;br&gt;
One second later, the border will be changed in black.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s try it:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-java&#34; data-lang=&#34;java&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;![]&lt;/span&gt;(img&lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt;myImage.&lt;span style=&#34;color:#a6e22e&#34;&gt;png&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Interesting, isn&amp;rsquo;t it?&lt;/p&gt;</description>
    </item>
    <item>
      <title>Android - Error - DeviceMonitor</title>
      <link>https://www.badprog.com/android-error-devicemonitor/</link>
      <pubDate>Fri, 16 Sep 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/android-error-devicemonitor/</guid>
      <description>&lt;p&gt;The following error occurs when you try to restart your Android Virtual Device too quickly during another launch, with the Run command of Eclipse:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-java&#34; data-lang=&#34;java&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;This application has requested the Runtime to terminate it in an unusual way.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Please contact the application&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&amp;#39;&lt;/span&gt;s support team &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; more information.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Error during Sync: timeout.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Adb connection Error:An existing connection was forcibly closed by the remote host
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Connection attempts: 1
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Connection attempts: 2
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Connection attempts: 3
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Connection attempts: 4
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Connection attempts: 5
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;To resolve it, close your ADV and restart your application. 😜&lt;/p&gt;</description>
    </item>
    <item>
      <title>Android - Error - ActivityManager</title>
      <link>https://www.badprog.com/android-error-activitymanager/</link>
      <pubDate>Thu, 15 Sep 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/android-error-activitymanager/</guid>
      <description>&lt;p&gt;There, errors took from the ActivityManager within the Eclipse Console for the Android plugin and of course some explanations.&lt;/p&gt;
&lt;h2 id=&#34;1-error-1&#34;&gt;1. Error 1&lt;/h2&gt;
&lt;h3 id=&#34;11-the-console-text&#34;&gt;1.1. The console text&lt;/h3&gt;
&lt;p&gt;ActivityManager: Starting: Intent&lt;br&gt;
{&lt;br&gt;
act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.badprog/.Tutorial&lt;br&gt;
}&lt;br&gt;
&lt;strong&gt;ActivityManager: Warning: Activity not started, its current task has been brought to the front&lt;/strong&gt;&lt;/p&gt;
&lt;h3 id=&#34;12-the-solution&#34;&gt;1.2. The solution&lt;/h3&gt;
&lt;p&gt;This error occurs when you run your application without modifying anything before.&lt;br&gt;
To remove it, just add a space in your code and save it.&lt;br&gt;
Restart your application and this error should have gone. 😊&lt;/p&gt;</description>
    </item>
    <item>
      <title>Android - Tips&#39;n Tricks - Creating components</title>
      <link>https://www.badprog.com/android-tips-n-tricks-creating-components/</link>
      <pubDate>Thu, 15 Sep 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/android-tips-n-tricks-creating-components/</guid>
      <description>&lt;p&gt;Today I will show you how to create 3 Buttons with 3 different ways and how to display them on the layout.&lt;/p&gt;
&lt;p&gt;It will be the &lt;strong&gt;Tuto 3&lt;/strong&gt; that can be found on the Android Market for free, of course.&lt;/p&gt;
&lt;p&gt;First of all, let&amp;rsquo;s explain what we will do.&lt;br&gt;
We want to display 3 Buttons.&lt;br&gt;
For this example, I will use &lt;em&gt;BadprogTutorial&lt;/em&gt; instead of the complete one I used to create the application (&lt;em&gt;Tuto_3_BadprogTutorialCreatingComponentsActivity&lt;/em&gt;).&lt;/p&gt;</description>
    </item>
    <item>
      <title>JavaScript - Object Node - The childElementCount property</title>
      <link>https://www.badprog.com/javascript-object-node-the-childelementcount-property/</link>
      <pubDate>Wed, 14 Sep 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/javascript-object-node-the-childelementcount-property/</guid>
      <description>&lt;p&gt;In this tutorial of the childElementCount property, we will see how to use it.&lt;br&gt;
It is really easy.&lt;br&gt;
This method returns the number of elements of a node.&lt;/p&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-java&#34; data-lang=&#34;java&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Insert title here
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt; Hello
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt; Welcome
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt; On
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt; BadproG.&lt;span style=&#34;color:#a6e22e&#34;&gt;com&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The result is 4, of course. 😊&lt;/p&gt;</description>
    </item>
    <item>
      <title>JavaScript - Object Node - The childNodes property</title>
      <link>https://www.badprog.com/javascript-object-node-the-childnodes-property/</link>
      <pubDate>Wed, 14 Sep 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/javascript-object-node-the-childnodes-property/</guid>
      <description>&lt;p&gt;The &lt;strong&gt;childNodes&lt;/strong&gt; property allows us to select an element of a node.&lt;/p&gt;
&lt;p&gt;For example, we want to retrieve all values of HTML &lt;li&gt; tags inside a &lt;ul&gt; one.&lt;/p&gt;
&lt;p&gt;So, let&amp;rsquo;s try it:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-java&#34; data-lang=&#34;java&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Insert title here
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt; Hello,
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt; welcome
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt; on
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt; BadproG.&lt;span style=&#34;color:#a6e22e&#34;&gt;com&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The result displays all texts of each &lt;li&gt; inside the &lt;ul&gt; HTML tag:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-java&#34; data-lang=&#34;java&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Hello, welcome on BadproG.&lt;span style=&#34;color:#a6e22e&#34;&gt;com&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;As you can see there is a specific technique to retrieve these data.&lt;br&gt;
Indeed, you can not see a text of a &lt;li&gt; with an even &lt;strong&gt;number&lt;/strong&gt;.&lt;br&gt;
You have to use &lt;strong&gt;odd&lt;/strong&gt; ones.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Android - API Google Maps - Using MapView</title>
      <link>https://www.badprog.com/android-api-google-maps-using-mapview/</link>
      <pubDate>Fri, 09 Sep 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/android-api-google-maps-using-mapview/</guid>
      <description>&lt;p&gt;This is the Tuto 2 of the Android tutorial series. You can find the application made here on the Android Market.&lt;br&gt;
Just follow the link on your right.&lt;/p&gt;
&lt;p&gt;The MapView class of the Android Google Maps API is designed to display a map with data obtained from the Google Maps services.&lt;br&gt;
If you never created a Google Maps application on Android, and for a full description and files needed, take a look at this tutorial:&lt;br&gt;
&lt;/android-application-using-google-maps&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Android - Application - Using Google Maps</title>
      <link>https://www.badprog.com/android-application-using-google-maps/</link>
      <pubDate>Thu, 08 Sep 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/android-application-using-google-maps/</guid>
      <description>&lt;p&gt;&lt;strong&gt;As the Google Maps API v1 is now obsolete, I could recommend to check this &lt;a href=&#34;https://www.badprog.com/android-api-google-maps-using-google-maps-api-v2&#34;&gt;tutorial for the new version of Google Maps API v2&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;This &lt;strong&gt;Tuto 1&lt;/strong&gt; could be found on the Android Market and the direct link is on your right, in the menu.&lt;/p&gt;
&lt;p&gt;The Android API allows us to use the Google Maps library.&lt;/p&gt;
&lt;p&gt;So, in this tutorial, for beginners, we will create a first application with some examples of the Google Maps.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Android - API - CharSequence</title>
      <link>https://www.badprog.com/android-api-charsequence/</link>
      <pubDate>Wed, 07 Sep 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/android-api-charsequence/</guid>
      <description>&lt;p&gt;CharSequence is a native Java Interface.&lt;br&gt;
Its path in the package is &lt;strong&gt;android.content&lt;/strong&gt;.&lt;strong&gt;Context.getText(resId)&lt;/strong&gt;&lt;br&gt;
The class &lt;strong&gt;Context&lt;/strong&gt; extends &lt;strong&gt;Object&lt;/strong&gt;.&lt;br&gt;
We will see this with an Hello World! example.&lt;/p&gt;
&lt;h2 id=&#34;1-charsequence-gettext&#34;&gt;1. CharSequence getText()&lt;/h2&gt;
&lt;p&gt;The Android API uses it to create a &lt;strong&gt;getText&lt;/strong&gt; method.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s take an example.&lt;/p&gt;
&lt;p&gt;The Java class:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-java&#34; data-lang=&#34;java&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// src/com.badprog.mobile/BadprogActivity.java&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;package&lt;/span&gt; com.badprog.mobile;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;import&lt;/span&gt; android.app.Activity;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;import&lt;/span&gt; android.os.Bundle;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;import&lt;/span&gt; android.widget.TextView;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;public&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;class&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;BadprogActivity&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;extends&lt;/span&gt; Activity {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;/** Called when the activity is first created. */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;@Override&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;public&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;onCreate&lt;/span&gt;(Bundle savedInstanceState) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;super&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;onCreate&lt;/span&gt;(savedInstanceState);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;TextView tv &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;new&lt;/span&gt; TextView(&lt;span style=&#34;color:#66d9ef&#34;&gt;this&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;CharSequence myString &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; getText(R.&lt;span style=&#34;color:#a6e22e&#34;&gt;string&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;hello&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_world&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_smile);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;tv.&lt;span style=&#34;color:#a6e22e&#34;&gt;setText&lt;/span&gt;(myString);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;setContentView(tv);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then the XML file:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Python 3 - Function - Declaration</title>
      <link>https://www.badprog.com/python-3-function-declaration/</link>
      <pubDate>Tue, 06 Sep 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/python-3-function-declaration/</guid>
      <description>&lt;p&gt;The following code is an example of how declaring a function with Python 3:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;def&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;myFunction&lt;/span&gt;(name):
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;print(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Hello &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; name &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;!&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then to use it:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;myFunction(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;YOU&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;It will display:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Hello YOU&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;!&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;We can note that there is neither semicolon at the end of a code line nor curly brackets.&lt;br&gt;
Only indentation! 😱&lt;/p&gt;</description>
    </item>
    <item>
      <title>Android - API - Activity</title>
      <link>https://www.badprog.com/android-api-activity/</link>
      <pubDate>Sun, 04 Sep 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/android-api-activity/</guid>
      <description>&lt;p&gt;Each Android application has one or more Activities.&lt;br&gt;
Each Activity has a lifecycle.&lt;br&gt;
Each screen we want to use as an interactive component is an Activity.&lt;br&gt;
So this application component must extends the Activity class.&lt;br&gt;
Interactive component is a component that the user uses to do something, for example, send an email, take a photo, etc.&lt;/p&gt;
&lt;h2 id=&#34;1-lifecycle-of-an-activity&#34;&gt;1. Lifecycle of an Activity&lt;/h2&gt;
&lt;p&gt;There is below their fundamental methods:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-java&#34; data-lang=&#34;java&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;public&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;class&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;ExampleActivity&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;extends&lt;/span&gt; Activity {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;@Override&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;public&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;onCreate&lt;/span&gt;(Bundle savedInstanceState) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;super&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;onCreate&lt;/span&gt;(savedInstanceState);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// The activity is being created.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;@Override&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;protected&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;onStart&lt;/span&gt;() {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;super&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;onStart&lt;/span&gt;();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// The activity is about to become visible.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;@Override&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;protected&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;onResume&lt;/span&gt;() {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;super&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;onResume&lt;/span&gt;();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// The activity has become visible (it is now &amp;#34;resumed&amp;#34;).&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;@Override&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;protected&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;onPause&lt;/span&gt;() {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;super&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;onPause&lt;/span&gt;();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// Another activity is taking focus (this activity is about to be &amp;#34;paused&amp;#34;).&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;@Override&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;protected&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;onStop&lt;/span&gt;() {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;super&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;onStop&lt;/span&gt;();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// The activity is no longer visible (it is now &amp;#34;stopped&amp;#34;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;@Override&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;protected&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;onDestroy&lt;/span&gt;() {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;super&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;onDestroy&lt;/span&gt;();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// The activity is about to be destroyed.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;So an activity may be used in interaction with several activities.&lt;br&gt;
When an activity starts another one, the first is always in the stack (the &lt;strong&gt;back stack&lt;/strong&gt;).&lt;br&gt;
The second one may send data to the first with, for example, a return value and after the end of the second one, the first activity receives this data to use it.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Android - Application - First application for beginners with an Hello World tutorial</title>
      <link>https://www.badprog.com/android-application-first-application-for-beginners-with-an-hello-world-tutorial/</link>
      <pubDate>Sun, 04 Sep 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/android-application-first-application-for-beginners-with-an-hello-world-tutorial/</guid>
      <description>&lt;p&gt;Let&amp;rsquo;s play a bit with Android and create our first application, in this tutorial for beginners.&lt;br&gt;
We can call this tutorial: &lt;strong&gt;Tuto 0&lt;/strong&gt;.&lt;br&gt;
You could find it on the Android Market.&lt;/p&gt;
&lt;p&gt;Open Eclipse.&lt;/p&gt;
&lt;p&gt;On the Package Explorer, right click and select:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New &amp;gt; Other &amp;gt; Android &amp;gt; Android Project &amp;gt; Next&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Write the Project Name: &lt;strong&gt;HelloWorld&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;On the Build Target area, select the version of Android you would like to use.&lt;br&gt;
We are selecting the Android 3.2 one for this example.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Android - Installation - On Windows OS and Eclipse</title>
      <link>https://www.badprog.com/android-installation-on-windows-os-and-eclipse/</link>
      <pubDate>Sat, 03 Sep 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/android-installation-on-windows-os-and-eclipse/</guid>
      <description>&lt;p&gt;Let&amp;rsquo;s get started with the installation of Android on Windows 7.&lt;/p&gt;
&lt;p&gt;First of all, you must have a JDK (Java Development Kit) on your OS, the &lt;strong&gt;version 6&lt;/strong&gt; is the most secure one, so I recommand it.&lt;br&gt;
If you do not have one, let&amp;rsquo;s download it on the official website of Oracle:&lt;br&gt;
&lt;a href=&#34;http://www.oracle.com/technetwork/java/javase/downloads/index.html&#34;&gt;http://www.oracle.com/technetwork/java/javase/downloads/index.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Then download the Android SDK (Software Development Kit) on the official website of Android:&lt;br&gt;
&lt;a href=&#34;http://developer.android.com/sdk/index.html&#34;&gt;http://developer.android.com/sdk/index.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Once installed on your computer, launch the SDK Manager on the Android SDK directory if it does not start automatically.&lt;br&gt;
On the left panel, select the &lt;strong&gt;Available packages&lt;/strong&gt; and select all packages you want.&lt;br&gt;
Then click &lt;strong&gt;Install Selected&lt;/strong&gt; &amp;gt; &lt;strong&gt;Accept All.&lt;/strong&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Eclipse - Python - Installation of PyDev with a Python Hello World tutorial</title>
      <link>https://www.badprog.com/eclipse-python-installation-of-pydev-with-a-python-hello-world-tutorial/</link>
      <pubDate>Fri, 02 Sep 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/eclipse-python-installation-of-pydev-with-a-python-hello-world-tutorial/</guid>
      <description>&lt;p&gt;Once you finished your &lt;a href=&#34;https://www.badprog.com/python-3-installing&#34;&gt;installation of Python on your Windows OS&lt;/a&gt;,  &lt;strong&gt;GNU/Linux or Mac OS&lt;/strong&gt;, let me tell you how to install it on your favorite IDE, Eclipse.&lt;/p&gt;
&lt;p&gt;First of all, you have to &lt;a href=&#34;https://www.eclipse.org/downloads/&#34;&gt;download Eclipse on the official website.&lt;/a&gt; I suggest you to choose the JavaScript version.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s go.&lt;br&gt;
Open Eclipse then:&lt;/p&gt;
&lt;p&gt;Help &amp;gt; Eclipse Marketplace.&lt;br&gt;
On the Find input, type &lt;strong&gt;PyDev&lt;/strong&gt; and click the &lt;em&gt;search&lt;/em&gt; icon.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;PyDev - Python IDE for Eclipse&lt;/em&gt; appears.&lt;br&gt;
Click the Install button on the right.&lt;/p&gt;</description>
    </item>
    <item>
      <title>JavaScript - Closure - Three examples for the price of one</title>
      <link>https://www.badprog.com/javascript-closure-three-examples-for-the-price-of-one/</link>
      <pubDate>Thu, 01 Sep 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/javascript-closure-three-examples-for-the-price-of-one/</guid>
      <description>&lt;p&gt;It is possible to pass arguments on a parent function to add these arguments on the nested one.&lt;br&gt;
Can you believe this?&lt;br&gt;
One calls this a &lt;strong&gt;closure&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s start with an easy example without any closure:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-java&#34; data-lang=&#34;java&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// test1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;function &lt;span style=&#34;color:#a6e22e&#34;&gt;fTop&lt;/span&gt;(a) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; a;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; fake1 &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; fTop(1);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; fake2 &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; fTop(2);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;alert(fake1 &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; fake2);
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;And the result is&amp;hellip;?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;3&lt;/strong&gt; of course!&lt;/p&gt;
&lt;p&gt;OK, it was easy.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s continue with this new example, a little more astonishing:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Python 3 - Installing - On Windows 7</title>
      <link>https://www.badprog.com/python-3-installing-on-windows-7/</link>
      <pubDate>Thu, 01 Sep 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/python-3-installing-on-windows-7/</guid>
      <description>&lt;p&gt;First of all, let&amp;rsquo;s download the last version of Python 3 on the official website of Python : &lt;a href=&#34;http://www.python.org/download/releases/&#34;&gt;http://www.python.org/download/releases/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I suggest you to select the last one. And of course to choose the right version of your Operating System (OS).&lt;/p&gt;
&lt;p&gt;For this Python tutorial on Windows 7, we will take, of course, the &lt;strong&gt;Windows X86-64 MSI Installer&lt;/strong&gt; because the installation is under &lt;strong&gt;Windows 7 - 64 bits&lt;/strong&gt;.&lt;br&gt;
If you do not know if your Windows 7 is 64 bits or not, choose the &lt;strong&gt;Windows x86 MSI Installer&lt;/strong&gt;.&lt;br&gt;
This version will work on both &lt;strong&gt;32 and 64 bits&lt;/strong&gt;, so do not hesitate to take it in any doubt.&lt;/p&gt;</description>
    </item>
    <item>
      <title>JavaScript - Window Object - The alert() method</title>
      <link>https://www.badprog.com/javascript-window-object-the-alert-method/</link>
      <pubDate>Wed, 24 Aug 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/javascript-window-object-the-alert-method/</guid>
      <description>&lt;p&gt;In this JavaScript tutorial we will see that the behaviour of the &lt;strong&gt;JavaScript alert() method&lt;/strong&gt; is sometimes not that we can hope.&lt;/p&gt;
&lt;p&gt;First of all, let&amp;rsquo;s create a new directory named &lt;em&gt;js&lt;/em&gt; and add the &lt;em&gt;myAlert.js&lt;/em&gt; script inside:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-java&#34; data-lang=&#34;java&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// js/myAlert.js&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;alert(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;9&amp;#39;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then in our &lt;strong&gt;index.html&lt;/strong&gt; we add this one:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-java&#34; data-lang=&#34;java&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Alert testing
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Some text.
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In this example it is expected that the &lt;strong&gt;alert() methods&lt;/strong&gt; are called in this order:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Symfony 1 - Helper - UrlHelper</title>
      <link>https://www.badprog.com/symfony-1-helper-urlhelper/</link>
      <pubDate>Sun, 14 Aug 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/symfony-1-helper-urlhelper/</guid>
      <description>&lt;p&gt;Symfony UrlHelpers add some features to the URL management.&lt;/p&gt;
&lt;p&gt;In this Symfony UrlHelpers tutorial, we will see how to use them with some examples.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s start with the &lt;strong&gt;link_to&lt;/strong&gt; UrlHelper:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-php&#34; data-lang=&#34;php&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;php&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;echo&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;link\_to&lt;/span&gt;(    &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;My page&amp;#39;&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                    &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;level/index&amp;#39;&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                    &lt;span style=&#34;color:#66d9ef&#34;&gt;array&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;confirm&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;go?&amp;#39;&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                        &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;absolute&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;true&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                        &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;query\_string&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;foo=32&amp;#39;&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                        &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;anchor&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;hello&amp;#39;&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                        &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;post&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;true&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                    ));
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;?&amp;gt;&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This PHP code will produce this HTML one:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-php&#34; data-lang=&#34;php&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;My&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;page&lt;/span&gt;](&lt;span style=&#34;color:#a6e22e&#34;&gt;http&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;://&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;myproject&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;frontend_dev&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;php&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;level&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;?&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;foo&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;32&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#hello)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;It will ask you if you accept to continue or not.&lt;br&gt;
You have to use the right syntax such as &amp;ldquo;&lt;em&gt;module/action&amp;rdquo;&lt;/em&gt;, otherwise this will not work correctly.&lt;br&gt;
As you can see, it will create a lot of JavaScript code.&lt;br&gt;
You will have less code if you remove the &lt;em&gt;post&lt;/em&gt; option and will can add the &lt;em&gt;popup&lt;/em&gt; option and set it to &lt;em&gt;true&lt;/em&gt; to open a new window when clicking.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Symfony 1 - Routing - Creating a URL with dashes (manually)</title>
      <link>https://www.badprog.com/symfony-1-routing-creating-a-url-with-dashes-manually/</link>
      <pubDate>Tue, 09 Aug 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/symfony-1-routing-creating-a-url-with-dashes-manually/</guid>
      <description>&lt;p&gt;A great way to display URLs is to using dashes.&lt;/p&gt;
&lt;p&gt;Indeed, it is always better for an human being to see a reading URL instead of a succession of symbols.&lt;/p&gt;
&lt;p&gt;That is what we will see in this Symfony 1 tutorial about routing.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s take an example.&lt;br&gt;
We want to create a module that represents a tutorial for beginners.&lt;/p&gt;
&lt;p&gt;Our application is named Badprog.&lt;br&gt;
Our model might be called : BadprogBeginnerTutorial.&lt;br&gt;
So the module might be called : beginnnertutorial.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Symfony 1 - Security - Authentication</title>
      <link>https://www.badprog.com/symfony-1-security-authentication/</link>
      <pubDate>Mon, 01 Aug 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/symfony-1-security-authentication/</guid>
      <description>&lt;p&gt;Symfony 1 uses the YAML files to secure the application.&lt;/p&gt;
&lt;p&gt;For example, in this tutorial, we can see with the backend side how to secure the entire application.&lt;br&gt;
But we can also secure only the index of a module or all others webpages excepted the index.&lt;br&gt;
This, with an authenfication.&lt;/p&gt;
&lt;p&gt;By default, in your backend side, you have a &lt;em&gt;security.yml&lt;/em&gt; file:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-php&#34; data-lang=&#34;php&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// apps/backend/config/security.yml
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;default&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;is\_secure&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;false&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Change the boolean &lt;strong&gt;false&lt;/strong&gt; into &lt;strong&gt;true&lt;/strong&gt; and save it.&lt;/p&gt;</description>
    </item>
    <item>
      <title>PHP 5 - PEAR - Installation</title>
      <link>https://www.badprog.com/php-5-pear-installation/</link>
      <pubDate>Sun, 31 Jul 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/php-5-pear-installation/</guid>
      <description>&lt;p&gt;In this tutorial, we will see how to install PEAR with PHP 5 on Windows 7.&lt;/p&gt;
&lt;p&gt;We, of course, assume that you already installed PHP.&lt;/p&gt;
&lt;p&gt;For example, the PHP path installation is:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-php&#34; data-lang=&#34;php&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;C&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;\Program&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;Files&lt;/span&gt; (&lt;span style=&#34;color:#a6e22e&#34;&gt;x86&lt;/span&gt;)&lt;span style=&#34;color:#a6e22e&#34;&gt;\PHP\php&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;5&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Inside there is a file named:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-php&#34; data-lang=&#34;php&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;go&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;pear&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;bat&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Double click it.&lt;/p&gt;
&lt;p&gt;A black window appears asking you what installation do you prefer.&lt;/p&gt;
&lt;p&gt;Write:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-php&#34; data-lang=&#34;php&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;system&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;A suggestion appears asking you if the default directories for the PEAR installation.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Symfony 1 - Test Unit - With Doctrine and a database</title>
      <link>https://www.badprog.com/symfony-1-test-unit-with-doctrine-and-a-database/</link>
      <pubDate>Sun, 31 Jul 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/symfony-1-test-unit-with-doctrine-and-a-database/</guid>
      <description>&lt;p&gt;In this test unit tutorial of the Symfony 1 framework, we will take examples to show how it works with Doctrine and a database.&lt;/p&gt;
&lt;p&gt;First of all, you have to set up a database to test and create some fixtures.&lt;br&gt;
If you have not done it yet, take a look at this tutorial:&lt;/p&gt;
&lt;/symfony-1-doctrine-set-up-a-new-database&gt;
&lt;p&gt;Then we can create a special database for tests.&lt;/p&gt;
&lt;p&gt;For this new test database, we can either copy/paste all fixture files from /data/fixtures/* in /test/fixtures/* or use directly the fixtures of the /data/fixtures/*.&lt;/p&gt;</description>
    </item>
    <item>
      <title>PHP 5 - Installation - On Windows</title>
      <link>https://www.badprog.com/php-5-installation-on-windows/</link>
      <pubDate>Wed, 27 Jul 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/php-5-installation-on-windows/</guid>
      <description>&lt;p&gt;I made a tutorial with examples for the installation of Apache HTTP, PHP, MySQL, phpMyAdmin and some virtual host explanations, for Windows.&lt;/p&gt;
&lt;p&gt;You can find this tutorial by following this link:&lt;/p&gt;
&lt;/windows-7-installing-php-apache-http-mysql-phpmyadmin-on-windows&gt;
&lt;p&gt;Enjoy&lt;/p&gt;</description>
    </item>
    <item>
      <title>Symfony 1 - Routing - Creating a basic route</title>
      <link>https://www.badprog.com/symfony-1-routing-creating-a-basic-route/</link>
      <pubDate>Thu, 21 Jul 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/symfony-1-routing-creating-a-basic-route/</guid>
      <description>&lt;p&gt;In this tutorial of the Symfony 1 framework, we will see how to create a new easy basic route.&lt;/p&gt;
&lt;p&gt;The &lt;em&gt;url_for()&lt;/em&gt; method will help us to create this routing.&lt;br&gt;
In the layout, let&amp;rsquo;s first add a link to our new page, called B&lt;em&gt;apdroG&lt;/em&gt; and its corresponding route, called &lt;em&gt;routingBadprog&lt;/em&gt;.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-php&#34; data-lang=&#34;php&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// frontend/templates/layout.php- [BadproG](&amp;lt;?php echo url_for(&amp;#39;routingBadprog&amp;#39;) ?&amp;gt;)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If you try to refresh your webpage, you will have a 500 error, saying that the route &amp;ldquo;routingBadprog&amp;rdquo; does not exist.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Eclipse - Indigo - PHP installation with PHP Development Tools (PDT)</title>
      <link>https://www.badprog.com/eclipse-indigo-php-installation-with-php-development-tools-pdt/</link>
      <pubDate>Sun, 17 Jul 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/eclipse-indigo-php-installation-with-php-development-tools-pdt/</guid>
      <description>&lt;p&gt;With the last Eclipse version, Indigo, there is no special IDE for PHP.&lt;br&gt;
So you have either to install the Helios PDT version or install Indigo and then install PDT.&lt;/p&gt;
&lt;p&gt;I love innovation, so I will show you how to install, in this tutorial, the new Indigo version and then PDT within.&lt;/p&gt;
&lt;p&gt;First of all, download the Indigo Eclipse version on the official website: &lt;a href=&#34;http://www.eclipse.org/&#34;&gt;http://www.eclipse.org&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Ckick Download and choose the right version you want. I suggest you the Eclipse IDE for JavaScript Web Developers.&lt;br&gt;
Once downloaded and installed, open Eclipse and click:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Symfony 1 - MVC - How does it work?</title>
      <link>https://www.badprog.com/symfony-1-mvc-how-does-it-work/</link>
      <pubDate>Sun, 17 Jul 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/symfony-1-mvc-how-does-it-work/</guid>
      <description>&lt;p&gt;In this tutorial I will show you how the symfony framework works with the MVC pattern.&lt;/p&gt;
&lt;p&gt;Each application, for example the frontend, has one or several modules.&lt;/p&gt;
&lt;p&gt;Each module has one or several Controllers and Views.&lt;/p&gt;
&lt;p&gt;The first Controller of a module is in the &lt;em&gt;actions&lt;/em&gt; directory and the &lt;em&gt;actions.class.php&lt;/em&gt; file that can be found there:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-php&#34; data-lang=&#34;php&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;symfony&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;apps&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;frontend&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;modules&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;moduleName&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;actions&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;actions&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;class&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;php&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The Views in the &lt;em&gt;templates&lt;/em&gt; directory and they are suffixed by the &lt;em&gt;Success&lt;/em&gt; word, except for the &lt;em&gt;_form&lt;/em&gt; file.&lt;/p&gt;</description>
    </item>
    <item>
      <title>MySQL - Installation - On Windows</title>
      <link>https://www.badprog.com/mysql-installation-on-windows/</link>
      <pubDate>Wed, 13 Jul 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/mysql-installation-on-windows/</guid>
      <description>&lt;p&gt;I made a tutorial with examples for the installation of Apache HTTP, PHP, MySQL, phpMyAdmin and some virtual host explanations, for Windows.&lt;/p&gt;
&lt;p&gt;You can find this tutorial by following this link:&lt;/p&gt;
&lt;/windows-7-installing-php-apache-http-mysql-phpmyadmin-on-windows&gt;
&lt;p&gt;Enjoy&lt;/p&gt;</description>
    </item>
    <item>
      <title>Eclipse - Explorer - Removing all .svn folders</title>
      <link>https://www.badprog.com/eclipse-explorer-removing-all-svn-folders/</link>
      <pubDate>Mon, 11 Jul 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/eclipse-explorer-removing-all-svn-folders/</guid>
      <description>&lt;p&gt;You maybe wondering how to remove .svn folders from your Eclipse explorer.&lt;br&gt;
In this tutorial we will see how to hide .svn directories.&lt;/p&gt;
&lt;p&gt;Open your Eclipse.&lt;br&gt;
Click the project name in the explorer.&lt;br&gt;
Right click it.&lt;br&gt;
Then:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-xml&#34; data-lang=&#34;xml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Properties &amp;gt; Resource &amp;gt; Resource Filters
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Click the Add button on the right.&lt;/p&gt;
&lt;p&gt;Select:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-xml&#34; data-lang=&#34;xml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Exclude all
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Folders and All children (recursive)
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then write in the input:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-xml&#34; data-lang=&#34;xml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;.svn
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Click OK.&lt;br&gt;
Click Apply.&lt;br&gt;
Click OK.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Symfony 1 - Error - SQL and Doctrine with the command line</title>
      <link>https://www.badprog.com/symfony-1-error-sql-and-doctrine-with-the-command-line/</link>
      <pubDate>Sun, 10 Jul 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/symfony-1-error-sql-and-doctrine-with-the-command-line/</guid>
      <description>&lt;p&gt;In this page, I&amp;rsquo;m gathering all errors that I will find while playing with Symfony and SQL requests.&lt;br&gt;
And of course I will bring some explanations to resolve these errors.&lt;br&gt;
It will be sliced by an example of each error and with its own solution.&lt;br&gt;
So, let&amp;rsquo;s start it because a problem has always a solution!&lt;/p&gt;
&lt;h2 id=&#34;example-1&#34;&gt;Example 1&lt;/h2&gt;
&lt;p&gt;For example you typed this in your command line:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ php symfony doctrine:build --all --no-confirmation ; php symfony doctrine:data-load
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;And you have this error:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Symfony 1 - Doctrine - Set up a new database</title>
      <link>https://www.badprog.com/symfony-1-doctrine-set-up-a-new-database/</link>
      <pubDate>Sat, 09 Jul 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/symfony-1-doctrine-set-up-a-new-database/</guid>
      <description>&lt;p&gt;In this tutorial we will see how to set up a database with Symfony 1 and doctrine examples.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s start by writing some code in the &lt;em&gt;schema.sql&lt;/em&gt; file.&lt;br&gt;
We will create the &lt;em&gt;Hello&lt;/em&gt; project with this &lt;em&gt;hello&lt;/em&gt; database.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-php&#34; data-lang=&#34;php&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# config/doctrine/schema.yml
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;HelloCategory&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#a6e22e&#34;&gt;actAs&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; { &lt;span style=&#34;color:#a6e22e&#34;&gt;Timestampable&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;~&lt;/span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#a6e22e&#34;&gt;columns&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;name&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; { &lt;span style=&#34;color:#a6e22e&#34;&gt;type&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;string&lt;/span&gt;(&lt;span style=&#34;color:#ae81ff&#34;&gt;255&lt;/span&gt;), &lt;span style=&#34;color:#a6e22e&#34;&gt;notnull&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;true&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;unique&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;true&lt;/span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;HelloBook&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#a6e22e&#34;&gt;actAs&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; { &lt;span style=&#34;color:#a6e22e&#34;&gt;Timestampable&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;~&lt;/span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#a6e22e&#34;&gt;columns&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;category\_id&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt;  { &lt;span style=&#34;color:#a6e22e&#34;&gt;type&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;integer&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;notnull&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;true&lt;/span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;email&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt;        { &lt;span style=&#34;color:#a6e22e&#34;&gt;type&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;string&lt;/span&gt;(&lt;span style=&#34;color:#ae81ff&#34;&gt;255&lt;/span&gt;), &lt;span style=&#34;color:#a6e22e&#34;&gt;notnull&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;true&lt;/span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;expires\_at&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt;   { &lt;span style=&#34;color:#a6e22e&#34;&gt;type&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;timestamp&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;notnull&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;true&lt;/span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;relations&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;HelloCategory&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; { &lt;span style=&#34;color:#a6e22e&#34;&gt;onDelete&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;CASCADE&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;local&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;category\_id&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;foreign&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;id&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;foreignAlias&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;HelloBooks&lt;/span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;We continue by typing a command line for connecting to the database.&lt;br&gt;
The name of your project will be also the name of the database:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Symfony 1 - Set up - A new project</title>
      <link>https://www.badprog.com/symfony-1-set-up-a-new-project/</link>
      <pubDate>Sat, 09 Jul 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/symfony-1-set-up-a-new-project/</guid>
      <description>&lt;p&gt;In this tutorial of Symfony 1, we will set up a project from scratch.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s start it by downloading the project that you can find on the official web page of Symfony: &lt;a href=&#34;http://www.symfony-project.org/installation&#34;&gt;http://www.symfony-project.org/installation&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This tutorial will use the 1.4.12 version.&lt;/p&gt;
&lt;p&gt;Once done, come back there.&lt;/p&gt;
&lt;p&gt;Just before starting, do not forget that for Windows, you have to use a SLASH (/) and for GNU/Linux a BACKSLAH () for you PATH.&lt;br&gt;
And of course, replace &lt;em&gt;yourProjectName&lt;/em&gt; by yours.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Apache - HTTP - Installation</title>
      <link>https://www.badprog.com/apache-http-installation/</link>
      <pubDate>Wed, 06 Jul 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/apache-http-installation/</guid>
      <description>&lt;p&gt;I made a tutorial with examples for the installation of Apache HTTP, PHP, MySQL, phpMyAdmin and some virtual host explanations, for Windows.&lt;/p&gt;
&lt;p&gt;You can find this tutorial by following this link:&lt;/p&gt;
&lt;/windows-7-installing-php-apache-http-mysql-phpmyadmin-on-windows&gt;
&lt;p&gt;Enjoy&lt;/p&gt;</description>
    </item>
    <item>
      <title>Apache - HTTP - Errors</title>
      <link>https://www.badprog.com/apache-http-errors/</link>
      <pubDate>Tue, 28 Jun 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/apache-http-errors/</guid>
      <description>&lt;p&gt;If all your web installation was working fine and you do not know why now nothing is working anymore, with a beautiful error such as: &amp;ldquo;Could not connect to localhost&amp;rdquo;, let&amp;rsquo;s try this solution.&lt;/p&gt;
&lt;p&gt;First of all, try to stop your Apache HTTP server manually.&lt;br&gt;
Left click on it on your tray icon in your taskbar:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-xml&#34; data-lang=&#34;xml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Apache 2.2 &amp;gt; Stop
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If nothing happens, this is because your server is still running in an infinite loop.&lt;br&gt;
So do not panic and wait around one minute.&lt;br&gt;
Normally the server would stop.&lt;br&gt;
So restart it with left click and:&lt;/p&gt;</description>
    </item>
    <item>
      <title>phpMyAdmin - Installation - On Windows</title>
      <link>https://www.badprog.com/phpmyadmin-installation-on-windows/</link>
      <pubDate>Tue, 21 Jun 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/phpmyadmin-installation-on-windows/</guid>
      <description>&lt;p&gt;I made a tutorial with examples for the installation of Apache HTTP, PHP, MySQL, phpMyAdmin and some virtual host explanations, for Windows.&lt;/p&gt;
&lt;p&gt;You can find this tutorial by following this link:&lt;/p&gt;
&lt;/windows-7-installing-php-apache-http-mysql-phpmyadmin-on-windows&gt;
&lt;p&gt;Enjoy&lt;/p&gt;</description>
    </item>
    <item>
      <title>Zend - Framework 1.11 - Using the zf command line tool</title>
      <link>https://www.badprog.com/zend-framework-1-11-using-the-zf-command-line-tool/</link>
      <pubDate>Tue, 21 Jun 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/zend-framework-1-11-using-the-zf-command-line-tool/</guid>
      <description>&lt;p&gt;An easy way to create a new Controller is by doing this with the command line.&lt;/p&gt;
&lt;p&gt;On Windows, open a new terminal (SHIFT + right click on your project directory) and write this:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ TheProjectDirectory&amp;gt; CompletePathUntil&lt;span style=&#34;color:#ae81ff&#34;&gt;\Z&lt;/span&gt;endFramework-1.11.7&lt;span style=&#34;color:#ae81ff&#34;&gt;\b&lt;/span&gt;in&lt;span style=&#34;color:#ae81ff&#34;&gt;\z&lt;/span&gt;f.bat create controller Menu
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;It will create:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;A controller in /application/controller/MenuController.php&lt;/li&gt;
&lt;li&gt;An indexAction in the MenuController file&lt;/li&gt;
&lt;li&gt;A view script in /view/scripts/menu/index.phtml&lt;/li&gt;
&lt;li&gt;An update for the project file: .zfproject.xml&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;All that in a single line.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Zend - Framework 1.11 - Using Zend_Controller</title>
      <link>https://www.badprog.com/zend-framework-1-11-using-zend-controller/</link>
      <pubDate>Tue, 21 Jun 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/zend-framework-1-11-using-zend-controller/</guid>
      <description>&lt;p&gt;Let&amp;rsquo;s explain, with this tutorial, how this Zend_Controller works.&lt;/p&gt;
&lt;p&gt;I added some examples in addition of the official documentation, even if most of my text is taking from the Zend documentation.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Zend_Controller_Front&lt;/strong&gt; is the heart of this MVC framework.&lt;br&gt;
It intercepts all requests and dispatches them to all adequate controllers.&lt;br&gt;
Each controller has one or several action methods and each action has a view script.&lt;br&gt;
It means that if we have a MenuController with a method named firstAction(), we will have the template /view/scripts/menu/first.phtml to display content of the firstAction() method.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C - Library functions - Using strcmp()</title>
      <link>https://www.badprog.com/c-library-functions-using-strcmp/</link>
      <pubDate>Tue, 07 Jun 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-library-functions-using-strcmp/</guid>
      <description>&lt;p&gt;In this tutorial we will see how to use the &lt;strong&gt;strcmp()&lt;/strong&gt; function.&lt;br&gt;
It returns:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;-1 if the first argument is less than the second&lt;/li&gt;
&lt;li&gt;0 if the first argument is equal to the second&lt;/li&gt;
&lt;li&gt;1 if the first argument is greater than the second&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;We need the &lt;em&gt;string.h&lt;/em&gt; include to use this function.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see this example of the &lt;strong&gt;strcmp()&lt;/strong&gt; function:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// compare.c
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;main&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; ac, &lt;span style=&#34;color:#66d9ef&#34;&gt;char&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;av[])
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;char&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;word;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; cmp;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;word &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;badprog&amp;#34;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cmp &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;strcmp&lt;/span&gt;(av[&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;], word);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (&lt;span style=&#34;color:#f92672&#34;&gt;!&lt;/span&gt;cmp)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Match, indeed, strcmp = %d&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, cmp);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;else&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Do not match, indeed, strcmp = %d&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, cmp);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; (&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Compiling and executing:&lt;/p&gt;</description>
    </item>
    <item>
      <title>C - Recursion - Displaying a string</title>
      <link>https://www.badprog.com/c-recursion-displaying-a-string/</link>
      <pubDate>Tue, 07 Jun 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-recursion-displaying-a-string/</guid>
      <description>&lt;p&gt;In this tutorial we will see how to display a string with the recursive method.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see this example of the recursive and the iterative method with the functions below:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// recursion.c
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;void displayString\_iterative(char *str)&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; i;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;i &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;while&lt;/span&gt; (str[i])
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;write&lt;/span&gt;(&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;, &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;str[i&lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;], &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; displayString&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_recursive&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;char&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;str)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (&lt;span style=&#34;color:#a6e22e&#34;&gt;strlen&lt;/span&gt;(str) &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;write&lt;/span&gt;(&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;, &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;str[&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;], &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;displayString&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_recursive&lt;/span&gt;(str &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;main&lt;/span&gt;()
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;displayString&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_recursive&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Hello BadproG.com!&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;displayString&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_iterative&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Hello BadproG.com!&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; (&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Let&amp;rsquo;s compile and execute it:&lt;/p&gt;</description>
    </item>
    <item>
      <title>C - Character manipulation - Allocation memory</title>
      <link>https://www.badprog.com/c-character-manipulation-allocation-memory/</link>
      <pubDate>Wed, 18 May 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-character-manipulation-allocation-memory/</guid>
      <description>&lt;p&gt;It is hard to understand conceptually what is happening when we create a string with and without &lt;strong&gt;malloc()&lt;/strong&gt; allocation.&lt;br&gt;
That is what we will see in this tutorial.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see some examples of allocation memory, with and without malloc(), and let&amp;rsquo;s see what is happening in the memory:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;main&lt;/span&gt;()
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;char&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;str1;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;char&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;str2;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;char&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;str3;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;char&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;str4;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;char&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;str5;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;str1 &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;hell&amp;#34;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;str2 &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;hello&amp;#34;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;str3 &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;hello&amp;#34;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;str4 &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;hello&amp;#34;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;str5 &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;malloc&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;sizeof&lt;/span&gt;(&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;str2) &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;5&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;str5[&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;] &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;h&amp;#39;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;str5[&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;] &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;e&amp;#39;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;str5[&lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;] &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;l&amp;#39;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;str5[&lt;span style=&#34;color:#ae81ff&#34;&gt;3&lt;/span&gt;] &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;l&amp;#39;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;str5[&lt;span style=&#34;color:#ae81ff&#34;&gt;4&lt;/span&gt;] &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;o&amp;#39;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;str5[&lt;span style=&#34;color:#ae81ff&#34;&gt;5&lt;/span&gt;] &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;\0&amp;#39;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;str1 | %c - %c - %c - %c&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, str1[&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;], str1[&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;], str1[&lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;], str1[&lt;span style=&#34;color:#ae81ff&#34;&gt;3&lt;/span&gt;]);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;str1 | %p - %p - %p - %p&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;str1[&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;], &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;str1[&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;], &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;str1[&lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;], &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;str1[&lt;span style=&#34;color:#ae81ff&#34;&gt;3&lt;/span&gt;]);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;str2 | %c - %c - %c - %c - %c&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, str2[&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;], str2[&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;], str2[&lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;],str2[&lt;span style=&#34;color:#ae81ff&#34;&gt;3&lt;/span&gt;], str2[&lt;span style=&#34;color:#ae81ff&#34;&gt;4&lt;/span&gt;]);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;str2 | %p - %p - %p - %p - %p&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;str2[&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;], &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;str2[&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;], &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;str2[&lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;], &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;str2[&lt;span style=&#34;color:#ae81ff&#34;&gt;3&lt;/span&gt;], &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;str2[&lt;span style=&#34;color:#ae81ff&#34;&gt;4&lt;/span&gt;]);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;str3 | %c - %c - %c - %c - %c&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, str3[&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;], str3[&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;], str3[&lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;],str3[&lt;span style=&#34;color:#ae81ff&#34;&gt;3&lt;/span&gt;], str3[&lt;span style=&#34;color:#ae81ff&#34;&gt;4&lt;/span&gt;]);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;str3 | %p - %p - %p - %p - %p&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;str3[&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;], &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;str3[&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;], &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;str3[&lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;], &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;str3[&lt;span style=&#34;color:#ae81ff&#34;&gt;3&lt;/span&gt;], &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;str3[&lt;span style=&#34;color:#ae81ff&#34;&gt;4&lt;/span&gt;]);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;str4 | %c - %c - %c - %c - %c&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, str4[&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;], str4[&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;], str4[&lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;],str4[&lt;span style=&#34;color:#ae81ff&#34;&gt;3&lt;/span&gt;], str4[&lt;span style=&#34;color:#ae81ff&#34;&gt;4&lt;/span&gt;]);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;str4 | %p - %p - %p - %p - %p&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;str4[&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;], &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;str4[&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;], &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;str4[&lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;], &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;str4[&lt;span style=&#34;color:#ae81ff&#34;&gt;3&lt;/span&gt;], &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;str4[&lt;span style=&#34;color:#ae81ff&#34;&gt;4&lt;/span&gt;]);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;str5 | %c - %c - %c - %c - %c&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, str5[&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;], str5[&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;], str5[&lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;],str5[&lt;span style=&#34;color:#ae81ff&#34;&gt;3&lt;/span&gt;], str5[&lt;span style=&#34;color:#ae81ff&#34;&gt;4&lt;/span&gt;]);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;str5 | %p - %p - %p - %p - %p&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;str5[&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;], &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;str5[&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;], &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;str5[&lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;], &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;str5[&lt;span style=&#34;color:#ae81ff&#34;&gt;3&lt;/span&gt;], &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;str5[&lt;span style=&#34;color:#ae81ff&#34;&gt;4&lt;/span&gt;]);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;free&lt;/span&gt;(str5);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; (&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Let&amp;rsquo;s compile it and execute it:&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - Emacs - Auto-completion with Auto-complete</title>
      <link>https://www.badprog.com/unix-gnu-linux-emacs-auto-completion-with-auto-complete/</link>
      <pubDate>Tue, 03 May 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-emacs-auto-completion-with-auto-complete/</guid>
      <description>&lt;p&gt;We all agree, without any auto-completion, write always the same functions is really annoying.&lt;br&gt;
A guy named Tomohiro Matsuyama has created an auto-completion plugin, really helpful.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s install it together in this tutorial.&lt;br&gt;
First of all, &lt;a href=&#34;http://cx4a.org/software/auto-complete/&#34;&gt;download the latest auto-complete&amp;rsquo;s version&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;We have now to extract it:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ tar xjf auto-complete-1.3.1.tar.bz2
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Open a new file with Emacs:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ emacs badprog
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Wihtin, type ALT + X and write &lt;em&gt;load-file&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;Type RETURN.&lt;/p&gt;
&lt;p&gt;And write it:&lt;/p&gt;</description>
    </item>
    <item>
      <title>C - Linked lists - Head and End</title>
      <link>https://www.badprog.com/c-linked-lists-head-and-end/</link>
      <pubDate>Sat, 16 Apr 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-linked-lists-head-and-end/</guid>
      <description>&lt;p&gt;I hope you liked my fantastic &lt;a href=&#34;https://www.badprog.com/c-linked-lists-simple-example&#34;&gt;simple example of linked list&lt;/a&gt; (OK it was not so exciting, but it works fine).&lt;/p&gt;
&lt;p&gt;SO, let&amp;rsquo;s try today a tutorial of a linked list where we will able to add and display elements in our linked list, first by adding elements from the head and then from the queue (or the end).&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s start our example of this famous linked list by adding elements from the head and from the end:&lt;/p&gt;</description>
    </item>
    <item>
      <title>C - Library functions - Using daemon()</title>
      <link>https://www.badprog.com/c-library-functions-using-daemon/</link>
      <pubDate>Fri, 15 Apr 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-library-functions-using-daemon/</guid>
      <description>&lt;p&gt;In this tutorial we will see the &lt;strong&gt;daemon()&lt;/strong&gt; function.&lt;br&gt;
This function is designed to launch a program in background.&lt;/p&gt;
&lt;p&gt;So when you exectute a program it will start and if you want to stop it, just make a Ctrl + C.&lt;/p&gt;
&lt;p&gt;The program will stop instantly.&lt;/p&gt;
&lt;p&gt;Now, with the daemon function, the program will not stop even with a Ctrl + C.&lt;br&gt;
To stop it, you have to kill the process with the kill command.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Java - Variable - Casting</title>
      <link>https://www.badprog.com/java-variable-casting/</link>
      <pubDate>Wed, 13 Apr 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/java-variable-casting/</guid>
      <description>&lt;p&gt;Let&amp;rsquo;s see how to use casting in JAVA in a simple tutorial.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see an example of casting variabless in JAVA, with String.valueOf() and Integer.valueOf() methods:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-java&#34; data-lang=&#34;java&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;public&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;class&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;Main&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#75715e&#34;&gt;/**
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;     * @param args
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;     */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;public&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;static&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;main&lt;/span&gt;(String&lt;span style=&#34;color:#f92672&#34;&gt;[]&lt;/span&gt; args) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;       
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;    theNumber        &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; 12;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        String theString    &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;new&lt;/span&gt; String();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt;    anotherNumber;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;       
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;       
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        theString &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; String.&lt;span style=&#34;color:#a6e22e&#34;&gt;valueOf&lt;/span&gt;(theNumber);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        anotherNumber &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; Integer.&lt;span style=&#34;color:#a6e22e&#34;&gt;valueOf&lt;/span&gt;(theString);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        theString &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; theString &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; 1;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        anotherNumber &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; anotherNumber &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; 1;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        System.&lt;span style=&#34;color:#a6e22e&#34;&gt;out&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;println&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;theNumber = &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; theNumber);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        System.&lt;span style=&#34;color:#a6e22e&#34;&gt;out&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;println&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;theString = &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; theString);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        System.&lt;span style=&#34;color:#a6e22e&#34;&gt;out&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;println&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;anotherNumber = &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; anotherNumber);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Result:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Java -  SE - Application HelloWorld.jar</title>
      <link>https://www.badprog.com/java-se-application-helloworld-jar/</link>
      <pubDate>Sun, 10 Apr 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/java-se-application-helloworld-jar/</guid>
      <description>&lt;p&gt;You can transform a Java project into a JAR file. This JAR file is a Java Archive of several Java files.&lt;/p&gt;
&lt;p&gt;It can be executed like a program.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see a way to create a JAR file, with 2 IDE such as NetBeans and Eclipse, and we will execute it with a command line tool.&lt;/p&gt;
&lt;h2 id=&#34;click-on-clean-and-build-main-project-with-netbeans-this-is-the-hammer-with-the-brooms-with-eclipse-you-have-to-click-on-file--export--java--runnable-jar-file--select-the-project-the-path-and-name-it-helloworld--finish&#34;&gt;Click on Clean and build main project, with NetBeans, this is the Hammer with the brooms. With Eclipse you have to click on: File &amp;gt; Export &amp;gt; Java &amp;gt; Runnable JAR file &amp;gt; Select the project, the path and name it HelloWorld &amp;gt; Finish.&lt;/h2&gt;
&lt;p&gt;It will remove all old compiled files and recompile the project to build a JAR file.&lt;br&gt;
A JAR file is like a ZIP archive that contains all compiled files.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Java - Variable - Declaration</title>
      <link>https://www.badprog.com/java-variable-declaration/</link>
      <pubDate>Sun, 10 Apr 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/java-variable-declaration/</guid>
      <description>&lt;p&gt;Let&amp;rsquo;s see how to use variables in JAVA in a simple tutorial.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see an example of variable declarations in JAVA:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-java&#34; data-lang=&#34;java&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;public&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;class&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;Main&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;/**
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;* @param args
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;*/&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;public&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;static&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;main&lt;/span&gt;(String&lt;span style=&#34;color:#f92672&#34;&gt;[]&lt;/span&gt; args) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;byte&lt;/span&gt; aByte;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;short&lt;/span&gt; aShort;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; anInt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;long&lt;/span&gt; aLong;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;float&lt;/span&gt; aFloat;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;double&lt;/span&gt; aDouble;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;char&lt;/span&gt; aChar;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;boolean&lt;/span&gt; aBoolean;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;aByte &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; 123;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;aShort &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; 12345;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;anInt &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; 1234567890;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;aLong &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; 1000000000000000000L;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;aFloat &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; 9.&lt;span style=&#34;color:#a6e22e&#34;&gt;12345678912345678912345678945123F&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;aDouble &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; 0.&lt;span style=&#34;color:#a6e22e&#34;&gt;3333333333333333333333333333333333333333334&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;aChar &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; 65;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;aBoolean &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;true&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;System.&lt;span style=&#34;color:#a6e22e&#34;&gt;out&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;println&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;aByte = &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; aByte);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;System.&lt;span style=&#34;color:#a6e22e&#34;&gt;out&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;println&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;aShort = &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; aShort);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;System.&lt;span style=&#34;color:#a6e22e&#34;&gt;out&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;println&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;anInt = &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; anInt);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;System.&lt;span style=&#34;color:#a6e22e&#34;&gt;out&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;println&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;aLong = &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; aLong);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;System.&lt;span style=&#34;color:#a6e22e&#34;&gt;out&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;println&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;aFloat = &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; aFloat);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;System.&lt;span style=&#34;color:#a6e22e&#34;&gt;out&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;println&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;aDouble = &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; aDouble);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;System.&lt;span style=&#34;color:#a6e22e&#34;&gt;out&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;println&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;aChar = &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; aChar);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;System.&lt;span style=&#34;color:#a6e22e&#34;&gt;out&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;println&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;aBoolean = &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; aBoolean);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Result:&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - User commands - Using info</title>
      <link>https://www.badprog.com/unix-gnu-linux-user-commands-using-info/</link>
      <pubDate>Fri, 08 Apr 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-user-commands-using-info/</guid>
      <description>&lt;p&gt;The info user command is designed to display all information about a command.&lt;/p&gt;
&lt;p&gt;It is more detailled than the man user command with several menu.&lt;/p&gt;
&lt;p&gt;For example you can go throw a menu and click ENTER to enter in this menu:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ info open
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In this info you can see this:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;* Menu:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;* Linked Channels:: Dealing with channels sharing a file position.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;* Independent Channels:: Dealing with separately opened, unlinked channels.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;* Cleaning Streams:: Cleaning a stream makes it safe to use
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;another channel.
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Put your cursor on:&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - System calls - Using stat()</title>
      <link>https://www.badprog.com/unix-gnu-linux-system-calls-using-stat/</link>
      <pubDate>Thu, 07 Apr 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-system-calls-using-stat/</guid>
      <description>&lt;p&gt;The &lt;strong&gt;system call stat function&lt;/strong&gt; is designed to retrieve statistics of a file or a directory.&lt;/p&gt;
&lt;p&gt;Simply add the &lt;strong&gt;path of your file or directory&lt;/strong&gt; in the first parameter, then the variable of type &lt;strong&gt;struct stat&lt;/strong&gt; in the second parameter.&lt;/p&gt;
&lt;p&gt;The function stat returns 0 on success and -1 on error.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s try an example of the &lt;strong&gt;system call stat function&lt;/strong&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;int main&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;int c, char *v&lt;span style=&#34;color:#f92672&#34;&gt;[])&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;struct stat *buf;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;buf &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; malloc&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;sizeof&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;*buf&lt;span style=&#34;color:#f92672&#34;&gt;))&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;stat&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;v&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;1&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;, buf&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; 0&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;buf-&amp;gt;st\_dev = %d\n&amp;#34;&lt;/span&gt;, buf-&amp;gt;st&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;dev&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;buf-&amp;gt;st\_ino = %d\n&amp;#34;&lt;/span&gt;, buf-&amp;gt;st&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;ino&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;buf-&amp;gt;st\_mode = %d\n&amp;#34;&lt;/span&gt;, buf-&amp;gt;st&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;mode&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;buf-&amp;gt;st\_nlink = %d\n&amp;#34;&lt;/span&gt;, buf-&amp;gt;st&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;nlink&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;buf-&amp;gt;st\_uid = %d\n&amp;#34;&lt;/span&gt;, buf-&amp;gt;st&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;uid&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;buf-&amp;gt;st\_gid = %d\n&amp;#34;&lt;/span&gt;, buf-&amp;gt;st&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;gid&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;buf-&amp;gt;st\_rdev = %d\n&amp;#34;&lt;/span&gt;, buf-&amp;gt;st&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;rdev&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;buf-&amp;gt;st\_size = %d\n&amp;#34;&lt;/span&gt;, buf-&amp;gt;st&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;size&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;buf-&amp;gt;st\_blksize = %d\n&amp;#34;&lt;/span&gt;, buf-&amp;gt;st&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;blksize&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;buf-&amp;gt;st\_blocks = %d\n&amp;#34;&lt;/span&gt;, buf-&amp;gt;st&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;blocks&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;buf-&amp;gt;st\_atime = %d\n&amp;#34;&lt;/span&gt;, buf-&amp;gt;st&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;atime&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;buf-&amp;gt;st\_mtime = %d\n&amp;#34;&lt;/span&gt;, buf-&amp;gt;st&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;mtime&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;buf-&amp;gt;st\_ctime = %d\n&amp;#34;&lt;/span&gt;, buf-&amp;gt;st&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;ctime&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;0&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You are now ready to create a file, named hello.bp (the extension is free of course).&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - User commands - Using man</title>
      <link>https://www.badprog.com/unix-gnu-linux-user-commands-using-man/</link>
      <pubDate>Thu, 07 Apr 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-user-commands-using-man/</guid>
      <description>&lt;p&gt;The man of Linux can help us to find some helpful information of functions.&lt;br&gt;
This manual is splitted into eight parts.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;General commands&lt;/li&gt;
&lt;li&gt;System calls&lt;/li&gt;
&lt;li&gt;C or other language library functions&lt;/li&gt;
&lt;li&gt;Special files (usually devices, those found in /dev) and drivers&lt;/li&gt;
&lt;li&gt;File formats and conventions&lt;/li&gt;
&lt;li&gt;Games and screensavers&lt;/li&gt;
&lt;li&gt;Miscellaneous&lt;/li&gt;
&lt;li&gt;System administration commands and daemons&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;For example, to see the man of the open() function, you can use the:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ man &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt; open
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;or&lt;/p&gt;</description>
    </item>
    <item>
      <title>Java -  SE - Application HelloWorld</title>
      <link>https://www.badprog.com/java-se-application-helloworld/</link>
      <pubDate>Wed, 06 Apr 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/java-se-application-helloworld/</guid>
      <description>&lt;p&gt;This is an easy &lt;strong&gt;JAVA SE tutorial&lt;/strong&gt; for a classic Hello World! code.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s start this &lt;strong&gt;JAVA SE tutorial&lt;/strong&gt; with a simple example using Eclipse, NetBeans and a command line.&lt;/p&gt;
&lt;h2 id=&#34;1-an-easy-application-of-java-se-using-eclipse&#34;&gt;1. An easy application of JAVA SE using Eclipse&lt;/h2&gt;
&lt;p&gt;Creating a new project named &lt;strong&gt;HelloWorld&lt;/strong&gt;:&lt;br&gt;
File &amp;gt; New &amp;gt; Java Project &amp;gt; HelloWord &amp;gt; Finish&lt;/p&gt;
&lt;p&gt;Creating of the main class in the src directory:&lt;br&gt;
Right click &amp;gt; New &amp;gt; Class&lt;br&gt;
Write a name in the Name input: MyFirstClass&lt;br&gt;
Select &lt;em&gt;public static void main(String[] args)&lt;/em&gt; and &lt;em&gt;Inherited abstract methods&lt;/em&gt;&lt;br&gt;
Then Finish&lt;/p&gt;</description>
    </item>
    <item>
      <title>Objective-C - Design pattern - Delegation</title>
      <link>https://www.badprog.com/objective-c-design-pattern-delegation/</link>
      <pubDate>Wed, 06 Apr 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/objective-c-design-pattern-delegation/</guid>
      <description>&lt;p&gt;Delegation principle is that an object sends messages to its delegate to ask or to notify it that something is occuring.&lt;/p&gt;
&lt;p&gt;The main example is the Application that sends messages to its delegate to tell it that the routines are ready and the custom configuration can start.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Objective-C - Design pattern - Model-View-Controller - MVC</title>
      <link>https://www.badprog.com/objective-c-design-pattern-model-view-controller-mvc/</link>
      <pubDate>Wed, 06 Apr 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/objective-c-design-pattern-model-view-controller-mvc/</guid>
      <description>&lt;p&gt;The MVC pattern is certainly the most famous one.&lt;br&gt;
It allows to dispatch the work in 3 concepts: The Model, the View and the Controller.&lt;br&gt;
This concept exists in all programming languages.&lt;br&gt;
So it&amp;rsquo;s easy, when you understood it, to apply your knowledge with all others languages.&lt;br&gt;
That&amp;rsquo;s why this design pattern is really important for a good developer, and I am sure you are one of them.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s beginning by the Controller.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C - General Programming - Return value of a if statement without any condition</title>
      <link>https://www.badprog.com/c-general-programming-return-value-of-a-if-statement-without-any-condition/</link>
      <pubDate>Mon, 04 Apr 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-general-programming-return-value-of-a-if-statement-without-any-condition/</guid>
      <description>&lt;p&gt;To test a condition in a &lt;strong&gt;if&lt;/strong&gt; statement without any condition, the result has to be other than 0 to test a true condition.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see an example of a &lt;strong&gt;if&lt;/strong&gt; statement without any condition:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;int checkIt()&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; a;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;a &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (a &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; (&lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; (&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;main&lt;/span&gt;()
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; number;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;number &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;checkIt&lt;/span&gt;();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (number)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;True - Value was %d.&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, number);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;else&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;False - Value was %d.&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, number);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; (&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Compile and execute it:&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - User commands - Using wc</title>
      <link>https://www.badprog.com/unix-gnu-linux-user-commands-using-wc/</link>
      <pubDate>Sun, 27 Mar 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-user-commands-using-wc/</guid>
      <description>&lt;p&gt;The user command &lt;strong&gt;wc&lt;/strong&gt; is a GNU/Linux tool written by Paul Rubin and David MacKenzie.&lt;/p&gt;
&lt;p&gt;It helps us to display the number of lines, words and bytes counted in one or several files.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see an example of the user command &lt;strong&gt;wc&lt;/strong&gt; by executing this command in our favourite terminal:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ wc -l *
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;It will display the number of lines in all files present in the current directory.&lt;/p&gt;
&lt;p&gt;You can combine all flags at the same time and the result will be displayed in different colums:&lt;/p&gt;</description>
    </item>
    <item>
      <title>C - Bitwise operation - Bit shift in decimal</title>
      <link>https://www.badprog.com/c-bitwise-operation-bit-shift-in-decimal/</link>
      <pubDate>Sat, 26 Mar 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-bitwise-operation-bit-shift-in-decimal/</guid>
      <description>&lt;p&gt;Let&amp;rsquo;s try to transform a binary into a decimal with a simple loop.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see this example of a &lt;strong&gt;bit shift&lt;/strong&gt; into a decimal display:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;int main()&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; i;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; j;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;i &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;j &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;%d&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, j);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;while&lt;/span&gt; (i &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;32&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;j &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; j &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;%d&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, j);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;i&lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; (&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Let&amp;rsquo;s compile and execute it:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ cc main.c &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&amp;amp;&lt;/span&gt; ./a.out
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Result:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;4&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;8&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;16&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;32&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;64&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;128&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;256&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;512&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1024&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;2048&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;4096&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;8192&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;16384&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;32768&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;65536&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;131072&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;262144&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;524288&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1048576&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;2097152&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;4194304&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;8388608&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;16777216&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;33554432&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;67108864&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;134217728&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;268435456&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;536870912&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1073741824&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;2147483648&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;I&amp;rsquo;m seeing some of you saying : &amp;ldquo;Uh why?&amp;rdquo;&lt;/p&gt;</description>
    </item>
    <item>
      <title>C - Character manipulation - Displaying a char</title>
      <link>https://www.badprog.com/c-character-manipulation-displaying-a-char/</link>
      <pubDate>Tue, 22 Mar 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-character-manipulation-displaying-a-char/</guid>
      <description>&lt;p&gt;Today I will show you how to transform a decimal number, an hexadecimal number and a binary number into the same character.&lt;/p&gt;
&lt;p&gt;And you will see that this transformation is made by the terminal, the shell and Linux (or UNIX ;).&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see an example, with 3 files and after with printf():&lt;/p&gt;
&lt;p&gt;First of all, you have to create 3 files named &lt;em&gt;file1&lt;/em&gt;, &lt;em&gt;file2&lt;/em&gt; and &lt;em&gt;file3&lt;/em&gt;.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;int main()&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; fd1;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; fd2;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; fd3;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;char&lt;/span&gt; i;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;char&lt;/span&gt; j;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;char&lt;/span&gt; k;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;i &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;120&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;j &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x78&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;k &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;b01111000;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;fd1 &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;open&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;file1&amp;#34;&lt;/span&gt;, O&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_WRONLY);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;fd2 &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;open&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;file2&amp;#34;&lt;/span&gt;, O&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_WRONLY);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;fd3 &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;open&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;file3&amp;#34;&lt;/span&gt;, O&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_WRONLY);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;write&lt;/span&gt;(fd1, &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;i, &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;write&lt;/span&gt;(fd2, &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;j, &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;write&lt;/span&gt;(fd3, &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&lt;/span&gt;k, &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Compile and execute it:&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - User commands - Using grep</title>
      <link>https://www.badprog.com/unix-gnu-linux-user-commands-using-grep/</link>
      <pubDate>Tue, 22 Mar 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-user-commands-using-grep/</guid>
      <description>&lt;p&gt;Maybe you sometimes asked yourself how to find a part of a code inside all your files.&lt;br&gt;
But how to find this part of code?&lt;br&gt;
We can use the &lt;strong&gt;grep&lt;/strong&gt; user command to display this part of a code.&lt;/p&gt;
&lt;p&gt;We can moreover display this code in color.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see an example of the &lt;strong&gt;grep&lt;/strong&gt; user command.&lt;/p&gt;
&lt;p&gt;The line below has to be typed directly in your favourite shell:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ grep --color main *
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The result is the code &amp;ldquo;main&amp;rdquo; in red and the file where the code is found (in purple).&lt;/p&gt;</description>
    </item>
    <item>
      <title>Assembly - GNU/Linux - Hello World!</title>
      <link>https://www.badprog.com/assembly-gnu-linux-hello-world/</link>
      <pubDate>Fri, 18 Mar 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/assembly-gnu-linux-hello-world/</guid>
      <description>&lt;p&gt;In this tutorial, we are going to see how to create an executable from an assembly file.&lt;/p&gt;
&lt;p&gt;The following example uses a 32-bit version of Ubuntu.&lt;br&gt;
Notice that the version is important when you compiling your assembly file.&lt;br&gt;
It is the same for the linkage operation.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see it in detail.&lt;/p&gt;
&lt;h2 id=&#34;1-the-code&#34;&gt;1. The code&lt;/h2&gt;
&lt;p&gt;This file is named hello.asm.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-asm&#34; data-lang=&#34;asm&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;section&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;.text&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;global&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;_start&lt;/span&gt; &lt;span style=&#34;color:#75715e&#34;&gt;;must be declared for linker (ld)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_syscall: &lt;span style=&#34;color:#75715e&#34;&gt;;system call
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x25&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ret&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_start: &lt;span style=&#34;color:#75715e&#34;&gt;;tell linker entry point
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;push&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;dword&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;len&lt;/span&gt; &lt;span style=&#34;color:#75715e&#34;&gt;;message length
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;push&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;dword&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;msg&lt;/span&gt; &lt;span style=&#34;color:#75715e&#34;&gt;;message to write
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;push&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;dword&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; &lt;span style=&#34;color:#75715e&#34;&gt;;file descriptor (stdout)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;mov&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;eax&lt;/span&gt;,&lt;span style=&#34;color:#ae81ff&#34;&gt;0x3&lt;/span&gt; &lt;span style=&#34;color:#75715e&#34;&gt;;system call number (sys\_write)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;call&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;_syscall&lt;/span&gt; &lt;span style=&#34;color:#75715e&#34;&gt;;call kernel
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;add&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;esp&lt;/span&gt;,&lt;span style=&#34;color:#ae81ff&#34;&gt;12&lt;/span&gt; &lt;span style=&#34;color:#75715e&#34;&gt;;clean stack (3 * 4)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;push&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;dword&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; &lt;span style=&#34;color:#75715e&#34;&gt;;exit code
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;mov&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;eax&lt;/span&gt;,&lt;span style=&#34;color:#ae81ff&#34;&gt;0x3f&lt;/span&gt; &lt;span style=&#34;color:#75715e&#34;&gt;;system call number (sys\_exit)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;call&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;_syscall&lt;/span&gt; &lt;span style=&#34;color:#75715e&#34;&gt;;call kernel
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;;no need to clean stack
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;section&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;.data&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;msg&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;db&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;Hello&lt;/span&gt;, &lt;span style=&#34;color:#66d9ef&#34;&gt;world&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;!&amp;#34;,0xa ;our dear string
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;len&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;equ&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;$&lt;/span&gt; - &lt;span style=&#34;color:#66d9ef&#34;&gt;msg&lt;/span&gt; &lt;span style=&#34;color:#75715e&#34;&gt;;length of our dear string
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;2-compilation&#34;&gt;2. Compilation&lt;/h2&gt;
&lt;p&gt;The following command will create a new file: &lt;strong&gt;hello.o&lt;/strong&gt;.&lt;br&gt;
We tell to the compiler that we want an &lt;strong&gt;elf&lt;/strong&gt; file, standing for Executable and Linkage Format.&lt;br&gt;
We use &lt;strong&gt;nasm&lt;/strong&gt; tool to compile it.&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - User commands - Using fs</title>
      <link>https://www.badprog.com/unix-gnu-linux-user-commands-using-fs/</link>
      <pubDate>Fri, 18 Mar 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-user-commands-using-fs/</guid>
      <description>&lt;p&gt;To set ACL correctly, you can use the f&lt;strong&gt;s&lt;/strong&gt; user command.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s take an example to set the ACL:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ fs setacl path/until/directory name command
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If we want to see ACL list, let&amp;rsquo;s execute this with the &lt;strong&gt;la&lt;/strong&gt; (for &lt;strong&gt;l&lt;/strong&gt; ist &lt;strong&gt;a&lt;/strong&gt; cl):&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ fs la path/until/directory
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;To remove all the ACL rights for the user &lt;em&gt;&lt;strong&gt;system:anyuser&lt;/strong&gt;&lt;/em&gt; we have to write it (&lt;strong&gt;sa&lt;/strong&gt; for &lt;strong&gt;s&lt;/strong&gt; et&lt;strong&gt;a&lt;/strong&gt; cl):&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ fs sa directory system:anyuser none
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - System calls - Using execve()</title>
      <link>https://www.badprog.com/unix-gnu-linux-system-calls-using-execve/</link>
      <pubDate>Sun, 06 Mar 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-system-calls-using-execve/</guid>
      <description>&lt;p&gt;The &lt;strong&gt;execve()&lt;/strong&gt; system call function is used to execute a binary executable or a script.&lt;br&gt;
The function returns &lt;strong&gt;nothing on success&lt;/strong&gt; and &lt;strong&gt;-1 on error&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The first parameter must be the path of a binary executable or a script.&lt;br&gt;
The second must be an array of pointers on a character (char *myArray[]), and the last pointer must be set to NULL.&lt;br&gt;
The third parameter must be an environment.&lt;/p&gt;
&lt;h2 id=&#34;using-the-execve-syscall&#34;&gt;Using the execve() syscall&lt;/h2&gt;
&lt;h3 id=&#34;first-example&#34;&gt;First example&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/**
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;* Badprog.com
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;* main.c
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;*/
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;int main&lt;span style=&#34;color:#f92672&#34;&gt;()&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;int e;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;char *envp&lt;span style=&#34;color:#f92672&#34;&gt;[]&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt; NULL &lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;char *argv&lt;span style=&#34;color:#f92672&#34;&gt;[]&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;/bin/ls&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;-l&amp;#34;&lt;/span&gt;, NULL &lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;e &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; execve&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;/bin/ls&amp;#34;&lt;/span&gt;, argv, envp&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;e &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; -1&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;fprintf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;stderr, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Error: %s\n&amp;#34;&lt;/span&gt;, strerror&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;errno&lt;span style=&#34;color:#f92672&#34;&gt;))&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; 0;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;compiling&#34;&gt;Compiling&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;gcc main.c -o execve-me ; ./execve-me
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;ouput&#34;&gt;Ouput&lt;/h3&gt;
&lt;p&gt;The output is a classic &lt;em&gt;ls -la&lt;/em&gt;:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Assembly - objdump - -p command</title>
      <link>https://www.badprog.com/assembly-objdump-p-command/</link>
      <pubDate>Fri, 25 Feb 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/assembly-objdump-p-command/</guid>
      <description>&lt;p&gt;To see the header of a binary, in our example &amp;ldquo;ls&amp;rdquo;, we have to use the -p command of the objdump tool.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s try it:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ objdump -p /bin/ls
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Result:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-asm&#34; data-lang=&#34;asm&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;/&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;bin&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;/&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;ls&lt;/span&gt;: &lt;span style=&#34;color:#66d9ef&#34;&gt;file&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;format&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;elf32-i386&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;Program&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;Header&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;PHDR&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;off&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x00000034&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;vaddr&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x08048034&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;paddr&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x08048034&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;align&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;**&lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;filesz&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x00000100&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;memsz&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x00000100&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;flags&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;r-x&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;INTERP&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;off&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x00000134&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;vaddr&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x08048134&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;paddr&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x08048134&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;align&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;**&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;filesz&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x00000013&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;memsz&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x00000013&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;flags&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;r--&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;LOAD&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;off&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x00000000&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;vaddr&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x08048000&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;paddr&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x08048000&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;align&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;**&lt;span style=&#34;color:#ae81ff&#34;&gt;12&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;filesz&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x0001a8d0&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;memsz&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x0001a8d0&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;flags&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;r-x&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;LOAD&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;off&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x0001a8d0&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;vaddr&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x080638d0&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;paddr&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x080638d0&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;align&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;**&lt;span style=&#34;color:#ae81ff&#34;&gt;12&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;filesz&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x00001b8e&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;memsz&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x00001b8e&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;flags&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;rw-&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;DYNAMIC&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;off&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x0001ae44&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;vaddr&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x08063e44&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;paddr&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x08063e44&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;align&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;**&lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;filesz&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x000000e8&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;memsz&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x000000e8&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;flags&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;rw-&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;NOTE&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;off&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x00000148&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;vaddr&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x08048148&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;paddr&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x08048148&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;align&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;**&lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;filesz&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x00000044&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;memsz&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x00000044&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;flags&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;r--&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;EH&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;_FRAME&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;off&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x000177a8&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;vaddr&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x0805f7a8&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;paddr&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x0805f7a8&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;align&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;**&lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;filesz&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x000006ec&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;memsz&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x000006ec&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;flags&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;r--&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;STACK&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;off&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x00000000&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;vaddr&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x00000000&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;paddr&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x00000000&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;align&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;**&lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;filesz&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x00000000&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;memsz&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x00000000&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;flags&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;rw-&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;Dynamic&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;Section&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;NEEDED&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;libselinux.so.1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;NEEDED&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;librt.so.1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;NEEDED&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;libcap.so.2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;NEEDED&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;libacl.so.1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;NEEDED&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;libc.so.6&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;INIT&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x08049558&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;FINI&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x0805bb4c&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;GNU&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;_HASH&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x0804818c&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;STRTAB&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x08064e40&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;SYMTAB&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x080481f4&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;STRSZ&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x000005e3&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;SYMENT&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x00000010&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;DEBUG&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x00000000&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;PLTGOT&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x08063f78&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;PLTRELSZ&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x00000330&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;PLTREL&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x00000011&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;JMPREL&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x08049228&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;REL&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x08049198&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;RELSZ&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x00000090&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;RELENT&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x00000008&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;VERNEED&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x080490c8&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;VERNEEDNUM&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x00000003&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;VERSYM&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x08048fc8&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;0&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;x6ffffef9&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x080489e4&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;0&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;x6ffffdf7&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x000000b4&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;0&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;x6ffffef8&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x08048a98&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;0&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;x6ffffdf6&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x00000354&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;Version&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;References&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;required&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;from&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;librt.so.1&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;0&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;x0d696912&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x00&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;09&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;GLIBC&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;_2.2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;required&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;from&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;libacl.so.1&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;0&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;x05822450&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x00&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;08&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;ACL&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;_1.0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;required&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;from&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;libc.so.6&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;0&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;x09691a73&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x00&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;11&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;GLIBC&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;_2.2.3&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;0&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;x0d696914&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x00&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;10&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;GLIBC&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;_2.4&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;0&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;x0d696913&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x00&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;07&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;GLIBC&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;_2.3&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;0&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;x09691974&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x00&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;06&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;GLIBC&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;_2.3.4&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;0&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;x0d696911&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x00&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;05&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;GLIBC&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;_2.1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;0&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;x09691f73&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x00&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;04&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;GLIBC&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;_2.1.3&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;0&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;x0d696912&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x00&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;03&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;GLIBC&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;_2.2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;0&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;x0d696910&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0x00&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;02&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;GLIBC&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;_2.0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - Emacs - Phases of the Moon</title>
      <link>https://www.badprog.com/unix-gnu-linux-emacs-phases-of-the-moon/</link>
      <pubDate>Wed, 23 Feb 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-emacs-phases-of-the-moon/</guid>
      <description>&lt;p&gt;Yes it really exits!&lt;br&gt;
You can see, with Emacs, the phase of the Moon for the next 12 weeks.&lt;/p&gt;
&lt;p&gt;Make an ALT + X and write this:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;lunar-phases
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Result:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Tuesday, January 4, 2011: New Moon 10:05am &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;CET&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Wednesday, January 12, 2011: First Quarter Moon 12:33pm &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;CET&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Wednesday, January 19, 2011: Full Moon 10:19pm &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;CET&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Wednesday, January 26, 2011: Last Quarter Moon 2:03pm &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;CET&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Thursday, February 3, 2011: New Moon 3:33am &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;CET&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Friday, February 11, 2011: First Quarter Moon 8:20am &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;CET&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Friday, February 18, 2011: Full Moon 9:33am &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;CET&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Friday, February 25, 2011: Last Quarter Moon 12:32am &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;CET&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Friday, March 4, 2011: New Moon 9:48pm &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;CET&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Sunday, March 13, 2011: First Quarter Moon 12:46am &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;CET&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Saturday, March 19, 2011: Full Moon 7:07pm &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;CET&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Saturday, March 26, 2011: Last Quarter Moon 1:12pm &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;CET&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Enjoy!&lt;/p&gt;</description>
    </item>
    <item>
      <title>PHP 5 - array() - Using is_array()</title>
      <link>https://www.badprog.com/php-5-array-using-is-array/</link>
      <pubDate>Tue, 22 Feb 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/php-5-array-using-is-array/</guid>
      <description>&lt;p&gt;How to know if a variable is an array() or not?&lt;br&gt;
Easy with the is_array() function.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see an example of the is_array() function:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-php&#34; data-lang=&#34;php&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;php&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$my &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;array&lt;/span&gt;();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (&lt;span style=&#34;color:#a6e22e&#34;&gt;is\_array&lt;/span&gt;($my))
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;echo&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;This is an array().&amp;#34;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;else&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;echo&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;This is not an array().&amp;#34;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;?&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Result:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-php&#34; data-lang=&#34;php&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;This&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;is&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;an&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;array&lt;/span&gt;()&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
    </item>
    <item>
      <title>Zend - Framework 1.11 - Create a new project</title>
      <link>https://www.badprog.com/zend-framework-111-create-a-new-project/</link>
      <pubDate>Sat, 19 Feb 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/zend-framework-111-create-a-new-project/</guid>
      <description>&lt;ol&gt;
&lt;li&gt;Dowload the &lt;a href=&#34;http://framework.zend.com/&#34;&gt;Zend framework&lt;/a&gt; To easily create a new project with Zend framework we have to go until the bin/ directory of the framework package. 2) Once downloaded from the official website, go until this directory:&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-php&#34; data-lang=&#34;php&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ZendFramework&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1.11&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;3&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;bin&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;/&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In this directory we have the binaries for UNIX like and Windows OS, named respectively zf.sh and zf.bat. 3) Open a shell (this black screen you like so much) and write this:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ zf.sh create project &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;/home/login/www/test&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;or&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - Emacs - Display number lines</title>
      <link>https://www.badprog.com/unix-gnu-linux-emacs-display-number-lines/</link>
      <pubDate>Tue, 15 Feb 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-emacs-display-number-lines/</guid>
      <description>&lt;p&gt;If you want to see number of lines in Emacs, you have to activate it.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s start this tiny tutorial:&lt;/p&gt;
&lt;p&gt;Open Emacs, click &lt;strong&gt;ALT + X&lt;/strong&gt; and write &lt;strong&gt;linum-mode&lt;/strong&gt; then type RETURN.&lt;/p&gt;
&lt;p&gt;Well done, it works!&lt;/p&gt;
&lt;p&gt;To deactivate it, just retype this command.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Ruby on Rails 3 - Console options - Create a project</title>
      <link>https://www.badprog.com/ruby-on-rails-3-console-options-create-a-project/</link>
      <pubDate>Mon, 14 Feb 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/ruby-on-rails-3-console-options-create-a-project/</guid>
      <description>&lt;p&gt;To create a project in Ruby on Rails 3 with a console you have to go until the parent folder of your future project. The command line is:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-ruby&#34; data-lang=&#34;ruby&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rails &lt;span style=&#34;color:#66d9ef&#34;&gt;new&lt;/span&gt; myProject
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;For example, if you are in this path:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ C:/ror3/
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;And you want to create a project named site1. Write this:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ C:/ror3/ rails new site1
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;All files will be created.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Ruby on Rails 3 - Console options - Display version</title>
      <link>https://www.badprog.com/ruby-on-rails-3-console-options-display-version/</link>
      <pubDate>Mon, 14 Feb 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/ruby-on-rails-3-console-options-display-version/</guid>
      <description>&lt;p&gt;To know the version of your Ruby just write on your console:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ ruby -v
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - gdb - With Emacs</title>
      <link>https://www.badprog.com/unix-gnu-linux-gdb-with-emacs/</link>
      <pubDate>Mon, 14 Feb 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-gdb-with-emacs/</guid>
      <description>&lt;p&gt;To start gdb, we have to add the &lt;strong&gt;-g flag&lt;/strong&gt; at the compilation time.&lt;br&gt;
So it is easy to add it in a Makefile. We are also using the &lt;strong&gt;Emacs&lt;/strong&gt; IDE for running gdb.&lt;br&gt;
Note that the code below does not work because we want to see the segmentation fault with gdb.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s create a main.c file in our gdb mini tutorial:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;int main&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;int c, char *v&lt;span style=&#34;color:#f92672&#34;&gt;[])&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;char *string; int i;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;i &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; 0;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;while&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;i &amp;lt; strlen&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;v&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;1&lt;span style=&#34;color:#f92672&#34;&gt;]))&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;%c&amp;#34;&lt;/span&gt;, string&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;i&lt;span style=&#34;color:#f92672&#34;&gt;])&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;i++;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;0&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Let see an example of the gdb using:&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - tcsh - Setting prompt with country flags</title>
      <link>https://www.badprog.com/unix-gnu-linux-tcsh-setting-prompt-with-country-flags/</link>
      <pubDate>Mon, 14 Feb 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-tcsh-setting-prompt-with-country-flags/</guid>
      <description>&lt;p&gt;If you have always dreamed to change the classic prompt of your favorite Shell, it is time to see how to do it. Open your tcsh&amp;rsquo;s config that you can find in your home, it is called &lt;em&gt;.tcshrc&lt;/em&gt; and inside, modify the line:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;set prompt&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;(%n@%m %h)&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;by&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;set prompt&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;&amp;lt;%T %/%B%{\033[1;31m%}&amp;gt;%{\033[0m%}%b&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Open a new terminal or juste write &amp;ldquo;&lt;strong&gt;. .bashrc&lt;/strong&gt;&amp;rdquo; on your terminal, and miracle, you have now the time, your current path and a &lt;em&gt;&amp;gt;&lt;/em&gt; in red and bold!&lt;/p&gt;</description>
    </item>
    <item>
      <title>C - Linked lists - Simple example</title>
      <link>https://www.badprog.com/c-linked-lists-simple-example/</link>
      <pubDate>Sun, 13 Feb 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-linked-lists-simple-example/</guid>
      <description>&lt;p&gt;Below, certainly the most easy example of the linked lists.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s see this example as a FILO, meaning First In Last Out:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;/*
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;** STRUCTURE
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;*/&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;typedef&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;struct&lt;/span&gt; s&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_list
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; nb;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;struct&lt;/span&gt; s&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_list &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;next;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;} t&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_list;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;/*
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;** ADD
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;*/&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;t&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_list &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;add&lt;/span&gt;(t&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_list &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;element, &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; i)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;t&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_list &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;link;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;link &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;malloc&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;sizeof&lt;/span&gt;(&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;link));
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;link&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;nb &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; i;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;link&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;next &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; element;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; (link);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;/*
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;** DISPLAY
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;*/&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;display&lt;/span&gt;(t&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_list &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;toDisplay)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;while&lt;/span&gt; (toDisplay &lt;span style=&#34;color:#f92672&#34;&gt;!=&lt;/span&gt; NULL)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;toDisplay-&amp;gt;nb = %d&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;, toDisplay&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;nb);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;toDisplay &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; toDisplay&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;next;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;/*
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;** MAIN
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;*/&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;main&lt;/span&gt;()
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;t&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;_list &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;new;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; i;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;new &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; NULL;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;i &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;while&lt;/span&gt; (i &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;18&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;new &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;add&lt;/span&gt;(new, i&lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;display&lt;/span&gt;(new);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; (&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Result:&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - System calls - Using open()</title>
      <link>https://www.badprog.com/unix-gnu-linux-system-calls-using-open/</link>
      <pubDate>Thu, 03 Feb 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-system-calls-using-open/</guid>
      <description>&lt;p&gt;The &lt;strong&gt;open()&lt;/strong&gt; system call function is used to open a file.&lt;br&gt;
We have to pass the pathname of the file we want to open, then a flag in the second parameter. This second one has to be a flag among the following ones:&lt;br&gt;
O_RDONLY, O_WRONLY or O_RDWR.&lt;/p&gt;
&lt;p&gt;An important thing is that this function will always return a non negative integer on success.&lt;br&gt;
This return value will be used by others functions, such as read() or write() for example, as a file descriptor.&lt;br&gt;
As all system calls, if the function returns -1, it will mean that an error has occurred. Errors are POSIX standard.&lt;br&gt;
The value 0, 1 and 2 are already reserved by the system, so if we open a new file that exists, its integer value will be 3 or more.&lt;br&gt;
Let&amp;rsquo;s see why.&lt;br&gt;
Write it successively on your favourite terminal:&lt;br&gt;
ls -la /dev/ stdin&lt;br&gt;
ls -la /dev/stdout&lt;br&gt;
ls -la /dev/stderr&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - Tips and tricks - Change the screen resolution</title>
      <link>https://www.badprog.com/unix-gnu-linux-tips-and-tricks-change-the-screen-resolution/</link>
      <pubDate>Thu, 03 Feb 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-tips-and-tricks-change-the-screen-resolution/</guid>
      <description>&lt;p&gt;The command to change the screen resolution is &lt;strong&gt;xrandr&lt;/strong&gt;, To see all size available for your screen:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ xrandr
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;To choose the another one resolution just use the -s option with the resolution, for example:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ xrandr -s 800x600
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - gcc - Commands -v</title>
      <link>https://www.badprog.com/unix-gnu-linux-gcc-commands-v/</link>
      <pubDate>Wed, 02 Feb 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-gcc-commands-v/</guid>
      <description>&lt;p&gt;With the -v command of the gcc, you can see all programs invoked by the compiler. Let&amp;rsquo;s try with an example of the -v command:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;gcc -v
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Result (certainly different on your system):&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Using built-in specs.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Target: i686-redhat-linux
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Configured with: ../configure --prefix&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;/usr --mandir&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;/usr/share/man --infodir&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;/usr/share/info --with-bugurl&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;posix --enable-checking&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;release --with-system-zlib --enable-&lt;span style=&#34;color:#ae81ff&#34;&gt;\_\_&lt;/span&gt;cxa&lt;span style=&#34;color:#ae81ff&#34;&gt;\_&lt;/span&gt;atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;gtk --disable-dssi --with-java-home&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;generic --with-arch&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;i686 --build&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;i686-redhat-linux
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Thread model: posix
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;gcc version 4.4.4 &lt;span style=&#34;color:#ae81ff&#34;&gt;20100503&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;Red Hat 4.4.4-2&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;GCC&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - tar - The xvf command</title>
      <link>https://www.badprog.com/unix-gnu-linux-tar-the-xvf-command/</link>
      <pubDate>Wed, 02 Feb 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-tar-the-xvf-command/</guid>
      <description>&lt;p&gt;The xvf command of the tar tool allows to extract files from a file with the .tgz extension, in the current folder. Let&amp;rsquo;s see an example of the xvf command:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ tar xvf /home/login/Downloads/myArchive.tgz
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;It will extract all files present in the archive into the current directory in a new directory with the name of the first directory of the archive file.&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - Tips and tricks - Change keyboard language</title>
      <link>https://www.badprog.com/unix-gnu-linux-tips-and-tricks-change-keyboard-language/</link>
      <pubDate>Sun, 30 Jan 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-tips-and-tricks-change-keyboard-language/</guid>
      <description>&lt;p&gt;An easy way to change the keyboard language on Linux is to write this command on your favourite terminal:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;setxkbmap lang
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Where &lt;em&gt;lang&lt;/em&gt; is the language you want. As an example to change the keyboard in french:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;setxbmap fr
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Or for an american keyboard:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;setxbmap us
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
    </item>
    <item>
      <title>C - Pointers - Some examples</title>
      <link>https://www.badprog.com/c-pointers-some-examples/</link>
      <pubDate>Wed, 26 Jan 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-pointers-some-examples/</guid>
      <description>&lt;p&gt;We can see with examples below that myString[0] == *myString == *(&amp;amp;myString[0]) == H.&lt;/p&gt;
&lt;p&gt;Why?&lt;/p&gt;
&lt;p&gt;Because myString[0] points the first character of the string &amp;ldquo;Hello World&amp;rdquo;, in this case &amp;ldquo;H&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;Same for *myString that is the value of the first character of the string. Finally &amp;amp;myString[0] is the address of the first character (H), and with the * before we retrieve the value of this address, in this case &amp;ldquo;H&amp;rdquo;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C - Library functions - Using free()</title>
      <link>https://www.badprog.com/c-library-functions-using-free/</link>
      <pubDate>Tue, 25 Jan 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-library-functions-using-free/</guid>
      <description>&lt;p&gt;The free() function is the sister of the malloc() function. As malloc() returns the address of the first byte of the allocated memory, free() accepts, as only parameter, the address of this first byte.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;/*
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;** Made by BadproG
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;*/&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;main&lt;/span&gt;()
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;char&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;myString;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;myString &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;malloc&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;sizeof&lt;/span&gt;(myString));
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (myString &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; NULL)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Can not malloc(), not enough space in the memory!&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;exit&lt;/span&gt;(&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;else&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;printf&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;OK memory is allocated!&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;free&lt;/span&gt;(myString);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; (&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
    </item>
    <item>
      <title>C - Unary operators - Using sizeof()</title>
      <link>https://www.badprog.com/c-unary-operators-using-sizeof/</link>
      <pubDate>Tue, 25 Jan 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-unary-operators-using-sizeof/</guid>
      <description>&lt;p&gt;The sizeof() unary operator is often used, so it is important to know some tricks that we can do with it.&lt;/p&gt;
&lt;p&gt;It is used to calculate the sizes of datatypes and it takes one argument: the &lt;strong&gt;type&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The main purpose of &lt;strong&gt;sizeof()&lt;/strong&gt; is of course to allocate memory in conjuction with &lt;strong&gt;malloc&lt;/strong&gt;.&lt;/p&gt;
&lt;h2 id=&#34;1-displaying-size-of-types&#34;&gt;1. Displaying size of types&lt;/h2&gt;
&lt;p&gt;In the example below, we can note the 1 byte of the *myString.&lt;/p&gt;</description>
    </item>
    <item>
      <title>C - General Programming - Beep function</title>
      <link>https://www.badprog.com/c-general-programming-beep-function/</link>
      <pubDate>Thu, 20 Jan 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/c-general-programming-beep-function/</guid>
      <description>&lt;p&gt;In this tutorial we will see a simple beep function. Let&amp;rsquo;s take an example of the beep function:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;/*
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;** Made by BadproG.com
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;*/&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#define SOUND\_IT(x) (x-&amp;#39;@&amp;#39;)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;void beep(void)&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;putchar&lt;/span&gt;(SOUND&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;\&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;_IT&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;G&amp;#39;&lt;/span&gt;));
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;fflush&lt;/span&gt;(stdout);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;main&lt;/span&gt;()
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;beep&lt;/span&gt;();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Just compile and each time you will execute it, you will hear a simple beep.&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - System calls - Using tgetflag()</title>
      <link>https://www.badprog.com/unix-gnu-linux-system-calls-using-tgetflag/</link>
      <pubDate>Thu, 20 Jan 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-system-calls-using-tgetflag/</guid>
      <description>&lt;p&gt;The tgetflag() function is a Linux system call function. It is designed to be used with the getenv() and tgetent() functions.&lt;br&gt;
The tgetflag() function returns a boolean value: 1 on success or 0 on fail.&lt;/p&gt;
&lt;p&gt;With the tgetflag() function, we have to put an only one string parameter. You have to use the two letters of the appropriate termcaps. You can find all of them in the Boolean Capabilities of the termcap manual.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Ruby on Rails 3 - Server - Start the (native) Webrick server</title>
      <link>https://www.badprog.com/ruby-on-rails-3-server-start-the-native-webrick-server/</link>
      <pubDate>Wed, 19 Jan 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/ruby-on-rails-3-server-start-the-native-webrick-server/</guid>
      <description>&lt;p&gt;To start the native server of Ruby on Rails, WEBrick, you have to open a shell and go until the path of your website and write &amp;ldquo;rails server&amp;rdquo; to start it.&lt;/p&gt;
&lt;p&gt;Example on Windows:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ C:/rubyOnRails/site1&amp;gt; rails server
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Same for GNU/Linux:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ home/name/rubyOnRails/site1&amp;gt; rails server
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You will see the server start and show all what is happening when there is activity on your website. To display something on your server, just go on &lt;a href=&#34;http://localhost:3000/&#34;&gt;http://localhost/3000/&lt;/a&gt; and some information will be displayed.&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - System calls - Using getenv()</title>
      <link>https://www.badprog.com/unix-gnu-linux-system-calls-using-getenv/</link>
      <pubDate>Wed, 19 Jan 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-system-calls-using-getenv/</guid>
      <description>&lt;p&gt;The getenv() function is a Linux system call function.&lt;/p&gt;
&lt;p&gt;It is designed to know what is the name of an environment variable.&lt;/p&gt;
&lt;p&gt;The main use is for the &amp;ldquo;TERM&amp;rdquo; variable. Let&amp;rsquo;s see an example of the getenv() function:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/*
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;** Made by BadproG.com
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;*/
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;int main&lt;span style=&#34;color:#f92672&#34;&gt;()&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;const char *name;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;name &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;TERM&amp;#34;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;printf&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;My terminal is %s.\n&amp;#34;&lt;/span&gt;, getenv&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;name&lt;span style=&#34;color:#f92672&#34;&gt;))&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;0&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - System calls - Using tgetent()</title>
      <link>https://www.badprog.com/unix-gnu-linux-system-calls-using-tgetent/</link>
      <pubDate>Wed, 19 Jan 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-system-calls-using-tgetent/</guid>
      <description>&lt;p&gt;The tgetent() function is a Linux system call function. It is designed to be used with other termcap functions such as:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;tgetflag&lt;/li&gt;
&lt;li&gt;tgetnum&lt;/li&gt;
&lt;li&gt;tgetstr&lt;/li&gt;
&lt;li&gt;tgoto&lt;/li&gt;
&lt;li&gt;tputs&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;With the tgetent() function, we stock in the first parameter (a buffer pointer), the capabilities of the second parameter (the environment variable retrieved by the getenv() function).&lt;br&gt;
This function returns 1 on success, 0 if there is not a such description and -1 if the terminfo database is not found.&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - System calls - Using tgetnum()</title>
      <link>https://www.badprog.com/unix-gnu-linux-system-calls-using-tgetnum/</link>
      <pubDate>Wed, 19 Jan 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-system-calls-using-tgetnum/</guid>
      <description>&lt;p&gt;The tgetnum() function is a Linux system call function. It is designed to be used with the getenv() and tgetent() functions.&lt;br&gt;
If the description of the terminal is not found, most probably because there is no result in the tgetent() function, the tgetnum() one will return -1.&lt;/p&gt;
&lt;p&gt;With the tgetnum() function, we have to put an only one string parameter. You have to use the two letters of the appropriate termcaps. You can find all of them in the Numeric capabilities of the termcap manual.&lt;/p&gt;</description>
    </item>
    <item>
      <title>MySQL - Commands - Pager</title>
      <link>https://www.badprog.com/mysql-commands-pager/</link>
      <pubDate>Thu, 13 Jan 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/mysql-commands-pager/</guid>
      <description>&lt;p&gt;There is a way on GNU/Linux to change the display of the result of the SQL query. Just type:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ pager less -i -n -S
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now make a command and look this new display!&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - System calls - opendir()</title>
      <link>https://www.badprog.com/unix-gnu-linux-system-calls-opendir/</link>
      <pubDate>Tue, 11 Jan 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-system-calls-opendir/</guid>
      <description>&lt;p&gt;The &lt;strong&gt;opendir()&lt;/strong&gt; system call function is used to open a directory and to return a pointer on this directory.&lt;br&gt;
Let&amp;rsquo;s take an example of the using of the &lt;strong&gt;opendir&lt;/strong&gt; system call function.&lt;/p&gt;
&lt;p&gt;First, we have to create two files: a directory named &lt;em&gt;hello&lt;/em&gt; and file name &lt;em&gt;world&lt;/em&gt;.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;mkdir hello
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;touch world
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;And now let&amp;rsquo;s create the main.c file:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/*
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;** Made by BadproG.com
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;*/
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;int main&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;int c, char *v&lt;span style=&#34;color:#f92672&#34;&gt;[])&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;DIR *myDirectory;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;myDirectory &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; opendir&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;v&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;1&lt;span style=&#34;color:#f92672&#34;&gt;])&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;c &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; 2&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;myDirectory&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;puts&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;OK the folder is opened.&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/*
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;** closedir
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;*/
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;closedir&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;myDirectory&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; 0&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;puts&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;The directory is now closed.&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;else&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;puts&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;The directory can not be closed.&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;else&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;errno &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; ENOENT&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;puts&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;This directory does not exist.&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;else&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;errno &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; ENOTDIR&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;puts&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;This file is not a directory.&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;else&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;errno &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; EACCES&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;puts&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;You do not have the right to open this folder.&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;else&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;puts&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;That&amp;#39;s a new error, check the manual.&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;else&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;puts&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Sorry we need exactly 2 arguments.&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;0&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Let&amp;rsquo;s try:&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - System calls - readdir()</title>
      <link>https://www.badprog.com/unix-gnu-linux-system-calls-readdir/</link>
      <pubDate>Tue, 11 Jan 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-system-calls-readdir/</guid>
      <description>&lt;p&gt;The &lt;strong&gt;readdir()&lt;/strong&gt; system call function is used to read into a directory.&lt;br&gt;
The function returns a pointer to a &lt;em&gt;dirent&lt;/em&gt; structure. This structure contains five fields but only two are POSIX standard, this is the &lt;em&gt;d_name&lt;/em&gt; and the &lt;em&gt;d_ino&lt;/em&gt; member.&lt;br&gt;
That&amp;rsquo;s the first we will use in our &lt;strong&gt;readdir()&lt;/strong&gt; example.&lt;/p&gt;
&lt;p&gt;Before starting, let&amp;rsquo;s create some files. We need a folder named &lt;em&gt;hello&lt;/em&gt;.&lt;br&gt;
In the &lt;em&gt;hello&lt;/em&gt; directory, let&amp;rsquo;s create three new files: a folder named &lt;em&gt;one&lt;/em&gt; and two files named &lt;em&gt;girl&lt;/em&gt; and &lt;em&gt;boy&lt;/em&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - tcsh - Builtin commands source</title>
      <link>https://www.badprog.com/unix-gnu-linux-tcsh-builtin-commands-source/</link>
      <pubDate>Fri, 07 Jan 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-tcsh-builtin-commands-source/</guid>
      <description>&lt;p&gt;In this tutorial we will see what is the &lt;strong&gt;source&lt;/strong&gt; builtin command.&lt;br&gt;
We will set the prompt of our tcsh as example.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s go.&lt;br&gt;
We can change the prompt with a script. But without modifying the .tcshrc file. It means that each new terminal you will open will be with the default shell config, in this case .tcshrc.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s make a classic script by creating a new file named tcshScript.&lt;br&gt;
Let&amp;rsquo;s open it and write this inside:&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - make - Makefile</title>
      <link>https://www.badprog.com/unix-gnu-linux-make-makefile/</link>
      <pubDate>Thu, 06 Jan 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-make-makefile/</guid>
      <description>&lt;p&gt;A &lt;strong&gt;Makefile&lt;/strong&gt; has to be named &lt;strong&gt;Makefile&lt;/strong&gt; with the first letter in capitalize.&lt;/p&gt;
&lt;p&gt;There can be only one such file.&lt;br&gt;
It is called with the &lt;strong&gt;make&lt;/strong&gt; tool.&lt;br&gt;
To use it simply write &lt;strong&gt;make&lt;/strong&gt; on your terminal and it will execute the rules in your &lt;strong&gt;Makefile&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Using a &lt;strong&gt;Makefile&lt;/strong&gt; is really helpful.&lt;br&gt;
It automates tasks you have to do.&lt;br&gt;
Let us take some examples:&lt;/p&gt;
&lt;p&gt;In this first example, the &lt;em&gt;Variables&lt;/em&gt; section contains 3 variables.&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - System call functions</title>
      <link>https://www.badprog.com/unix-gnu-linux-system-call-functions/</link>
      <pubDate>Mon, 03 Jan 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-system-call-functions/</guid>
      <description>&lt;p&gt;List of Linux system call functions.&lt;br&gt;
These functions need one or more appropriate headers for each one of them.&lt;/p&gt;
&lt;p&gt;These headers can be found in this directory on your operating system: /usr/include/&lt;/p&gt;
&lt;p&gt;And if you want to learn more of them, just write &lt;strong&gt;man&lt;/strong&gt; 2 &lt;em&gt;&lt;strong&gt;theNameOfTheFunction&lt;/strong&gt;&lt;/em&gt; on your favorite shell.&lt;/p&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ man &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt; open
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Why 2?&lt;br&gt;
Because it is the number chosen for the system call functions.&lt;/p&gt;</description>
    </item>
    <item>
      <title>UNIX &amp; GNU/Linux - System calls - fork()</title>
      <link>https://www.badprog.com/unix-gnu-linux-system-calls-fork/</link>
      <pubDate>Mon, 03 Jan 2011 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/unix-gnu-linux-system-calls-fork/</guid>
      <description>&lt;p&gt;The &lt;strong&gt;fork()&lt;/strong&gt; function is a &lt;strong&gt;Linux system call function&lt;/strong&gt;.&lt;br&gt;
It is used to make a new identical process from another one.&lt;/p&gt;
&lt;p&gt;The original process becoming the parent and the new process becoming its child. The both are alive at the same time.&lt;/p&gt;
&lt;p&gt;But when the fork() function is called, both process will terminate with the same end.&lt;/p&gt;
&lt;p&gt;Let us see an example of the fork() function with 3 fonctions:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;/*
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;** Made by BadproG.com
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;*/&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;void begin()&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;puts&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;#############&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;puts&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;### BEGIN ###&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;puts&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;#############&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;ending&lt;/span&gt;()
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;puts&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;##############&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;puts&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;### ENDING ###&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;puts&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;##############&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;main&lt;/span&gt;()
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;begin&lt;/span&gt;();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;puts&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Here the neutral code&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;fork&lt;/span&gt;();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;puts&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Here the code after fork()&amp;#34;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;ending&lt;/span&gt;();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;We compile:&lt;/p&gt;</description>
    </item>
    <item>
      <title></title>
      <link>https://www.badprog.com/about/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://www.badprog.com/about/</guid>
      <description>&lt;p&gt;Mi-K is a software engineer passionate about computer science.&lt;/p&gt;
&lt;p&gt;He enjoys working across the full stack to craft great user experiences.&lt;/p&gt;
&lt;a href=&#34;https://github.com/badprog?tab=repositories&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34; aria-label=&#34;GitHub&#34;&gt;
  &lt;svg xmlns=&#34;http://www.w3.org/2000/svg&#34; width=&#34;28&#34; height=&#34;28&#34; viewBox=&#34;0 0 24 24&#34; fill=&#34;currentColor&#34;&gt;
    &lt;path d=&#34;M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12&#34;/&gt;
  &lt;/svg&gt;
&lt;/a&gt;</description>
    </item>
  </channel>
</rss>
