Posts

Editing a Reddit Post

Image
Here we go - the biggy. The U in CRUD.😟😟 Update Update Is the hardest part of CRUD for a couple reasons, but as I am an API and only focusing on client-side development things should be a little easier. The main challenge is visually creating an application that previews the current status of an item to be edited, and then an updated version once you complete the request.  For this, I have used a series of buttons, with some handy JQuery helpers to assist. Once the dynamically generated button is pressed, then the button is located and replaced with the 'confirm' button using JQuery's '.replaceWith()'. The body of the post (or 'selftext') is then found, and replaced with a form. This form contains an input box with the original body of the post as a value.  From here, the user can change the text and press confirm, which will trigger the ajax request. As shown above, the new user text is taken from the input box with the id of 'editText' and assign...

WordPress vs Web Developer

WordPress vs Web Developer In this post I will be comparing the development of my website using technologies such as JQuery, AJAX and a CMS with trying to achieve the same outcome using plain HTML/CSS with JavaScript and PHP. JQuery is a JavaScript library. This means that it is based around JavaScript but adds additional functionality to the base language. JavaScript is a very powerful tool, so why is this necessary? Because as much as JavaScript is capable of a lot, some techniques take a lot of time to implement. Say, for instance, you wanted to run through a loop of every element in an array. This could be easily achieved by creating a loop from 0 -> array.length. Great! But over time, this becomes monotonous and nonsensical. The phrase 're-invent the wheel' comes to mind. This is what libraries like JQuery aim to solve, by providing pre-determined methods to be accessed to utilise common activates. Instead, for this example, we could use JQuery's .each() to achieve ...

Conclusion and Recommendations

Image
To conclude, this module has taught me a decent amount. At first, I was apprehensive of using technologies such as JQuery, as my experience of JavaScript prior to this module was sour. Though, Through this module, I have learned and used more JavaScript-based login and as such grown a fondness for it. On top of this, WordPress was a complete unknown to me. I had used services such as Wix before, but WordPress has more functionality than a website building application. Thankfully I was well versed in working with AJAX, JSON and API's due to my honours project. I have learned the inner workings of WordPress such as plugins and widgets, which will surely be beneficial in the future should I take freelance work, say. But the most was gained in my new-found familiarity in JQuery. Learning how this library works, and what is capable of is very important as JavaScript frameworks and libraries are massively relevant to this day with libraries such as React.  If I were to do this module aga...

Hot Fix

Image
While demonstrating this assessment, an issue came apparent. This issue was causing the temperature of 'Tom Land' to seem very... cold. Once the temperature reached double digits, the reading would be cut off, as only the first digit was taken. Below is an example of the issue using the console, logging the temperatures. As you can see, the temperature was going from rising from one degree rapidly, then plummeting back down.  The issue was caused by the substr() method, I was using substr(0,1) which would take the first digit only.  Instead, this could be more accurately shown by using the .split() method - using the demical point (".") as a splitting point, as shown below: Which will show the full readings of temperatures: