<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jonathan Thomas</title>
    <description>The latest articles on DEV Community by Jonathan Thomas (@jonathanmkpt).</description>
    <link>https://dev.to/jonathanmkpt</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F187141%2Feed49689-f090-45d2-aeee-5f15a656949e.jpeg</url>
      <title>DEV Community: Jonathan Thomas</title>
      <link>https://dev.to/jonathanmkpt</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jonathanmkpt"/>
    <language>en</language>
    <item>
      <title>My Journey Through Tech: Junior IT Analyst Program day 60</title>
      <dc:creator>Jonathan Thomas</dc:creator>
      <pubDate>Fri, 27 Mar 2020 09:12:04 +0000</pubDate>
      <link>https://dev.to/jonathanmkpt/my-journey-through-tech-junior-it-analyst-program-day-60-56ii</link>
      <guid>https://dev.to/jonathanmkpt/my-journey-through-tech-junior-it-analyst-program-day-60-56ii</guid>
      <description>&lt;p&gt;It has been quite some time since my last posting. The cohort is going extremely well. As of writing, I have completed the Core 1 exam for Comptia’s A+ certification. This is the first real step I’ve taken to having my skill verified. The only difficulty at this time is the global pandemic that is the corona virus. Due to it’s spread across the globe, my country has insitigated a nation wide quarantine. While this has essentially ground life in this country to a halt, it has not stopped the cohort from continuing.Like it or not, we are deternimed to become Junior Information Technology Analyst.&lt;/p&gt;

&lt;p&gt;The staff at NPowerCanada have set up work from home criteria in which we are still expected attend and complete. We’ve switched over to remote learning. For now this has offered some repreive as I find myself being able to focus on the Core 2 modules on my own. A downside, unfortunately, is that there seems to be a lot more impatient from some of the other cohort attendees.Regardless my journey through tech continues uninterrupted.&lt;br&gt;
My Pressing Concerns&lt;/p&gt;

&lt;p&gt;While it is a challenging situation that the entire world is facing right now, I am a bit worried about my own employment prospects. Since completing Core 1, candidates were being setup for infield placements, sadly that has been upended in part due to corona. Upsetting as it may be, it’s a chance to work on my own personal branding. When I’m not studying the rest of the IT materials, I’ve actively started working on making a freelance portfolio. Through out my journey through tech personal branding is an area I must work on.&lt;/p&gt;

&lt;p&gt;I had also started looking into crowdsourced employment for the time being. Furthermore it’s been about 3 weeks since I last touched the blockchain development course. I plan on resuming that monday but have been refreshing my skills by going onto typing.io and couple of coding books from a recent humble bundle purchase.Since the junior information technology analyst program is designed for entry level, it is important that I get better typing to make documentaion easier.&lt;br&gt;
Plans after the cohort?&lt;/p&gt;

&lt;p&gt;The major one is to continue on improving my freelance profile and networking through NPowerCanada. I know that if I do land a job within the next couple of months, I’ve seriously thought about investing in education. Currently I’m looking at Gerogebrown’s Robotics Technician program and Coursera Plus. The reason I’m looking at them now is due to the corona pandemic. Learning to maintain and program robots aligns with my values.The days of doing one thing only and expecting employment has not existed for a lot of  decades.  By proactively gettting experience and accreditation both both fields, I develop an interdisciplanay skillset. My journey through tech has shown that if I want to increase my chances, I have to always be learning.&lt;/p&gt;

&lt;p&gt;These two options are also distance based and cost effective. The George Brown Robotics Certification program is self-paced and simulation based. Once I get a new laptop with required specifications I can see myself enrolling. At the same time, Coursera Plus, has an annual subscription that allows me to access several industry recognized specializations. I completed the Google IT Support Specialization in 2018. The specializations such as  cybersecurity,  robotics, mathematics for machine learning, artificial intelligence, embedded systems/sensors and cloud engineering would give me access to the type of education I’ve always dreamed of, but could never afford.&lt;/p&gt;

&lt;p&gt;Preparing for a Digital Revolution&lt;/p&gt;

&lt;p&gt;These last couple of months have really been eye opening. I realize now just how much of my time and potential I was wasting from drinking. The pain of not living up to my own expecations is no longer present. Rather than despair, there is hope. I’ve approached 200 plus days of alcohol sobriety and will reassess at 270 day. At this rate I’m wlll on my way to making it to a full year without booze.&lt;/p&gt;

&lt;p&gt;Furthermore, I’ve actually started reassessing my creative goals. I took a step back from drawing again but plan to start back over the weekend. In the meantime I’m going to be writing out a couple of scripts for youtube and using the creative community I’m a part of more frequently. As such I now have some comic ideas again after 2 months. I’m starting to take Japanese seriously again and started a plan for that.&lt;/p&gt;

&lt;p&gt;I’ll use the next two weeks of quarantine to catchup on niche skillsets, create some type of content and work on my branding.&lt;/p&gt;

&lt;p&gt;The real concern however is will I be able to translate the technical skills into something higher than junior information technology analsyt?&lt;/p&gt;

&lt;p&gt;I admit, it’s going to be rough but I have time to build my autonomy for the future.&lt;/p&gt;

&lt;p&gt;Thanks for reading&lt;/p&gt;

</description>
      <category>beginners</category>
    </item>
    <item>
      <title>My Journey through Tech: FullStack Blockchain course Section 3</title>
      <dc:creator>Jonathan Thomas</dc:creator>
      <pubDate>Thu, 27 Feb 2020 12:40:47 +0000</pubDate>
      <link>https://dev.to/jonathanmkpt/my-journey-through-tech-fullstack-blockchain-course-section-3-3h97</link>
      <guid>https://dev.to/jonathanmkpt/my-journey-through-tech-fullstack-blockchain-course-section-3-3h97</guid>
      <description>&lt;p&gt;Continuing on from the last section, it appears that I needed to add a few more describes to our replaceChain description in the blockchain.test.js file like so:&lt;/p&gt;

&lt;p&gt;describe('replaceChain()', () =&amp;gt; {&lt;br&gt;
      let errorMock, logMock;&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  beforeEach(() =&amp;gt; {
      errorMock = jest.fn();
      logMock = jest.fn();

      global.console.error = errorMock;
      global.console.log = logMock;
  });

    describe('when the new chain is not longer', () =&amp;gt; {
        beforeEach(() =&amp;gt; {
            newChain.chain[0] = { new : 'chain'};

            blockchain.replaceChain(newChain.chain);
    });
      it('does not replace the chain', () =&amp;gt; {

        expect(blockchain.chain).toEqual(originalChain);
        });

        it('logs an error', () =&amp;gt; {
            expect(errorMock).toHaveBeenCalled();
        });



        describe('when the chain is longer', () =&amp;gt; {
            beforeEach(() =&amp;gt; {
                newChain.addBlock({ data: 'Bears'});
                newChain.addBlock({data: 'Beets'});
                newChain.addBlock({data: 'Battlestar Galactica' });
            });

            describe('and the chain is invalid', () =&amp;gt; {});
                beforeEach(() =&amp;gt; {
                    newChain.chain[2].hash = 'some-fake-hash';

                    blockchain.replaceChain(newChain.chain);
                });
                it('does not replace the chain', () =&amp;gt; {

                    expect(blockchain.chain).toEqual(originalChain);

                });

                it('logs an error', () =&amp;gt; {
                    expect(errorMock).toHaveBeenCalled();
                });

            describe('and the chain is valid', () =&amp;gt; {
                beforeEach(() =&amp;gt; {
                    blockchain.replaceChain(newChain.chain);
                })

                it('replaces the chain', () =&amp;gt; {
                    expect(blockchain.chain).toEqual(newChain.chain);
                });

                it('logs about chain replacement', () =&amp;gt;{
                    expect(logMock).toHaveBeenCalled();
                })
            });
        });
    });
})
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;}); &lt;/p&gt;

&lt;p&gt;We set the global values of the error output to be stubbed using the jest.fn() built-in. We set the variables, errorCheck and logCheck to be globally accessible. The idea is that, this module will quiet the error outputs on the command line. As of writing, the current replaceChain test fails because the erroMock, is expecting to be called but not found. Currently I have reached out to fellow learners and the course instructor for solutions. As well, I've taken the initiative to read up on the jestJS documentaion for a solution.&lt;/p&gt;

&lt;p&gt;From what I've gathered from my readings, this is a bug that seems to be common in versions of jest &amp;lt;= 23.0.6, which is currently part of my dependcy file.I'll test with a current version of jest later tonight.&lt;/p&gt;

&lt;p&gt;Proof of Work portion&lt;/p&gt;

&lt;p&gt;Before getting back into code we got introduced to the proof of work theory behind cryptocurrency. The proof of work system was based on hashcash a concept designed back in 1997. The premise of which is, that any hashes generated from data has a difficulty rating assigned to it. The higher the difficulty, the more computing power needed to decrypt the hash.&lt;br&gt;
In the case of block hashes, we are looking for hashes with leading zeroes that that can match up to a number used once(nonce) that is generated from our data.&lt;/p&gt;

&lt;p&gt;The idea that anyone who wants to solve thes hash problems uses their computer's resources to match the hash.Using bitcoin as an example, the network of bitcoin is set to release a new block every 10 minutes. During that time, people who are trying to solve a hash on a newly released block contribute their computing power. The more that you can contribute, the greater the chance that a portion of the reward goes to you for decrypting it.&lt;/p&gt;

&lt;p&gt;However, this could lead to being exploited by a 51% attack. The concept behind this attack is that a malicious block is inserted into the chain that has a greater amount of resources contributing to decrypting th hash. &lt;/p&gt;

&lt;p&gt;Updating the block.test.js&lt;/p&gt;

&lt;p&gt;While back inside out block test file we add two more tests they are nonce and difficulty tests to the block.test.js file:&lt;/p&gt;

&lt;p&gt;describe('Block',() =&amp;gt; {&lt;br&gt;
    const timestamp = 'a-date';&lt;br&gt;
    const lastHash = 'foo-hash';&lt;br&gt;
    const hash = 'bar-hash';&lt;br&gt;
    const data = ['blockchain', 'data'];&lt;br&gt;
    const nonce = 1;&lt;br&gt;
    const difficulty = 1;&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const block = new Block({timestamp,lastHash,hash, data, nonce, difficulty});
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;We updated the block object as well to refelct the new values.&lt;/p&gt;

&lt;p&gt;We then updated the SHA 256 has test to refelct the nonce and difficulty like so:&lt;/p&gt;

&lt;p&gt;it('creates a sha-256 &lt;code&gt;hash&lt;/code&gt; based on proper inputs', () =&amp;gt; {&lt;br&gt;
            expect(minedBlock.hash)&lt;br&gt;
            .toEqual(&lt;br&gt;
                cryptoHash(&lt;br&gt;
                minedBlock.timestamp, &lt;br&gt;
                minedBlock.nonce,&lt;br&gt;
                minedBlock.difficulty,&lt;br&gt;
                lastBlock.hash, &lt;br&gt;
                data&lt;br&gt;
                )&lt;br&gt;
            );&lt;br&gt;
        });&lt;br&gt;
And then we finally added a hash matching test to match for the difficulty of the block:&lt;/p&gt;

&lt;p&gt;it('it sets a &lt;code&gt;hash&lt;/code&gt; that matches the difficulty criteria', () =&amp;gt; {&lt;br&gt;
            expect(minedBlock.hash.substring(0, minedBlock.difficulty))&lt;br&gt;
                .toEqual('0'.repeat(minedBlock.difficulty));&lt;br&gt;
        });&lt;br&gt;
    });&lt;/p&gt;

&lt;p&gt;We then set an initial difficulty within the config.js with the added nonce and diffictulty values:&lt;br&gt;
const INITIAL_DIFFICULTY = 3;&lt;/p&gt;

&lt;p&gt;const GENESIS_DATA = {&lt;br&gt;
    timestamp: 1,&lt;br&gt;
    lastHash : '-----',&lt;br&gt;
    hash :'hash-one',&lt;br&gt;
    difficulty: INITIAL_DIFFICULTY,&lt;br&gt;
    nonce: 0,&lt;br&gt;
    data: []&lt;br&gt;
};&lt;/p&gt;

&lt;p&gt;module.exports = { GENESIS_DATA} ;&lt;/p&gt;

&lt;p&gt;Then in the blockchain file, we updated according to the new values as well:&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;static isValidChain(chain) {
    if(JSON.stringify(chain[0]) !== JSON.stringify(Block.genesis())) {

    return false;
    };

    for (let i=1; i&amp;lt;chain.length; i++){
        const { timestamp, lastHash, hash, nonce, difficulty,data } = chain[i];

        const actualLastHash = chain[i-1].hash;


        if(lastHash !== actualLastHash) return false;

        const validatedHash = cryptoHash(timestamp, lastHash, data, nonce, difficulty);

        if(hash !== validatedHash) return false;
    }

    return true;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;We also updated the minedBlock fucntion like so:&lt;/p&gt;

&lt;p&gt;static mineBlock({ lastBlock, data }) {&lt;br&gt;
        let hash, timestamp;&lt;br&gt;
        const lastHash = lastBlock.hash;&lt;br&gt;
        const { difficulty } = lastBlock;&lt;br&gt;
        let nonce = 0;&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    do {
        nonce++;
        timestamp = Date.now();
        hash = cryptoHash(timestamp, lastHash, data, nonce, difficulty);
    } while (hash.substring(0, difficulty) !== '0'.repeat(difficulty));

    return new this({ timestamp,lastHash,data,difficulty,nonce,hash });
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Next we need to find a way to dynamically change the difficulty of the new blocks on the chain by establishiing a mine rate. So we update out config.js file:&lt;/p&gt;

&lt;p&gt;cont MINE_RATE = 1000;&lt;/p&gt;

&lt;p&gt;const INITIAL_DIFFICULTY = 3;&lt;/p&gt;

&lt;p&gt;const GENESIS_DATA = {&lt;br&gt;
    timestamp: 1,&lt;br&gt;
    lastHash : '-----',&lt;br&gt;
    hash :'hash-one',&lt;br&gt;
    difficulty: INITIAL_DIFFICULTY,&lt;br&gt;
    nonce: 0,&lt;br&gt;
    data: []&lt;br&gt;
};&lt;/p&gt;

&lt;p&gt;module.exports = { GENESIS_DATA, MINE_RATE} ;&lt;/p&gt;

&lt;p&gt;Afterward we add a tests for asjusting difficulty in block.test.js:&lt;br&gt;
    describe('adjustDifficulty()', ()=&amp;gt; {&lt;br&gt;
        it('raises the difficulty for a quickly mined block', () =&amp;gt;{&lt;br&gt;
            expect(Block.adjustDifficulty({&lt;br&gt;
                originalBlock: block, timestamp: block.timestamp + MINE_RATE - 100&lt;br&gt;
            })).toEqual(block.difficulty+1);&lt;br&gt;
        });&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    it('lowers the difficulty for a slowly mined block', () =&amp;gt; {
        expect(Block.adjustDifficulty({
            originalBlock: block, timestamp: block.timestamp + MINE_RATE +100
        })).toEqual(block.difficulty-1);
    });
});
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;});&lt;/p&gt;

&lt;p&gt;Here if the block was mined to fast, we increase the difficulty and if mined to long we decrease the difficulty.From here we add the adjustDifficuly() function to our block.js file:&lt;/p&gt;

&lt;p&gt;static adjustDifficulty({ originalBlock, timestamp }){&lt;br&gt;
        const { difficulty } = originalBlock;&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    const difference = timestamp - originalBlock.timestamp;

    if(difference &amp;gt; MINE_RATE) return difficulty -1;

    return difficulty + 1;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Next we improve the proof of work system by implementing an average work script.The reason being is that we want to mine blocks with leading zeros in hexeadecimal. So we need to add parameters that will also be able to solve the binary hashes with leading zeros.We going to write a script that takes tha average pace of mining when we try to add meany blocks to the chain.&lt;/p&gt;

&lt;p&gt;average-work.js&lt;br&gt;
const Blockchain = require('./blockchain');&lt;/p&gt;

&lt;p&gt;const blockchain = new Blockchain();&lt;/p&gt;

&lt;p&gt;blockchain.addBlock({data: 'inital'});&lt;/p&gt;

&lt;p&gt;let prevTimestamp, nextTimestamp, nextBlock, timeDiff,average;&lt;/p&gt;

&lt;p&gt;const times = [];&lt;/p&gt;

&lt;p&gt;for(let i=0; i&amp;lt;10000; i++){&lt;br&gt;
    prevTimestamp = blockchain.chain[blockchain.chain.length-1].timestamp;&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;blockchain.addBlock({ data: `block ${i}`});
nextBlock = blockchain.chain[blockchain.chain.length-1];

nextTimestamp = nextBlock.timestamp;
timeDiff = nextTimestamp - prevTimestamp;
times.push(timeDiff);

average = times.reduce((total, num) =&amp;gt; (total + num))/times.length;

console.log(`Time to mine block: ${timeDiff}ms.Difficulty: ${nextBlock}.Average time: ${average}ms`)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;Here we've initiated a new instance of a block for our average work script. This way, the new block's timestamp will be different from the genesis data's timetamp and we keep track of times in a times array.Finally we ensure that the difficulty cannot be abritrarily changed by adding a description for a jumped block.&lt;br&gt;
 blockchain.test.js:&lt;/p&gt;

&lt;p&gt;const cryptoHash = require('./crypto-hash');&lt;/p&gt;

&lt;p&gt;describe('and the chain contains a block with a jumped difficulty', () =&amp;gt; {&lt;br&gt;
                    it('return false', () =&amp;gt; {&lt;br&gt;
                        const lastBlock = blockchain.chain[blockchain.chain.length-1];&lt;br&gt;
                        const lastHash = lastBlock.hash;&lt;br&gt;
                        const timestamp = Date.now();&lt;br&gt;
                        const nonce = 0;&lt;br&gt;
                        const data = [];&lt;br&gt;
                        const difficulty = lastBlock.difficulty - 3;&lt;br&gt;
                        const hash = cryptoHash(timestamp, lastHash, difficulty, nonce, data);&lt;br&gt;
                        const badBlock = new Block({&lt;br&gt;
                            timestamp, lastHash, hash, nonce, data&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                    });
                    blockchain.chain.push(badBlock);

                    expect(Blockchain.isValidChain(blockchain.chain).toBe(false));
                });
            });
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;And we finally update the isValidChain in blockchain.js:&lt;br&gt;
static isValidChain(chain) {&lt;br&gt;
        if(JSON.stringify(chain[0]) !== JSON.stringify(Block.genesis())) {&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    return false;
    };

    for (let i=1; i&amp;lt;chain.length; i++){
        const { timestamp, lastHash, hash, nonce, difficulty,data } = chain[i];
        const actualLastHash = chain[i-1].hash;
        const lastDifficulty = chain[i-1].difficulty;

        if(lastHash !== actualLastHash) return false;

        const validatedHash = cryptoHash(timestamp, lastHash, data, nonce, difficulty);

        if(hash !== validatedHash) return false;

        if(Math.abs(lastDifficulty - difficulty) &amp;gt; 1) return false 
    }

    return true;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Personal reflection:&lt;br&gt;
This took me a week longer to implement and follow along because the tests for error checking wasn't working. I finally got feed back from the coures instructor and it turns out that I hadn't properly nested the beforeEach block in the blockchain test file. While refactoring some code and checking the difference, I can get the test checking properly it seems.&lt;/p&gt;

&lt;p&gt;Still at this part of the course we've completed the block and test needed to work on the blockchain network. Before moving onto the API and Network implementation I'll review everything I've done up to this point. I'm getting more comfortable with porject but need to take it one section at a time. I've already statred thinking about how this could be implemented in future cloud infrastructure but for now just relax, review and get ready for the next section.&lt;/p&gt;

&lt;p&gt;Thanks for reading :)&lt;/p&gt;

</description>
      <category>node</category>
      <category>javascript</category>
      <category>blockchain</category>
    </item>
    <item>
      <title>MY Journey Through Tech:Fullstack Blockchain Course Section 2</title>
      <dc:creator>Jonathan Thomas</dc:creator>
      <pubDate>Sun, 16 Feb 2020 12:26:45 +0000</pubDate>
      <link>https://dev.to/jonathanmkpt/my-journey-through-tech-fullstack-blockchain-course-section-2-202l</link>
      <guid>https://dev.to/jonathanmkpt/my-journey-through-tech-fullstack-blockchain-course-section-2-202l</guid>
      <description>&lt;p&gt;In the last post here, we managed to create a block object with hashing functionality. We also identified the tests that must be passed for valid blocks. Today, we are adding the blockchain.test.js and blockchain.js as such:&lt;/p&gt;

&lt;p&gt;Adding the blockchain.test.js:&lt;/p&gt;

&lt;p&gt;const Blockchain = require('./blockchain');&lt;br&gt;
const Block = require('./block');&lt;/p&gt;

&lt;p&gt;describe('Blockchain', () =&amp;gt; {&lt;br&gt;
    const blockchain = new Blockchain();&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ii('contains a `chain` Array instance', () =&amp;gt; {
    expect(blockchain.chain instanceof Array).toBe(true);

});
it('starts with the genesis block', () =&amp;gt;{
    expect(blockchain.chain[0]).toEqual(Block.genesis());
});
it('adds a new block to the chain', () =&amp;gt;{
    const newData = 'foo-bar';
    blockchain.addBlock({data : newData });

    expect(blockchain.chain[blockchain.chain.length-1].data).toEqual(newData);

});
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;})&lt;/p&gt;

&lt;p&gt;In this test we import the blockchain.js and block.js files for the program. Next in our description for the test, we're expecting the object values to be start with a genesis block as the first item in the array.Then is looks for the addBlock method in the blockchain file as an instance of a block itself and calling the "{data:newData}" object does this as arguments for the addBlock function. Then finally we expect the most recent value to be the last item in the chain.&lt;/p&gt;

&lt;p&gt;Add blockchain.js:&lt;/p&gt;

&lt;p&gt;const Block = require('./block');&lt;br&gt;
class Blockchain{&lt;br&gt;
    constructor(){&lt;br&gt;
        this.chain = [Block.genesis()];&lt;br&gt;
    }&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;addBlock({ data }){
    const newBlock = Block.mineBlock({
        lastBlock: this.chain[this.chain.length-1],
        data
    });

    this.chain.push(newBlock);
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;module.exports = Blockchain;&lt;/p&gt;

&lt;p&gt;Here we created the blockchain class by importing the block.js file. In the constructor, we declared a genesis block is the first item in the array. Then we created the addBlock method that takes a data object as an argument. You'll recall that the mineBlock method has data as it's own argument from the block.js file when creating an instance. It then looks for the last item in the array and pushes it into the blockchain array as a data value. Finally to be seen for the tests, we export it it locally. &lt;/p&gt;

&lt;p&gt;Completing the Chain Validation tests &lt;/p&gt;

&lt;p&gt;To complete our blockchain.test file we now refactor it as show:&lt;/p&gt;

&lt;p&gt;const Blockchain = require('./blockchain');&lt;br&gt;
const Block = require('./block');&lt;/p&gt;

&lt;p&gt;describe('Blockchain', () =&amp;gt; {&lt;br&gt;
    let blockchain; &lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;beforeEach( () =&amp;gt; {
    blockchain = new Blockchain();
});

it('contains a `chain` Array instance', () =&amp;gt; {
    expect(blockchain.chain instanceof Array).toBe(true);

});
it('starts with the genesis block', () =&amp;gt;{
    expect(blockchain.chain[0]).toEqual(Block.genesis());
});
it('adds a new block to the chain', () =&amp;gt;{
    const newData = 'foo-bar';
    blockchain.addBlock({data : newData });

    expect(blockchain.chain[blockchain.chain.length-1].data).toEqual(newData);

});

describe('isValidChain()', () =&amp;gt; {
    describe('when the chain does not start with a genesis block', () =&amp;gt;{
        it('returns false', () =&amp;gt; {
            blockchain.chain[0] = { data: 'fake-genesis'};

            expect(Blockchain.isValidChain(blockchain.chain)).toBe(false);
        });

    });

        describe('when the chain starts with the genesis block and has multiple blocks', () =&amp;gt; {
            beforeEach( () =&amp;gt; {
                blockchain.addBlock({ data: 'Bears'});
                blockchain.addBlock({data: 'Beets'});
                blockchain.addBlock({data: 'Battlestar Galactica' });

            });
            describe('and lastHash reference has changed', () =&amp;gt;{
                it('returns false', () =&amp;gt; {


                    blockchain.chain[2].lastHash = 'broken-lastHash';

                    expect(blockchain.isValidChain(blockchain.chain)).toBe(false);
                });
            });

            describe('when the chain starts with the genesis block and has multiple blocks', () =&amp;gt; {
                describe('and a lastHash reference has changed', () =&amp;gt; {
                    it('returns false', () =&amp;gt; {});
                });

                describe('and the chain contains a block with an invalid field', () =&amp;gt; {
                    it('returns false', () =&amp;gt; {

                        blockchain.chain[2].data = 'some-bad-and-evil-data';

                        expect(blockchain.isValidChain(blockchain.chain)).toBe(false);
                    });
                });

                describe('and the chain does not contain any invalid blocks', () =&amp;gt; {
                    it('returns true', () =&amp;gt; {

                        expect(blockchain.isValidChain(blockchain.chain)).toBe(true);

                    });
                });
            });

        });
    });
}); 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;});&lt;/p&gt;

&lt;p&gt;Immediately in the first describe block, we change it so that there is a new block is formed every time using the beforeEach function. We then added out validation test to see if the data matches the arguments needed before adding the a new block to the chain.Again we also used beforeEach within the multiple block tests with dummy data.&lt;/p&gt;

&lt;p&gt;Chain Validation code//blockchain.js&lt;/p&gt;

&lt;p&gt;static isValidChain(chain) {&lt;br&gt;
        if(JSON.stringify(chain[0]) !== JSON.stringify(Block.genesis())) {&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    return false;
    };

    for (let i=1; i&amp;lt;chain.length; i++){
        const { timestamp, lastHash, hash, data } = chain[i];

        const actualLastHash = chain[i-1].hash;


        if(lastHash !== actualLastHash) return false;

        const validatedHash = cryptoHash(timestamp, lastHash, data);

        if(hash !== validatedHash) return false;
    }

    return true;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Here, we've completed the is valid chain function.Since the instance of a block object can be called in the blockchain test we use the JSON.stringify method so that the data inside the block can be read for testing.We iterate through the data of the block instance that get pushed into an arry. It checks the hash of the last block is valid before continuing on to chain replacement.&lt;/p&gt;

&lt;p&gt;Chain replacement tests:&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;describe('replaceChain()', () =&amp;gt; {
    describe('when the new chain is not longer', () =&amp;gt; {
        it('does not replace the chain', () =&amp;gt; {
            newChain.chain[0] = { new : 'chain' };

            blockchain.replaceChain(newChain.chain);

            expect(blockchain.chain).toEqual(originalChain);
        });

        describe('when the chain is longer', () =&amp;gt; {
            beforeEach(() =&amp;gt; {
                newChain.addBlock({ data: 'Bears'});
                newChain.addBlock({data: 'Beets'});
                newChain.addBlock({data: 'Battlestar Galactica' });
            });

            describe('and the chain is invalid', () =&amp;gt; {});
                it('does not replace the chain', () =&amp;gt; {
                    newChain.chain[2].hash = 'some-fake-hash';

                    blockchain.replaceChain(newChain.chain);

                    expect(blockchain.chain).toEqual(originalChain);

                });
            describe('and the chain is valid', () =&amp;gt; {
                it('replaces the chain', () =&amp;gt; {
                    blockchain.replaceChain(newChain.chain);

                    expect(blockchain.chain).toEqual(newChain.chain);
                });
            });
        });
    });
})
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;In completing the tests for chain replacement, we check to see if the chain length matches what needs to be taken.If the chain length doesn't match up, it creates a new instance at the end of the array.In the next description, we check if the chain is longer but populated with invalid data, it doesn't replace the last block, rather, it calls the replaceChain function to make a new instance of a valid block.&lt;/p&gt;

&lt;p&gt;Chain replacement function&lt;/p&gt;

&lt;p&gt;replaceChain(chain) {&lt;br&gt;
        if(chain.length &amp;lt;= this.chain.length){&lt;br&gt;
            return;&lt;br&gt;
        }&lt;br&gt;
        if(!Blockchain.isValidChain(chain)){&lt;br&gt;
            return;&lt;br&gt;
        }&lt;br&gt;
        this.chain = chain;&lt;br&gt;
    }&lt;br&gt;
Finally we add the replaceChain functionality anf having our tests pass.&lt;/p&gt;

&lt;p&gt;Personal Reflections:&lt;br&gt;
It took a bit longer to complete this section. So far I'm averaging a section a week and I'm probably going to stick to that schedule. I'm also in the third week of the IT Analyst program and I'm well on my way to being read for the Comptia Core 1 Exam in 3 weeks time.Wrting the test decriptions was abit confusing, but ultimately made sense with practice. All that's left now is to add stubs for error checking and I can move on to the next section.&lt;/p&gt;

&lt;p&gt;Thanks for reading and hapy coding, constructive criticism always welcome&lt;/p&gt;

</description>
      <category>node</category>
      <category>javascript</category>
      <category>blockchain</category>
    </item>
    <item>
      <title>My Journey Through Tech:Fullstack Blockchain Course Section 1</title>
      <dc:creator>Jonathan Thomas</dc:creator>
      <pubDate>Tue, 11 Feb 2020 13:04:34 +0000</pubDate>
      <link>https://dev.to/jonathanmkpt/my-journey-through-tech-fullstack-blockchain-course-section-1-3add</link>
      <guid>https://dev.to/jonathanmkpt/my-journey-through-tech-fullstack-blockchain-course-section-1-3add</guid>
      <description>&lt;p&gt;As I'm progressing well with my A+ certification course, I believe now is a good get back into coding again. By learning the blockchain development, it'll reinforce what I've learned as I follow along and summarize what I do with each section completed.&lt;/p&gt;

&lt;p&gt;First I updated node and npm using nvm. Using nvm I don't have to worry about versions not matching and can actually focus on the project itself.&lt;/p&gt;

&lt;p&gt;I also managed to download a stable redis server that for later in the course. I'll be building this in the Ubuntu box.&lt;/p&gt;

&lt;p&gt;Next I downloaded the jest library as a dependency and saved it. I confirmed this by checking the package.json file.&lt;/p&gt;

&lt;p&gt;I then created the block class using javascript OOP syntax&lt;br&gt;
The constructor arguments include a timestamp, lastHash, hash and data. In an effort to avoid errors such as arguments not being put in order, wrapped the arguments as an object. &lt;/p&gt;

&lt;p&gt;So our initial block class looks like this now:&lt;/p&gt;

&lt;p&gt;class Block{&lt;br&gt;
     constructor({timestamp, lastHash, hash, data}){&lt;br&gt;
         this.timestamp = timestamp;&lt;br&gt;
         this.lastHash = lastHash;&lt;br&gt;
         this.hash = hash;&lt;br&gt;
         this.data = data;&lt;br&gt;
    }&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;module.exports = Block;&lt;/p&gt;

&lt;p&gt;Moving on, we were then to use test driven development methodology by adding the jest script to the package json file watching for errors. We then had to created a test file with the following code:&lt;/p&gt;

&lt;p&gt;const Block = require("./block");&lt;/p&gt;

&lt;p&gt;describe('Block',() =&amp;gt; {&lt;br&gt;
    const timestamp = 'a-date';&lt;br&gt;
    const lastHash = 'foo-hash';&lt;br&gt;
    const hash = 'bar-hash';&lt;br&gt;
    const data = ['blockchain', 'data'];&lt;br&gt;
    const block = new Block({timestamp,lastHash,hash, data});&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;it("has a timestamp, lastHash, hash and data property", () =&amp;gt; {
    expect(block.timestamp).toEqual(timestamp);
    expect(block.lastHash).toEqual(lastHash);
    expect(block.hash).toEqual(hash);
    expect(block.data).toEqual(data);
});
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;});&lt;/p&gt;

&lt;p&gt;This code states that the block.js file in the same directory will be looked at first to see if it exists. Then using the describe keywork, we set the arguments used in the block constructor from block.js by declaring them as variables in the describe object. The 'it' keyword then uses an anonymous function expecting the arguments of the block class to be found using the toEqual method as a form of testing.&lt;/p&gt;

&lt;p&gt;To add more functionality, we created a genesis data that could populate the first block in the chain in a config.js file with the following code:&lt;/p&gt;

&lt;p&gt;const GENESIS_DATA = {&lt;br&gt;
    timestamp: 1,&lt;br&gt;
    lastHash : '-----',&lt;br&gt;
    hash :'hash-one',&lt;br&gt;
    data: []&lt;br&gt;
};&lt;br&gt;
module.exports = { GENESIS_DATA} ;&lt;/p&gt;

&lt;p&gt;Here, we created dummy data that could be used to populate a block. with that in mind we had to require this code in the block.test.js file and the block.js file as such:&lt;/p&gt;

&lt;p&gt;const { GENESIS_DATA } = require('./config')&lt;/p&gt;

&lt;p&gt;Futher we also had to make sure the instances of the genesis block could be generated during the test by adding the following in the block.test.js file:&lt;/p&gt;

&lt;p&gt;describe('genesis()', () =&amp;gt; {&lt;br&gt;
        //calls instance of genesis blocks this is a static function :)&lt;br&gt;
        const genesisBlock = Block.genesis();&lt;br&gt;
        console.log('genesisBlock', genesisBlock);&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    it('returns a Block instance', () =&amp;gt; {
        expect(genesisBlock instanceof Block).toBe(true);
    });

    it('returns the genesis data', () =&amp;gt;{
        expect(genesisBlock).toEqual(GENESIS_DATA);
    });
});
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;In this describe object, we added we're creating a new instance of a genesis block and checking if it meets the required arguments. Upon testing, an error occurs because we did not define the genesis block as a function inside the block.js file. To remedy and pass the test, we simply add the genesis function to the Clock class like so:&lt;/p&gt;

&lt;p&gt;static genesis() {&lt;br&gt;
        return new this(GENESIS_DATA);&lt;br&gt;
    }&lt;/p&gt;

&lt;p&gt;Since we've imported the "{ GENESIS_DATA }" from the config.js file we can now properly create instances of a genesis block.Next within out block.test.js file, we wanted to add  the mine Block description like this:&lt;/p&gt;

&lt;p&gt;describe('mineBlock()', () =&amp;gt;{&lt;br&gt;
        const lastBlock = Block.genesis();&lt;br&gt;
        const data = 'mined data';&lt;br&gt;
        const minedBlock = Block.mineBlock({ lastBlock, data });&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    it('returns a Block instace', () =&amp;gt; {
        expect(minedBlock instanceof Block).toBe(true);
    });

    it('sets the `lastHash` to be the `hash` of the lastBlock', () =&amp;gt; {
        expect(mineBlock.lastHash).toEqual(lastBlock.hash);
    });

    it('sets the `data`', () =&amp;gt; {
        expect(minedBlock.data).toEqual(data);
    });
    it('sets a `timestap`', () =&amp;gt; {
        expect(minedBlock.timestamp).not.toEqual(undefined);
    });
});
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Here we're testing if the lastHash to be the hash of the previous block, the data of the current block is being mined and the timestamp matches.&lt;/p&gt;

&lt;p&gt;Afterwards we added mine block method to the block.js file so that the instances of mineBlock can be generated like so:&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;static mineBlock({ lastBlock, data }) {
    return new this({
        timestamp: Date.now(),
        lastHash: lastBlock.hash,
        data
    });
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now that we've established the block functionality, we need to add hashes to be checked using SHA 256. First we created  a crypto-hash.js and crypto-hashe.test.js files respectively:&lt;/p&gt;

&lt;p&gt;//crypto-hash.js&lt;br&gt;
const crypto = require('crypto');&lt;br&gt;
const cryptoHash = (...inputs) =&amp;gt; {&lt;br&gt;
    const hash = crypto.createHash('sha256');&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;hash.update(inputs.sort().join(' '));

return hash.digest('hex');
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;};&lt;/p&gt;

&lt;p&gt;module.exports = cryptoHash;&lt;br&gt;
In the cyrpto-hash file, we import and require the 'crypto' module of NodeJS. When we declare the cryptoHash, we use the spread operator on the data within the upcoming 'inputs array'. Then we use the update, sort and joint methods to format the hashes from the last block and returns them as a hexadecimal value using the digest built in. This ensures that there will at least be some hasing present regardless of argument orders.&lt;/p&gt;

&lt;p&gt;//crypto-hash.test.js&lt;/p&gt;

&lt;p&gt;const cryptoHash = require('./crypto-hash');&lt;/p&gt;

&lt;p&gt;describe('cryptoHash', () =&amp;gt; {&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;it('generates SHA-256 hashed output', () =&amp;gt;{
    expect(cryptoHash('foo'))   .toEqual('2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae');
});

it('produces the same hash with the same input in any order', () =&amp;gt;{
    expect(cryptoHash('one', 'two','three'))
    .toEqaul(cryptoHash('three','one','two'));
});
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;});&lt;br&gt;
In the testing file, we got the hash of 'foo' and test to see if it matches up. Furthermore, we now have to update our block/block.test functions respectufully by importing the crypto-hash files from the local directory:&lt;br&gt;
//added to block.js, block.test.js&lt;br&gt;
const cryptoHash = require("./crypto-hash");&lt;/p&gt;

&lt;p&gt;Then we updated the mineBlock function to a more completed state like this:&lt;br&gt;
//block.js&lt;br&gt;
static mineBlock({ lastBlock, data }) {&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    const timestamp = Date.now();
    const lastHash = lastBlock.hash;

    return new this({
        timestamp,
        lastHash,
        data,
        hash: cryptoHash(timestamp, lastHash, data)
    });
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now that we've declared the timestamp,lastHash and data in the cryptoHash module new instances apply a hash to the arguments of the block. We also finalized the mineBlock description test as so:&lt;/p&gt;

&lt;p&gt;//block.test.js&lt;br&gt;
describe('mineBlock()', () =&amp;gt;{&lt;br&gt;
        const lastBlock = Block.genesis();&lt;br&gt;
        const data = 'mined data';&lt;br&gt;
        const minedBlock = Block.mineBlock({ lastBlock, data });&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    it('returns a Block instace', () =&amp;gt; {
        expect(minedBlock instanceof Block).toBe(true);
    });

    it('sets the `lastHash` to be the `hash` of the lastBlock', () =&amp;gt; {
        expect(minedBlock.lastHash).toEqual(lastBlock.hash);
    });

    it('sets the `data`', () =&amp;gt; {
        expect(minedBlock.data).toEqual(data);
    });
    it('sets a `timestap`', () =&amp;gt; {
        expect(minedBlock.timestamp).not.toEqual(undefined);
    });
    it('creates a sha-256 `hash` based on proper inputs', () =&amp;gt; {
        expect(minedBlock.hash).toEqual(cryptoHash(minedBlock.timestamp, lastBlock.hash, data));
    });
});
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;So in summary, I've created a block, started using a test driven development approach, added functionality to the blocks and I'm now ready to move on to the next section.&lt;/p&gt;

&lt;p&gt;Personal reflection: This is the most coding I've done in the last 3 months. It feels really good to understand what I'm doing. I've really reinforced object oriented programming concepts in javascript, the use of anonymous functions and was introduced to a new way of developing a project. I fins it also helps that iI actually record what it is I've done after I complete each section. For now I'm off to study the A+ materials for today and will start section 2 of this course in the morning.&lt;/p&gt;

&lt;p&gt;Things to keep in mind: There are some portions of javascript I should really become more familiar like spread operators. As such it's probably a good idea to keep up with the documentaion. I should also change my git settings so I can push requests faster, but that's another story.&lt;br&gt;
Anyway that was my the summary of Section 1, constructive criticism is alsways welsom and have a nice day!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>node</category>
      <category>blockchain</category>
      <category>gettingbackintocoding</category>
    </item>
    <item>
      <title>My new pathway into tech: Junior IT Analyst bootcamp through NPowerCanada</title>
      <dc:creator>Jonathan Thomas</dc:creator>
      <pubDate>Thu, 30 Jan 2020 04:13:44 +0000</pubDate>
      <link>https://dev.to/jonathanmkpt/my-new-pathway-into-tech-junior-it-analyst-bootcamp-through-npowercanada-1b44</link>
      <guid>https://dev.to/jonathanmkpt/my-new-pathway-into-tech-junior-it-analyst-bootcamp-through-npowercanada-1b44</guid>
      <description>&lt;p&gt;In July 2019, my father was diagnosed with cancer. Today I am happy to say that treatment has been effective and he is in remission as of writing.&lt;/p&gt;

&lt;p&gt;That said I've never been more relieved and thank the people who posted here for pathways and projects they suggested.&lt;/p&gt;

&lt;p&gt;Unfortunately, I wasn't able to land a developer job. I still had to take odd jobs to help my family until I was laid off in October. Since then I haven't even so much opened an text editor. I think it's because I've been trying to learn web development as a prerequisite for everything else. I still like coding but I kept getting caught up in trying to build projects from scratch and be unique.&lt;/p&gt;

&lt;p&gt;That approach is why I never progressed. So for now I'll have to take a different approach and pause the coveted developer pathway. Because I realise it's not where I need to be...yet.&lt;/p&gt;

&lt;p&gt;But all those courses and groups weren't in vain because it revealed my true interest and career fit Information Technology.&lt;/p&gt;

&lt;p&gt;I realise now that I've been idealizing the creative portion of tech as a substitute for not being able to create art. After actually reflecting on all the skills that I attempted to learn,I came up with career and creative goals. Creative wise, I know I want to make comics and YouTube videos and planned out the year for that. &lt;/p&gt;

&lt;p&gt;Career wise,I am actually interested in the operation and analysis of all things technology related.Now that I manage to seperate the two I shifted my focus to entry level IT support roles or training. I had already completed Google Information Support Specialization from Coursera in 2018. But that wasn't enough so I had to dig deeper into the skills I had tried and liked as a hobbies.&lt;/p&gt;

&lt;p&gt;Before that I was(am)a member of Cybrary.it and went through the various modules of Comptia, Cisco and Microsoft theory that would prepare me for certification.I dabble with some network security and penetration testing from a membership at StationX&lt;/p&gt;

&lt;p&gt;I always thought it would be nice to have certs, but never found a training/testing that wouldn't be ridiculously marked up by for profit institutions. That changed however when I was reached out to by a community employment services news letter I had signed up for and I saw it right there in the list:&lt;/p&gt;

&lt;p&gt;JUNIOR IT ANALYST BOOTCAMP via NPowerCanada. The site outlined a 14 week ,FREE, bootcamp that would not only prepare me for Comptia A+ certification, cover the COST of the testing, industry networking/scouting and job/support placement. THIS IS EXACTLY WHAT I NEED RIGHT NOW XD!!!!!&lt;/p&gt;

&lt;p&gt;I clicked the linked, saw that I met the requirements for the program and applied immediately. This was back in November. Weeks went by then in the middle of December I got to the interview portion. I was honest about my situation and explained everything that I'd done to get into tech on my own. I knew this was my best chance for an actually career if only given a chance.&lt;/p&gt;

&lt;p&gt;I was thanked for being honest and open in my interview. I was told accepted candidates would be contacted by early January. I walked out and waited.&lt;/p&gt;

&lt;p&gt;Three days later I received a congratulatory email saying I'd been accepted into the program. I finally got my foot in the door moment and in the week since this program has started, it's the first time in nearly a decade that careerwise, felt absolutely right.&lt;/p&gt;

&lt;p&gt;Next post will be when we actually start the A+ training&lt;/p&gt;

&lt;p&gt;Thanks for reading&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Recursion recall, because it's necessary</title>
      <dc:creator>Jonathan Thomas</dc:creator>
      <pubDate>Wed, 17 Jul 2019 20:10:48 +0000</pubDate>
      <link>https://dev.to/jonathanmkpt/recursion-recall-because-it-s-necessary-433p</link>
      <guid>https://dev.to/jonathanmkpt/recursion-recall-because-it-s-necessary-433p</guid>
      <description>&lt;p&gt;Continuing on since my last post on Big O, which involves time and space complexity of programs, I'm adding a quick recall of an often used, if not completely understood concept. RECURSION!&lt;/p&gt;

&lt;p&gt;What it do?&lt;/p&gt;

&lt;p&gt;Recursion, in the most basic terms ,is a function that has the ability to call itself.It is used all the time in in programming and is seen as a cleaner alternative to iteration.&lt;/p&gt;

&lt;p&gt;With recursion, you use a different input each time until you reach your base case.&lt;/p&gt;

&lt;p&gt;For example, you have an array of numbers and you want to find out which of the elements are odd. So knowing that even numbers are anything divisible by two with no remainder, I can say my base case is&lt;br&gt;
N%2 where N is an element in the array divided by two with no remainder.&lt;/p&gt;

&lt;p&gt;I could put this in a helper function that uses this as the base case when no matter what my inputs. We need a base case and different inputs to ensure that program returns the base case when conditions are met.&lt;/p&gt;

&lt;p&gt;So this was my quick recall of recursion. I will come back and post an updated version as I learn more. Constructive criticism is greatly appreciated and hopefully this helps you too.&lt;/p&gt;

&lt;p&gt;Thanks for reading.....k bye :)&lt;/p&gt;

</description>
      <category>computerscience</category>
      <category>beginners</category>
      <category>algorithmsanddatastructures</category>
      <category>interviewprep</category>
    </item>
    <item>
      <title>My recall of Big O and how understanding it will make all development easier.</title>
      <dc:creator>Jonathan Thomas</dc:creator>
      <pubDate>Fri, 12 Jul 2019 20:22:36 +0000</pubDate>
      <link>https://dev.to/jonathanmkpt/my-recall-of-big-o-and-how-understanding-it-will-make-all-development-easier-1kkl</link>
      <guid>https://dev.to/jonathanmkpt/my-recall-of-big-o-and-how-understanding-it-will-make-all-development-easier-1kkl</guid>
      <description>&lt;p&gt;Since my last post I've been working on and off getting back into the flow of code.&lt;/p&gt;

&lt;p&gt;Recently I dived back into Data Structures and Algorithms in Javascript Masterclass by Colt Steele. So far the concepts are starting to make sense but to really reinfore the ideas recall is needed so here it goes&lt;/p&gt;

&lt;p&gt;In computer science, Big O is a measurment used to describe the efficiency of algorithms. There are best, worse and average cases that can come about depending on the data structures, algorithms and languages used.&lt;/p&gt;

&lt;p&gt;Common runtimes include O(N), O(log N), O(N log N), O(N^2) and O(2^N).&lt;/p&gt;

&lt;p&gt;Runtimes are determined by the amount of operations and memory(O(1) a constant as an example) used in programming.&lt;/p&gt;

&lt;p&gt;Ideally taking runtimes into account could help when deploying a program. In thes case of javascript in browsers, depending on the browsers themeselves, different runtimes might occur.&lt;/p&gt;

&lt;p&gt;With regard to memory(O(1)), also know as space complexity, can affect big O since the computer has to reserve memeory to use for operations.&lt;/p&gt;

&lt;p&gt;Best and worst case scenarios are determined by what the algorithm is trying to do. For example of going through an array of near sorted items for bubble sort would be O(N) however in most cases the items will have to be sorted first, thus we'd be left with O(N^2) since it has to recursively go through and check each element that isn't sorted.&lt;/p&gt;

&lt;p&gt;Anyway this was my first foray into inderstanding big O theory and constructive criticism and guidance os greatly appreciated. &lt;/p&gt;

&lt;p&gt;If there is anything that I'm missing or could elaborate on, please let me know.&lt;/p&gt;

&lt;p&gt;Thanks again,&lt;br&gt;
Jonathan Thomas, future Software Engineer&lt;/p&gt;

</description>
      <category>computerscience</category>
      <category>career</category>
      <category>beginners</category>
    </item>
    <item>
      <title>I NEED mentorship to land a job within the next 120 days becaue my father is dying...</title>
      <dc:creator>Jonathan Thomas</dc:creator>
      <pubDate>Sun, 07 Jul 2019 03:01:14 +0000</pubDate>
      <link>https://dev.to/jonathanmkpt/i-need-mentorship-to-land-a-job-within-the-next-120-days-becaue-my-father-is-dying-4dek</link>
      <guid>https://dev.to/jonathanmkpt/i-need-mentorship-to-land-a-job-within-the-next-120-days-becaue-my-father-is-dying-4dek</guid>
      <description>&lt;p&gt;Hey all, so very new to this communtiy and, kind of at a loss. I've been putting off trying to land a developer career because life keeps getting in the way. Well, today the biggest obstacle to this journey has just been put in front of me. This morning at 11:15 am, my father was diagnosed with cancer of the lungs, liver and colon. The shock and sadness are still prevalent, I'm hurting, my mother and brother are hurting. I'm sad and angry because even all three of our jobs right now won't enough. So I need build my portfolio starting right now.&lt;/p&gt;

&lt;p&gt;I need to get one of these jobs but I don't know what to build to even get my foot in the door. I've been putting it off over and over again, but this is my wake up call. I have to land a job in the next 4 months(projection from doctors).So I reach out to you those who are already in tech for guidance and what to add. I'll link my github and linkedin profiles here, I just don't know how to focus. Please, any advice or guidance would be greatly appreciated as I take things one day at a time.I have to make this work for my family's sake&lt;/p&gt;

&lt;p&gt;github: &lt;a href="https://github.com/JonathanMKPT"&gt;https://github.com/JonathanMKPT&lt;/a&gt;&lt;br&gt;
linkedin: &lt;a href="https://www.linkedin.com/in/jonathan-thomas-5b5135114"&gt;https://www.linkedin.com/in/jonathan-thomas-5b5135114&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks in advance,&lt;br&gt;
Jonathan Thomas&lt;/p&gt;

</description>
      <category>beginners</category>
    </item>
    <item>
      <title>Is it possible to suffer from code withdrawal?</title>
      <dc:creator>Jonathan Thomas</dc:creator>
      <pubDate>Thu, 04 Jul 2019 17:58:40 +0000</pubDate>
      <link>https://dev.to/jonathanmkpt/is-it-possible-to-suffer-from-code-withdrawal-b7a</link>
      <guid>https://dev.to/jonathanmkpt/is-it-possible-to-suffer-from-code-withdrawal-b7a</guid>
      <description>&lt;p&gt;I ask this because as I sit in another industrial mechanic theory class I'm zoning out thinking about all the programming I could be learning now.&lt;/p&gt;

&lt;p&gt;I kind of feel weak and stressed that I'm not at a terminal right now. Especially after I'll be going straight to work after my classes and that means I'll be away longer.&lt;/p&gt;

&lt;p&gt;The keyboard is calling and I'm not there, does anyone have advice for this type of experience?&lt;/p&gt;

&lt;p&gt;Thanks in advance&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Coding procrastination keeps me back and my plan to handle the future</title>
      <dc:creator>Jonathan Thomas</dc:creator>
      <pubDate>Thu, 27 Jun 2019 14:08:28 +0000</pubDate>
      <link>https://dev.to/jonathanmkpt/coding-procrastination-keeps-me-back-and-my-plan-to-handle-the-future-378n</link>
      <guid>https://dev.to/jonathanmkpt/coding-procrastination-keeps-me-back-and-my-plan-to-handle-the-future-378n</guid>
      <description>&lt;p&gt;It's been two months since my last bootcamp. Let the coding procastination begin! Sadly, I am no closer to the goal I set forth to complete by August 1st, 2019. From this previous post, I made my intention clear that I would do everything it took to finally land a coveted tech job. Yet now I find myself in a government funded skilled trades program. While I'm grateful for the opportunity and tactile experiences, I feel my bias against this employ remain still. The program and text books are free so it's soemthing different, but I don't see any longer term career out of this. For now, I'll stick it out and continue to work on ways to get back into the software development habit.&lt;/p&gt;

&lt;p&gt;But to make that habit successful, I need to understand how I get distracted from coding when life opportunities occur.&lt;/p&gt;

&lt;p&gt;For the full post please click here. Have a wonderful day!&lt;br&gt;
&lt;a href="http://afropolymath.com/procastination-sucks-ass-when-your-broke/"&gt;http://afropolymath.com/procastination-sucks-ass-when-your-broke/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>productivity</category>
      <category>career</category>
    </item>
  </channel>
</rss>
