Posted on Leave a comment

From Coder to Creator: How AI Will Revolutionize My Workflow in 2024!

close up of text on black background

Introduction

In the ever-evolving landscape of software development, the journey from coder to creator has taken on new dimensions with the advent of artificial intelligence (AI). As a developer immersed in this rapidly changing field, I’ve witnessed firsthand the transformative power of AI in revolutionizing traditional coding workflows. In 2024, I find myself at the precipice of a paradigm shift, embracing AI as a pivotal tool to streamline my development process and unlock new realms of creativity.

The traditional approach to coding has long been characterized by hours of manual labor, meticulously crafting lines of code to bring ideas to life. While this method has yielded remarkable innovations, it’s also rife with challenges: time constraints, repetitive tasks, and the constant battle against burnout. However, with the rise of AI-driven automation, a new era of possibility has emerged—one where developers can transition from mere coders to true creators, empowered by the capabilities of intelligent machines.

In this blog post, I invite you to join me on a journey into the heart of this transformation. We’ll explore how AI is reshaping the landscape of software development, revolutionizing workflows, and redefining the role of the modern developer. From automated code generation to AI-powered documentation and marketing, we’ll delve into the myriad ways in which AI is becoming an indispensable ally in the quest for innovation.

So, fasten your seatbelts and prepare to embark on a journey into the future of coding. Together, we’ll uncover the untapped potential of AI and discover how it’s paving the way for a new breed of creators in 2024 and beyond.

The Current State of Coding

Traditional Coding Landscape:

In the realm of software development, the foundation has long rested on the meticulous craftsmanship of code. Developers, the architects of digital innovation, have traditionally embarked on a journey of manual coding, sculpting intricate lines of logic to breathe life into their ideas.

Challenges Inherent in Manual Coding:

While this artisanal approach has led to remarkable technological feats, it is not without its challenges. The time-intensive nature of manual coding poses a significant hurdle. Developers often grapple with repetitive tasks, such as the creation of boilerplate code and exhaustive documentation. The linear progression of coding, while effective, can inadvertently stifle creativity, limiting developers to the constraints of their knowledge and experience.

The Conundrum of Productivity and Creativity:

In the contemporary landscape, where speed and innovation are paramount, the traditional coding paradigm faces a conundrum. The time and effort invested in manual coding can become a hindrance to the demand for increased productivity. The dichotomy between meeting tight deadlines and fostering creativity becomes more apparent as developers navigate through complex coding processes. This prompts a critical examination of the sustainability of the conventional approach.

Listen To Some Hacker Music While You Code

Follow me on Spotify I make Tech Trap music

Introducing AI Prototyping

Defining AI Prototyping:

Enter AI prototyping, the harbinger of a new era in software development. AI prototyping harnesses the power of artificial intelligence to streamline and enhance the development process. At its core, AI prototyping automates various aspects of software creation, from generating code snippets to crafting comprehensive documentation and even assisting in marketing endeavors.

The Multifaceted Role of AI Agents:

AI agents, equipped with machine learning algorithms and natural language processing capabilities, serve as invaluable companions in the developer’s toolkit. They possess the ability to analyze vast datasets, decipher complex patterns, and generate tailored solutions to meet specific requirements. Through continuous learning and adaptation, these agents evolve alongside developers, becoming indispensable collaborators in pursuing innovation.

Unveiling the Benefits of AI Prototyping:

The adoption of AI prototyping heralds a plethora of benefits for developers. Firstly, it significantly enhances efficiency by automating routine tasks, thereby freeing up valuable time and resources. Moreover, AI-driven solutions boast unparalleled accuracy and reliability, minimizing the occurrence of errors and enhancing the overall quality of the development process. Furthermore, AI prototyping empowers developers to explore new realms of creativity, unencumbered by the constraints of manual labor. By seamlessly integrating AI into their workflows, developers can unleash their full potential as creators, envisioning and realizing groundbreaking innovations with unprecedented ease.

My Journey with AI in 2024

Embracing AI Integration:

In my journey as a developer in 2024, integrating AI into my workflow has been nothing short of transformative. Recognizing the potential of AI prototyping to revolutionize traditional coding practices, I embarked on a journey of exploration and experimentation. Through careful evaluation of available AI tools and platforms, I identified solutions that seamlessly complemented my development process, paving the way for enhanced productivity and innovation.

Leveraging AI Tools and Platforms:

From automated code generation to AI-driven documentation and marketing assistance, I embraced a diverse array of AI tools and platforms. These intelligent companions proved instrumental in streamlining various facets of my development workflow, allowing me to allocate more time and energy toward strategic problem-solving and creative imagination. By leveraging AI to tackle repetitive tasks and streamline workflows, I unlocked newfound levels of efficiency and agility in my development endeavors.

Navigating Successes and Challenges:

Throughout my journey with AI in 2024, I encountered a spectrum of successes and challenges. While the integration of AI yielded tangible benefits in terms of productivity and innovation, it also presented its fair share of obstacles. Adapting to new technologies and methodologies required patience and perseverance, as I navigated the intricacies of AI-driven development. However, through continuous experimentation and iteration, I overcame these challenges and emerged with a deeper appreciation for the transformative power of AI in software development.

The Impact on Creativity and Innovation

Empowering Creativity through AI Integration:

The infusion of AI into my development journey has been a revelation, sparking a renaissance of creativity and innovation. By leveraging AI to automate mundane tasks, I’ve been liberated to channel my creative energies into ideation and exploration. Freed from the constraints of repetitive coding and documentation, I’ve discovered newfound avenues for experimentation and invention. This symbiotic relationship between human ingenuity and AI-driven automation has fostered a dynamic ecosystem of creativity, where bold ideas flourish and innovation thrives.

Cultivating a Culture of Innovation:

At the organizational level, AI integration has catalyzed a cultural shift towards innovation and collaboration. By democratizing access to advanced AI tools and fostering a culture of experimentation, organizations can empower their teams to push the boundaries of what’s possible. Through cross-functional collaboration and iterative prototyping, developers can harness the power of AI to transform abstract concepts into tangible realities. This collaborative ethos fuels a virtuous cycle of innovation, where every idea is nurtured, refined, and ultimately brought to fruition with unprecedented speed and precision.

Realizing Visionary Ideas with AI Prototyping:

AI prototyping stands as a beacon of possibility, enabling developers to transform visionary concepts into tangible solutions with unparalleled efficiency. Through rapid prototyping and iterative refinement, developers can explore a multitude of possibilities, pushing the boundaries of innovation with each iteration. Whether it’s developing groundbreaking software applications or pioneering disruptive technologies, AI prototyping catalyzes realizing bold ideas and driving meaningful change. With AI as a trusted ally in the creative process, the only limit to innovation is the boundless imagination of the developer.

Overcoming Skepticism and Challenges

Addressing Common Concerns:

The integration of AI into the development landscape is not without its skeptics and naysayers. Common concerns, ranging from the perceived complexity of AI implementation to apprehensions about job displacement, warrant careful consideration. However, my experience has shown that understanding and addressing these concerns head-on is pivotal. Through transparent communication and education, the potential of AI becomes more apparent, demystifying misconceptions and fostering a more inclusive and informed approach.

Strategies for Maximizing AI Benefits:

Navigating the challenges posed by AI integration requires a strategic mindset. From selecting the right AI tools to fostering a culture of continuous learning, implementing robust strategies is essential. Encouraging collaboration between AI systems and human developers, rather than viewing them as adversaries, enhances the collective potential. Establishing clear guidelines for AI implementation, ensuring data privacy, and prioritizing ethical considerations are foundational elements in maximizing the benefits while mitigating challenges.

Guidance for Developers Delving into AI:

For developers contemplating the leap into AI-driven workflows, guidance is paramount. Offering training programs, mentorship initiatives, and access to resources facilitates a smoother transition. Acknowledging the learning curve and providing support structures can empower developers to embrace the possibilities presented by AI, transforming skepticism into enthusiasm and challenges into opportunities for growth.

Looking Ahead: The Future of AI in Software Development

Evolving Trends and Advancements:

As we gaze into the future, the trajectory of AI in software development promises to be nothing short of revolutionary. Emerging trends such as federated learning, generative adversarial networks (GANs), and reinforcement learning are poised to redefine the boundaries of what’s possible. These advancements, coupled with the democratization of AI tools and platforms, herald a new era of innovation and disruption in the software development landscape.

Envisioning AI’s Continued Impact:

Looking ahead, the influence of AI in software development will continue to permeate every facet of the development lifecycle. From accelerating prototyping and enhancing user experiences to optimizing performance and facilitating autonomous decision-making, AI will play an increasingly pivotal role. Moreover, the symbiotic relationship between human creativity and AI-driven automation will drive unprecedented levels of innovation, empowering developers to realize their boldest visions.

Call to Embrace AI-Driven Innovation:

As we stand on the cusp of this transformative journey, the call to embrace AI-driven innovation grows louder. By embracing AI as a catalyst for creativity and a tool for empowerment, developers can unlock boundless possibilities and chart a course toward a future limited only by imagination. Together, let us embrace the transformative power of AI and embark on a journey of innovation, collaboration, and limitless potential.

Conclusion

In conclusion, the transition from coder to creator in 2024 is not merely a shift in perspective but a seismic evolution in the software development paradigm. Through the integration of AI prototyping, developers are empowered to transcend the constraints of traditional coding, unleashing their full creative potential and redefining the boundaries of innovation. As we navigate this exhilarating journey together, let us embrace the transformative power of AI and embark on a path toward a future where creativity knows no bounds.

Thank you for joining me on this exploration of how AI will revolutionize my workflow in 2024. Here’s to a future fueled by innovation, collaboration, and the limitless possibilities of AI.

Follow Me On Social Media

Follow Me On Youtube!

Follow my YouTube account

Get Your Next Domain Cheap & Support The Channel

I use Namecheap for all of my domains! Whenever I need a cheap solution for a proof-of-concept project I grab a domain name for as little as $1! When you sign up and buy your first domain with Namecheap I get a commission, it’s a great way to get a quality service and support this platform!

Get Your Next Domain Cheap
CLICK HERE

Become A Sponsor

Open-source work is free to use but it is not free to develop. If you enjoy my content and would like to see more please consider becoming a sponsor on Github or Patreon! Not only do you support me but you are funding tech programs for at risk youth in Louisville, Kentucky.

Join The Newsletter

By joining the newsletter, you get first access to all of my blogs, events, and other brand-related content delivered directly to your inbox. It’s 100% free and you can opt out at any time!

Check The Shop

You can also consider visiting the official #CodeLife shop! I have my own clothing/accessory line for techies as well as courses designed by me covering a range of software engineering topics.

Posted on Leave a comment

Exploring the Difference Between Artificial Life and Biological Life in AI Ethics

Introduction

AI ethics is a complex and thought-provoking field that raises important questions about the impact and boundaries of artificial intelligence. One particular topic of interest is the distinction between artificial life and biological life. In this blog post, we will delve into this subject, exploring the characteristics that set artificial life apart from biological life and the ethical considerations that arise from this distinction.

Defining Artificial Life and Biological Life

Artificial life refers to life forms that are created or simulated by artificial intelligence or other human-made systems. These life forms are often based on programmed instructions or algorithms, allowing them to exhibit behavior and adapt to their environment. On the other hand, biological life refers to life forms that exist naturally and evolve through biological processes such as reproduction and genetic inheritance.

Origins and Replication

Artificial life is brought into existence through human intervention or design. It is the result of intentional programming or simulation. In contrast, biological life originates through natural processes, with life forms arising from the reproduction of existing organisms. Biological life has a long history of evolution and adaptation, while artificial life is born from deliberate human action.

Autonomy and Consciousness

Autonomy and consciousness are fundamental aspects of life that differentiate artificial life from biological life. While artificial life exhibits a certain level of autonomy and decision-making capabilities based on programmed instructions or learning algorithms, current AI systems have limitations that prevent them from achieving true autonomy or consciousness.

Artificial life possesses a degree of autonomy that allows it to process information, make decisions, and exhibit behavior based on its programming. For example, autonomous vehicles use AI algorithms to navigate roads, interpret traffic signals, and respond to various driving situations. However, their autonomy is bounded by the predefined rules and algorithms set by human programmers.

Consciousness, on the other hand, refers to subjective awareness and self-perception. It involves the ability to have experiences, emotions, and a sense of self. While artificial life may simulate certain aspects of consciousness, such as recognizing objects or engaging in natural language processing, it falls short of possessing true subjective consciousness. For example, a ChatGPT Discord bot is not going to be conscious.

Biological life, in contrast, exhibits a remarkable degree of autonomy and consciousness. Living organisms have intricate nervous systems that allow for complex cognitive processes and subjective experiences. Humans, for instance, have self-awareness, introspection, and the capacity for introspective thought. We possess a rich inner world of thoughts, emotions, and sensations that contribute to our conscious experience.

The distinction between artificial life and biological life becomes apparent when we consider the limitations of AI systems in achieving true autonomy and consciousness. AI algorithms are designed to process information and make decisions based on predetermined rules or patterns, but they lack the deep and multi-faceted awareness inherent in biological organisms.

As AI research progresses, there are ongoing debates about the possibility of creating artificial life forms with consciousness. Some argue that as AI becomes more sophisticated and capable of complex learning and adaptation, it may eventually achieve a level of consciousness comparable to biological beings. Others contend that consciousness is not solely a product of computation but involves biological, embodied, and experiential aspects that cannot be replicated by purely artificial means.

Exploring the boundaries of autonomy and consciousness in artificial life raises profound philosophical and ethical questions. It prompts us to consider the nature of consciousness, the implications of creating conscious artificial entities, and the ethical responsibilities associated with their development and treatment.

Adaptation and Evolution

Adaptation and evolution are key processes that distinguish biological life from artificial life. While artificial life can be programmed to adapt to changing environments and display evolutionary-like behavior, its adaptation is limited to the scope of its programming and lacks the dynamic and unpredictable nature of biological evolution.

Artificial life is designed to adapt to specific conditions or challenges within the parameters set by its creators. For example, machine learning algorithms can optimize their performance based on feedback and data, allowing AI systems to improve their accuracy and efficiency over time. Genetic algorithms, another example of artificial life, employ a process of mutation and selection to optimize solutions to specific problems.

However, the adaptation of artificial life is constrained by the preconceived rules, algorithms, and objectives imposed upon it. It lacks the inherent capacity for open-ended exploration and innovation that characterizes biological evolution. Artificial life forms cannot undergo the kind of continuous and unpredictable changes that lead to the emergence of new species or the development of novel traits observed in the natural world.

In contrast, biological life forms undergo adaptation and evolution through a combination of genetic variation, natural selection, and environmental factors. Through genetic recombination and mutation, organisms develop unique genetic traits that provide advantages or disadvantages in their specific environments. These variations are then subjected to the process of natural selection, where individuals with beneficial traits are more likely to survive and reproduce, passing those advantageous traits to future generations.

The dynamic nature of biological evolution allows for the emergence of new species and the continuous diversification of life forms. The interplay between genetic variation, natural selection, and environmental pressures leads to the incredible biodiversity and complexity observed in the natural world.

The distinction between the adaptation and evolution of artificial life and biological life has ethical implications. While artificial life can be designed to serve specific purposes or solve particular problems, the unintended consequences and potential limitations of these design choices must be carefully considered. Artificial life can never fully replicate the intricate and nuanced processes of biological evolution, which have shaped ecosystems over millions of years.

Moreover, the responsible development and deployment of artificial life require careful ethical considerations. The intentional creation and manipulation of life forms raise questions about the potential impacts on existing ecosystems, the risks of unintended consequences, and the balance between human agency and the preservation of natural systems.

By studying and understanding the mechanisms of biological adaptation and evolution, we can gain insights into the complexity and resilience of natural life. This understanding can inform the responsible design and implementation of artificial life, ensuring that it aligns with ethical principles and avoids undue harm or disruption.

Listen To Some Hacker Music While You Code

Follow me on Spotify I make Tech Trap music

Ethical Considerations

The distinction between artificial life and biological life carries significant ethical implications. The creation and treatment of artificial life raise profound questions of responsibility and moral agency. Consider the following examples:

  1. Rights and Protections: Should artificial life forms be granted rights and protections? As we create intelligent and autonomous artificial entities, it becomes crucial to examine whether they should be afforded certain rights and ethical considerations. This includes questions about their well-being, freedom from harm, and the potential for exploitation or abuse.
  2. Consequences and Implications: What are the potential consequences and implications of creating artificial life? Introducing artificial life forms into society can have far-reaching effects. We need to assess the impact on existing ecosystems, potential disruptions to the balance of nature, and the ethical implications of creating life with specific functions or purposes. Additionally, considering the potential misuse or unintended consequences of artificial life raises concerns about the responsible development and use of AI.

These ethical considerations urge us to reflect on the ethical dimensions of our actions as creators and the long-term implications of introducing artificial life forms into our world.

Philosophical and Metaphysical Perspectives

Beyond the realm of ethics, the distinction between artificial life and biological life leads us into philosophical and metaphysical territories. Philosophical viewpoints on the nature of life and consciousness, such as materialism, dualism, and panpsychism, offer different perspectives on the possibility of artificial life and its relationship to biological life. Exploring these perspectives encourages deep reflection on the fundamental nature of life itself.

Conclusion

Understanding the difference between artificial life and biological life is crucial for navigating the ethical implications of artificial intelligence. As we continue to push the boundaries of AI, it is important to consider the limitations and unique qualities of artificial life compared to the intricate tapestry of biological life. By engaging in thoughtful discourse and ethical reflection, we can shape a future where AI is developed responsibly and in alignment with our values.

We hope this blog post has shed light on the distinction between artificial life and biological life and the ethical considerations that arise from it. We encourage you to continue exploring this fascinating topic and to share your thoughts on the matter.

Thank you for reading!

Follow Me On Social Media

Follow Me On Youtube!

Follow my YouTube account

Get Your Next Domain Cheap & Support The Channel

I use Namecheap for all of my domains! Whenever I need a cheap solution for a proof-of-concept project I grab a domain name for as little as $1! When you sign up and buy your first domain with Namecheap I get a commission, it’s a great way to get a quality service and support this platform!

Get Your Next Domain Cheap
CLICK HERE

Become A Sponsor

Open-source work is free to use but it is not free to develop. If you enjoy my content and would like to see more please consider becoming a sponsor on Github or Patreon! Not only do you support me but you are funding tech programs for at risk youth in Louisville, Kentucky.

Join The Newsletter

By joining the newsletter, you get first access to all of my blogs, events, and other brand-related content delivered directly to your inbox. It’s 100% free and you can opt out at any time!

Check The Shop

You can also consider visiting the official #CodeLife shop! I have my own clothing/accessory line for techies as well as courses designed by me covering a range of software engineering topics.

Posted on 4 Comments

Moving The ChatGPT Laravel API Into Composer – Creating My First Laravel 10 Package

I Created A Laravel 10 OpenAI ChatGPT Composer Package

In my last tutorial, I created a Laravel site that featured an OpenAI ChatGPT API. This was very fun to create and while I was thinking of ways to improve it, the idea dawned upon me to make it a Composer package and share it with the world. This took less time than I expected honestly and I already have integrated my package into a few applications (it feels good to composer require your own shit!).

What’s The Benefit?

1. Reusability

I know for a fact that I will be using OpenAI in a majority of my projects going forward, instead of rewriting functionality over and over and over, I’m going to package up the functionality that I know I will need every time.

2. Modularity

Breaking my code into modules allows me to think about my applications from a high-level view. I call it Lego Theory; all of my modules are legos and my app is the lego castle I’m building.

3. Discoverability

Publishing packages directly helps my brand via discoverability. If I produce high-quality, in-demand open-source software then more people will use it, and the more people that use it then the more people know who I am. This helps me when I am doing things like applying for contracts or conference talks.

Creating The Code

Scaffold From Spatie

The wonderful engineers at Spatie have created a package skeleton for Laravel and is what I used as a starting point for my Laravel package. If you are using GitHub you can use this repo as a template or if using the command line enter the following command:

git clone git@github.com:spatie/package-skeleton-laravel.git laravel-open-api

There is a configure.php script that will set all of the placeholder values with the values you provide for your package

php ./configure.php

Now we can get to the nitty gritty.

Listen To Some Hacker Music While You Code

Follow me on Spotify I make Tech Trap music

The Front-Facing Object

After running the configure script you will have a main object that will be renamed, in my case it was called LaravelOpenaiApi.php and it looks like this:

<?php

namespace Mastashake\LaravelOpenaiApi;

use OpenAI\Laravel\Facades\OpenAI;
use Mastashake\LaravelOpenaiApi\Models\Prompt;

class LaravelOpenaiApi
{
  function generateResult(string $type, array $data): Prompt {
    switch ($type) {
      case 'text':
      return $this->generateText($data);
      case 'image':
      return $this->generateImage($data);
    }
  }

  function generateText($data) {
    $result = OpenAI::completions()->create($data);
    return $this->savePrompt($result, $data);
  }

  function generateImage($data) {
    $result = OpenAI::images()->create($data);
    return $this->savePrompt($result, $data);
  }

  private function savePrompt($result, $data): Prompt {
    $prompt = new Prompt([
      'prompt_text' => $data['prompt'],
      'data' => $result
    ]);
    return $prompt;
  }
}

It can generate text and images and save the prompts, it looks at the type provided to determine what resource to generate. It’s all powered by the OpenAI Laravel Facade.

The Migration

The default migration will be edited to use the prompts migration from the Laravel API tutorial, open it up and replace the contents with the following:

<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('prompts', function (Blueprint $table) {
            $table->id();
            $table->string('prompt_text');
            $table->json('data');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('prompts');
    }
};

The Model

Create a file called src/Models/Prompt.php and copy the old Prompt code inside

<?php

namespace Mastashake\LaravelOpenaiApi\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Prompt extends Model
{
    use HasFactory;

    protected $guarded = [];
    protected $casts = [
      'data' => 'array'
    ];
}

The Controller

For the controllers, we have to create a BaseController and a PromptController. Create a file called src/Http/Controllers/BaseController.php

<?php

namespace Mastashake\LaravelOpenaiApi\Http\Controllers;

use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;

class Controller extends BaseController
{
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
}

Now we will create our PromptController and inherit from the BaseController

<?php

namespace Mastashake\LaravelOpenaiApi\Http\Controllers;
use Illuminate\Http\Request;
use Mastashake\LaravelOpenaiApi\LaravelOpenaiApi;
class PromptController extends Controller
{
    //
    function generateResult(Request $request) {

      $ai = new LaravelOpenaiApi();
      $prompt = $ai->generateResult($request->type, $request->except(['type']));
      return response()->json([
        'data' => $prompt
      ]);
    }
}

OpenAI and ChatGPT can generate multiple types of responses, so we want the user to be able to choose which type of resource they want to generate then pass on that data to the underlying engine.

The Route

Create a routes/api.php file to store our api route:

<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "api" middleware group. Make something great!
|
*/
Route::group(['prefix' => '/api'], function(){
  if(config('openai.use_sanctum') == true){
    Route::middleware(['api','auth:sanctum'])->post(config('openai.api_url'),'Mastashake\LaravelOpenaiApi\Http\Controllers\PromptController@generateResult');
  } else {
    Route::post(config('openai.api_url'),'Mastashake\LaravelOpenaiApi\Http\Controllers\PromptController@generateResult');
  }
});

Depending on the values in the config file (we will get to it in a second calm down) the user may want to use Laravel Sanctum for token-based authenticated requests. In fact, I highly suggest you do if you don’t want your token usage abused, but for development and testing, I suppose it’s fine. I made it this way to make it more robust and extensible.

The Config File

Create a file called config/openai.php that will hold the default config values for the package. This will be published into any application that you install this package in:

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | OpenAI API Key and Organization
    |--------------------------------------------------------------------------
    |
    | Here you may specify your OpenAI API Key and organization. This will be
    | used to authenticate with the OpenAI API - you can find your API key
    | and organization on your OpenAI dashboard, at https://openai.com.
    */

    'api_key' => env('OPENAI_API_KEY'),
    'organization' => env('OPENAI_ORGANIZATION'),
    'api_url' => env('OPENAI_API_URL') !== null ? env('OPENAI_API_URL') : '/generate-result',
    'use_sanctum' => env('OPENAI_USE_SANCTUM') !== null ? env('OPENAI_USE_SANCTUM') == true : false

];
  • The api_key variable is the OpenAI API key
  • The organization variable is the OpenAI organization if one exists
  • The api_url variable is the user-defined URL for the API routes, if one is not defined then use /api/generate-result
    • The use_sanctum variable defines if the API will use auth:sanctum middleware.

The Command

The package includes an artisan command for generating results from the command line. Create a file called src/Commands/LaravelOpenaiApiCommand.php

<?php

namespace Mastashake\LaravelOpenaiApi\Commands;

use Illuminate\Console\Command;
use Mastashake\LaravelOpenaiApi\LaravelOpenaiApi;
class LaravelOpenaiApiCommand extends Command
{
    public $signature = 'laravel-openai-api:generate-result';

    public $description = 'Generate Result';

    public function handle(): int
    {
        $data = [];
        $suffix = null;
        $n = 1;
        $temperature = 1;
        $displayJson = false;
        $max_tokens = 16;
        $type = $this->choice(
            'What are you generating?',
            ['text', 'image'],
            0
        );
        $prompt = $this->ask('Enter the prompt');
        $data['prompt'] = $prompt;

        if($type == 'text') {
          $model = $this->choice(
              'What model do you want to use?',
              ['text-davinci-003', 'text-curie-001', 'text-babbage-001', 'text-ada-001'],
              0
          );
          $data['model'] = $model;
          if ($this->confirm('Do you wish to add a suffix to the generated result?')) {
              //
              $suffix = $this->ask('What is the suffix?');
          }
          $data['suffix'] = $suffix;

          if ($this->confirm('Do you wish to set the max tokens used(defaults to 16)?')) {
            $max_tokens = (int)$this->ask('Max number of tokens to use?');
          }
          $data['max_tokens'] = $max_tokens;

          if ($this->confirm('Change temperature')) {
            $temperature = (float)$this->ask('What is the temperature(0-2)?');
            $data['temperature'] = $temperature;
          }
        }

        if ($this->confirm('Multiple results?')) {
          $n = (int)$this->ask('Number of results?');
          $data['n'] = $n;
        }

        $displayJson = $this->confirm('Display JSON results?');

        $ai = new LaravelOpenaiApi();
        $result = $ai->generateResult($type,$data);

        if ($displayJson) {
          $this->comment($result);
        }
        if($type == 'text') {
          $choices = $result->data['choices'];
          foreach($choices as $choice) {
            $this->comment($choice['text']);
          }
        } else {
          $images = $result->data['data'];
          foreach($images as $image) {
            $this->comment($image['url']);
          }
        }


        return self::SUCCESS;
    }
}

I’m going to add more inputs later, but for now, this is a good starting point to get back data. I tried to make it as verbose as possible, I’m always welcoming PRs if you want to add functionality 🙂

The Service Provider

All Laravel packages must have a service provider, open up the default one in the root directory, in my case it was called LaravelOpenaiApiServiceProvider

<?php

namespace Mastashake\LaravelOpenaiApi;

use Spatie\LaravelPackageTools\Package;
use Spatie\LaravelPackageTools\PackageServiceProvider;
use Mastashake\LaravelOpenaiApi\Commands\LaravelOpenaiApiCommand;
use Spatie\LaravelPackageTools\Commands\InstallCommand;
class LaravelOpenaiApiServiceProvider extends PackageServiceProvider
{
    public function configurePackage(Package $package): void
    {
        /*
         * This class is a Package Service Provider
         *
         * More info: https://github.com/spatie/laravel-package-tools
         */
        $package
            ->name('laravel-openai-api')
            ->hasConfigFile(['openai'])
            ->hasRoute('api')
            ->hasMigration('create_openai_api_table')
            ->hasCommand(LaravelOpenaiApiCommand::class)
            ->hasInstallCommand(function(InstallCommand $command) {
                $command
                    ->publishConfigFile()
                    ->publishMigrations()
                    ->askToRunMigrations()
                    ->copyAndRegisterServiceProviderInApp()
                    ->askToStarRepoOnGitHub('mastashake08/laravel-openai-api');
                  }
                );
    }
}

The name is the name of our package, next we pass in the config file created above. Of course we have to add our API routes and migrations. Lastly, we add our commands.

Testing It In Laravel Project

composer require mastashake08/laravel-openai-api

You can run that command in any Laravel project, I used it in the Laravel API tutorial I did last week. If you runphp artisan route:list and you will see the API is in your project!

Hey look mom it’s my package!!!

Check The Repo!

This is actually my first-ever Composer package! I would love feedback, stars, and PRs that would go a long way. You can check out the repo here on GitHub. Please let me know in the comments if this tutorial was helpful and share on social media.

Follow Me On Social Media

Follow Me On Youtube!

Follow my YouTube account

Get Your Next Domain Cheap & Support The Channel

I use Namecheap for all of my domains! Whenever I need a cheap solution for a proof-of-concept project I grab a domain name for as little as $1! When you sign up and buy your first domain with Namecheap I get a commission, it’s a great way to get a quality service and support this platform!

Get Your Next Domain Cheap
CLICK HERE

Become A Sponsor

Open-source work is free to use but it is not free to develop. If you enjoy my content and would like to see more please consider becoming a sponsor on Github or Patreon! Not only do you support me but you are funding tech programs for at risk youth in Louisville, Kentucky.

Join The Newsletter

By joining the newsletter, you get first access to all of my blogs, events, and other brand-related content delivered directly to your inbox. It’s 100% free and you can opt out at any time!

Check The Shop

You can also consider visiting the official #CodeLife shop! I have my own clothing/accessory line for techies as well as courses designed by me covering a range of software engineering topics.

Posted on Leave a comment

4 Key Software Development Trends for 2023




Software development has become an undeniably significant part of digital transformations, and many changes facilitate this. Research by Laato et al. notes that software development, both as an industry and a profession, has emphasized more on scalable and data-driven solutions.

This is made possible by integrating emerging technologies like automation, machine learning, and cloud computing. There is also the increasing convergence of IT and non-IT industries, as sectors like healthcare that are traditionally not software-intensive have shifted from manual to digitized processes.

All of these changes and drivers have implications for the key software development trends in the year 2023, from new programming tools and platforms to the growth of software companies.


1. Decline in demand for no or low-code platforms



Due to a shortage of coding talent and the need to democratize software development, no and low-code platforms have proliferated over the years. These democratized solutions that can be used for day-to-day operations include website builders like Wix, ecommerce platforms like SquareSpace, and design tools like Canva.

However, more and more developers are also starting to realize the limitations of no or low coding. There are unique security challenges that crop up when organizations adopt these easy-to-use platforms without explicit approval from IT, leading to the creation of unsafe applications and oversight in access controls. No and low-code platforms also have a narrow range of use cases, thereby affecting the flexibility and customization options for developers and business users.


2. Tools for speech recognition in web applications



Aside from improving the efficiency of organizations’ day-to-day operations, software development can also be harnessed to increase the usability and accessibility of applications. A previous look at the SpeechKit package for speech recognition and synthesis has shown that the JavaScript Web Speech API makes it possible for web apps to work with voice data.

Web Speech API simplifies the once-tedious task of coding voice-activated commands and text-to-speech interfaces. With other features, such as the ability to generate SSML from text, developers can also fine-tune the text-to-speech output attributes in terms of pitch, speed, volume, and more. This enhances and personalizes the overall user experience for web applications with speech recognition software.


3. Growth potential for software industry traffic



Despite the demand for software development in various industries, the software industry itself has been facing a decline in website traffic. As indicated by Search Engine Journal’s report on software industry traffic, worldwide monthly visits to the websites of top software companies in the US have decreased by more than 1 billion. Fortunately, despite the decline in numbers, the overall quality of website traffic has increased in terms of visit duration and the number of pages seen per visit.

To fully leverage this potential for growth, software companies have to tailor their digital marketing practices to suit consumer trends and customer journeys. Ayima states that integrating SEO and PPC strategies is a way to increase conversion rates and customer growth while still making significant cost savings. By merging data sources and using PPC data to see which SEO keywords are profitable and must be focused on, companies can optimize their content and investments in the areas that truly matter, therefore reducing wasted spend.


4. AI-assisted security testing



Software testing is a crucial part of the software development process, enabling developers to conduct performance tests and risk management. Among the software testing trends outlined by InfoQ, the emerging technology of artificial intelligence (AI) is particularly useful in security testing. Sophisticated AI algorithms can be deployed to detect cybersecurity threats like phishing attacks. By actively looking for anomalous patterns or behaviors in systems and access controls, AI can create real-time offensive capabilities against potential cyber-attacks.

With the growth of software development as an industry, there comes a set of unique challenges and opportunities, namely the emergence of new roles focused on digital marketing, data analytics, and AI. Nevertheless, it is up to software developers and the industry as a whole to be equipped for these changes so that they stay ahead in the global digital economy.

Follow Me On Social Media

Follow Me On Youtube!

Follow my YouTube account

Get Your Next Domain Cheap & Support The Channel

I use Namecheap for all of my domains! Whenever I need a cheap solution for a proof-of-concept project I grab a domain name for as little as $1! When you sign up and buy your first domain with Namecheap I get a commission, it’s a great way to get a quality service and support this platform!

Get Your Next Domain Cheap
CLICK HERE

Become A Sponsor

Open-source work is free to use but it is not free to develop. If you enjoy my content and would like to see more please consider becoming a sponsor on Github or Patreon! Not only do you support me but you are funding tech programs for at risk youth in Louisville, Kentucky.

Join The Newsletter

By joining the newsletter, you get first access to all of my blogs, events, and other brand-related content delivered directly to your inbox. It’s 100% free and you can opt out at any time!

Check The Shop

You can also consider visiting the official #CodeLife shop! I have my own clothing/accessory line for techies as well as courses designed by me covering a range of software engineering topics.

Posted on Leave a comment

Creating A Laravel ChatGPT API

laravel + chatgpt

What Is ChatGPT?

ChatGPT is a generative AI software created by OpenAI from the official Wikipedia page

ChatGPT (Chat Generative Pre-trained Transformer[2]) is a chatbot developed by OpenAI and launched in November 2022. It is built on top of OpenAI’s GPT-3 family of large language models and has been fine-tuned (an approach to transfer learning) using both supervised and reinforcement learning techniques.

https://en.wikipedia.org/wiki/ChatGPT

Since its launch, it has taken the world by storm. People are losing their minds over the impending AI overlords destroying society and making humanity its slave 😂

Seriously though we are talking BILLIONS of weights across MILLIONS of neurons I geek out every time I think about it. I keep getting asked what my thoughts are on ChatGPT and instead of repeating myself for the 99934394398th time, I decided to write a blog and do a Laravel code tutorial to show developers just HOW EASY it is to use this OpenAI software.

Use Cases For ChatGPT

Asset Generation

With ChatGPT you can generate images This was first made popular with the DALL-E project. AI-generated art is on the rise and there are many opportunities to be had. Images aren’t the end though, with ChatGPT you can generate any asset. Think about how this will affect gaming! You can generate 3D assets, audio assets, texture assets, and more.

Code Generation

In my opinion, this is where ChatGPT shines. The Codex project allows you to use ChatGPT to generate code, and the results are scarily amazing. If you are a solo developer you can leverage the power of artificial intelligence to speed run through proof of concepts. I have seen videos of people programming whole apps with ChatGPT

Text Generation

Using ChatGPT you can generate text. Many companies are integrating ChatGPT to create contextual accurate text responses. One of my favorite integrations of this is the Twitter bot ChatGPTBot. However, some people are scared of this technology such as the Rabbi who used AI to create a sermon. I personally think e-commerce will be dominated by AI-driven product descriptions.

The Sky Is The Limit

Microsoft has already integrated ChatGPT into Bing and Google is working on a rival application called Bard. The beautiful thing about this technology is that it is only limited to our imagination. We don’t even know the full scope of what ChatGPT is capable of. This is a perfect storm for people to get first movers advantage on this gold rush that is coming over the next decade.

How I Plan On Using ChatGPT

Mobisnacks

Download Mobisnacks!

I have integrated ChatGPT into MobiSnacks to create product descriptions for chefs. The chefs can put in keywords and ChatGPT spits out 3 descriptions for the chefs to use as a starting point. The next step is to use ChatGPT to generate contextual ads for the platform and for the chefs as an additional service.

GPT Audiobook

GPT Audiobook logo

I created a proof of concept called GPT Audiobook. It uses ChatGPT to create audiobooks and spits them out as SSML documents for text-to-speech software to read. I’m currently creating an Android and iOS app to go with the web app. In the future, I plan on adding rich structured data snippets to display the books on Google and other search engines. Even the logo for GPT Audiobook was MADE WITH CHATGPT!

The Laravel ChatGPT API

Overview

The Laravel API will be very simple: one route, one model, and one controller. The model will be called Prompt a prompt will have two fields, prompt_text and data. The controller will have one method called generateResult that will use the OpenAI SDK to communicate with ChatGPT and generate the result. Finally, there will be a POST route called /generate-result which saves the model and returns the JSON.

Listen To Some Hacker Music While You Code

Follow me on Spotify I make Tech Trap music

Creating The Application

For this tutorial, I am using a Mac with docker. To start open up the tutorial and create a new Laravel application

curl -s "https://laravel.build/laravel-chat-gpt-api" | bash

Afterward cd into the application and add the OpenAI Laravel package, which will power our ChatGPT logic.

composer require openai-php/laravel

This is the only composer requirement we will need for this tutorial. Now we need to do our configuration for OpenAI.

Configuring The OpenAI SDK

The OpenAI Laravel package comes with some config files that need to be published before we get started coding. In your terminal paste the following command

php artisan vendor:publish --provider="OpenAI\Laravel\ServiceProvider"

This will create a config/openai.php configuration file in your project, which you can modify to your needs using environment variables: You need to retrieve your OpenAI developer key from here and paste it in your .env file.

OPENAI_API_KEY=sk-...

Ok, that’s it for the SDK configuration.

Database & Model

The Prompt model will have a prompt_text field that will hold the text entered by the user. It will also have a data json field that holds the result from OpenAI. Let’s create the model and the migration all in one:

./vendor/bin/sail artisan make:model -m Prompt

Open up the created migration and paste in the following:

<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('prompts', function (Blueprint $table) {
            $table->id();
            $table->string('prompt_text');
            $table->json('data');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('prompts');
    }
};
 

Next open up the Prompt model and paste the following:

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Prompt extends Model
{
    use HasFactory;

    protected $guarded = [];
    protected $casts = [
      'data' => 'array'
    ];
}

Next, let’s move on to creating the controller.

Creating The Controller

Generate the PromptController in the terminal:

 ./vendor/bin/sail artisan make:controller PromptController 

Open it up and let’s create our generateResult function:

<?php

namespace App\Http\Controllers;
use OpenAI\Laravel\Facades\OpenAI;
use App\Models\Prompt;
use Illuminate\Http\Request;

class PromptController extends Controller
{
    //
    function generateResult(Request $request) {

      $result = OpenAI::completions()->create($request->all());
      $prompt = new Prompt([
        'prompt_text' => $request->prompt,
        'data' => $result
      ]);
      return response()->json($prompt);
    }
}

So what’s going on here? We import the OpenAI SDK and we simply pass the $request to the completions API. If you need a reference you can check the OpenAI API reference. We then create a new prompt model pass in the text and pass in the resulting data. The last thing to do is create the route and we are done!

Creating The API Route

Open up the routes/api.php routes file and update it to call the PromptController@generateResult function

<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "api" middleware group. Make something great!
|
*/

Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
    return $request->user();
});

Route::post('/generate-result','App\Http\Controllers\PromptController@generateResult');

Now we are done, make sure you plug in your API key and make a test request! Here is how we can test with cURL:


curl -X POST http://localhost/api/generate-result -H "Content-Type: application/json" --data-binary @- <<DATA
{
  "model": "text-davinci-003",
   "prompt" : "PHP is"
}
DATA

Next Steps

The next step that I want to do with this project is to create it as a Laravel package so developers can put an OpenAI ChatGPT API in their backends easily. Afterward, I would like to add functionality for issuing tokens and possibly even a monetization module powered by Stripe and Laravel Cashier. Please leave comments on this article and let me know what you would like to see and I will build it! You can see the GitHub repository here.

**UPDATE** I Created The Laravel Composer Package

Shortly after writing this tutorial, I went ahead and created a Composer package for the Laravel OpenAI ChatGPT API. If you want to implement this functionality from the tutorial and more then please check it out! I’m actively looking for PRs from fellow developers! I can’t wait to see how you all use and integrate this package into your web applications and business services!

You can install the package using the following command:

composer require mastashake08/laravel-openai-api 

Afterward you can publish the migrations and config files with the following commands:

php artisan vendor:publish --tag="openai-api-migrations"
php artisan migrate
php artisan vendor:publish --tag="openai-api-config"

Finally, start to use it in your code! You can access the object directly, via the included API routes, or with the interactive Artisan CLI command.

Via Code

$laravelOpenaiApi = new Mastashake\LaravelOpenaiApi();
echo $laravelOpenaiApi->generateResult($type, $data);

Via Artisan

php artisan laravel-openai-api:generate-result

Via API

You set the OPENAI_API_URL in the .env file if a value is not set then it defaults to /api/generate-result

/api/generate-result POST {openai_data}

The data object requires a type property that is either set to text or image. Depending on which type then provide the JSON referenced in the OpenAI API Reference

Text Example

{
  "type": "text",
  "prompt": "Rust is",
  "n": 1,
  "model": "text-davinci-003",
  "max_tokens": 16
}

Image Example

{
  "type": "image",
  "prompt": "A cute baby sea otter",
  "n": 1,
  "size": "1024x1024"
}

I’m going to continue to work on both this package and the demo tutorial and will update you all on the progress for sure. Thank you for taking time to read this tutorial, if you found it helpful please leave a comment and a like!

Follow Me On Social Media

Follow Me On Youtube!

Follow my YouTube account

Get Your Next Domain Cheap & Support The Channel

I use Namecheap for all of my domains! Whenever I need a cheap solution for a proof-of-concept project I grab a domain name for as little as $1! When you sign up and buy your first domain with Namecheap I get a commission, it’s a great way to get a quality service and support this platform!

Get Your Next Domain Cheap
CLICK HERE

Become A Sponsor

Open-source work is free to use but it is not free to develop. If you enjoy my content and would like to see more please consider becoming a sponsor on Github or Patreon! Not only do you support me but you are funding tech programs for at risk youth in Louisville, Kentucky.

Join The Newsletter

By joining the newsletter, you get first access to all of my blogs, events, and other brand-related content delivered directly to your inbox. It’s 100% free and you can opt out at any time!

Check The Shop

You can also consider visiting the official #CodeLife shop! I have my own clothing/accessory line for techies as well as courses designed by me covering a range of software engineering topics.

Posted on 2 Comments

SpeechKit: A Javascript Package For The Web Speech API (Speech Synthesis & Speech Recognition)

Speech Recognition & Speech Synthesis In The Browser With Web Speech API

Voice apps are now first-class citizens on the web thanks to the Speech Recognition and the Speech Synthesis interfaces which are a part of the bigger Web Speech API. Taken from the MDN docs

The Web Speech API makes web apps able to handle voice data. There are two components to this API:

  • Speech recognition is accessed via the SpeechRecognition interface, which provides the ability to recognize voice context from an audio input (normally via the device’s default speech recognition service) and respond appropriately. Generally you’ll use the interface’s constructor to create a new SpeechRecognition object, which has a number of event handlers available for detecting when speech is input through the device’s microphone. The SpeechGrammar interface represents a container for a particular set of grammar that your app should recognize. Grammar is defined using JSpeech Grammar Format (JSGF.)
  • Speech synthesis is accessed via the SpeechSynthesis interface, a text-to-speech component that allows programs to read out their text content (normally via the device’s default speech synthesizer.) Different voice types are represented by SpeechSynthesisVoice objects, and different parts of text that you want to be spoken are represented by SpeechSynthesisUtterance objects. You can get these spoken by passing them to the SpeechSynthesis.speak() method.
Brief on Web Speech API from MDN

So basically with the Web Speech API you can work with voice data. You can make your apps speak to its users and you can run commands based on what your user speaks. This opens up a host of opportunities for voice-activated CLIENT-SIDE apps. I love building open-source software, so I decided to create an NPM package to work with the Web Speech API called SpeechKit and I couldn’t wait to share it with you! I suppose this is a continuation of Creating A Voice Powered Note App Using Web Speech

Simplifying The Process With SpeechKit

I decided starting this year I would contribute more to the open-source community and provide packages (primarily Javascript, PHP, and Rust) to the world to use. I use the Web Speech API a lot in my personal projects and so why not make it an NPM package? You can find the source code here.

Listen To Some Hacker Music While You Code

Follow me on Spotify I make Tech Trap music

Features

  • Speak Commands
  • Listen for voice commands
  • Add your own grammar
  • Transcribe words and output as file.
  • Generate SSML from text
npm install @mastashake08/speech-kit

Import

import SpeechKit from '@mastashake08/speech-kit'

Instantiate A New Instance

new SpeechKit(options)

listen()

Start listening for speech recognition.

stopListen()

Stop listening for speech recognition.

speak(text)

Use Speech Synthesis to speak text.

Param Type Description
text string Text to be spoken

getResultList() ⇒ SpeechRecognitionResultList

Get current SpeechRecognition resultsList.

Returns: SpeechRecognitionResultList – – List of Speech Recognition results

getText() ⇒ string

Return text

Returns: string – resultList as text string

getTextAsFile() ⇒ Blob

Return text file with results.

Returns: Blob – transcript

getTextAsJson() ⇒ object

Return text as JSON.

Returns: object – transcript

addGrammarFromUri()

Add grammar to the SpeechGrammarList from a URI.

Params: string uri – URI that contains grammar

addGrammarFromString()

Add grammar to the SpeechGrammarList from a Grammar String.

Params: string grammar – String containing grammar

getGrammarList() ⇒ SpeechGrammarList

Return current SpeechGrammarList.

Returns: SpeechGrammarList – current SpeechGrammarList object

getRecognition() ⇒ SpeechRecognition

Return the urrent SpeechRecognition object.

Returns: SpeechRecognition – current SpeechRecognition object

getSynth() ⇒ SpeechSynthesis

Return the current Speech Synthesis object.

Returns: SpeechSynthesis – current instance of Speech Synthesis object

getVoices() ⇒ Array<SpeechSynthesisVoice>

Return the current voices available to the user.

Returns: Array<SpeechSynthesisVoice> – Array of available Speech Synthesis Voices

setSpeechText()

Set the SpeechSynthesisUtterance object with the text that is meant to be spoken.

Params: string text – Text to be spoken

setSpeechVoice()

Set the SpeechSynthesisVoice object with the desired voice.

Params: SpeechSynthesisVoice voice – Voice to be spoken

getCurrentVoice() ⇒ SpeechSynthesisVoice

Return the current voice being used in the utterance.

Returns: SpeechSynthesisVoice – current voice

Example Application

In this example vue.js application there will be a text box with three buttons underneath, when the user clicks the listen button, SpeechKit will start listening to the user. As speech is detected, the text will appear in the text box. The first button under the textbox will tell the browser to share the page, the second button will speak the text in the textbox while the third button will control recording.

Home page from the github.io page

I created this in Vue.js and (for sake of time and laziness) I reused all of the defaul components and rewrote the HelloWorld component. So let’s get started by creating a new Vue application.

Creating The Application

Open up your terminal and input the following command to create a new vue application:

vue create speech-kit-demo

It doesn’t really matter what settings you choose, after you get that squared away, now it is time to add our dependecy.

Installing SpeechKit

Still inside your terminal we will add the SpeechKit dependency to our package.json file with the following command:

npm install @mastashake08/speech-kit

Now with that out of the way we can begin creating our component functionality.

Editing HelloWorld.vue

Open up your HelloWorld.vue file in your components/ folder and change it to look like this:

<template>
  <div class="hello">
    <h1>{{ msg }}</h1>
    <p>
      Simple demo to demonstrate the Web Speech API using the
      <a href="https://github.com/@mastashake08/speech-kit" target="_blank" rel="noopener">SpeechKit npm package</a>!
    </p>
    <textarea v-model="voiceText"/>
    <ul>
      <button @click="share" >Share</button>
      <button @click="speak">Speak</button>
      <button @click="listen" v-if="!isListen">Listen</button>
      <button @click="stopListen" v-else>Stop Listen</button>
    </ul>
  </div>
</template>

<script>
import SpeechKit from '@mastashake08/speech-kit'
export default {
  name: 'HelloWorld',
  props: {
    msg: String
  },
  mounted () {
    this.sk = new SpeechKit({rate: 0.85})
    document.addEventListener('onspeechkitresult', (e) => this.getText(e))
  },
  data () {
    return {
      voiceText: 'SPEAK ME',
      sk: {},
      isListen: false
    }
  },
  methods: {
    share () {
      const text = `Check out the SpeechKit Demo and speak this text! ${this.voiceText} ${document.URL}`
      try {
        if (!navigator.canShare) {
          this.clipBoard(text)
        } else {
          navigator.share({
            text: text,
            url: document.URL
          })
        }
      } catch (e) {
        this.clipBoard(text)
      }
    },
    async clipBoard (text) {
      const type = "text/plain";
      const blob = new Blob([text], { type });

      const data = [new window.ClipboardItem({ [type]: blob })];
      await navigator.clipboard.write(data)
      alert ('Text copied to clipboard')
    },
    speak () {
      this.sk.speak(this.voiceText)
    },
    listen () {
      this.sk.listen()
      this.isListen = !this.isListen
    },
    stopListen () {
      this.sk.stopListen()
      this.isListen = !this.isListen
    },
    getText (evt) {
      this.voiceText = evt.detail.transcript
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
  margin: 40px 0 0;
}
ul {
  list-style-type: none;
  padding: 0;
}
li {
  display: inline-block;
  margin: 0 10px;
}
a {
  color: #42b983;
}
</style>

As you can see the almost all of the functionality is being offloaded to the SpeechKit library. You can see a live version of this at https://mastashake08.github.io/speech-kit-demo/ . In the mount() method we initialize our SpeechKit instance and add an event listener on the document to listen for the onspeechkitresult event emitted from the SpeechKit class which dispatches everytime there is an availble transcript from speech recognition. The listen() and stopListen() functions simply call the SpeechKit functions and toggle a boolean indicating recording is in process. Finally the share() function uses the Web Share API to share the URL if available, otherwise it defaults to using the Clipboard API and copying the text to the user’s clipboard for manual sharing.

Want To See More Tutorials?

Join my newsletter and get weekly updates from my blog delivered straight to your inbox.

Check The Shop!

Consider purchasing an item from the #CodeLife shop, all proceeds go towards our coding initiatives.

Follow Me On Social Media

Follow Me On Youtube!

Follow my YouTube account

Get Your Next Domain Cheap & Support The Channel

I use Namecheap for all of my domains! Whenever I need a cheap solution for a proof-of-concept project I grab a domain name for as little as $1! When you sign up and buy your first domain with Namecheap I get a commission, it’s a great way to get a quality service and support this platform!

Get Your Next Domain Cheap
CLICK HERE

Become A Sponsor

Open-source work is free to use but it is not free to develop. If you enjoy my content and would like to see more please consider becoming a sponsor on Github or Patreon! Not only do you support me but you are funding tech programs for at risk youth in Louisville, Kentucky.

Join The Newsletter

By joining the newsletter, you get first access to all of my blogs, events, and other brand-related content delivered directly to your inbox. It’s 100% free and you can opt out at any time!

Check The Shop

You can also consider visiting the official #CodeLife shop! I have my own clothing/accessory line for techies as well as courses designed by me covering a range of software engineering topics.

Posted on Leave a comment

How To Prepare for a Successful Entrepreneurial Journey

a man glancing out the airplane window

How To Prepare for a Successful Entrepreneurial Journey

So you want to be your own boss? Great! Making the leap into entrepreneurship is an exciting and rewarding process. But it’s not without its challenges. 

Fortunately, there are a few things you can do to set yourself up for success. In this blog post, Jyrone Parker shares six tips for preparing to become an entrepreneur. From getting an online degree to funding your business, these strategies will put you on the path to greatness:

1. Get an Online Degree To Sharpen Your Business Skills

If you’re serious about becoming a successful entrepreneur, consider getting an online degree in business or a related field. Many accredited online programs can help you gain the skills and knowledge you need to run a successful business. Not to mention, having a degree can make you more attractive to potential investors and customers. 

With today’s technology, there’s no excuse not to take advantage of online education opportunities. When looking at the options, only consider accredited universities with tuition rates you can afford. Studying online will strengthen your business acumen without hindering you from your job or family commitments. 

2. Learn About the Different Business Structures 

There are several different business structures you can choose from when starting your own company. These include sole proprietorships, partnerships, limited liability companies (LLCs), and corporations. It’s important to learn about the pros and cons of each structure so you can choose the option that makes the most sense for your particular business.

Many entrepreneurs form LLCs because it protects them from personal liability for the debts and obligations of the company. This can prove invaluable if your company is sued or goes bankrupt. Also, you can choose how the company is taxed and take advantage of certain tax deductions and credits. Research the LLC rules in your state, and hire a formation service to do the heavy lifting. 

3. How To Create a Productive Work Space or Find an Office Space  

One of the challenges of working from home is creating a productive work environment. It can be tempting to lounge in your PJs all day or take work calls from bed, but this isn’t conducive to a productive workday. Instead, try to create a dedicated workspace in your home, such as a spare bedroom or home office. 

If you struggle with distractions, you might want to find an office space outside of your home so you can separate your work life from your personal life. Spend time looking into your options, and ensure your office space is the size you need, especially if you plan on hiring employees. 

4. How To Get the Funding You Need  

Many aspiring entrepreneurs quit on their dreams because they don’t have the capital necessary to get their businesses off the ground. If this is something you battle, you have several options. You could apply for small business loans, look into venture capital firms, or launch a crowdfunding campaign. Do some research and see which options make the most sense for your business. 

5. Types of Tech Tools That Can Help  

Technology has come a long way in recent years, and many different tech tools are available to help entrepreneurs run their businesses more efficiently. Some examples include project management, invoicing, customer relationship management (CRM), and accounting software. Take time to research the wealth of tech tools on the market that can streamline your operations. 

6. How To Create a Routine and Schedule  

One of the benefits of being your own boss is having flexibility with your schedule. However, this can also be a challenge. Without set office hours, it’s easy to let work consume your entire day—and night! To avoid burnout, you must set some parameters around when and how often you’ll work each day, week, and month.  

Conclusion

Congratulations—you’re on your way to becoming an entrepreneur! Keep these tips in mind as you prepare for this exciting journey, and with some hard work and dedication, you’ll be running your own successful business in no time. Just remember to believe in yourself and stay true to your core values, and you’ll maintain the motivation necessary to thrive. 

If you like this content, check out my startup MobiSnacks available for iOS and Android!

Posted on Leave a comment

Tech Upgrades to Boost Business Productivity and Save Money

Tech Upgrades to Boost Business Productivity and Save Money

Taking advantage of modern technology is important for keeping your business competitive. However, many business owners are hesitant to spend money on the latest tech. What if your investment doesn’t pay off? As a small business owner, you can’t afford to waste capital on fancy new tools and equipment just for the sake of being innovative. Your tech investments need to save you enough money that they pay for themselves in the long run. 

The good news is that there are several tools out there that can do just that! You just have to know where to look—and how to pick the right technology for your unique business needs. Are you ready to invest in some new technology and take your business to the next level? Here are a few tools that are bound to pay off!

Project Management Software

Project management tools can make your life a lot easier. Even if you have a small team, good project management software will help you stay on schedule, optimize the use of your available resources, and monitor progress from one centralized platform. This will save you the headache of constant back-and-forth emails and enable your team to get work done more quickly. Look for project management software that allows you to collaborate in real-time with your team members. 

Meeting Scheduling Platforms

Scheduling meetings with team members and clients is another common business task that can take a lot of unnecessary time. How many emails do you have to send before you land at a meeting time that works for everyone? According to Boomerang, it takes an average of 8 emails to schedule a single meeting! Instead, take advantage of meeting scheduling apps and tools. For example, Calendly lets people schedule meetings based on their availability, which is ideal for business owners who get a lot of meeting requests.

Accounting Apps

Accounting is yet another one of those administrative tasks that take a lot of time. And when you don’t know what you’re doing, accounting mistakes can wind up costing a lot of money! Take advantage of accounting software to save time and keep more money in your business. With accounting software for your SMB, you will be able to automate a lot of your accounting processes so you can spend less time calculating taxes and more time focusing on big-picture projects. You’ll also be able to track expenses and inventory and send electronic invoices to get paid faster.

Email Marketing Software

If you collect emails from your customers—and you should—email marketing software will help you extract the most value out of your list. Email marketing tools make it easy to store, organize, and segment your audience so you can promote your business more effectively. At the same time, you’ll be able to use your email tools to schedule automatic abandoned cart emails and drip campaigns to improve your customer conversions!

Social Media Scheduling Tools

Posting on social media and engaging with your followers is one of the most affordable ways to advertise your business. But staying on top of your social media marketing tasks can be challenging. Thankfully, there are many social media management tools that allow you to create and schedule posts in advance. These social tools also make it easier for team members to respond to customers on social media from one easy-to-use platform.

The right technology can make your small business much more productive. Tech tools will help you automate time-consuming tasks, avoid common human errors, manage your finances, and save money across all areas of your business. Start exploring small business tech tools today so you can catch up with your competitors!

Work with software entrepreneur Jyrone Parker to take your business to the next level!

Posted on Leave a comment

Teaching Your Employees to Recognize and Avoid Common Internet Scams 

woman holding macbook

Teaching Your Employees to Recognize and Avoid Common Internet Scams

An informed workforce is your best defense against cyberattacks. Every time your employees go online, whether to check their email or conduct a search, they could encounter internet scams that put your business at risk. Cybercriminals like to target employees, especially those with access to sensitive financial information. Because your employees are your first line of defense against threats, you must empower them to protect your company!

Here are some tips presented by JyroneParker.com to help you teach your employees to avoid common cybersecurity threats. 

Start with a Recovery Plan

Every business needs a cybersecurity disaster recovery plan. Employee education and vigilance aren’t always enough to prevent cybercriminals from bypassing your defenses. Don’t wait for a disaster to happen to formulate a recovery plan! If your business experiences a cyber-attack, your recovery plan will enable you to get back up and running as quickly as possible so you can avoid angering your customers or disrupting your cash flow. When it comes to planning for potential cyber security threats, be sure to identify which data you will need to recover first in the event of an attack. This way, you’ll be able to put together a recovery plan that will help restore trust among your clients and customers.

Of course, creating a disaster recovery plan is no mean feat. With the level of detail, research, and strategizing that goes into it, you’ll definitely find your hands full. If you find yourself needing to reshuffle your work tasks to get this vital measure in place, you’ll need to find ways to organize your time differently. Download a planner template and use visual elements like sticky notes to keep you on track without taking much away from your other tasks.

Phishing Attacks

Phishing attacks are some of the most common internet scams. In a phishing scam, an attacker tricks their victim into clicking a link or downloading a file, resulting in any manner of damaging attacks. These attacks usually occur over email, but social media, instant messaging services, and apps are also frequently used in phishing attempts. Phishing emails often look like they’ve been sent by a company you know, so it’s important to know how to identify them.

Trojan Horse Software

Trojan horse software is a malicious program that appears legitimate but can take control of your computer after being downloaded. Trojans can do different things, from stealing sensitive information to freezing important data. Make sure your employees know not to click on pop-up windows, download programs from unknown publishers or click links in emails from people they don’t recognize. 

Tech Support Scams

The Federal Trade Commission explains that tech support scammers will lead you to believe that there’s something wrong with your computer and you will have to pay for tech support services to fix the issue. These scams often appear as pop-up warnings that look like error messages on your computer. Show your employees some examples of these scam attempts so they know what to look out for when working online.

Public Wi-Fi Scams

If your employees work remotely some or part of the time, make sure they know how to avoid public Wi-Fi scams. In public places, like coffee shops or airports, scammers may set up Wi-Fi networks with a name similar to one you would expect. Once you connect to this network, the hacker can steal your passwords, scan emails, or otherwise access your sensitive data. Discourage your employees from using public Wi-Fi for sensitive business tasks, like accessing business bank accounts or making purchases. You may also want to provide your employees with a VPN service to encrypt their connections and make public Wi-Fi safer.

Commit to Regular Cybersecurity Training

Teaching your employees how to avoid internet scams should be an ongoing process. Hackers are getting increasingly skilled and attacks are becoming more sophisticated by the day. Protect your business from these ever-evolving threats by committing to regular employee education. Make cybersecurity a common topic to address in team meetings so you can remind your employees how they can best protect themselves and your company from threats. Importantly, ensure your cybersecurity messages are understandable and relatable. You want your employees to feel responsible for their stake in your company’s security plan.

Cybersecurity is an important topic that’s often overlooked by small business owners. Even if you did everything in your power to shield your business from online threats, your employees still create points of vulnerability. Commit to cybersecurity training so your employees know how to reduce their risk of falling for internet scams.

Posted on Leave a comment

Adding Google Drive Functionality To Screen Recorder Pro

You All Requested Google Drive Functionality!

In my last YouTube video, I was asked to implement Google Drive upload functionality for saving screen recordings. I thought this was a marvelous idea and immediately got to work! We already added OAuth login via Google and Laravel in the last tutorial to interact with the Youtube Data v3 API, so with a few simple backend tweaks, we can add Google Drive as well!

Steps To Accomplish

The functionality I want to add to this is going to be just uploading to Google Drive, with no editing or listing. Keep things simple! This is going to require the following steps

  • Adding Google Drive scopes to Laravel Socialite
  • Create a function to upload file to Google API endpoint

Pretty easy if I do say so myself. Let’s get started with the backend.

Adding Google Drive Scopes To Laravel Socialite

We already added scopes for YouTube in the last tutorial so thankfully not a whole lot of work is needed to add Google Drive scopes. Open up your routes/api.php file and update the scopes array to include the new scopes needed to interact with Google Drive

Route::get('/login/youtube', function (Request $request) {
  return Socialite::driver('youtube')->scopes(['https://www.googleapis.com/auth/youtube', 'https://www.googleapis.com/auth/youtube.upload', 'https://www.googleapis.com/auth/youtube.readonly', 'https://www.googleapis.com/auth/drive', 'https://www.googleapis.com/auth/drive.metadata', 'https://www.googleapis.com/auth/drive.metadata.readonly'])->stateless()->redirect();
});

Make sure you enable the API in the Google cloud console! Now we head over to the frontend Vue application and let’s add our markup and functions.

Open the Home.vue and we are going to add a button in our list of actions for uploading to Google Drive

<t-button v-on:click="uploadToDrive" v-if="uploadReady" class="ml-10">Upload To Drive 🗄️</t-button>
    

In the methods add a function called uploadToDrive() inside put the following

  async uploadToDrive () {
      let metadata = {
          'name': 'Screen Recorder Pro - ' + new Date(), // Filename at Google Drive
          'mimeType': 'application/zip', // mimeType at Google Drive
      }
      let form = new FormData();
      form.append('metadata', new Blob([JSON.stringify(metadata)], {type: 'application/json'}));
      form.append('file', this.file);
      await fetch('https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart', {
        method: 'POST', // *GET, POST, PUT, DELETE, etc.
        mode: 'cors', // no-cors, *cors, same-origin
        cache: 'no-cache',
        headers: {
          'Content-Length': this.file.length,
          Authorization: `Bearer ${this.yt_token}`
        },
        body: form
      })
      alert('Video uploaded to Google Drive!')
    }

Inside this function we create an HTTP POST request to the Google Drive endpoint for uploading files. We pass a FormData object that contains some metadata about the object and the actual file itself. After the file is uploaded the user is alerted that their video is stored!

Screen Recorder Pro Google Drive upload confirmation

What’s Next?

Next, we will add cloud storage you will be able to share with Amazon S3 and WebShare API! Finally we will add monetization and this project will be wrapped up! If you enjoyed this please give the app a try at https://recorder.jcompsolu.com