teleren/devto huggingface dataset:
Getting Acquainted with the Mako Framework in PHP
Tags: webdev, php, beginners, tutorial
Published: 2023-07-29 20:40:55

I've recently discovered a great little framework called [Mako](https://makoframework.com/). It's fast, quick, simple to understand, and I love the engineering and thought put into it (unit testing is a breeze and makes sense!).

Here's a simple "Hello, World!" example using the Mako PHP framework. This guide assumes you have PHP 8.0.0 or higher installed along with `ext-json` and `ext-mbstring`. If you plan to use the database library, you'll also need to install `ext-pdo`. If you have PHP 7.4, you can easily use Mako Framework version 8.*

# Creating a Hello World App with Mako Framework

## Step 1: Installation

First, you'll need to install the Mako framework. You can do this using composer:

```bash
composer create-project mako/app hello_world
```

This will create a new project named `hello_world`.

Next, you'll need to make the `app/storage/*` directories writable. The command may vary depending on your system, but here's a common example:

```bash
chmod 0777 -R hello_world/app/storage
```

> In the real world, you would never do 0777 permissions! But in a test environment when learning about a framework, it's totally acceptable!

## Step 2: Configuration

By default, only the most essential services are enabled. You can enable the ones you need by uncommenting them in the `hello_world/app/config/application.php` configuration file.

## Step 3: Creating a Hello World Route

In Mako, you can define a route in the `app/routing/routes.php` file. Let's create a simple route that returns "Hello, World!".

```php
$routes->get('/', function()
{
    return 'Hello, World!';
});
```

## Step 4: Running the App

Mako includes a simple development server which can be started with the following command:

```bash
php hello_world/app/reactor app:server
```

Now, if you open `http://localhost:8000` in your browser, you should see "Hello, World!".

## Step 5: Updating the Framework

Mako and all your other dependencies can easily be updated when a new patch release is made available using the following command:

```bash
composer update
```

If you want to bump the Mako version (e.g. from `9.0.*` to `9.1.*`) then you'll have to update your `composer.json` file before running the update command.

That's it! You've just created a simple "Hello, World!" app using the Mako PHP framework. Happy coding!

> Note: The included development server is great when getting started and for quick prototyping but you should probably use a VM or Docker setup that closely resembles your production environment for advanced projects.
The 48th Day of the 100 Days of Code challenge
Published: 2023-07-29 20:23:19

Today I worked on debugging the real-time transcription application I've been working on some more. I came across time-alignment problems and still working on exploring other options to fix them. There also considerations when it comes to the speaker diarization feature, as when there's misalignments which usually happen when using the smaller models, I need to decide what happens. If the transcriber was unable to identify which segments belong to which speaker, I'll have to mark the speaker as an unknown speaker. However, only if other speakers were detected during the transcription. If no other speakers were detected, it's safe to assume that the only one detected is the one who spoke.

Otherwise, if there's even a slight second of another person speaking, I'll mark it as an Unknown Speaker. I think that's fair enough for now.

I'll also explore faster whisper implementations, the problem is the alignment. WhisperX does not easily fit within the project, which does perform alignment. I'll try to see what I can do and if I can perform alignment separately, but if not, I'll stick to my current implementation and debug it some more to see where it excels and where it doesn't.

Hoping to finalize this part of the app and release it,
Happy coding everyone!!
Building Your Own Shell in C: A Journey into Command-Line Magic
Tags: c, developer, shell
Published: 2023-07-29 20:20:14

Today, I want to take you on an exciting journey into the world of command-line magic by creating your very own shell in the C programming language. Shells are an integral part of any operating system, allowing users to interact with the system using text commands. By building a simple shell from scratch, you'll gain a deeper understanding of how shells work and how they execute commands.

## Lets Get in it
How does shell works? 
A shell reads user input, interprets the commands, and executes them by forking child processes. The standard C library provides functions like fork(), exec(), and wait() that help us achieve this.

```
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>
#include <string.h>

#define MAX_INPUT_LENGTH 100

int main() {
    char input[MAX_INPUT_LENGTH];
    char* args[MAX_INPUT_LENGTH];
    int status;

    while (1) {
        printf("YourShell$ ");
        fgets(input, sizeof(input), stdin);

        /*Tokenize the input*/
        char* token = strtok(input, " \n");
        int i = 0;
        while (token != NULL) {
            args[i] = token;
            token = strtok(NULL, " \n");
            i++;
        }
        args[i] = NULL; /*Null-terminate the argument list*/

        if (strcmp(args[0], "exit") == 0) {
            printf("Exiting the shell...\n");
            break;
        }

        pid_t pid = fork();
        if (pid < 0) {
            perror("Fork error");
        } else if (pid == 0) {
            /*Child process*/
            if (execvp(args[0], args) == -1) {
                perror("Execution error");
                exit(EXIT_FAILURE);
            }
        } else {
            /*Parent process*/
            wait(&status);
        }
    }

    return 0;
}

```

## How does this work

1. The program sets up a loop to keep the shell running until the user types "exit."
2. It prompts the user for input and reads the command from the standard input using fgets().
3. The input is then tokenized into arguments using strtok() and stored in the args array.
4. The shell checks if the command is "exit"; if so, it exits the loop.
5. If not, it forks a child process using fork().
6. In the child process, the command is executed using execvp(), which searches for the command in the system's PATH and runs it.
7. The parent process waits for the child to complete using wait().

## Let's do it!!

### To compile it we use gcc 

```
gcc simple_shell.c -o myshell
```

### Now we can execute this by :

```
./myshell
```

## Conclusion
That's it. That's how shell works. Is it not interesting how the command line works?😃
Of course, there's a lot more you can add to make it more feature-rich and robust, but this serves as an excellent starting point to dive deeper into the world of shells and command-line interfaces.

If you have any questions or want to share your experiences, drop a comment below. I'd love to hear your thoughts!

Stay curious, keep coding, and until next time, happy hacking! 🚀

Big Thanks to ALX SE for introducing me to this fascinating world.
my first web project and stuff about life
Tags: webdev, life, javascript, beginners
Published: 2023-07-29 19:36:49

Okay.. so today I've completed my first project. An e-commerce web app built using React JS and Firebase. I completed this project in a month. I learned a lot and I still messed up Firebase hosting for this project but never mind. I built unixchange a marketplace for people to exchange their products.

GitHub Repo - https://github.com/shrey802/unixchange

Things I learned -

Web app flow, local storage, Firebase services, stripe setup, Braintree (I tried Braintree before stripe), Hooks, Components, conditional rendering, forms, Database chaining, CRUD operations on Database, debugging, reading documentation, and a lot more.

I'm happy that I built something on my own and got out of the tutorial hell. Also, I learned 'how to google', and 'prompt engineering'. I kept on learning and understanding the code and writing it on my own. I tried to write clean and optimized code with comments.

I also want to share that in the past 2 months that is June and July (although 2 days are remaining). I feel I grew a lot in terms of programming. I started my junior year, built a project, prepared for Azure 900 fundamentals, and did around 91-92 LeetCode questions, did an internship assignment but unfortunately couldn't get an interview, joined a community, became the leader of the ACM committee of my college, learned basic C panel, did 2 small certifications, met some family members, enjoyed some alone time. Overall these two months have been good for me. Looking forward to building more web + cloud projects and getting my Azure certification. Also, I've applied to buildspace n&w season 4. Hope so I get in. Thank you for reading.
Mocha and Chai Unit Testing (node js)
Tags: webdev, javascript, testing, programming
Published: 2023-07-29 19:34:56

Let's start by understanding unit testing and why you need to test your code before deploying to production!

**_Unit Testing _**- It is a form of testing where individual components of the codebase is tested before deploying. To verify that each piece of code in the codebase works properly. 

Test-driven development includes writing a particular test before production and checking whether it’s working. The idea is basically to get a little bit of assurance from the initial test. 

Behaviour-driven development is a subtopic of test-driven development but instead uses simple and human-readable descriptions of software user requirements as the basis for tests.

There are various tools with which you can perform unit testing in node js.

1. Mocha js
2. Chai js
3. Jest
4. Enzyme
5. SinonJS
6. Cypress

Now let's test our piece of code :

index.html:

```
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Mocha Tests</title>
  <link href="https://cdn.rawgit.com/mochajs/mocha/2.2.5/mocha.css" rel="stylesheet"/>
</head>
<body>
  <div id="mocha"></div>
  <script src="https://cdn.rawgit.com/Automattic/expect.js/0.3.1/index.js"></script>
  <script src="https://cdn.rawgit.com/chaijs/chai/3.5.0/chai.js"></script>
  <script src="https://cdn.rawgit.com/mochajs/mocha/2.2.5/mocha.js"></script>

  <script src="problems.js"></script>
  <script>
    const mocha = window.mocha;
    mocha.setup('bdd');
  </script>
  <script src="tests.js"></script>
  <script>
    mocha.checkLeaks();
    mocha.run();
  </script>
</body>
</html>

```

So index.html is just a boilerplate code and few script tags.

Problems.js - where we will write our piece of code

```
function cube(numberarray){
    const newnumberarray = numberarray.filter(val => val%2!=0);
    return newnumberarray.map(val => val**3);
}

//numberarray=[2,3,4,5,6,7,8]
//newnumberarray=[27,125,343]
```
Here we have taken an array named _**numberarray**_ and we are filtering even numbers from numberarray
I have many issues with my C code. Can someone please help me fix it?
Tags: coding, c, codenewbie
Published: 2023-07-29 19:07:55

There are a lot of problems with my code but i don't where to now even begin. First, when i run the code the option 1 does not update once someone has booked a slot say 13:00pm, another issue which is also quite major is that i want this to have 8 available rooms, along with having 11 slots from 8 am to 7 pm so a total of 88 slots but one person should be able to book only 3 slots per day. The worst part is i am sure there must be other issues after running but i can't even tell at this point! so please everyone please help me out on this. Thank you and sorry for the long post[](https://docs.google.com/document/d/1I4dfsFNnYcrFKwBRQoszBRcKHoHC1IDyPzDNwT_ux40/edit?usp=sharing)
ScrollView program is not woking why ?
Published: 2023-07-29 18:55:47

I Written below given Program but all thigs is ok but the Scroll is not working the cimulator is i phone 14 pro.
i am harsly tried to solve but i cant please help.

Simple numbers printed scrollView also not working,

 whta is the solution for my problem ?

import SwiftUI
struct Test: View
{
    var body: some View
    {
        NavigationView
        {
            ScrollView(.vertical, showsIndicators: true)
            {
                VStack(spacing: 30)
                {
                    ForEach(0 ..< 10)
                    {
                        item in
                        NavigationLink(destination: DetailView())
                        {
                            GeometryReader
                            {
                                geometry in
                                VStack
                                {
                                    Text("Link")
                                  .foregroundColor(Color.white)
                                }
                                .frame(width: 300, height: 200)
                                .background(Color.blue)
                                .cornerRadius(30)
                            }
                            .frame(width: 300, height: 200)
                        }
                    }
                }
            }
            .navigationBarTitle(Text("Title Text"))
        }
    }
}
struct Test_Previews: PreviewProvider {
    static var previews: some View {
        Test()
    }
}
THE TINY ADVICE BLOG: UML- A Must-Have for Nigerian Developers
Tags: webdev, softwaredevelopment
Published: 2023-07-29 18:37:58

Abeg, you sabi UML?
If you're a Nigerian developer, you might have or not heard of UML before. But trust me, you need to know about it. UML stands for Unified Modeling Language, and it's a way of visualizing and documenting software.
It's used by developers all over the world to create better, more efficient software.
So why should you care about UML? Well, for one thing, it can help you to improve your communication skills.
When you use UML, you can create diagrams that show how your software is supposed to work. This can help you to explain your ideas to other developers, and it can also help you to identify any potential problems with your design.
Another reason why you should care about UML is that it can help you to save time. When you use UML, you can create a blueprint for your software before you start coding. This can help you to avoid making changes later on, which can save you a lot of time and frustration.
So if you're a developer, I urge you to learn about UML. It's a valuable tool that can help you to become a better developer.

Here are some additional tips for developers who are new to UML:
1. Start with the basics. There are a lot of different UML diagrams, so it’s important to start with the basics. Learn about class diagrams, object diagrams, and sequence diagrams.
2. Find a good UML tool. There are a number of tools available, both free and paid. Find one that you’re comfortable with and that can help you to create the diagrams you need. Google is your friend for this.
3. Practice, practice, practice. The best way to learn UML is to practice. Create some diagrams for your own projects, and don’t be afraid to ask for help if you get stuck.
Top 20 Latest Technology Trends
Tags: ai
Published: 2023-07-29 18:35:32

Artificial Intelligence (AI) and Machine Learning have emerged as two of the most influential technologies in recent years. AI refers to the development of computer systems that can perform tasks that typically require human intelligence, such as decision-making, speech recognition, and problem-solving. Machine Learning, on the other hand, is a subset of AI that allows systems to learn and improve from experience without being explicitly programmed.
For read more follow below link
[Read more...](https://amlogy.com/top-20-latest-technology-trends/)
Footballs United
Tags: webdev, beginners, tutorial, react
Published: 2023-07-29 18:16:05

At Footballs United, our passion lies in [football](https://footballsunited.com/), and we are committed to offering extensive coverage of diverse football leagues and competitions across the globe. Our mission is to be the ultimate destination for football enthusiasts, providing them with the most current updates on news, match schedules, live scores, player transfers, statistics, and a wealth of other football-related content.
#LearnedToday: One month of #LearnedToday
Tags: learnedtoday, webdev, communication, socialmedia
Published: 2023-07-29 18:15:32

It has been exactly **one month since my first post with the hashtag "LearnedToday"**!

I didn't think I would make it this far and be able to post something every day (including weekends!).. That makes me really **proud** of myself! 🥳

At the same time I couldn't imagine it would be so **timeconsuming** and **mentally exhausting**! 😮‍💨 (even choosing the right emoji takes its time! 😂)
**The initial idea** was to post mostly simple links and add just some personal comments once in a while or share some code snippets. I ended up adding an original description and image to each link, I created small stackblitz projects to show some JS and CSS functionality, and even wrote a couple of slightly more in-depth technical articles.

I am very **happy** with how it turned out but I realized that posting something like this every day is **challenging** if you have a _full-time job_, a _personal life_ in which you do a _thousand activities_ and, most importantly, if you try to _put your own spin on every post you write_.

I have many other **projects** in the pipeline that I'd like to **prioritise**, such as developing a _cool side project with some of my colleagues_, _organizing a conference_ by the end of the year, and _preparing my first talk_. In short, all new things that require some **time** and **perseverance**! 💪

I'm not saying I won't post anymore, it is exactly the contrary! I've seen that I really enjoy it and sometime I'm also useful to someone... I will simply do it when I have time and maybe I can **devote a little more space to specific posts**. 🙃

We could say that _all good things come to an end_, in fact today was also **the last day of the WeAreDevelopers conference**! 😜

P.S. The photo is not perfectly related to the post, but I like it! 👴🏻🐶


![Me and the techie dog by Vodafone](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5i66rvrymfh48ncivzp8.jpeg)
#LearnedToday: WeAreDevelopers conference 2023 in Berlin
Tags: learnedtoday, internet, web, conference
Published: 2023-07-29 18:05:40

⏰ Finding time to write posts these days is not easy.... There are too many things to do in **Berlin** with my colleagues, especially in the last two days since the start of the 🧑‍💻 [WeAreDevelopers conference](https://www.linkedin.com/company/wearedevelopers.org/)! And that's what today's post is all about!

🚀🌟 The **energy** and enthusiasm here is off the scale! 😃

It's been an incredible opportunity to **connect** with other technology enthusiasts, **learn** from inspiring speakers, and delve into the latest industry trends.

I also enjoyed watching and singing during the 🎤 **karaoke** session! I can't wait to see what the rest of the conference has in store for us! (spoiler: the final round of the **#Code100** contest has just begun and at 22pm is going to star the official **party** 🕺).

Let's keep the **excitement** going! 💪🔥
And let me give you just a piece of advice: **take the time to attend conferences**, you won't learn too much technical stuff but you will **meet people** like you and you'll be definitely **inspired**! ❤️

I wrap thing up, with a photo of the opening speech by **Tim Berners-Lee, the man who invented the Internet**! 😍


![Tim Berners-Lee at the We Are Developers conference 2023 in Berlin](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ek8v3wai8fga9gj9hsxb.jpeg)
#LearnedToday: Qwik
Tags: learnedtoday, javascript, webdev, qwik
Published: 2023-07-29 18:00:53

Today we attended the [Misko Hevery](https://www.linkedin.com/in/misko-hevery-3883b1/)'s [Qwik](https://qwik.builder.io) workshop at the [WeAreDevelopers conference](https://www.linkedin.com/company/wearedevelopers.org/) and I asked my colleague [Erik Fazio](https://www.linkedin.com/in/erik-fazio/) to share his thoughts about it:


"Today, I had a realization that I need to rebuild my **website** from scratch yet again, all to incorporate some exciting and dazzling new features.

Qwik seems the right answer. It’s a new **framework** to build web applications focused on **speed** and **performances**. Today I had the possibility to implement a project to gather data from my GitHub account implementing **authentication** and some **crud** operations. Its **hydration** feature is awesome, I can effortlessly add all the JavaScript code I want.

As a big fan of React, I got a bit upset when they began criticizing it, only to later adopt its style. It raises the question of coherence 😌. Nevertheless, despite this, Qwik seems awesome, and I'm definitely going to give it a try in my upcoming projects.

Do you think it's worth attempting to **optimize** my website even further, pushing it from 97% to a perfect 100%?"
Deploying a PERN Full-Stack CRUD App with Vercel: Hosting and Integration Made Easy!
Tags: vercel, react, webdev, javascript
Published: 2023-07-29 17:58:47

[GitHub](https://github.com/fetterollie) | [LinkedIn](https://www.linkedin.com/in/jonathanfetterolf/) | [Twitter](https://twitter.com/fetterollie)

---

Over the past few weeks, I’ve been working to create a PERN full-stack CRUD application. I wanted to share it with others and make it available for friends, family, and colleagues to check out. So, I started looking into options to host my application.

---

I chose to deploy my application on Vercel with the hobby plan for a few reasons. First and foremost, Vercel is incredibly easy to use. Its user-friendly interface and streamlined deployment process made it a great fit for me, as I didn't want to deal with complex hosting setups. Additionally, the hobby plan offered a free tier, which was perfect for hosting my personal project. Lastly, Vercel's seamless integration with Git repositories, especially GitHub, allowed me to set up automatic deployments whenever I pushed changes to my repository, saving me time and effort.

---

![Vercel Logo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/luifunmy278hupp19k5r.jpg)

---

Deploying my project on Vercel was a breeze since my code was already on GitHub. All I had to do was import my Git repository to Vercel. I went to the Vercel dashboard, clicked on the "New Project" button, and selected the "GitHub" option. After authorizing Vercel to access my GitHub account, I chose the repository I wanted to deploy. With a few configurations, like selecting the branch to deploy and setting up build options, my application was automatically deployed whenever I made new changes to the selected branch.

---

Besides the GitHub integration, Vercel offers other deployment methods too. These options include Vercel CLI which allows the user to deploy directly from their local development environment. Another option is deploy hooks which are unique URLs that trigger deployments when accessed. The final option is a deployment via a RESTful API which allows the user to create Deployments by making an HTTP POST request.

---

Vercel provided me with an excellent hosting solution for my PERN full-stack CRUD application. Its ease of use, free hobby plan, and seamless Git integration made the deployment process smooth and hassle-free. Whether deploying via GitHub, using the CLI, deploy hooks, or the REST API, Vercel offered flexibility and efficiency in hosting my web application.

---

In my upcoming post, I’ll walk you through the process of hosting my PostgreSQL database and integrating it with this application on Vercel. This follow-up post will be the last step of deploying a full-stack application with a backend database.

---

## Want to Follow Along?
[GitHub](https://github.com/fetterollie) | [LinkedIn](https://www.linkedin.com/in/jonathanfetterolf/) | [Twitter](https://twitter.com/fetterollie)