<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>johannespour.de</title>
    <link>https://johannespour.de</link>
    <description>Student @ University of Freiburg</description>
    <managingEditor>(Tch1b0)</managingEditor>
    <item>
      <title>Achievements</title>
      <link>https://johannespour.de/projects/378661892</link>
      <description>Achievements for VS Code</description>
      <content:encoded>&lt;h1&gt;What?&lt;/h1&gt;
&lt;p&gt;This is a &lt;a href="https://code.visualstudio.com/"&gt;Visual Studio Code&lt;/a&gt; extension that adds game-like achievements to the code editor. My goal for this project was to sometimes give the user a little &quot;reward&quot; for what they were doing.&lt;/p&gt;
&lt;h2&gt;Examples&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;If a file ending with &lt;code&gt;.asm&lt;/code&gt; is created, the achievement &lt;code&gt;Bye Friends&lt;/code&gt; is unlocked&lt;/li&gt;
&lt;li&gt;If a &lt;code&gt;.b&lt;/code&gt; file is deleted, the achievement &lt;code&gt;That's not how a brain works&lt;/code&gt; is unlocked&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;Technical Aspects&lt;/h1&gt;
&lt;p&gt;The Achievements extension was my first interaction with &lt;a href="https://www.typescriptlang.org/"&gt;TypeScript&lt;/a&gt;, the &lt;a href="https://code.visualstudio.com/api/references/vscode-api"&gt;VSCode API&lt;/a&gt; and building an extension in general, so there was pretty much to learn.&lt;/p&gt;
&lt;h1&gt;What I learned&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.typescriptlang.org/"&gt;TypeScript&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://code.visualstudio.com/api/references/vscode-api"&gt;VSCode API&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content:encoded>
      <pubDate>Wed Apr 27 2022 14:43:06 GMT+0000 (Coordinated Universal Time)</pubDate>
      <author>Tch1b0</author>
    </item>
    <item>
      <title>dsbmobile.js</title>
      <link>https://johannespour.de/projects/410312472</link>
      <description>JavaScript package for interacting with the DSBmobile API</description>
      <content:encoded>&lt;h1&gt;dsbmobile&lt;/h1&gt;
&lt;p&gt;&lt;a href="https://heinekingmedia.de/education/digitales-schwarzes-brett"&gt;Digitales Schwarzes Brett&lt;/a&gt; (DSB) is an online-substitution plan that is widely used in Germany.&lt;/p&gt;
&lt;h1&gt;Why?&lt;/h1&gt;
&lt;p&gt;Since there was no package in JavaScript to interact with the dsbmobile API, I figured I had to make one.&lt;/p&gt;
&lt;p&gt;Also, I needed the package for &lt;a href="https://github.com/Tch1b0/myDSB"&gt;myDSB&lt;/a&gt; and other private projects.&lt;/p&gt;
&lt;h1&gt;How does it work?&lt;/h1&gt;
&lt;h2&gt;As a User&lt;/h2&gt;
&lt;p&gt;Since the API only gave me an html response, I needed to parse the things I needed from that file, which isn't the cleanest thing to do, but it works.&lt;/p&gt;
&lt;p&gt;You can easily interact with the package like this:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-ts"&gt;import DSBmobile from &quot;dsbmobile&quot;

const api = new DSBmobile(&lt;username&gt;, &lt;password&gt;);
const table = await api.getTimetable()
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and that's all! Nothing more is needed to get the table, which is otherwise only displayed as an html file.&lt;/p&gt;
&lt;h2&gt;Behind the Scenes&lt;/h2&gt;
&lt;p&gt;While the &lt;code&gt;NewsPost&lt;/code&gt; and &lt;code&gt;DocumentPost&lt;/code&gt; are pretty normal http-requests, the &lt;code&gt;Timetable&lt;/code&gt; is a bit more interesting, as the API responds with an HTML file. So when requesting the Time Table, I am receiving all of the information I need, but in a pretty bloated way. Using the &lt;a href=""&gt;cheerio&lt;/a&gt; package, I am iterating over certain parts of the HTML file to gather the information that I want.&lt;/p&gt;
&lt;h1&gt;Some difficulties&lt;/h1&gt;
&lt;p&gt;Because there is no official documentation of the dsbmobile API, I had to &lt;a href="https://en.wikipedia.org/wiki/Reverse_engineering"&gt;reverse engineer&lt;/a&gt; it to find out which routes, methods and data I need.&lt;/p&gt;
&lt;h1&gt;Technical specifications&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://nodejs.org"&gt;node.js&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.typescriptlang.org/"&gt;TypeScript&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content:encoded>
      <pubDate>Fri Feb 25 2022 18:00:03 GMT+0000 (Coordinated Universal Time)</pubDate>
      <author>Tch1b0</author>
    </item>
    <item>
      <title>JP-nuxt</title>
      <link>https://johannespour.de/projects/451393301</link>
      <description>My nuxt personal website</description>
      <content:encoded>&lt;h1&gt;What?&lt;/h1&gt;
&lt;p&gt;This project is the site you are currently reading this article from. Not just the back- or the frontend, but both combined.
This site is built with &lt;a href="https://nuxtjs.org/"&gt;Nuxt.js&lt;/a&gt;, which is a &lt;a href="https://vuejs.org/"&gt;Vue&lt;/a&gt; framework, that enables &lt;a href="https://en.wikipedia.org/wiki/Server-side_scripting"&gt;server-side rendering&lt;/a&gt; and gives much other neat utility.&lt;/p&gt;
&lt;h1&gt;Why?&lt;/h1&gt;
&lt;h2&gt;The problem&lt;/h2&gt;
&lt;p&gt;My &lt;a href="https://github.com/Tch1b0/JP-old"&gt;previous site&lt;/a&gt; was also built with Vue, but with client-side rendering and worse styling.&lt;/p&gt;
&lt;p&gt;The main problem that bothered me was that the site &lt;strong&gt;needed way too long to load&lt;/strong&gt;, and if you clicked on a post, it would take an &lt;strong&gt;entire second&lt;/strong&gt; to load the actual article. While waiting for the content for loading, you would sit in front of a blank article screen, with &lt;strong&gt;nothing indicating that anything is happening&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Another problem was that there was no real data management. By this, I mean that on the front page &lt;strong&gt;every single article&lt;/strong&gt; was already loaded with &lt;strong&gt;every single bit of its information&lt;/strong&gt;. But when you entered a certain article, the &lt;strong&gt;entire block of data&lt;/strong&gt; was fetched again.&lt;/p&gt;
&lt;p&gt;Now I could start talking about the styling, the backend or the upload page, but I think I made my point clear. I saw flaws all over the site.&lt;/p&gt;
&lt;h2&gt;The solution&lt;/h2&gt;
&lt;p&gt;When I discovered Nuxt.js I thought that this would be exactly what I needed. And that is still my opinion.&lt;/p&gt;
&lt;p&gt;Compared to my old site, the new site is &lt;strong&gt;loading blazingly fast&lt;/strong&gt; and the user has to &lt;strong&gt;fetch way less data&lt;/strong&gt;, because now that the backend and the frontend can communicate better with each other, the data is able to be fetched and handled smartly.&lt;/p&gt;
&lt;p&gt;When it comes to styling, I started using &lt;a href="https://tailwindcss.com/"&gt;Tailwind CSS&lt;/a&gt; and tried to think more about the design, which seems to have worked out, because I see fewer flaws with the design on this site.&lt;/p&gt;
&lt;h2&gt;Choice of the name&lt;/h2&gt;
&lt;p&gt;Previously I have always named my main-site &quot;JP&quot;. But when I realised that I rewrite the entire page every now and then, I thought I might name it individually so I don't have to overwrite the repository as I did with &lt;a href="https://github.com/Tch1b0/JP-old"&gt;JP-old&lt;/a&gt;. I named this project &quot;JP-nuxt&quot; because I think that this will be the only version of my site that is built with Nuxt.js. Not because I don't like Nuxt.js, but because with my website, I always test out new technology. So my next project will maybe be made using &lt;a href="https://nextjs.org/"&gt;Next.js&lt;/a&gt;, &lt;a href="https://kit.svelte.dev/"&gt;Svelte Kit&lt;/a&gt; or I might go back to the roots and generate simple static sites like &lt;a href="https://evilcookie.de"&gt;evilcookie.de&lt;/a&gt;.&lt;/p&gt;
&lt;h1&gt;The problems I encountered&lt;/h1&gt;
&lt;p&gt;When setting up my project, I decided to use &lt;a href="http://v3.nuxtjs.org/"&gt;Nuxt 3&lt;/a&gt;, which may not have been the wisest decision, because it is so new and unstable that nearly none of the plugins for Nuxt.js works. So I had to make most of the basic stuff on my own.&lt;/p&gt;
&lt;p&gt;What annoyed me, was that I wasn't able to use &lt;a href="https://expressjs.com/de/"&gt;express.js&lt;/a&gt; in the backend, and I had to handle requests via the default &lt;code&gt;http&lt;/code&gt; module in &lt;a href="https://nodejs.org/en/"&gt;node.js&lt;/a&gt;, which isn't as nice to use as express.js. So to abstract things a bit, I started building a little router, that at least makes me feel like I was using express.js. The router looked basically like this:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-js"&gt;class Router {
    // Every request type has its own map of routes pointing to handlers
    handlers = new Map([
        [&quot;GET&quot;, new Map()],
        [&quot;POST&quot;, new Map()]
    ])

    get(route, handler) {
        // Get the `GET` handler map and set the route to the new handler
        this.handlers.get(&quot;GET&quot;).set(route, handler)
    }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;With the router I was able to create new routes like this:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-js"&gt;const app = new Router()
app.get(&quot;/my-route&quot;, (request, response) =&gt; {
     // do something...
    response.end(&quot;Ok&quot;)
});
// GET /my-route =&gt; Ok
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So with this set-up, building the backend was more fun than I expected it to be.
Of course, the real router is more complex than this, so if you want to read the source code &lt;a href="https://github.com/Tch1b0/JP-nuxt/blob/master/server/router.ts"&gt;you can look at it on GitHub&lt;/a&gt;.&lt;/p&gt;
&lt;h1&gt;Technical specifications&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://nodejs.org/en"&gt;node.js&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.typescriptlang.org/"&gt;TypeScript&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://v3.nuxtjs.org"&gt;Nuxt 3&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.docker.com/"&gt;docker&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;... and many more. To see all the tech I used, go to &lt;a href="https://github.com/Tch1b0/JP-nuxt"&gt;the GitHub repo&lt;/a&gt;.&lt;/p&gt;
</content:encoded>
      <pubDate>Wed Mar 02 2022 09:07:57 GMT+0000 (Coordinated Universal Time)</pubDate>
      <author>Tch1b0</author>
    </item>
    <item>
      <title>battlesnake-builder</title>
      <link>https://johannespour.de/projects/463937993</link>
      <description>Easily build a battlesnake in python</description>
      <content:encoded>&lt;h1&gt;Idea&lt;/h1&gt;
&lt;p&gt;The idea of this library is, to abstract the process of building a BattleSnake to its fundamental parts. Which is declaring functions that get called when a move is requested. But not just that, but also accessible game-data(enemies, coordinates) and a session-wide store(for storing data across different events).&lt;/p&gt;
&lt;h1&gt;Implementation&lt;/h1&gt;
&lt;p&gt;As a user, you can just build a new snake like this:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-py"&gt;from battlesnake_builder import BattleSnake

my_snake = BattleSnake()

@my_snake.on_move
def move(_data, _store):
    return &quot;up&quot;

my_snake.run()
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;While behind the scenes, the library just assigns the &lt;code&gt;move&lt;/code&gt; function to the &lt;code&gt;on_move&lt;/code&gt; callback, which is called when the route &lt;code&gt;/move&lt;/code&gt; is accessed. The BattleSnake object also passes two parameters into the callback, which are &lt;code&gt;data&lt;/code&gt; and &lt;code&gt;store&lt;/code&gt;. The &lt;code&gt;data&lt;/code&gt; is just the data that the client sent, parsed into python-objects. The &lt;code&gt;store&lt;/code&gt; is just a dictionary, in which you can store whatever you want, across different events in the same session. With the &lt;code&gt;my_snake.run()&lt;/code&gt; the lib starts a Flask-server.&lt;/p&gt;
&lt;h1&gt;Related&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://johannespour.de/projects/355929028"&gt;Esproso&lt;/a&gt; (my BattleSnake)&lt;/li&gt;
&lt;/ul&gt;
</content:encoded>
      <pubDate>Thu Mar 03 2022 16:53:21 GMT+0000 (Coordinated Universal Time)</pubDate>
      <author>Tch1b0</author>
    </item>
    <item>
      <title>aoc2021</title>
      <link>https://johannespour.de/projects/433381433</link>
      <description>My solutions for Advent of Code 2021</description>
      <content:encoded>&lt;h1&gt;AO-what?&lt;/h1&gt;
&lt;p&gt;The &lt;a href="https://adventofcode.com/"&gt;Advent of Code&lt;/a&gt; is a yearly advent calendar that provides a new coding challenge every day while getting more difficult over time.&lt;/p&gt;
&lt;h1&gt;My Attempt&lt;/h1&gt;
&lt;h2&gt;The Preparation&lt;/h2&gt;
&lt;p&gt;This year, I tried to be &lt;strong&gt;prepared&lt;/strong&gt; and made the &lt;code&gt;aoc-helper&lt;/code&gt;(&lt;a href="https://github.com/Tch1b0/aoc2021/tree/master/aoc-helper"&gt;source code&lt;/a&gt;), a cli that allows me to easily &lt;strong&gt;generate a template&lt;/strong&gt; for my solution with unit tests in the programming language of my choice.&lt;/p&gt;
&lt;p&gt;With this command:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-bash"&gt;$ aoc -d 4 -l py
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I was able to generate a template for aoc-day 4 in the &lt;a href="https://www.python.org/"&gt;Python&lt;/a&gt; language.&lt;/p&gt;
&lt;p&gt;And by using this command:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-bash"&gt;$ aoc gen-doc
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Every single solution got their own little README that told a bit about the content.&lt;/p&gt;
&lt;p&gt;The cli was made using &lt;a href="https://crystal-lang.org/"&gt;Crystal&lt;/a&gt;, while the solutions to the tasks were written in &lt;a href="https://www.python.org/"&gt;Python&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;How it Turned Out&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;aoc-helper&lt;/code&gt; saved me a lot of time by &lt;strong&gt;automatically generating&lt;/strong&gt; what I needed. For &lt;strong&gt;10 days straight&lt;/strong&gt; I was able to solve the daily task. After the 10th day I slowly lost motivation, because the tasks kept getting harder and I needed longer to solve them. Despite this, I am happy with my performance, and planning to &lt;strong&gt;improve next year&lt;/strong&gt;.&lt;/p&gt;
</content:encoded>
      <pubDate>Tue Mar 22 2022 18:40:01 GMT+0000 (Coordinated Universal Time)</pubDate>
      <author>Tch1b0</author>
    </item>
    <item>
      <title>myDSB</title>
      <link>https://johannespour.de/projects/412470037</link>
      <description>An alternative for the DSBmobile app, for both Android and iOS</description>
      <content:encoded>&lt;h1&gt;What?&lt;/h1&gt;
&lt;p&gt;myDSB is an app for the DSBmobile service, which is a famous service for substitution plans in Germany.&lt;/p&gt;
&lt;h1&gt;Idea&lt;/h1&gt;
&lt;h2&gt;The Problem&lt;/h2&gt;
&lt;p&gt;Since the official DSBmobile app was the only way to access my substitution plan, I was &lt;strong&gt;required&lt;/strong&gt; to use it.&lt;/p&gt;
&lt;p&gt;The app itself provides a table containing &lt;strong&gt;every substitution&lt;/strong&gt; of &lt;strong&gt;every class&lt;/strong&gt; of the school, so I always needed to search where exactly the substitutions that were relevant to me were.&lt;/p&gt;
&lt;p&gt;And after some time, I thought: &lt;em&gt;&quot;Why can't I just filter the irrelevant data?&quot;&lt;/em&gt;.&lt;/p&gt;
&lt;h2&gt;The Solution&lt;/h2&gt;
&lt;p&gt;The solution was to build a library to interact with the DSBmobile API and a mobile application to display the &lt;strong&gt;filtered&lt;/strong&gt; information in a readable format.&lt;/p&gt;
&lt;p&gt;I decided to develop my library &amp; app in TypeScript, as I wanted &lt;a href="https://en.wikipedia.org/wiki/Cross-platform_software"&gt;cross-platform compatibility&lt;/a&gt;.&lt;/p&gt;
&lt;h1&gt;Execution&lt;/h1&gt;
&lt;p&gt;As I was pretty new to Javascript/TypeScript and Vue at the time, the development initially took a bit to get to a state where the app was usable.&lt;/p&gt;
&lt;p&gt;The library I created is &lt;a href="https://johannespour.de/projects/410312472"&gt;dsbmobile.js&lt;/a&gt;.&lt;/p&gt;
&lt;h1&gt;Technical specifications&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.typescriptlang.org/"&gt;TypeScript&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vuejs.org/"&gt;Vuejs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://ionicframework.com/"&gt;ionic framework&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content:encoded>
      <pubDate>Sat Jun 04 2022 08:58:11 GMT+0000 (Coordinated Universal Time)</pubDate>
      <author>Tch1b0</author>
    </item>
    <item>
      <title>Esproso</title>
      <link>https://johannespour.de/projects/355929028</link>
      <description>A Battlesnake made in Go</description>
      <content:encoded>&lt;h1&gt;What is a Battlesnake?&lt;/h1&gt;
&lt;h2&gt;Generally&lt;/h2&gt;
&lt;p&gt;A Battlesnake is a bot that competes against other Battlesnakes in a &lt;a href="https://en.wikipedia.org/wiki/Snake_(video_game_genre)"&gt;snake-like&lt;/a&gt; game on &lt;a href="https://play.battlesnake.com/"&gt;play.battlesnake.com&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;In-depth&lt;/h2&gt;
&lt;p&gt;A BattleSnake is an http-Server with the endpoints &lt;code&gt;/start&lt;/code&gt;, &lt;code&gt;/move&lt;/code&gt; and &lt;code&gt;/end&lt;/code&gt;. The BattleSnake Servers send a new request each turn, containing all the
necessary information.&lt;/p&gt;
&lt;h3&gt;Example Response&lt;/h3&gt;
&lt;pre&gt;&lt;code class="language-json"&gt;{
    &quot;move&quot;: &quot;up&quot;,
    &quot;shout&quot;: &quot;WHY ARE WE SHOUTING?&quot;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h1&gt;Tactic&lt;/h1&gt;
&lt;p&gt;Esproso is trying to survive as long as possible, and not really caring about other snakes as long as they stay out of their way. To achieve this, Esproso first looks if there is some obstacle right next to him, and sorts the given moves out. Afterwards, it looks for food nearby and calculates the lowest distance right before heading for it.&lt;/p&gt;
&lt;h1&gt;What I learned&lt;/h1&gt;
&lt;p&gt;When I started the project, the &lt;a href="https://go.dev/"&gt;Golang&lt;/a&gt; programming language was still pretty new for me, so I learned many fundamental things like http-servers or parsing JSON objects to structs.&lt;/p&gt;
&lt;h2&gt;Parsing JSON to a struct&lt;/h2&gt;
&lt;p&gt;JSON:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-json"&gt;{
    &quot;id&quot;: &quot;game-00fe20da-94ad-11ea-bb37&quot;,
    &quot;ruleset&quot;: {
        &quot;name&quot;: &quot;standard&quot;,
        &quot;version&quot;: &quot;v.1.2.3&quot;
    },
    &quot;timeout&quot;: 500
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Go struct:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-go"&gt;type Game struct {
    Id      string  `json:&quot;id&quot;`
    Ruleset Ruleset `json:&quot;ruleset&quot;`
    Timeout int     `json:&quot;timeout&quot;`
}
type Ruleset struct {
    Name    string `json:&quot;name&quot;`
    Version string `json:&quot;version&quot;`
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And after that, the hardest part is already done.&lt;/p&gt;
&lt;h1&gt;Technical specifications&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://go.dev/"&gt;Golang&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;default http-server&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docker.com"&gt;docker&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content:encoded>
      <pubDate>Fri Feb 25 2022 17:32:36 GMT+0000 (Coordinated Universal Time)</pubDate>
      <author>Tch1b0</author>
    </item>
    <item>
      <title>MoGo</title>
      <link>https://johannespour.de/projects/370768074</link>
      <description>This Discord bot automatically detects Links and shortens them</description>
      <content:encoded>&lt;h1&gt;What?&lt;/h1&gt;
&lt;p&gt;MoGo is a &lt;a href="https://en.wikipedia.org/wiki/Discord"&gt;Discord&lt;/a&gt; bot that scans through new messages for links to shorten them.&lt;/p&gt;
&lt;h1&gt;Technical&lt;/h1&gt;
&lt;h2&gt;Tech used&lt;/h2&gt;
&lt;p&gt;MoGo was built using &lt;a href="https://go.dev"&gt;Golang&lt;/a&gt; and &lt;a href="https://github.com/bwmarrin/discordgo"&gt;discordgo&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;How?&lt;/h2&gt;
&lt;p&gt;But how exactly does MoGo detect whether something is a link or not? The only input it gets is some text like &lt;em&gt;&quot; something something https://example.com something&quot;&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;The Answer is &lt;a href="https://en.wikipedia.org/wiki/Regular_expression"&gt;Regular Expressions&lt;/a&gt;!&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-regex"&gt;https?:\/\/(([a-z0-9]){0,}\.)?([a-z0-9]){2,63}\.[a-z]{2,}(\/[\s\S]{0,}?){0,}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The Regular Expression above describes a URL and tells MoGo whether something is an URL or not.&lt;/p&gt;
</content:encoded>
      <pubDate>Sun Jun 26 2022 15:41:52 GMT+0000 (Coordinated Universal Time)</pubDate>
      <author>Tch1b0</author>
    </item>
    <item>
      <title>quick-poll</title>
      <link>https://johannespour.de/projects/737780898</link>
      <description>live polls using websockets with realtime charts</description>
      <content:encoded>&lt;p&gt;&lt;br&gt;
&lt;div align=&quot;center&quot;&gt;
&lt;img src=&quot;https://github.com/Tch1b0/quick-poll/blob/main/client/icons/icon-256.png?raw=true&quot; style=&quot;border-radius: 5pt&quot;&gt;
&lt;/div&gt;&lt;/p&gt;
&lt;h2&gt;What is &lt;strong&gt;Quick Poll&lt;/strong&gt;?&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Quick Poll&lt;/strong&gt; is a a website on which you can take quickly polls. You first create your poll and then are able to share a link to that poll. But it doesn't end there, that would be boring.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Quick Poll&lt;/strong&gt; transmits the data the users enter &lt;strong&gt;&lt;em&gt;live&lt;/em&gt;&lt;/strong&gt;. That means whenever a user ticks something, your charts immediately update.&lt;/p&gt;
&lt;h2&gt;Philosophy&lt;/h2&gt;
&lt;h3&gt;Observing decision-making&lt;/h3&gt;
&lt;p&gt;&lt;em&gt;&quot;Why would that matter?&quot;&lt;/em&gt;, you may ask. Sometimes it isn't just enough to know peoples opinion on something, but also how &lt;strong&gt;their opinion changes&lt;/strong&gt; after receiving other information or thinking about their decision.&lt;/p&gt;
&lt;p&gt;For example, You could see how &lt;em&gt;question 2&lt;/em&gt; would affect the votes on &lt;em&gt;question 1&lt;/em&gt;, because, at least from my experience, people can change their minds all
the time based on their surroundings.&lt;/p&gt;
&lt;p&gt;Humans ideally &lt;strong&gt;do not&lt;/strong&gt; just have a &lt;strong&gt;black and white opinion&lt;/strong&gt; like normal polls may suggest. We've all been at that point in a poll where we are switching back and forth between two options.&lt;/p&gt;
&lt;p&gt;With &lt;strong&gt;Quick Poll&lt;/strong&gt; you can see these indecisive human patterns.&lt;/p&gt;
&lt;h3&gt;Privacy&lt;/h3&gt;
&lt;p&gt;&lt;em&gt;&quot;Isn't this a privacy violation?&quot;&lt;/em&gt; is a question that also came to my mind. If I would allow the poll admin to observe every single ones poll result individually - yes, then it &lt;strong&gt;&lt;em&gt;would be&lt;/em&gt;&lt;/strong&gt; a security violation. &lt;strong&gt;&lt;em&gt;However, you can not observe votes individually&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;You only see that &lt;strong&gt;anonymous cluster of votes&lt;/strong&gt;, which is also way more interesting than one single person.
After all, we are taking polls with as many people as possible, because that means we will get the most &lt;strong&gt;accurate&lt;/strong&gt; result.&lt;/p&gt;
&lt;h2&gt;Technical View&lt;/h2&gt;
&lt;h3&gt;Generally&lt;/h3&gt;
&lt;p&gt;The &lt;strong&gt;client&lt;/strong&gt; was built with vanilla &lt;strong&gt;html&lt;/strong&gt;, &lt;strong&gt;css&lt;/strong&gt; and &lt;strong&gt;javascript&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;backend&lt;/strong&gt; is written in plain &lt;strong&gt;&lt;a href="https://go.dev"&gt;go&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Communication protocols&lt;/strong&gt; between client and backend are &lt;strong&gt;&lt;a href="https://de.wikipedia.org/wiki/Hypertext_Transfer_Protocol"&gt;HTTP&lt;/a&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;a href="https://de.wikipedia.org/wiki/WebSocket"&gt;WebSocket&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;
&lt;h3&gt;WebSocket communication&lt;/h3&gt;
&lt;p&gt;This is, in my opinion, the most interesting part of the project, as it allows data to flow flawlessly between client (poll takers), server and host (poll admin).&lt;/p&gt;
&lt;p&gt;Multiple clients and the host are connected via individual websockets to the server:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-txt"&gt;----------     websocket  
| client |   -------------------
----------                     |
                               |
----------      websocket      |
| client |   ---------------|  |
----------                 ----------   websocket      --------
                           | server | --------------   | host |
----------      websocket  ----------                  --------
| client |   ---------------|  |
----------                     |
                               |
----------       websocket     |
| client |   -------------------
----------
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;strong&gt;clients&lt;/strong&gt; immediately send their &lt;em&gt;newly updated&lt;/em&gt; fields to the server, and the &lt;strong&gt;server&lt;/strong&gt; updates its &lt;strong&gt;internal state&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;state&lt;/strong&gt; is then sent to the &lt;strong&gt;host&lt;/strong&gt;, for the charts to be immediately updated.&lt;/p&gt;
&lt;p&gt;The host can send &lt;strong&gt;actions&lt;/strong&gt; (e.g. start a poll) to the &lt;strong&gt;server&lt;/strong&gt;, which then &lt;strong&gt;broadcasts&lt;/strong&gt; the action to the clients.&lt;/p&gt;
&lt;p&gt;Here is a visual representation of the data flow:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-txt"&gt;----------      input -&gt;  
| client |   -------------------------
----------      &lt;- action            |
                                     |
----------      input -&gt;             |
| client |   ---------------------|  |
----------      &lt;- action     ----------   state -&gt;       --------
                              | server | --------------   | host |
----------      input -&gt;      ----------   &lt;- action      --------
| client |   ---------------------|  |
----------      &lt;- action            |
                                     |
----------       input -&gt;            |
| client |   -------------------------
----------      &lt;- action
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;Messages in-depth&lt;/h3&gt;
&lt;p&gt;In my project, I decided to send &lt;a href="https://www.json.org/json-en.html"&gt;JSON&lt;/a&gt; objects around.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;default layout&lt;/strong&gt; of a message:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-json"&gt;{
  &quot;type&quot;: &lt;message type&gt;,
  &quot;data&quot;: &lt;data corresponding to type&gt;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;There are also &lt;strong&gt;special cases&lt;/strong&gt;, for example the input of a client is designed to be efficient, as it is sent pretty often (users like to click buttons). When a client changes their input, it only sends a small array containing the answers.&lt;/p&gt;
&lt;p&gt;For example:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-json"&gt;[2, &quot;Blue&quot;, &quot;George Washington&quot;, null]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In this case, we can see that the user already filled out the first three questions. The first questions seems to be a selection, number two and three seem to be inputs. Notice the &lt;code&gt;null&lt;/code&gt; at the end? That is a question that wasn't filled out &lt;em&gt;yet&lt;/em&gt;.&lt;/p&gt;
&lt;h2&gt;Purpose&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Quick Poll&lt;/strong&gt; was built as a school project, where the task was to simply build a web app.&lt;/p&gt;
&lt;p&gt;But different to my other experiences with my software, &lt;strong&gt;Quick Poll&lt;/strong&gt; was actually kind of integrated in my everday use.&lt;/p&gt;
&lt;p&gt;Sometimes when &lt;strong&gt;decisions had to be made&lt;/strong&gt; in my school class, or someone wanted to make a quiz/poll (e.g. for a presentation), &lt;strong&gt;Quick Poll&lt;/strong&gt; was used without me pushing that idea, which suggests to me, that this project fulfills it's purpose successfully. That is an experience that (many developers will agree) is not self explanatory and very rewarding.&lt;/p&gt;
&lt;h2&gt;What I learned / I want to tell you&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;WebSockets&lt;/strong&gt; are a great thing, and connecting clients &lt;strong&gt;&lt;em&gt;live&lt;/em&gt;&lt;/strong&gt; gives an immediate feeling of &lt;strong&gt;&lt;em&gt;magic&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;I can only recommend you &lt;strong&gt;to look into building one or two projects with WebSockets&lt;/strong&gt;, because the learning curve isn't as high as expected, but the results are very rewarding.&lt;/p&gt;
&lt;p&gt;You can do that in &lt;strong&gt;any programming language&lt;/strong&gt;, as it is only a network protocol, and it's implemented &lt;strong&gt;everywhere&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;No idea what to build?
Let me give you a hand, you could build a simple...&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Chat app (no fancy UI needed)&lt;/li&gt;
&lt;li&gt;Game (like tictactoe over the network)&lt;/li&gt;
&lt;li&gt;(Web-)App for polls (That was also &lt;a href="https://github.com/Tch1b0/quick-poll"&gt;my approach&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;And much much more!&lt;/p&gt;
&lt;p&gt;Not feeling creative? You can always ask the &lt;a href="https://en.wikipedia.org/wiki/Large_language_model"&gt;LLM&lt;/a&gt; of your trust.&lt;/p&gt;
</content:encoded>
      <pubDate>Sat Mar 23 2024 10:05:36 GMT+0000 (Coordinated Universal Time)</pubDate>
      <author>Tch1b0</author>
    </item>
    <item>
      <title>brainfuck</title>
      <link>https://johannespour.de/projects/747270304</link>
      <description>a brainfuck interpreter written in go</description>
      <content:encoded>&lt;h1&gt;What is Brainfuck?&lt;/h1&gt;
&lt;h2&gt;Description&lt;/h2&gt;
&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/Brainfuck"&gt;Brainfuck&lt;/a&gt; is a so called &lt;em&gt;esoteric programming language&lt;/em&gt;, which has no &lt;em&gt;real&lt;/em&gt; real world use, but is rather used to &lt;strong&gt;demonstrate&lt;/strong&gt; how abstract a programming language can be.&lt;/p&gt;
&lt;h2&gt;Functionality&lt;/h2&gt;
&lt;p&gt;The language itself is pretty simple, it only consists of &lt;strong&gt;8 commands&lt;/strong&gt;: &lt;code&gt;.,&lt;&gt;+-[]&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;When running Brainfuck code, you basically just go through and mutate an array of data cells.
The program is &lt;strong&gt;always pointing&lt;/strong&gt; at a &lt;strong&gt;certain data cell&lt;/strong&gt;.&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-txt"&gt;0  0  0  0  0  0  0  0
^^
Selected Cell
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;h3&gt;&lt;code&gt;&lt;&gt;&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;Using the &lt;code&gt;&lt;&lt;/code&gt; and &lt;code&gt;&gt;&lt;/code&gt; operators, you can &lt;strong&gt;switch the selected cell&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Executing the &lt;code&gt;&gt;&lt;/code&gt; command:&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-txt"&gt;0  0  0  0  0  0  0  0
   ^^
Selected Cell
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;h3&gt;&lt;code&gt;+-&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;So now we can switch between the cells, that's cool, but what else?&lt;/p&gt;
&lt;p&gt;We can increase or decrease the value of the cell by using the &lt;code&gt;+&lt;/code&gt; or &lt;code&gt;-&lt;/code&gt; command.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Executing the &lt;code&gt;+&lt;/code&gt; command:&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-txt"&gt;0  1  0  0  0  0  0  0
   ^^
Selected Cell
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;h3&gt;&lt;code&gt;.,&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;Now we want to &lt;strong&gt;print&lt;/strong&gt; our data to the terminal via using the &lt;code&gt;.&lt;/code&gt; or &lt;strong&gt;read&lt;/strong&gt; from the user &lt;strong&gt;input&lt;/strong&gt; via using &lt;code&gt;,&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;So, &lt;code&gt;.&lt;/code&gt; &lt;strong&gt;outputs&lt;/strong&gt; the current cell in ASCII representation, and &lt;code&gt;,&lt;/code&gt; &lt;strong&gt;stores&lt;/strong&gt; the ASCII code of the &lt;strong&gt;inputted data&lt;/strong&gt; in the currently selected cell.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;h3&gt;&lt;code&gt;[]&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;We've almost got everything to be turing complete, the only thing missing is &lt;strong&gt;the loop&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;[&lt;/code&gt; indicates the beginning of a loop, and &lt;code&gt;]&lt;/code&gt; indicates the end. The program loops, &lt;strong&gt;until the currently selected cell equals &lt;code&gt;0&lt;/code&gt;&lt;/strong&gt;.&lt;/p&gt;
&lt;h2&gt;Example Program&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Code:&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-bf"&gt;&gt;++++++++[&lt;+++++++++&gt;-]&lt;.&gt;++++[&lt;+++++++&gt;-]&lt;+.+++++++..+++.&gt;&gt;++++++[&lt;+++++++&gt;-]&lt;+
+.------------.&gt;++++++[&lt;+++++++++&gt;-]&lt;+.&lt;.+++.------.--------.&gt;&gt;&gt;++++[&lt;++++++++&gt;-
]&lt;+.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-sh"&gt;Hello, World!
&lt;/code&gt;&lt;/pre&gt;
&lt;h1&gt;My implementation&lt;/h1&gt;
&lt;h2&gt;Motivation&lt;/h2&gt;
&lt;p&gt;As I know some basic concepts of implementing a programming language (&lt;em&gt;even though I never did implement one&lt;/em&gt;), I thought that it would be a short and fun project to implement a Brainfuck interpreter, as this is a common exercise, due to the simple syntax and logic.&lt;/p&gt;
&lt;h2&gt;Technical Details / Project Structure&lt;/h2&gt;
&lt;p&gt;For my implementation, I used nothing but the raw &lt;a href="https://go.dev"&gt;go&lt;/a&gt; programming language.&lt;/p&gt;
&lt;p&gt;I tried to logically split the project into seperate layers, like it is done with bigger lanugages.&lt;/p&gt;
&lt;p&gt;&lt;hr style=&quot;width: 50%; margin-top: 10pt&quot; /&gt;&lt;/p&gt;
&lt;h3&gt;Layer 1 - Lexer / Tokenizer&lt;/h3&gt;
&lt;p&gt;In the first layer, the plain text/string is converted to an array of instructions, that &lt;strong&gt;do not yet hold any functionality&lt;/strong&gt;, but are rather just symbols for the interpreter to get along easier with the instructions.&lt;/p&gt;
&lt;p&gt;&lt;hr style=&quot;width: 50%; margin-top: 10pt&quot; /&gt;&lt;/p&gt;
&lt;h3&gt;Layer 2 - Block builder&lt;/h3&gt;
&lt;p&gt;In the second layer, the &lt;strong&gt;blocks&lt;/strong&gt; are built. You may ask yourself now &lt;em&gt;&quot;what are &lt;strong&gt;blocks&lt;/strong&gt;?&quot;&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;In the definition for this project, &lt;strong&gt;a block is a set of instructions&lt;/strong&gt;, that stands for itself and contains all instructions which are to be executed in it. A block cannot look outside of it's own scope, so it is &lt;strong&gt;isolated&lt;/strong&gt; from it's surroundings, and therefore &lt;strong&gt;easily executable&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;hr style=&quot;width: 50%; margin-top: 10pt&quot; /&gt;&lt;/p&gt;
&lt;h3&gt;Layer 3 - Interpreter&lt;/h3&gt;
&lt;p&gt;In the final layer, the previously built &lt;strong&gt;blocks&lt;/strong&gt; are now being &lt;strong&gt;executed&lt;/strong&gt;. There is a &lt;strong&gt;statically declared byte array&lt;/strong&gt;, in which the entire cell-selection and storage takes place.&lt;/p&gt;
</content:encoded>
      <pubDate>Thu Feb 15 2024 14:14:57 GMT+0000 (Coordinated Universal Time)</pubDate>
      <author>Tch1b0</author>
    </item>
  </channel>
</rss>