Stock Price Tracking

Submitted by daniel on Fri, 04/12/2020 - 03:02

Say we have an array of values that represents the stock price of duckduckgo over time.

e.g.

const stocks = [1, 0, 5, 14,  -1, 10];

How do we write a function that tells us what the biggest margin is? What is the optimal price that we can both buy and sell at? We cannot sell stock before we buy it. 

One approach requires iterating though each number and calculate the delta of every price in the future to ensure that we only make comparisons going forward in time. 

Here is an example

Tags:

Adding an external repo to your composer.json

Submitted by daniel on Mon, 30/11/2020 - 16:45

Sometimes it may be useful to specify a patched branch of a particular project. I recently came across an issue where it was not possible to patch a module, but I was able to create an issue branch  and  pull request. Pending approval and review I was still able to reference this branch in my composer file, This was useful in this case as this particular dependency broke the composer pipeline, install update etc. Here I show you how this can be done.

1. Add Your repo

Getting started with DNSMasq for local development

Submitted by daniel on Fri, 20/11/2020 - 15:11

Typically it is not uncommon to use yours hosts file to redirect network traffic on your local machine to point to your local environment where appropriate. That works pretty well for most circumstances however it can become a little tiresome if you are managing a large number of projects and quickly your hosts file can become quite long and unwieldy.

One alternative to using your hosts file is to use a local dns server. One such option is DNSMasq.

Getting started with Remote Images in Drupal

Submitted by daniel on Wed, 18/11/2020 - 19:10

In a previous article I touched on the oEmbed standard and a little about the use of remote media including remote images.

Of course embedding images into to page whether hosted remotely or locally is not a new thing. Embedding remote images from the Drupal UI is not supported out of the box. Of course you can manually edit the html using your wysiwyg editor, but that is not very user friendly and is not a great user experience. Furthermore doing so increases that the risk your markup may be malformed etc

Support for oEmbed opens up wealth of opportunities for embedded content

Submitted by daniel on Wed, 18/11/2020 - 15:01

Drupal 8.6.0 has an out-of-box adds support for embedding remote YouTube and Vimeo videos by means of the oEmbed format. You may notice these are often encapsulated in an iframe. You can see this evident in a new media type being defined called 'Remote Video' available form /admin/structure/media. A new icon is also available form your wysiwyg that allows you to embed the new format in your page or block.

NASA Streams Space-X Resilience launch live on Youtube

Submitted by daniel on Sun, 15/11/2020 - 22:55

NASA’s SpaceX Crew-1 mission will be the first crew rotation flight of a U.S. commercial spacecraft with astronauts to the International Space Station. NASA astronauts Michael Hopkins, Victor Glover, Shannon Walker, and Japanese astronaut Soichi Noguchi are set to launch on SpaceX’s Crew Dragon spacecraft and Falcon 9 rocket. The astronauts named the spacecraft Resilience, highlighting the dedication the teams involved with the mission have displayed and to demonstrate that when we work together, there is no limit to what we can achieve. 

Tags:

Adding IMAP email on your iPhone

Submitted by daniel on Tue, 10/11/2020 - 14:02

This article was originally written in 2005 as a support forum article. This is still relevant today so I have decided to add and update it here for posterity.

If you are looking to take advantage of IMAP ability to sync your emails across mutiple devices such as your mobile phone or pda, while being able to also pick them up from your home or work computer, them IMAP is the way to go.

Tags:

A skeleton for setting up your node js project

Submitted by daniel on Fri, 06/11/2020 - 19:09

There are many reasons that you might want to run your application on node js as opposed to php. One reason that stands out for me is that node js has a built in server, making it much lighter than say php that typically served on top of either Apache or Nginx 'web servers'. This typically makes such applications very heavy on memory usage, with each thread maybe consuming around 128MB for a standard Drupal site.

swf format set to be phased out by New Year

Submitted by daniel on Mon, 26/10/2020 - 18:00

Adobe Flash's swf format is set to reach end of life by the end of this year. Already Safari has dropped support from its latest browser and Microsoft has disabled it by default on its latest Edge browser. From the 1st jan 2021, support will be dropped by all browsers, with the possible exception of Firefox Enterprise (with updates disabled!).

Increasing Server Partition size

Submitted by daniel on Tue, 06/10/2020 - 14:28

When online servers are setup, for some reason the allocated partitions on the hard drive may need to be adjusted manually to take advantage of the the amount of space available. These instructions are specific to Centos but similar likely applies to other Linux distros.

We can look at what the current partitions and there allocated size by using the df command. the -h flag sets the out put to be human readable

Updating MySQL on Centos 7

Submitted by daniel on Thu, 01/10/2020 - 16:18

With the launch of Drupal 9, one of the requirements is for MySQL 5.7 or later.

  • If using Drupal 9 with MySQL or Percona, version 5.7.8+ is required.
  • If using Drupal 9 with MariaDB, version 10.3.7+ is required.

What I discovered is the the version of MySQL that ships by default with Centos is constrained to 5.5*. To find my current version of MySQL: