teleren/devto huggingface dataset:
Renew SSL Certificate on Ubuntu Nginx 22.04 / 20.04 / 18.04.
Tags: ubuntu, laravel, nginx
Published: 2023-07-16 18:38:48

**PER-REQUISITES**

1.Run 

```
sudo apt-get update
```
 to download and upgrade package information from all configured sources.

2.Run 

```
sudo apt-get install python3-certbot-nginx
```
 to install the Certbot client which is used in managing SSL/TLS certificates with the Nginx web server.

**NON-WILDCARD SSL RENEWAL**
For domains which do not require the use of wildcard domains make use of the command below;

Run 

```
sudo certbot --nginx -m example@gmail.com -d domain.ddns.net
```

> replace the **_example@gmail.com_** with your own email and **_domain.ddns.net_** with the domain you are renewing the SSL for.

**Wildcard SSL Certificate Renewal ( if you are using a non-wild card domain then skip step 1a and 1b )**
Run 

```
sudo certbot certonly --manual --preferred-challenges=dns --email example@gmail.com --server https://acme-v02.api.letsencrypt.org/directory --agree-dos -d domain.ddns.net -d "*.domain.ddns.net"
```
> replace the **example@gmail.com** with your own email and both **_domain.ddns.net_** and **(_"*.domain.ddns.net"_)** with the domain you are renewing the SSL for.

**1a**. At this point on the terminal enter "A" to accept terms and "C" to cancel the process and hit Enter.

**1b**. This step is to allow redirect of **HTTP** to the new **HTTPS**. There are two options to choose from;
a. Enter **type 2** => Highly recommended and hit enter.
b. Enter **type 1**=> To disallow redirect and hit enter.

**EXTRAS**
1. Run 

```
sudo service nginx restart
```
 to ensure the Nginx would reload and pick up the new configurations.

2. Run 

```
sudo certbot renew --dry-run
```
 to manually renew the SSL certificate before its expiry.

3. To check your available certs and expiration dates, run 

```
sudo certbot certificates
```
> **Step 2 is Not Recommended.**

**Conclusion**
The process of SSL certificate renewal is a critical aspect of maintaining a secure and trustworthy online presence. In this post, we explored the steps needed for the renewal of SSL certificates on an Ubuntu server which is very important aspect of server management in terms of securing data transmissions, establishing trust with visitors, and improving search engine rankings
Movie Recommendation Software Using Python
Tags: python, learning, algorithms, codecademy
Published: 2023-07-16 18:34:03

My Portfolio Project -- Recommendation software

This project was done as part of the Codecademy Computer Science Career Path. [Recommendation Software Project](https://www.codecademy.com/journeys/computer-science/paths/cscj-22-trees-and-graphs/tracks/cscj-22-portfolio-project-creating-recommendation-software/modules/cscj-22-portfolio-project-recommendation-software/kanban_projects/recommendation-software-project)

**Project Overview:**
In this portfolio project, you will research, brainstorm, and build a basic recommendation program for a topic of your choice. By entering letters or words into the terminal, the program will suggest a specific category for the user to explore. If the user is interested in the category, the program will provide a variety of related recommendations to the user. After you finish building the program, you will create a blog post to share the program on a publication of your choice!


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xwbssgo1u1e4kxoa4gqm.png)

For my project, I decided to create a movie recommendation software. 

To start, I pulled a small selection of movie data from [TMDB ](www.themoviedb.org). Then I used [Rotten Tomatoes](https://www.rottentomatoes.com) to get additional information for the movies.

To create the program I used LinkedLists and Nodes to access the data. 

This project was definitely a learning experience. I sometimes had trouble getting the LinkedList and nodes to work properly. I regularly got the NoneObject error. It was sometimes confusing to know if I should use the get_value or just get_next_node functions to access the data I wanted and I learned a lot through trial and error. Overall, I still think using LinkedList was the best way to store and access the data with the coding knowledge I have right now. 

Originally, I was going to only search by genre but then decided to also add searching by rating (PG, PG-13, R, etc), and alphabetically. The movie data was not stored alphabetically so I also decided to sort the movies alphabetically by title as the LinkedList was being created so the results would also print alphabetically. 

In the future I plan to add additional search parameters like tomato rating and audience score rating.

[https://github.com/lanesummer/Portfolio-Project---Recommendation-Software](https://github.com/lanesummer/Portfolio-Project---Recommendation-Software)

Thanks for checking out my project!
Using Modern Perl Features in your Projects
Tags: perl, webdev
Published: 2023-07-16 18:14:55

Perl has changed a lot over the years and it can be hard to keep track of what was introduced when and how to enable it in your project.  Additionally some new features get back ported via external modules.  Usually in a project you want a consistent feature setup across all the modules comprising it.  Also you want an easy way to enable new stuff when it comes out and you are able to upgrade.

There's probably several ways to do this but here's the approach I take.  I create a '::Syntax' module in the root of my project namespace and use that to setup all the features I want.  For example, let's say I have a project "Example".  I create a module like so:

    package Example::Syntax;

    use strict;
    use warnings;

    use Import::Into;
    use Module::Runtime;

    sub importables {
      my ($class) = @_;
      return (
        'utf8',
        'strict',
        'warnings',
        ['feature', ':5.16'],
        ['experimental', 'signatures', 'postderef'],
      );
    }

    sub import {
      my ($class, @args) = @_;
      my $caller = caller;

      foreach my $import_proto($class->importables) {
        my ($module, @args) = (ref($import_proto)||'') eq 'ARRAY' ? 
          @$import_proto : ($import_proto, ());
        Module::Runtime::use_module($module)
          ->import::into($caller, @args)
      }
    }

    1;


I can then use this in all my projects modules:

    package Example::User;

    use Example::Syntax;

    # Rest of code.


Using 'Example::Syntax' this way is the same as:

    package Example::User;

    use utf8;
    use strict;
    use warnings;
    use feature ':5.16';
    use experimental 'signatures', 'postderef';

    # Rest of code.

Later on if you upgrade to a new version of Perl you can just tweak syntax file.  For example if you move to Perl 5.38 then signatures are no longer loaded via the experimental pragma.  All your projects code will just continue to work correctly.

Although the Perl team goes to a lot of trouble to try and make sure stuff doesn't break across versions there's no reason to not add a bit of extra safety by centralizing your feature setup.  Otherwise you might find yourself with a tedious job of having to tweak boilerplate across your projects.  Personally I think this approach makes things a bit neater as well, or fewer lines at least.

**A quick last note...**

It might come to some that you could use this approach to preload some handy modules, like things out of Scalar::Utils for example.   I recommend not going crazy here and creating a default setup that might be surprising to newcomers to your project.   A light touch is probably best.
Are you a T-Shaped Developer?
Tags: fullstack, tshaped, discuss, career
Published: 2023-07-16 18:08:16


Up until now, I never put much thought into what type of developer I am. I studied a full stack curriculum at Flatiron School and I've focused on both frontend and backend at different times of my career. The other day my teammate mentioned that we should all work toward becoming T-shaped developers. That was a new one for me. What in the world is a T-shaped developer? 

After a bit of research I learned that a T-shaped developer embodies the best of both worlds between being a specialist and a jack of all trades. They are an experienced expert in one field with some knowledge in other areas too. 

While full stack usually entails that knowledge is generalized across the board, a T-shaped developer is a shiny rebranded version of full stack. It has the well-roundedness of full stack with the added bonus of a specialized area of expertise.

In the following chart example, the teal background color shows my depth of knowledge in data integrations (the vertical part of the T) as well as breadth across frontend, backend, full stack, and mobile app development (the horizontal part of the T).
![T-Shaped Developer Chart Example Across Stacks](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rih8qht80wcszt302585.png)

I omitted some skills from the teal area for the sake of making a perfect T-shape, so a truer representation of my skills would look more like an abstract shape scribbled by a toddler.

![Photo of child painting by Dragos Gontariu](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x742vvkcec40xysr4b7a.jpg)

There's no clear-cut definition of which fields are included as part of the chart, and the shape's contents seem to be entirely customizable. We all know that being a software engineer encompasses more than just writing code all day, so the next example shows my skills in the software engineer column along with aspects of other roles that I take on regularly. 

![T-Shaped Developer Chart Example Across Roles](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2rheut9ej6vc09hmq1jz.png)

You see, the chart can look different for everyone. Our levels of expertise are subjective and relative, so I could argue that every developer is already a T-shaped developer!

Creating a personal chart is a great exercise to dive deep into your own levels of expertise. What do you think, are you a T-shaped developer?
search target in nums array
Tags: javascript, beginners, programming, interview
Published: 2023-07-16 18:02:22



## This problem was asked by Google.

**Given an array of sorted integers in ascending order, and a target integer, write a function to search target in nums array. If target exists, return the index of the target in the array, otherwise return -1.**


**Example**

```
function binarySearch(arr, target){
 
};

const arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
const target = 5;
console.log(binarySearch(arr, target)); // 4
```

**Solution**

```
function binarySearch(arr, target) {
  let left = 0;
  let right = arr.length - 1;
  
  while (left <= right) {
    const mid = Math.floor((left + right) / 2);
    if (arr[mid] === target) {
      return mid; 
    } else if (arr[mid] < target) {
      left = mid + 1;
    } else {
      right = mid - 1;
    }
  }
  
  return -1;
}
```

**Explanation**
- Initialize left and right pointers representing search range
- Calculate the middle index
- If middle element matches target, return the index
- If middle element is less than target, update left pointer to mid + 1
- If middle element is greater than target, update right pointer to mid - 1
- Repeat steps 2-5 narrowing search range each iteration
- If target not found, return -1
- This implements a classic binary search algorithm to efficiently search a sorted array in O(log n) time complexity. The array is continuously divided in half after each comparison, eliminating half of the elements until the target is found.
Advanced Tutorial for Cypher (Part 2)
Tags: apacheage, agensgraph, graphdatabase, cypher
Published: 2023-07-16 17:56:06

This Tutorial is extension of The tutorial [Advanced Tutorial for Cypher Part (1)](https://dev.to/farooquememon385/advanced-tutorial-for-cypher-b8l) 

### Create Stored Procedure (1)
You can create Stored Procedure as follows:

- The **fn_array_uniq function** enters an array and returns a unique factor.
- **IMMUTABLE** represents the classification of the volatility of the procedure. Has the characteristics of calculating and processing returns as constants.
- **STRICT** returns a null value whenever the argument is null.
- The **GENERATE_SERIES** function takes** (start, stop, step interval)** as input variables and increments and decreases it to the units set in step interval
- The **ARRAY_LOWER / ARRAY_UPPER** function returns the lower/upper limit of the array dimension.


```
CREATE FUNCTION fn_array_uniq (anyarray)
RETURNS anyarray 
IMMUTABLE STRICT LANGUAGE SQL 
AS 
$$
SELECT ARRAY (
SELECT DISTINCT $1[i] 
FROM GENERATE_SERIES
(ARRAY_LOWER($1,1), ARRAY_UPPER($1,1)) AS g(i));
$$;
```

### Create Stored Procedure (2)
You can create Stored Procedure as follows:

- Ids is a function that takes id of the unique vertex as a factor and appends it to the array.
- IF [Conditions] Then [True Execution Code] END IF [False Execution Code]
  Perform execution code when true or false, depending on the conditions.
- FOREACH [Execution Code]
  Performs an execution code with each row as a factor.
- LOOP [Repeat Execution Code] END LOOP
  Repeat the execution code in the Loop section until there is no input.

```
CREATE FUNCTION ids(vertex[]) RETURNS text[] AS $$
DECLARE
v vertex;    vids text[];
BEGIN
IF $1 IS NULL THEN
RETURN ARRAY[]::text[];
END IF;
FOREACH v IN ARRAY $1 
LOOP        vids = array_append(vids,
id(v)::text);
END LOOP;
vids = vids[2:];    RETURN vids;
END;
$$ LANGUAGE plpgsql;
```

### Check the Fraud Ring
Explore the raid ring with Cypher Query using Stored Procedure.


```
SELECT cy.path
FROM (match path = (person:person)-[*..]-(person) with path,ids(nodes(path)) as node
    return path,length(fn_array_uniq(node)) as dcnt, length(node) as cnt) cy
WHERE cnt = dcnt
```
- Use the fn_array_uniq function to query the unique Node ID of the Path to be viewed as an array.
- Use the Ids function to extract only the Node IDs to consider and count and compare them.
- GraphPath that meets the previous conditions among the Paths inquired in the Match clause is printed and inquired.

## Explore
- [AGCloud](https://agcloud.bitnine.net)
- [Apache AGE](https://age.apache.org)
- [Apache AGE Github Repo](https://github.com/apache/age)
ES Lint Unknown Property error
Published: 2023-07-16 17:34:03

Couple of days ago I started working on a basic, starter level three.js website. While working on the website I encountered an error from eslint while I was defining properties under the <mesh></mesh> Tag. The error says "Unknown property 'geometry' found eslint react/no-unknown-property". The properties I defined under <mesh></mesh> Tag were - castShadow, geometry, material, material-roughness and dispose. Due to this error the component that I want to display on one of the tabs of the website, just doesn't get displayed. I have tried some of the solutions I found online but none of them worked for me for eg I tried solutions like - 

1. Adding this line of code in eslintrc file under the rules section "react/no-unknown-property": ['error', { ignore: ['css'] }]. 

2. And If the above line of code doesn't work then we may add this line of code in it's place "react/no-unknown-property": ['error', { ignore: ['jsx'] }]. 

3. Tried Quick fixing options which shows when we hover over on red line of error. 

4. Checked my code many a times but It seems alright to me, I don't have any missing lines of code or any kind of typos. 

So, If Someone could provide me with some other solutions than above ones than It would be really helpful.
The difference between injecting a service directly into a view and injecting services into a view via the route definition
Tags: laravel, php, webdev, backend
Published: 2023-07-16 17:26:13



## Injecting a Service Directly into a View:

- In this approach, the service is directly injected into the Blade view using the **@inject** directive. The injection is done directly within the view file.

- This method is suitable for small, isolated cases where you need access to a specific service in a particular view only.

- It provides a quick way to access services without the need to pass them through controllers or route closures.

- However, it can lead to less organized code, and using it for extensive dependencies throughout views might make the code harder to maintain and debug.

Example (Injecting directly into a view) :

```php
<!-- resources/views/welcome.blade.php -->

@inject('userService', 'App\Services\UserService')

<div>
    Total users: {{ $userService->getUserCount() }}
</div>
```

## Injecting Services into a View via the Route Definition Constructor:

- In this approach, the service injection is performed within a route definition closure or controller method before rendering the view. The service is injected into the closure or controller method, and then it is passed as data to the view during the rendering process.

- This method is more suitable for scenarios where you need the same service across multiple views or when the service requires some additional processing or data manipulation before being used in the view.

- It allows you to keep your views clean and focused on presentation logic while centralizing the service injection in the route or controller.

Example (Injecting via the route definition constructor):
```php
// routes/web.php

use App\Services\UserService;

Route::get('/users', function (UserService $userService) {
    $userCount = $userService->getUserCount();

    return view('users', compact('userCount'));
});
```

```php
<!-- resources/views/users.blade.php -->

<div>
    Total users: {{ $userCount }}
</div>
```
Which approach to choose depends on the complexity and scope of your application:

- For simple, one-off cases where you need to access a service in a specific view, using the **@inject** directive directly in the view might be acceptable.
- For larger applications or cases where the service is needed across multiple views, using dependency injection via route definition closures or controllers is a better approach for better organization and maintainability.

As a best practice, try to use dependency injection with controllers or route closures for most cases, and only use **@inject** when you have a specific need to access a service in a single view without introducing additional complexity to your application.
TIL Blog Day 3
Tags: webdev, beginners, css, html
Published: 2023-07-16 16:57:33

## Link in Bio

Today I started working on the 'Link in Bio' assignment. I began by creating the basic structure of the app and adding all my social media account links. For the links below that, I decided to create a developer 'toolbelt' with helpful links. These are a few sites that I still go to when I have questions and am looking for a quick refresher. 

#### Link 1
The Mozilla Developer Network, or MDN for short, is the go to website for web developers. Any questions concerning HTML, CSS and JavaScript can be answered by searching this vast site. It is an indispensable tool in web dev.

#### Link 2
This link is a visual guide to CSS. It has a list of 100+ CSS properties. When you click on a property it gives you a short description of the property and then gives you a few examples of how to use the property.

#### Link 3
This link is very well known and is a great resource to have handy when working with Flexbox. It is a visual guide that explains the different properties of Flex and how they work. 

#### Link 4
If you want your website or project to have a unique feel you need to change the default fonts. Google Fonts gives you access to hundreds of free to use fonts. You do a quick search and when you find the font you like you click on it and select the different styles you want(italic, bold, light, etc). You can either download the fonts and manually add them to your project or you can use the provided link and embed the font using the `link` tag in the `head` of your html document.

#### Link 5
The last link is a site that helps you learn basic command line commands. When I first started learning Git I struggled using the CLI (command line interface). This site helped me learn a lot of different commands to navigate my folder structure. It can be a bit overwhelming at first but it is very beneficial to learn the basics of the command line.

So those are the 5 links I chose to add to my 'Link in Bio' assignment. I hope that you guys find them useful!
Midiendo el rendimiento de nuestro código con BenchmarkDotNet - MemoryDiagnoser
Tags: benchmarkdotnet, csharp, dotnet, performance
Published: 2023-07-16 16:52:08

En el primer artículo de esta serie introducimos el concepto de _Benchmark_ y como crear un test de rendimiento en C#. Es el momento de entender como analizar la utilización de la memoria y del GC de .Net.

# Utilización de MemoryDiagnoser

En este caso vamos a utilizar un _Benchmark_ diferente al que utilizamos anteriormente para que nos permita ver cuanta memoria es utilizada y cuantas veces se ejecuta el GC.

Para ver éstas métricas es necesario agregar el atributo `[MemoryAnaliser]` a nuestra clase.


```csharp
BenchmarkRunner.Run(typeof(StringVsSpan));

[MemoryDiagnoser]
public class StringVsSpan
{
    private string[] ListOfStrings { get; set; }

    [Benchmark]
    public string concatStrings_concat()
    {
        var retValue = string.Empty;
        for (int i = 0; i < ListOfStrings.Length; i++)
            retValue += ListOfStrings[i];

        return retValue;
    }

    [Benchmark]
    public string concatStrings_StringBuilder()
    {
        var sb = new StringBuilder();
        for(int i = 0; i < ListOfStrings.Length; i++)
            sb.Append(ListOfStrings[i]);

        return sb.ToString();
    }

    [Benchmark]
    public string concatStrings_Join()
    {
        return String.Join("", ListOfStrings);
    }

    [GlobalSetup]
    public void Startup()
    {
        var faker = new Faker("en");
        ListOfStrings = faker.Lorem.Paragraphs(50, "\n\n").Split("\n\n");
    }
}
```

Lo ejecutamos ..

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d8rslnoacdr3g9b62k80.JPG)

... y obtenemos el siguiente resultado

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nx086k5qdc2kw1c2b0yg.JPG)

Se ven 2 nuevas columnas, _Gen0_ y _Allocation_

**Allocation**
Es la cantidad de memoria en el Heap utilizada para correr la función que estamos probando por cada iteración

**Gen0**/**Gen1**/**Gen2**
En donde _Gen0_ es la ejecución del _GC_ donde recolecta objetos de corta duración y se ejecuta de forma mas periódica. En este caso no tenemos _Gen1_ ni _Gen2_, pero estas ejecuciones del _GC_ recolectan objetos mas "pesados" y que tienen un ciclo de vida más largos.

En nuestro resultado podemos concluir que la manera más eficiente de concatenar strings (dentro de las alternativas que se evaluaron) es utilizando `String.Join` porque genera menos ejecuciones del _GC_ de primer nivel y utiliza menos alocación de memoria en el Heap.

# Conclusión
Agregando el análisis de memoria a nuestros tests de _benchmark_ podemos identificar como se comporta, en manera general, diferentes estrategias para obtener un mismo resultado y darnos major información para elegir una y otra.
Mountainside Fitness - Your Gateway To Overall Health, Fitness And Family Enjoyment
Published: 2023-07-16 16:48:17

Mountainside Fitness has several locations across the state, mainly in the Phoenix, Arizona. It provides a wide range of amenities and services to meet the demands of its members. The article below describes this in detail.

(https://www.wiki-fit.com/mountainside-fitness-your-gateway-to-overall-health-fitness-and-family-enjoyment/)