<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="https://aandree5.github.io/feed.xml" rel="self" type="application/atom+xml" /><link href="https://aandree5.github.io/" rel="alternate" type="text/html" /><updated>2025-06-10T21:10:29+00:00</updated><id>https://aandree5.github.io/feed.xml</id><title type="html">Andre Silva</title><entry><title type="html">CovEventry - Android App</title><link href="https://aandree5.github.io/projects/CovEventry-Android-App.html" rel="alternate" type="text/html" title="CovEventry - Android App" /><published>2019-03-01T00:00:00+00:00</published><updated>2019-03-01T00:00:00+00:00</updated><id>https://aandree5.github.io/projects/CovEventry-Android-App</id><content type="html" xml:base="https://aandree5.github.io/projects/CovEventry-Android-App.html"><![CDATA[<p>An Android app built to show all events around the user in one place. Is able to check the app own database for special events created in it but also scan tweets around the user relating to events.</p>

<div class="title">
    <h1>Login</h1>
    <hr />
</div>
<p>This app doesn’t use a username and password login to simplify its use, having no need to memorize one more password, instead it uses social media to give special functions to the user, like connecting with friends and inviting to events (feature to be added in the future). It contains custom views to allow the user to seamlessly login with either Facebook or Twitter, or both, that will then be saved on the database and synced across devices.</p>

<div class="title">
    <h1>Twitter Events</h1>
    <hr />
</div>
<p>It also uses Twitter to retrieve events from posts, first it gets the user location, which will in turn ask Google for the address for that location and retrieve the user current city, uses that information to query the Twitter API (with custom built classes) to retrieve the events around the user with a special query to filter mostly events, after that it goes through each event to check if the free typed user location is the same city as the user, the last step is to pinpoint that event venue on a map, for that it queries Google Places API with the user location to retrieve a place around the user with the username from the tweet, showing it on the map after.</p>

<div class="title">
    <h1>Database</h1>
    <hr />
</div>
<p>To interact with the database the app connects to PHP webservices, that will perform the operations on the database, it’s a safer a cross platform approach. The events saved on the database are straight forward, they have all the needed information and the app just requests the events of the day, downloads the images and has everything it need to proper show to the user.</p>

<div class="title">
    <h1>Usability</h1>
    <hr />
</div>
<p>Fragments are used to follow Google’s design patterns a give the user an experience that his used to, with the system apps, also loads the important part as soon as the user opens the app, which removes the need to go through the app looking for the needed information, the user can even, with just a tap, swap to a list view instead of the map.</p>]]></content><author><name></name></author><category term="Java" /><category term="Android Studio" /><category term="GitHub" /><category term="PHP" /><category term="SQL" /><summary type="html"><![CDATA[An Android app built to show all events around the user in one place. Is able to check the app own database for special events created in it but also scan tweets around the user relating to events.]]></summary></entry><entry><title type="html">Android App</title><link href="https://aandree5.github.io/projects/Android-App.html" rel="alternate" type="text/html" title="Android App" /><published>2018-12-01T00:00:00+00:00</published><updated>2018-12-01T00:00:00+00:00</updated><id>https://aandree5.github.io/projects/Android-App</id><content type="html" xml:base="https://aandree5.github.io/projects/Android-App.html"><![CDATA[<p>An Android app built to consolidate the University information in one place. Able to check the news form the University and go through the enrolment process.</p>

<div class="title">
    <h1>Database</h1>
    <hr />
</div>
<p>For the connection to the database this app uses PHP as a webservice, improving security and allowing for easier portability, since the conde doesn’t need to be embedded in the app itself. 
To connect to the PHP file, the app uses an Interface built for this purpose that get a HashMap with the key-pair values to query the server, the PHP than return the appropriate response which the app will then read.</p>

<div class="title">
    <h1>Design</h1>
    <hr />
</div>
<p>The design contains different custom views to allow the app to adhere to the platform design patterns whilst having a University focused theme. The theme is kept simple and bold, so it doesn’t overcomplicate the visual effect but still gets the user attention.</p>

<div class="title">
    <h1>Usability</h1>
    <hr />
</div>
<p>Fragments and activities are used as needed to help with usability, keeping the same flow that the user is used to, with the platform. Different navigation views are used depending on their needed function.</p>]]></content><author><name></name></author><category term="Java" /><category term="Android Studio" /><category term="GitHub" /><category term="SQL" /><summary type="html"><![CDATA[An Android app built to consolidate the University information in one place. Able to check the news form the University and go through the enrolment process.]]></summary></entry><entry><title type="html">Binary Tree &amp;amp; Graph</title><link href="https://aandree5.github.io/projects/BinaryTree-Graph.html" rel="alternate" type="text/html" title="Binary Tree &amp;amp; Graph" /><published>2018-12-01T00:00:00+00:00</published><updated>2018-12-01T00:00:00+00:00</updated><id>https://aandree5.github.io/projects/BinaryTree-Graph</id><content type="html" xml:base="https://aandree5.github.io/projects/BinaryTree-Graph.html"><![CDATA[<p>A project composed of two data structures, a self-balancing binary tree (AVL Tree) and a Graph. Complete with expected methods and some specific operations like Dijkstra algorithm.</p>

<div class="title">
    <h1>Binary Tree</h1>
    <hr />
</div>
<p>For this project I needed to build a binary tree data structure, with add, remove, find and print methods. After doing that I decided to take it a step forward and make it a self-balancing tree, this way reducing the worst case big-O to <code class="language-plaintext highlighter-rouge">O(log(n))</code>.</p>

<div class="title">
    <h1>Self-Balancing</h1>
    <hr />
</div>
<p>Uses three functions to balance the tree, the first checks the balance of a specific subtree, the second function just checks what the depth for a node should be and the last function actually balances the tree, after checking if it is <code class="language-plaintext highlighter-rouge">Right Right Heavy</code>, <code class="language-plaintext highlighter-rouge">Right Left Heavy</code>, <code class="language-plaintext highlighter-rouge">Left Left Heavy</code> or <code class="language-plaintext highlighter-rouge">Left Right Heavy</code> and adjusts it accordingly.</p>

<div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">if</span> <span class="p">(</span><span class="n">balance</span> <span class="o">&lt;</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="c1">// Left Heavy</span>
<span class="p">{</span>
    <span class="kt">int</span> <span class="n">childBalance</span> <span class="o">=</span> <span class="n">checkBalance</span><span class="p">(</span><span class="n">node</span><span class="o">-&gt;</span><span class="n">left</span><span class="p">);</span>
    
    <span class="c1">// Left Right Heavy</span>
    <span class="cm">/*        T         -&gt;      R
             /          -&gt;     / \
            O           -&gt;    O   T
             \          -&gt;
              R         -&gt;              */</span>
    <span class="k">if</span> <span class="p">(</span><span class="n">childBalance</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">)</span>
    <span class="p">{</span>
        <span class="n">shared_ptr</span><span class="o">&lt;</span><span class="n">BinaryTreeNode</span><span class="o">&gt;</span> <span class="n">tempLeftRight</span> <span class="o">=</span> <span class="n">node</span><span class="o">-&gt;</span><span class="n">left</span><span class="o">-&gt;</span><span class="n">right</span><span class="p">;</span>

        <span class="k">if</span> <span class="p">(</span><span class="n">tempLeftRight</span><span class="o">-&gt;</span><span class="n">left</span><span class="p">)</span>
            <span class="n">tempLeftRight</span><span class="o">-&gt;</span><span class="n">left</span><span class="o">-&gt;</span><span class="n">parent</span> <span class="o">=</span> <span class="n">node</span><span class="o">-&gt;</span><span class="n">left</span><span class="p">;</span>

        <span class="k">if</span> <span class="p">(</span><span class="n">tempLeftRight</span><span class="o">-&gt;</span><span class="n">right</span><span class="p">)</span>
            <span class="n">tempLeftRight</span><span class="o">-&gt;</span><span class="n">right</span><span class="o">-&gt;</span><span class="n">parent</span> <span class="o">=</span> <span class="n">node</span><span class="p">;</span>

        <span class="n">node</span><span class="o">-&gt;</span><span class="n">left</span><span class="o">-&gt;</span><span class="n">right</span> <span class="o">=</span> <span class="n">tempLeftRight</span><span class="o">-&gt;</span><span class="n">left</span><span class="p">;</span>
        <span class="n">tempLeftRight</span><span class="o">-&gt;</span><span class="n">left</span> <span class="o">=</span> <span class="n">node</span><span class="o">-&gt;</span><span class="n">left</span><span class="p">;</span>

        <span class="n">node</span><span class="o">-&gt;</span><span class="n">left</span> <span class="o">=</span> <span class="n">tempLeftRight</span><span class="o">-&gt;</span><span class="n">right</span><span class="p">;</span>
        <span class="n">tempLeftRight</span><span class="o">-&gt;</span><span class="n">right</span> <span class="o">=</span> <span class="n">node</span><span class="p">;</span>

        <span class="k">if</span> <span class="p">(</span><span class="n">shared_ptr</span><span class="o">&lt;</span><span class="n">BinaryTreeNode</span><span class="o">&gt;</span> <span class="n">parent</span> <span class="o">=</span> <span class="n">node</span><span class="o">-&gt;</span><span class="n">parent</span><span class="p">.</span><span class="n">lock</span><span class="p">())</span>
            <span class="p">(</span><span class="n">parent</span><span class="o">-&gt;</span><span class="n">left</span> <span class="o">==</span> <span class="n">node</span> <span class="o">?</span> <span class="n">parent</span><span class="o">-&gt;</span><span class="n">left</span> <span class="o">:</span> <span class="n">parent</span><span class="o">-&gt;</span><span class="n">right</span><span class="p">)</span> <span class="o">=</span> <span class="n">tempLeftRight</span><span class="p">;</span>
        <span class="k">else</span>
            <span class="n">root</span> <span class="o">=</span> <span class="n">tempLeftRight</span><span class="p">;</span>

        <span class="n">tempLeftRight</span><span class="o">-&gt;</span><span class="n">parent</span> <span class="o">=</span> <span class="n">node</span><span class="o">-&gt;</span><span class="n">parent</span><span class="p">;</span>
        <span class="n">tempLeftRight</span><span class="o">-&gt;</span><span class="n">left</span><span class="o">-&gt;</span><span class="n">parent</span> <span class="o">=</span> <span class="n">tempLeftRight</span><span class="p">;</span>
        <span class="n">node</span><span class="o">-&gt;</span><span class="n">parent</span> <span class="o">=</span> <span class="n">tempLeftRight</span><span class="p">;</span>

        <span class="n">tempLeftRight</span><span class="o">-&gt;</span><span class="n">depth</span> <span class="o">=</span> <span class="n">getCorrectDepth</span><span class="p">(</span><span class="n">tempLeftRight</span><span class="p">);</span>
        <span class="n">tempLeftRight</span><span class="o">-&gt;</span><span class="n">left</span><span class="o">-&gt;</span><span class="n">depth</span> <span class="o">=</span> <span class="n">getCorrectDepth</span><span class="p">(</span><span class="n">tempLeftRight</span><span class="o">-&gt;</span><span class="n">left</span><span class="p">);</span>
    <span class="p">}</span>

    <span class="p">...</span>
<span class="p">}</span>
</code></pre></div></div>

<div class="title">
    <h1>Graph</h1>
    <hr />
</div>
<p>The graph required methods like, add node, add edge, check if there’s a path, Dijkstra best path, check if the graph is connected and print methods. I decided to use an adjacency list for the edges because it was going to work with sparse graphs and a matrix would consume more memory. Each edge is also an object where both nodes hold a pointer to, instead of having to update both nodes for any changes it can be made on the <code class="language-plaintext highlighter-rouge">Edge</code> object.</p>

<div class="title">
    <h1>Dijkstra</h1>
    <hr />
</div>
<p>This is a straight forward use of the algorithm, for each node creates a <code class="language-plaintext highlighter-rouge">DijkstraItem</code> object an sets the cost to the maximum allowed number, after steps trough each node finding and keeping track of the cheapest path to it, until it gets to the destination. After check if it is connected from the start node to the end node and prints the path</p>

<div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">///&lt;summary&gt;Data structure used by Dijkstra algorithm.&lt;/summary&gt;</span>
<span class="k">struct</span> <span class="nc">DijkstraItem</span>
<span class="p">{</span>
    <span class="n">weak_ptr</span><span class="o">&lt;</span><span class="n">GraphNode</span><span class="o">&gt;</span> <span class="n">fromRef</span><span class="p">;</span>
    <span class="kt">size_t</span> <span class="n">cost</span><span class="p">;</span>
    <span class="kt">bool</span> <span class="n">visited</span><span class="p">;</span>

    <span class="c1">///&lt;summary&gt;Creates a new item, with cost 0 and visited set to false.&lt;/summary&gt;</span>
    <span class="c1">///&lt;remark&gt;BigO notation for worst case is O(1).&lt;/remark&gt;</span>
    <span class="n">DijkstraItem</span><span class="p">()</span>
    <span class="p">{</span>
        <span class="k">this</span><span class="o">-&gt;</span><span class="n">cost</span> <span class="o">=</span> <span class="n">UINT64_MAX</span><span class="p">;</span>
        <span class="n">visited</span> <span class="o">=</span> <span class="nb">false</span><span class="p">;</span>
    <span class="p">}</span>

    <span class="c1">///&lt;summary&gt;Creates a new item, with the given properties.&lt;/summary&gt;</span>
    <span class="c1">///&lt;remark&gt;BigO notation for worst case is O(1).&lt;/remark&gt;</span>
    <span class="c1">///&lt;param name="fromRef"&gt;Pointer to the node from where this was found.&lt;/param&gt;</span>
    <span class="c1">///&lt;param name="cost"&gt;Cost to get from the starting node to this one, throught the 'fromRef'.&lt;/param&gt;</span>
    <span class="n">DijkstraItem</span><span class="p">(</span><span class="n">shared_ptr</span><span class="o">&lt;</span><span class="n">GraphNode</span><span class="o">&gt;</span> <span class="n">fromRef</span><span class="p">,</span> <span class="kt">size_t</span> <span class="n">cost</span><span class="p">)</span>
    <span class="p">{</span>
        <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">fromRef</span><span class="p">)</span>
            <span class="k">throw</span> <span class="n">invalid_argument</span><span class="p">(</span><span class="s">"'fomrRef' can't be null."</span><span class="p">);</span>

        <span class="k">this</span><span class="o">-&gt;</span><span class="n">fromRef</span> <span class="o">=</span> <span class="n">fromRef</span><span class="p">;</span>
        <span class="k">this</span><span class="o">-&gt;</span><span class="n">cost</span> <span class="o">=</span> <span class="n">cost</span><span class="p">;</span>
        <span class="n">visited</span> <span class="o">=</span> <span class="nb">false</span><span class="p">;</span>
    <span class="p">}</span>
<span class="p">};</span>
</code></pre></div></div>

<div class="title">
    <h1>Testing</h1>
    <hr />
</div>
<p>All methods of all classes on the project are tested, from wrong input to check if properties are set accordingly and operations run as they should.</p>

<div class="title">
    <h1>Reflection</h1>
    <hr />
</div>
<p>Some of the functions end up with a big-O of <code class="language-plaintext highlighter-rouge">O(n^2)</code> because the program tries to save memory in some places and as the graph isn’t dense the iterations can be done relatively fast, for denser graphs other methods could be used.
The custom queue, stack and list work as a singly linked list to save memory, for improved processing speed a hash table or a binary tree would be better used.</p>]]></content><author><name></name></author><category term="C++" /><category term="Visual Studio" /><category term="GitHub" /><summary type="html"><![CDATA[A project composed of two data structures, a self-balancing binary tree (AVL Tree) and a Graph. Complete with expected methods and some specific operations like Dijkstra algorithm.]]></summary></entry><entry><title type="html">MazeRaider</title><link href="https://aandree5.github.io/projects/MazeRaider.html" rel="alternate" type="text/html" title="MazeRaider" /><published>2018-05-01T00:00:00+00:00</published><updated>2018-05-01T00:00:00+00:00</updated><id>https://aandree5.github.io/projects/MazeRaider</id><content type="html" xml:base="https://aandree5.github.io/projects/MazeRaider.html"><![CDATA[<p>A text base ASCII maze game, the objective is to find the way out, pick up all the chests to get more points and defeat the monsters without being killed.</p>

<div class="title">
    <h1>Database</h1>
    <hr />
</div>
<p>This game connects to a MySQL database to retrieve and save the player data and score, also retrieves the information about the possible monsters to spawn. There’s also items that are fetched from the database, they appear in chests spread throughout the maze.</p>

<div class="title">
    <h1>Mechanics</h1>
    <hr />
</div>
<p>The objective is to reach the exit with the maximum number of points possible, the score decreases with time but can be increased with chests and by defeating monsters. The maze is generated randomly and the same for the monsters and chests, with items or not.
The player can also have several characters with different stats and visual representation.</p>

<div class="title">
    <h1>Features</h1>
    <hr />
</div>
<p>The battles with the monsters is the same style as a Pokémon battle, with animations for the attacks or defences and colors.</p>

<p>Also the game is prepared to run on a windows or linux system.</p>

<p>Used a A* pathfinding algorithm to find the best path for the enemies to move towards the player.</p>]]></content><author><name></name></author><category term="C++" /><category term="GitHub" /><summary type="html"><![CDATA[A text base ASCII maze game, the objective is to find the way out, pick up all the chests to get more points and defeat the monsters without being killed.]]></summary></entry><entry><title type="html">Challenges Chatbot</title><link href="https://aandree5.github.io/projects/Challenges-Chatbot.html" rel="alternate" type="text/html" title="Challenges Chatbot" /><published>2017-12-01T00:00:00+00:00</published><updated>2017-12-01T00:00:00+00:00</updated><id>https://aandree5.github.io/projects/Challenges-Chatbot</id><content type="html" xml:base="https://aandree5.github.io/projects/Challenges-Chatbot.html"><![CDATA[<p>A chatbot around the concept of a ‘pub quiz chatbot’. Can test the user with questions and tell him fun facts, whilst maintaining a “casual” conversation.</p>

<div class="title">
    <h1>Netwrok</h1>
    <hr />
</div>
<p>The server must be ran first, opening a connection for the client to connect to. The client is currently listening for messages from the server until he receives the string <code class="language-plaintext highlighter-rouge">"EndOfMessage"</code>, after that the client stops listening and prepares to send a message, the server in turn starts listening.
Every time a message is sent from either the server or the client, they hold sending more and wait for a <code class="language-plaintext highlighter-rouge">"Received"</code> message to check if it was successful or if needs to send again.</p>

<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">def</span> <span class="nf">sendMessage</span><span class="p">(</span><span class="n">message</span><span class="p">,</span> <span class="n">EOM</span> <span class="o">=</span> <span class="bp">True</span><span class="p">):</span> 
    <span class="s">''' Given a message input, and a False value, send the 
message and the client keeps wayting for another message '''</span>
    <span class="n">resp</span> <span class="o">=</span> <span class="s">""</span>
    <span class="k">while</span> <span class="p">(</span><span class="n">resp</span> <span class="o">!=</span> <span class="s">"Received"</span><span class="p">):</span>             <span class="c1"># If not received
</span>        <span class="n">conn</span><span class="p">.</span><span class="n">send</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">message</span><span class="p">).</span><span class="n">encode</span><span class="p">())</span>    <span class="c1"># Send message
</span>        <span class="k">print</span><span class="p">(</span><span class="s">"SERVER: {}"</span><span class="p">.</span><span class="nb">format</span><span class="p">(</span><span class="n">message</span><span class="p">))</span> <span class="c1"># Print message sent
</span>        <span class="n">resp</span> <span class="o">=</span> <span class="n">conn</span><span class="p">.</span><span class="n">recv</span><span class="p">(</span><span class="mi">1024</span><span class="p">).</span><span class="n">decode</span><span class="p">()</span>     <span class="c1"># Wait client feedback 
</span>    <span class="k">if</span> <span class="p">(</span><span class="n">EOM</span><span class="p">):</span>                               <span class="c1"># If is last message
</span>        <span class="n">conn</span><span class="p">.</span><span class="n">send</span><span class="p">(</span><span class="s">"EndOfMessage"</span><span class="p">.</span><span class="n">encode</span><span class="p">())</span>  <span class="c1"># Was last message 
</span></code></pre></div></div>

<div class="title">
    <h1>Information</h1>
    <hr />
</div>
<p>The chatbot connects to a free online database that has different types of questions with the respective answers, gets the information through the website’s API that returns it in JSON format.</p>

<p>There’s also three files that come together with the server, that were found online in another free website, they contain information that is used to show fun facts about historical events, famous birthdays or famous quotes, they are also used to build question for the user with that information.</p>

<div class="title">
    <h1>Functionality</h1>
    <hr />
</div>
<p>With all that information the chatbot can build single or multiple question to challenges the user, give him historical fun facts or just try and have a casual conversation with the user, if it doesn’t know the answer for any question it will perform a search on Google Search to try and answer the user.</p>

<div class="title">
    <h1>Reflection</h1>
    <hr />
</div>
<p>It was a group work, so not everything was done by me, but the things that I done, although they work, they are not as efficient as they could be, some things would be done differently to improve performance and quality.</p>]]></content><author><name></name></author><category term="Python" /><category term="GitHub" /><summary type="html"><![CDATA[A chatbot around the concept of a ‘pub quiz chatbot’. Can test the user with questions and tell him fun facts, whilst maintaining a “casual” conversation.]]></summary></entry></feed>