I was working on a video player app in Vue and forgot about the API_KEY that I was using from google for fetching video data from YouTube which I had listed as a const variable in my App.vue file. This ended up getting pushed up to my public github repo, exposing the key that I … Continue reading Vue.js: How to hide a public API key from github
JavaScript: How to use the .call( ) method
The .call() method is a JavaScript built-in that allows you to call a function that is defined in another object. Here is what w3schools.com says about the .call() method: The first argument when using .call() will always be expected to be an object that contains keys that the calling function requires as arguments. For example: … Continue reading JavaScript: How to use the .call( ) method
Javascript: How to use ES6 Template Literals
When using ES6 with a linter I got this suggestion from sonarqube to replace my standard string concatenation with an apparently preferred Template Literal. Here is the sonarqube message I got: The string concatenation that triggered this suggestion was: The suggested fix using a Template Literal looks like this: Basically, a template literal has this … Continue reading Javascript: How to use ES6 Template Literals
Vue.js: How to make an identicon generator
In this article, I will show how to create an identicon generator using Vue.js in codepen. First of all, an identicon is a graphical image that is generated by text input. This is useful as a substitute for photo images for site users. For example, when I type “Chris Nielsen Code Walk”, the identicon generator … Continue reading Vue.js: How to make an identicon generator
Vue.js: How to use Vue CLI to quickly create a project
Vue.js comes with a built in command line tool called Vue CLI, which makes setting up a new Vue.js project a breeze. Vue.js can be used without this, but the advantage of using Vue CLI is that it sets up a Vue.js project using Babel and Webpack and allows the project to be launched easily … Continue reading Vue.js: How to use Vue CLI to quickly create a project
MySQL: How to automatically update timestamp column in phpMyAdmin when a row is edited
I have a table in my database called “usercardsetplaycounts” that has a column called “updatedAt” that I want to get updated with a fresh timestamp every time a row is edited. When I originally set this column up, I set the default to CURRENT_TIMESTAMP. Here is what it looks like in phyMyAdmin: The updatedAt date … Continue reading MySQL: How to automatically update timestamp column in phpMyAdmin when a row is edited
Tableau: How to recreate a data graphic found on the web
One good way to get familiar with how to use a BI (business intelligence) tool such as Tableau is to start with a simple example of a data graphic and then attempt to replicate that graphic using Tableau. In this article I will describe step by step how to create the data display below in … Continue reading Tableau: How to recreate a data graphic found on the web
MySQL: How to copy database from web host to localhost
Let’s say you want to copy the MySQL database used on a website to a local installation of PHP/MySQL for testing. In order to do this, you will need the following: Access to the cpanel of the website that has phpMyAdmin installed An Apache server with phpMyAdmin installed locally. For this, you can use Bitnami’s … Continue reading MySQL: How to copy database from web host to localhost
Kotlin: How to use the ‘when’ expression
In addition to if, for, and while loops, Kotlin also has a control flow option called when. The ‘when’ expression acts just like a switch operator you might see in other languages. The basic structure looks like this: Some notes about this switch structure: The first line uses the key word when followed by a … Continue reading Kotlin: How to use the ‘when’ expression
Kotlin: How to use .filter( ), ‘it’ key word, and arrow ‘->’ operator
Kotlin’s built-in .filter() function is meant to iterate through any iterable collection type, (lists, sets, or maps) and check each element of the collection against some criteria (aka “predicate”). If the element matches the predicate, meaning the boolean result is true, then the element is added to a result collection of the same type that … Continue reading Kotlin: How to use .filter( ), ‘it’ key word, and arrow ‘->’ operator