Saturday, 13 May 2023

Creating a continuous deployment pipeline with Github Actions and S3

It's common in today's development world to want a continuous deployment process for getting your code changes under version control to production for the world to see.  While in an organisation or medium-larger sized team there may be some steps in between push-deploy, such as code reviews, testing, staging, quality assurance, client review etc. the basic flow can be set up quite easily.  

Two of the most common tools are Github for version control, and AWS, we'll use an S3 bucket in this instance, but we could tweak to a more involved cloud infrastructure if needed.   To set up a CI/CD process with GitHub Actions to an S3 bucket, you will need to:
  1. Create an S3 bucket in AWS.
  2. Create a GitHub repository for your project.
  3. Create a GitHub Action workflow that deploys your project to the S3 bucket.
  4. Configure the GitHub Action workflow with your AWS credentials.
  5. Push your code to the GitHub repository.
Here are the steps in more detail:

1. **Create an S3 bucket in AWS.**

To create an S3 bucket in AWS, you will need to:
  1. Go to the AWS Management Console.
  2. Click on the "S3" service.
  3. Click on the "Create Bucket" button.
  4. Enter a name for your bucket.
  5. Select a region for your bucket.
  6. Click on the "Create" button.

2. **Create a GitHub repository for your project.**

To create a GitHub repository for your project, you will need to:
  1. Go to the GitHub website.
  2. Click on the "Create Repository" button.
  3. Enter a name for your repository.
  4. Select a public or private repository.
  5. Click on the "Create Repository" button.

3. **Create a GitHub Action workflow that deploys your project to the S3 bucket.**

To create a GitHub Action workflow that deploys your project to the S3 bucket, you will need to:
  1. Go to your GitHub repository.
  2. Click on the "Actions" tab.
  3. Click on the "New workflow" button.
  4. Select the "AWS" template.
  5. Enter a name for your workflow.
  6. In the "Jobs" section, click on the "Add job" button.
  7. In the "Job name" field, enter a name for your job.
  8. In the "Run on" field, select the "push" event.
  9. In the "Steps" section, click on the "Add step" button.
  10. In the "Step name" field, enter a name for your step.
  11. In the "Action" field, select the "aws" action.
  12. In the "Use" field, select the "s3" operation.
  13. In the "Bucket" field, enter the name of your S3 bucket.
  14. In the "Key" field, enter the key for your object in the S3 bucket.
  15. In the "`Content-Type`" field, enter the content type of your object.
  16. In the "`Source`" field, enter the path to your source code.
  17. Click on the "Save" button.

4. **Configure the GitHub Action workflow with your AWS credentials.**

To configure the GitHub Action workflow with your AWS credentials, you will need to:
  1. Go to your GitHub repository settings.
  2. Click on the "Secrets" tab.
  3. Click on the "New secret" button.
  4. In the "Name" field, enter a name for your secret.
  5. In the "Value" field, enter your AWS access key ID and secret access key.
  6. Click on the "Add secret" button.

5. **Push your code to the GitHub repository.**

To push your code to the GitHub repository, you will need to:
  1. Go to your local repository.
  2. Run the following command:
  git push


Once you have pushed your code to the GitHub repository, the GitHub Action workflow will be triggered and your project will be deployed to the S3 bucket.

Monday, 1 May 2023

Personalisation and customisation

As a developer, I've been closely following the advancements in personalization and customization in recent years. These technologies have the potential to revolutionize the way we think about creating digital experiences and create new possibilities for the future.


Personalization and customization are closely related but distinct technologies. Personalization is the process of providing a personalized experience to the user based on their individual characteristics or preferences, while customization is the process of allowing the user to configure or tailor the experience to their needs.


One of the biggest benefits of personalization and customization is that they allow us to create more engaging and relevant experiences for the users. By providing personalized content, recommendations or offers, we can increase the likelihood of users engaging with the website or application, and also increase their satisfaction.


Another benefit of personalization and customization is that they can help to increase the conversion rates by providing a more relevant and tailored experience to the users. For example, an e-commerce website that provides personalized product recommendations based on the user's browsing history or purchase history is more likely to result in a sale than a website that provides generic recommendations.


From a developer's perspective, working with personalization and customization involves a few key steps. First, you need to gather data on the user's preferences and behavior, this can be done by collecting data through web analytics, cookies, or forms.


Next, you need to analyze the data and identify patterns and segments, this can be done by using techniques such as clustering or data mining.


Then, you need to create a personalized or customized experience based on the data. This can be done by using technologies such as JavaScript or server-side rendering to display personalized content, or by using APIs to access personalized data.


Finally, you need to test and deploy your personalized or customized experience. This typically involves using techniques such as A/B testing to evaluate the performance of your personalized or customized experience, and then deploying them to production environments.


In conclusion, personalization and customization are powerful technologies that have the potential to revolutionize the way we think about creating digital experiences. As a developer, I believe that these technologies are worth investing in and I look forward to seeing how they continue to evolve in the coming years. With personalization and customization, the possibilities are endless, and it can bring a whole new level of engagement, relevance, and conversion to the digital products we build. It's important to note that personalization and customization are not a one size fits all solution, they should be used in a responsible and ethical way, taking into account the user's privacy, and preferences.

Saturday, 22 April 2023

Learning PHP

Contents

  1. Introduction
  2. Getting Started with PHP
  3. Variables and Data Types
  4. Operators and Expressions
  5. Control Structures
  6. Functions
  7. Tips and Tricks
  8. Conclusion

Introduction

In today's digital age, learning to code is becoming increasingly important. There are numerous programming languages to choose from, each with its own strengths and weaknesses. One of the most popular programming languages today is PHP, which is used for building dynamic web applications.

PHP is an open-source, server-side scripting language that is designed to create dynamic web pages and applications. It is used to develop websites and web applications that can interact with databases, handle forms, and manage user sessions. With PHP, you can build everything from simple blogs to complex e-commerce sites.

If you're interested in learning to code in PHP, this article will provide you with the basic knowledge you need to get started. In this book, we'll cover the basics of PHP, including variables, operators, control structures, functions, and more. We'll also provide you with tips and tricks to help you write better code and avoid common mistakes.

Getting Started with PHP

In this chapter, we'll provide you with an overview of PHP and how to set up your development environment. We'll also introduce you to some of the basic syntax and concepts that you'll need to understand before you start writing PHP code.

PHP is an open-source scripting language that runs on the server-side of web development. This means that PHP scripts are executed on the server, and the results are sent to the client's browser. This is in contrast to client-side languages like JavaScript, which are executed in the client's browser.

To get started with PHP, you'll need to install a web server and PHP interpreter on your computer. One popular way to do this is to use a web development environment like XAMPP, which includes Apache, MySQL, and PHP. Alternatively, you can install these components individually.

Once you've installed your development environment, you can create your first PHP script. To do this, create a new file with a ".php" extension and add the following code:

<?php
    echo "Hello, world!";
?>

This code uses the "echo" statement to output the text "Hello, world!" to the browser. The "<?php" and "?>" tags indicate that the code between them should be executed as PHP code.

Variables and Data Types

In this chapter, we'll cover variables and data types in PHP. Variables are used to store data that can be used throughout your script, and data types determine the type of data that can be stored in a variable.

In PHP, variables are denoted with a dollar sign ($), followed by the variable name. For example:

$name = "John";
$age = 25;

In this code, we've created two variables, "$name" and "$age". The first variable is a string, and the second variable is an integer. PHP supports several data types, including strings, integers, floats, booleans, and arrays.

To check the data type of a variable, you can use the "gettype" function. For example:

$name = "John";
$age = 25;
echo gettype($name); // outputs "string"
echo gettype($age); // outputs "integer"

Operators and Expressions

In this chapter, we'll cover operators and expressions in PHP. Operators are used to perform operations on variables and values, and expressions are combinations of variables, values, and operators.

PHP supports several types of operators, including arithmetic, comparison, logical, and assignment operators. Arithmetic operators are used to perform basic math operations, such as addition, subtraction, multiplication, and division. Comparison operators are used to compare values, such as equal to, not equal to, greater than, and less than. Logical operators are used to combine multiple conditions, such as "AND", "OR", and "NOT". Assignment operators are used to assign values to variables.

For example, the following code uses arithmetic operators to perform a basic math operation:

$a = 10;
$b = 5;
$c = $a + $b; // $c is now 15

In this code, we've assigned the values 10 and 5 to the variables "$a" and "$b". We then used the addition operator (+) to add the values of "$a" and "$b" and assign the result to the variable "$c".

Expressions can be created by combining variables, values, and operators. For example:

$a = 10;
$b = 5;
$c = ($a + $b) * 2; // $c is now 30

In this code, we've used parentheses to group the addition operation before multiplying the result by 2.

Control Structures

In this chapter, we'll cover control structures in PHP. Control structures are used to control the flow of a PHP script based on certain conditions. PHP supports several control structures, including if statements, loops, and switch statements.

If statements are used to execute code based on a certain condition. For example:

$a = 10;
if ($a > 5) {
    echo "The value of a is greater than 5";
}

In this code, we've used an if statement to check if the value of "$a" is greater than 5. If the condition is true, the code within the curly braces is executed.

Loops are used to repeat code multiple times. PHP supports several types of loops, including for loops, while loops, and do-while loops. For example:

for ($i = 0; $i < 5; $i++) {
    echo "The value of i is " . $i;
}

In this code, we've used a for loop to output the value of "$i" from 0 to 4.

Switch statements are used to execute different code based on the value of a variable. For example:

$day = "Monday";
switch ($day) { 
    case "Monday":
        echo "Today is Monday";
        break;
    case "Tuesday": 
        echo "Today is Tuesday";
        break;
    default:
        echo "Today is not Monday or Tuesday";
        break;
}

In this code, we've used a switch statement to output a different message based on the value of the variable "$day".

Functions

In this chapter, we'll cover functions in PHP. Functions are used to group code together that performs a specific task. PHP supports both built-in functions and user-defined functions.

Built-in functions are functions that are included in PHP and can be used without any additional setup. For example, the "strlen" function is used to return the length of a string:

$name = "John";
echo strlen($name); // outputs 4

In this code, we've used the "strlen" function to output the length of the string "John".

User-defined functions are functions that are created by the developer to perform a specific task. For example:

function multiply($a, $b) {
    return $a * $b;
}
echo multiply(5, 10); // outputs 50

In this code, we've created a function called "multiply" that takes two parameters and returns their product.

Tips and Tricks

In this chapter, we'll provide you with some tips and tricks to help you write better PHP code and avoid common mistakes.

1. Use comments to document your code

Adding comments to your code can help you and other developers understand what the code does and how it works. Comments are lines of text that are ignored by PHP and are used to explain the code.

For example:

// This is a single-line comment 
/* This is a 
    multi-line 
    comment */

2. Use meaningful variable and function names

Using descriptive variable and function names can make your code easier to read and understand. For example, instead of using a variable called "$a", use a variable called "$totalSales". This will make it clear what the variable represents.Use indentation and whitespace

Indenting your code and using whitespace can make it easier to read and understand. Indentation is used to show the structure of your code and to make it clear which statements are part of a control structure or function.

For example:

if ($totalSales > 1000) {
    echo "You qualify for a discount!";
}

Use error reporting and debugging tools

PHP has several built-in error reporting and debugging tools that can help you find and fix errors in your code. Enabling error reporting can help you find syntax errors and other issues in your code. Debugging tools like xdebug can help you step through your code and identify issues.Use security best practices

When writing PHP code, it's important to follow security best practices to protect your application and its users. Some best practices include:
  • Sanitizing user input to prevent SQL injection and cross-site scripting (XSS) attacks
  • Using prepared statements to prevent SQL injection attacks
  • Validating input data to prevent unexpected data types or values
  • Storing sensitive data securely, such as using encryption for passwords

Conclusion

Learning to code in PHP can be a challenging but rewarding experience. With its wide range of features and capabilities, PHP is a powerful language for developing web applications.

In this article, we've covered the basics of PHP programming, including variables, data types, operators, control structures, and functions. We've also provided some tips and tricks to help you write better PHP code and avoid common mistakes.

Whether you're new to programming or an experienced developer, we hope that this article has provided you with a solid foundation for learning and working with PHP. Happy coding!

Wednesday, 19 April 2023

A practical guide to quality management in clinical trial research

Quality management in clinical trial research is an essential aspect of ensuring that the research is conducted in a safe, ethical, and scientifically sound manner. Here is a practical guide to implementing quality management in clinical trial research:


  1. Develop a Quality Management Plan: Develop a comprehensive quality management plan that outlines the policies, procedures, and responsibilities for ensuring quality in the research. This plan should be reviewed and approved by the appropriate institutional review board or ethics committee.
  2. Establish Standard Operating Procedures (SOPs): Develop SOPs for all aspects of the research, including data management, monitoring, and reporting. These SOPs should be reviewed and approved by the appropriate institutional review board or ethics committee.
  3. Train staff: Provide training to all staff involved in the research on the policies, procedures, and SOPs related to quality management. This training should be provided before the research begins and updated as needed.
  4. Data Management: Establish a system for data management that includes data entry, verification, and validation. The system should ensure the accuracy, completeness, and consistency of the data.
  5. Monitor the Research: Conduct regular monitoring of the research to ensure compliance with the quality management plan and SOPs. This should include on-site visits, remote monitoring, and audits.
  6. Report Adverse Events: Establish a system for reporting adverse events, including serious adverse events, that occur during the research. This system should be reviewed and approved by the appropriate institutional review board or ethics committee.
  7. Review and Evaluate: Regularly review and evaluate the quality management plan, SOPs, and the research to identify areas for improvement and make necessary changes.
  8. Compliance: Ensure compliance with all regulatory and ethical requirements related to quality management in clinical trial research, such as GCP (good clinical practice) guidelines.
  9. Document Control: Implement a system of document control that ensures that all documents related to the research are properly maintained, controlled and easily accessible when needed.
  10. Communication: Establish a system of communication that ensures that all stakeholders are informed of the progress, any issues, and changes related to the research.

https://www.amazon.co.uk/Practical-Quality-Management-Clinical-Research/dp/0849397227

Saturday, 1 April 2023

Artificial intelligence (AI) and machine learning (ML)

As a developer, I've been closely following the advancements in artificial intelligence (AI) and machine learning (ML) in recent years. These technologies have the potential to revolutionize the way we think about software development and create new possibilities for the future.


AI and ML are closely related but distinct technologies. AI is the broader concept of machines being able to perform tasks that typically require human intelligence, such as understanding natural language or recognising images. ML, on the other hand, is a specific approach to AI that involves training models on data to enable them to make predictions or decisions.


One of the biggest benefits of AI and ML is that they allow us to automate tasks that would otherwise be too complex or time-consuming for humans to perform. For example, an AI-powered image recognition system can quickly and accurately identify objects in thousands of images, something that would take a human days or even weeks to do.


Another benefit of AI and ML is that they can help us to make better decisions by providing insights that we would not be able to see otherwise. For example, an ML-powered customer segmentation system can analyse data on customer behaviour and demographics to identify patterns and trends that can be used to improve marketing campaigns.


From a developer's perspective, working with AI and ML involves a few key steps. First, you need to identify the problem you want to solve and the data you will need to train your models. This typically involves working with domain experts to understand the problem and collect and preprocess the data.


Next, you need to choose the appropriate AI and ML techniques and tools to build your models. This typically involves selecting a framework such as TensorFlow or PyTorch and using techniques such as supervised learning or unsupervised learning depending on the problem.


Finally, you need to test and deploy your models. This typically involves using techniques such as cross-validation to evaluate the performance of your models, and then deploying them to production environments.


In conclusion, AI and ML are powerful technologies that have the potential to revolutionise the way we think about software development. As a developer, I believe that these technologies are worth investing in and I look forward to seeing how they continue to evolve in the coming years. With AI and ML, the possibilities are endless, and it can bring a whole new level of automation, insights, and intelligence to the software we build. It's important to note that AI and ML are not a magic wand, they are just tools, and it's the developer's responsibility to use them in the right way and with the appropriate ethical considerations.

Wednesday, 15 March 2023

What is "Green IT"

"Green IT" (also known as "green computing") is a term used to describe the practice of designing, manufacturing, using, and disposing of computers, servers, and associated subsystems—such as monitors and printers—in an environmentally-friendly manner. It involves the use of environmentally sustainable computing resources in order to reduce the environmental impact of IT operations.


Green IT practices include energy-efficient computing, the use of renewable energy sources, the reduction of electronic waste, and the use of environmentally-friendly materials in the manufacture of IT equipment. It also includes the use of virtualisation, cloud computing and remote working to reduce the energy consumption of IT systems, and the use of teleconferencing to reduce travel.


Green IT is an important concept in today's world as technology continues to play a larger role in our lives and the environmental impact of IT operations become more significant. It aims to reduce the environmental impact of IT operations and promote sustainable business practices. Companies and organisations are adopting green IT strategies to reduce their environmental footprint, lower their energy costs, and improve their reputation with customers, partners, and other stakeholders. Additionally, governments and international organisations are also promoting green IT as a way to reduce greenhouse gas emissions and promote sustainable development.

Wednesday, 1 March 2023

Progressive web apps (PWA)

Progressive web apps, or PWAs, are a hot topic in the world of web development. As a technical lead, I've been keeping a close eye on this technology and I believe it is poised to revolutionise the way we think about web apps.


At their core, PWAs are web apps that use modern web technologies to deliver a app-like experience to users. They are built with standard web technologies such as HTML, CSS, and JavaScript, but have some key differences that set them apart from traditional web apps.


One of the biggest benefits of PWAs is that they can be accessed directly from a user's browser, without the need for them to download and install an app from an app store. This means that users can start using a PWA immediately, without any friction. PWAs also work offline, allowing users to continue to use the app even when they don't have an internet connection. This is achieved by caching the app's assets and data on the user's device, so that they are still available even when the user is offline.


Another benefit of PWAs is that they are much more responsive than traditional web apps. PWAs are designed to be fast and smooth, even on low-end devices or slow internet connections. This is achieved by using techniques such as lazy loading and code splitting, which help to minimise the amount of data that needs to be downloaded and reduce the amount of processing required to render the app.


As a technical lead, one of the things that excites me most about PWAs is the potential for increased engagement and conversion rates. PWAs can be designed to look and feel just like native apps, which means that users are more likely to engage with them and complete desired actions. PWAs can also be integrated with push notifications and other features that are typically only available to native apps, which can help to increase engagement and conversion rates even further.


Another great feature of PWAs is that they are easily discoverable by search engines, and they are indexed by the search engine, which means they can be found by users and they can increase the visibility of the website.


From a technical perspective, developing a PWA involves a few key steps. First, you need to create a web app that is optimized for performance and user experience. This typically involves using modern web technologies such as HTML, CSS, and JavaScript, and following best practices for web development.


Next, you need to configure your web app to work offline. This typically involves using a service worker, which is a script that runs in the background and handles caching and other offline-related tasks.


Finally, you need to make your web app installable. This typically involves creating a manifest file, which contains metadata about your app, such as its name, icons, and start URL.


In conclusion, PWAs are a powerful new technology that has the potential to revolutionise the way we think about web apps. As a technical lead, I believe that PWAs are well worth investing in and I look forward to seeing how they continue to evolve in the coming years.


npm Closed the Last Token Gap in Trusted Publishing. Now Remove Your Release Secrets

On 30 September, GitHub and npm removed a small but important obstacle to token-free package publishing. npm trusted publishing configurat...