Three Questions for ChatGPT


OpenAI currently runs ChatGPT for free at chat.openai.com. I’ve played around with it a bit and recently asked three questions. Those questions and ChatGPT’s responses are logged here.

Explain your learning model

ChatGPT is a type of language model called a transformer. It is trained using a variant of the transformer architecture called GPT-3 (Generative Pre-trained Transformer 3). This model is trained on a massive amount of text data using a technique called unsupervised learning, which means that it learns patterns in the data without any explicit labels or supervision. The model is pre-trained on a diverse set of internet text and fine-tuned on specific task by fine-tuning on smaller dataset. The model uses a deep neural network with attention mechanisms to generate human-like text. It can be fine-tuned for a wide range of natural language processing tasks, such as language translation, question answering, and text summarization.

What do you know about the company C Spire

C Spire is a telecommunications company based in Mississippi, USA. It provides a wide range of services including wireless, home phone, internet, and television services. The company is known for its focus on customer service and for offering customized plans and packages for its customers. C Spire also operates a number of retail stores in Mississippi and other states where it provides services. Additionally, it offers enterprise-level services such as cloud computing, data center, and cybersecurity services to businesses. The company is privately held and was founded in the 1990s.

What are the basic rules for telecommunications companies operating in the United States

Telecommunications companies operating in the United States are subject to a wide range of rules and regulations set by the federal government, including the Federal Communications Commission (FCC). Some of the basic rules that these companies are required to follow include:

  1. Universal Service: Telecommunications companies are required to contribute to the Universal Service Fund, which provides support for telecommunications services in rural and low-income areas.
  1. Interconnection: Telecommunications companies are required to interconnect with other companies to ensure that customers can reach all networks and services.
  1. Network Neutrality: Telecommunications companies are prohibited from discriminating against or blocking lawful internet traffic, also known as “net neutrality”
  1. Transparency: Telecommunications companies are required to provide accurate and timely information to customers about the prices, terms, and conditions of their services.
  1. Consumer protection: Telecommunications companies are required to follow rules to protect consumers from fraud, cramming and slamming, and other deceptive practices.
  1. Emergency Services: Telecommunications companies are required to provide 911 emergency services and meet other obligations to ensure public safety.

These are some of the basic rules that telecommunications companies operating in the United States must follow, but there are many more specific rules and regulations that apply to different types of services and different parts of the industry.

I believe you had a wrong fact in an earlier response. You told me C Spire was founded in the 1990s but the original company was created in 1988

I apologize for the error in my previous response. You are correct that C Spire was founded in 1988, not the 1990s. I apologize for any confusion this may have caused.

Why should more people use chatgpt

ChatGPT is a powerful language model that can be fine-tuned for a wide range of natural language processing tasks. Some of the benefits of using ChatGPT include:

  1. High-quality text generation: ChatGPT is trained on a large dataset of internet text, which allows it to generate human-like text that is often difficult to distinguish from text written by a human.
  1. Customizable: ChatGPT can be fine-tuned on a smaller dataset to perform specific tasks, such as answering questions or generating text in a specific style or tone.
  1. Efficient: ChatGPT is a highly efficient model that can be run on a wide range of devices, from high-performance servers to mobile devices, making it accessible to a wide range of users.
  1. Versatile: ChatGPT can be used for a wide range of applications such as text completion, text generation, question answering, language translation, text summarization, and many more.
  1. Cost effective: ChatGPT can be used for many tasks that would otherwise require human labor, which can save time and money.

In summary, ChatGPT is a versatile and efficient model that can be used to generate high-quality text, perform natural language processing tasks, and save time and money. It can be utilized by individuals, small businesses and large companies to automate various tasks, improve customer service, or creating new content.


Authored by Michael Lamb.
Published on 18 January 2023.


Adding Swagger UI to Spring Boot projects


This post copies and updates text from a previous version

Check out the previous version of this post if you want to compare the differences.

Spring Boot is a powerful project from the Spring ecosystem which enables developers to maximize their leverage of Spring applications. Standalone projects can be generated at start.spring.io with any other additional dependencies of Spring project included in just a few clicks.

I have created a Spring Boot demo project available on my GitHub. I use this project to demonstrate some tasks I perform regularly in Spring Boot.

Spring Logo

Swagger UI

If you’ve been a follower of this blog you might recall I have previously integrated Swagger UI into a Go application (check out this blog post from October 2021).

Swagger is a suite of tools which seeks to provide OpenAPI specifications and definitions. Codebases can be generated from a Swagger doc, just as an existing codebase can be documented by adding Swagger-identifiable annotations.

In this post I will show how I to integrate Springfox Swagger UI into a Spring Boot application. I will then demonstrate integrating Springdoc as an alternative, as Springfox hasn’t been updated in a while (the last commit was Oct, 2020). Springdoc supports the latest version of Spring Boot as of writing (2.7.2).

but first…

How this post is structured

There are three MILE MARKER sections. #1 precedes the relevant code blocks for Springfox. #2 occurs after Springfox is concluded and before Springdoc code blocks begin. #3 appears after the conclusion of Springdoc.

MILE MARKER 1

➡️ Springfox integration (you are here)

🔜 Springdoc integration

Springfox

This configuration uses an existing Spring Boot project and integrates io.springfox/swagger-boot-starter (version 3.0.0).

pom.xml - add Springfox dependency

Add the Springfox Spring Boot starter dependency.


<dependency>
    <groupId>io.springfox</groupId>
    <artifactId>springfox-boot-starter</artifactId>

    <version>3.0.0</version>

</dependency>

springfox-boot-starter provides the following artifacts from io.springfox:

  • springfox-oas
  • springfox-data-rest
  • springfox-bean-validators
  • springfox-swagger2
  • springfox-swagger-ui

Main Application Entry Point - add Springfox annotations

Wherever your Spring Boot app starts is dependent on your project. In my demo application, this is a file called DemoApplication.java.

In this file, only two annotations need to be added to the base class:


@EnableOpenApi
@EnableSwagger2

AppConfiguration.java - add Springfox annotations

If it doesn’t exist yet, create a new Java class called AppConfiguration.java. The class itself will be empty but it will have a few annotations that will enable Springfox to scan the application code and identify endpoints. You could add these annotations on the main application class but I like it this way as it feels more explicit in intention.


@Configuration
@EnableWebMvc
@ComponentScan("dev.michael.demo")
public class AppConfiguration {
}

SpringConfig.java - add Springfox WebMvcConfigurer registries

SpringConfig.java will implement the WebMvcConfigurer interface. It will override a couple of methods so that Spring Boot can serve Swagger UI alongside the Spring Boot app.


@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.
    addResourceHandler("/swagger-ui/**")
    .addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/")
    .resourceChain(false);
}

addResourceHandlers will enable Spring Boot to find Swagger resources.


@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/swagger-ui/")
    .setViewName("forward:" + "/swagger-ui/index.html");
}

addViewControllers will enable Spring Boot to serve the main Swagger UI page.

Springfox Conclusion

Swagger UI will now automatically generate API documentation every time the Spring Boot application is started.

MILE MARKER 2

✔️ Springfox integration

➡️ Springdoc integration (you are here)

Springdoc

Optional: For an example migration from Springfox to Springdoc, look at this commit on my Redis hackathon repo.

pom.xml - add Springdoc depdendency


<dependency>
    <groupId>org.springdoc</groupId>
    <artifactId>springdoc-openapi-ui</artifactId>

    <version>1.6.11</version>

</dependency>

application.properties - add Springdoc configuration properties


springdoc.packages-to-scan=dev.michaellamb.demo
springdoc.paths-to-match=/api/**
springdoc.swagger-ui.path=/swagger-ui.html
springdoc.swagger-ui.enabled=true

Springdoc Conclusion

Springdoc is a bit simpler in configuration than Springfox, relying primarily on application.properties to determine which packages to scan to document HTTP API routes for the app and without needing to override any Spring Beans to serve the frontend.

MILE MARKER 3

✔️ Springfox integration

✔️ Springdoc integration

Great job! 🎉

You have a Spring Boot app ready to start developing an auto-documented HTTP API.


Authored by Michael Lamb.
Published on 15 September 2022.
Category: Spring


Trunk Based Development & More


This overview of trunk based development was created for the Customer Applications team at C Spire. The information presented represents no proprietary systems or data, and this content uses trunkbaseddevelopment.com as a primary source. The presentation was recorded using Soapbox by Wistia.

Bytes & Bites 2022

Make connections. Make waves.

Birmingham’s premier IT event is back. And it means business. Network with the brightest IT professionals and learn about the latest solutions from industry leaders at C Spire Business’s annual event.

bytes & bites splash

10 AM - 2 PM 9.22.22 | Avondale Brewing Co., Birmingham, AL

Register Now


Authored by Michael Lamb.
Published on 07 September 2022.
Tags: feature


Redis Hackathon Submission


I participated in a Redis Hackathon hosted on Dev.to which required use of the Redis Stack. Anyone familiar with Redis knows it for its primary use case as a cache, with popular adoption as a primary database because of its ease-of-use and high developer happiness as part of the ecosystem’s DX metric.

The hackathon started at the beginning of August but I started late and had to balance free time against work time. The submission deadline was August 29 at 7 PM. Though I didn’t have a finalized submission, just for participating I’ve gotten a $500 credit for Redis Stack!

Redis Stack

The Redis Stack is a distributed system! Redis has multiple projects, meaning multiple parts of these applications can run in a distributed system to provide a single endpoint for a full-featured cache. Redis means Remote Dictionary server, which is what they call the initial redis app which is historically compared to memcached.

Redis Stack is made up of several components, licensed as follows:

Redis Stack Server, which combines open source Redis with RediSearch, RedisJSON, RedisGraph, RedisTimeSeries, and RedisBloom, is licensed under the Redis Source Available License (RSAL).

RedisInsight is licensed under the Server Side Public License (SSPL).

Using these combined systems, I made a microservice app which enabled me to create an endpoint to easily store some data for the michaellamb.dev Discord bot. The project I came up with involved integrating Midjourney image generation and a frontend.

The progress I did make

The following sections will be dated entries with commits SHAs and descriptions of the changes.

August 17

1 commit

This is just the basic initialization of the app. It builds and runs. Swagger is available.

August 20

1 commit

message: creates example People repository

I’m following along with the Stack Spring tutorial here to implement some basic functionality. This includes using the skeleton app repo as a reference.

Progress here includes connecting to the Redis Stack. Of course, the password has been changed since this is open source. A future commit will rename the application.properties file to indicate it is an example only, after another commit which adds an entry for application.properties in .gitignore.

August 22

3 commits

message: ignore application.properties

message: Update .gitignore

message: Rename application.properties to last-application.properties

This does the things I said in the last description.

August 23

message: migrate to springdoc

Springfox doesn’t support something in Spring 2.7.0 so I migrated the project to Springdoc.

message: replaced import

Fixed an erroneous import in the Person domain class.

message: implement RedisDocumentRepository operations

This adds functionality around the Person objects using RedisDocumentRepository to generate boilerplate code. We can easily return an Iterable<Person> with whatever data points we can imagine because of the power of Redis. The OM library gives us the ability to stub basic methods. We can use these to query Redis for data.

message: add controller operations

This exposes the functionality of the PeopleRepository as an API.

August 24

message: refactor Person

These chisel down some of the fields on the Person class

message: remove loadTestData CommandLineRunner

This is tutorial code and should be removed before further development.

message: fix build

I’m not perfect.

Reflection

I got a good deal of exposure to Redis OM Spring and more experience with RedisInight, the GUI used to inspect Redis databases. I ran into issues with the meta-model generation, I’m not sure if that was because VS Code doesn’t know about meta-modeling or if I was missing a Maven compilation step. Overall, Redis OM Spring seems like it’s headed in a good direction!

My code is not production ready but it’s progress.

Music Corner


Authored by Michael Lamb.
Published on 30 August 2022.


Spring Boot App as a Service


Docker as a deployment strategy can have its shortcomings. One shortcoming I experienced recently was a breakdown in being able to make requests and receive responses from other michaellamb.dev apps and the Spring Boot demo app.

Instead of fighting with Docker (a tool I’m less familiar with) I opted to install the Spring Boot application as a service on a single node. This process could be automated using a CI/CD strategy and I may implement something using GitHub Actions in the future, but it is a more involved process than pulling a Docker image and running it as a container.

Baeldung wrote an article I used as a guide for installing the Spring Boot demo app as a service on Linux.

Maven Configuration

The first step is to enable the executable flag in the spring-boot-maven-plugin referenced in pom.xml


<configuration>
    <executable>true</executable>
</configuration>

See this change in the linked commit: update pom

Build

The second step is to copy the source code to the node and package it for deployment.


./mvwn clean package

It may be necessary to change directory permissions to allow the app to read and write using the file system.

System V Init

Using the traditional System V init, we create a symbolic link that we can use to reference as a service.


sudo ln -s /home/michael/demo/target/demo-0.1.0.jar /etc/init.d/demo

This link would need to be updated any time the jar is renamed

The app needs to be enabled by the system using the following command:


sudo systemctl enable demo

Once the system knows the app is available as a service, the service can be started.


sudo service demo start

Other commands are available using the standard service script: stop, restart, and status. Moreover, logs can be viewed under var/log/demo.log.


Authored by Michael Lamb.
Published on 17 August 2022.
Category: Spring



About michaellamb.dev

Michael Lamb is a software engineer working at C Spire. If you have a blog-specific inquiry please create a new issue on GitHub. Feel free to fork this blog and build your own!

Get to know who I am in my first post Hello, World!

© Copyright 2021-2025
Michael Lamb Blog