teleren/devto huggingface dataset:
Deploy Angular website to GitHub Pages
Tags: angular, javascript, github, git
Published: 2024-03-29 18:04:09

GitHub Pages is an excellent platform for deploying your websites and portfolios. I created my personal website using Angular and deployed it to GitHub Pages. During the process, I noticed that there are specific settings for this framework.

In this post, I will show you that in just a few steps, your project will be running!

Let's go!🚀

**Create your GitHub Repository**
First of all, you need to have an account in GitHub then, click on the “+” icon and select “New repository”


![create your github repository](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g1gj5yvrkomsplgl7ihv.png)

It is important to create a **public repository** and choose a name for it.

![public repository](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/svat9up306j3qidlmklz.png)
After creating the repository, commit all your changes and push your project files to the repository you created.

Now, in your project terminal, execute the command below to start the deployment process.  

```
ng add angular-cli-ghpages
```

Navigate to your project directory and open the angular.json file. Add the **"baseHref"** with the name of your branch and then save the changes.

![add basehref](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vmo9d0s5wdudwmbvom0w.png)
Now, execute the command "ng deploy" and automatically with the command, the changes will be updated in GitHub and your project will be ready to deploy.

```
ng deploy
```
In your repository on GitHub, click on “Settings ” navigate to “Pages”

![set in pages](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dewpnfdjzdkbxcz6g0fm.png)
Now, you can see that the "gh-pages" branch is available, and it is responsible for building our project so, select it and click on "Save".

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

In a few minutes, your project will be running!

![project running](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0ul02uwjxi4i1o2hgp77.png)

If you found this article helpful, please leave a comment.❤️
Complete Guide to Build Your First CNN Machine Learning Model in Python
Tags: ai, machinelearning, python, cnn
Published: 2024-03-29 17:44:10

In this blog post, we will walk through a step-by-step guide on how to build your first Convolutional Neural Network (CNN) machine learning model in Python. CNNs are widely used for image recognition and classification tasks due to their ability to capture spatial hierarchies in data.

## Step 1: Import Necessary Libraries

First, let's import the required libraries for building our CNN model:

```python
import numpy as np
import matplotlib.pyplot as plt
from keras.models import Sequential
from keras.layers import Conv2D, MaxPooling2D, Flatten, Dense
from keras.datasets import mnist
from keras.utils import to_categorical
```

## Step 2: Load and Preprocess Data

For this demo, we will use the MNIST dataset, which consists of handwritten digits. Let's load the dataset and preprocess the data:

```python
# Load the MNIST dataset
(x_train, y_train), (x_test, y_test) = mnist.load_data()

# Normalize the pixel values to be between 0 and 1
x_train = x_train.astype('float32') / 255
x_test = x_test.astype('float32') / 255

# Reshape the input data
x_train = np.expand_dims(x_train, axis=-1)
x_test = np.expand_dims(x_test, axis=-1)

# One-hot encode the target labels
y_train = to_categorical(y_train, 10)
y_test = to_categorical(y_test, 10)
```

## Step 3: Build the CNN Model

**Now, let's build our CNN model with the following architecture:**

- Convolutional layer with 32 filters, kernel size of 3x3, and ReLU activation
- Max pooling layer with pool size of 2x2
- Flatten layer to convert 2D feature maps to 1D
- Dense layer with 128 units and ReLU activation
- Output layer with 10 units (number of classes) and softmax activation

```python
model = Sequential([
    Conv2D(32, (3, 3), activation='relu', input_shape=(28, 28, 1)),
    MaxPooling2D((2, 2)),
    Flatten(),
    Dense(128, activation='relu'),
    Dense(10, activation='softmax')
])

model.compile(optimizer='adam', loss='categorical_crossentropy', metrics=['accuracy'])
```

## Step 4: Train and Evaluate the Model

Next, let's train the model on the training data and evaluate its performance on the test data:

```python
model.fit(x_train, y_train, batch_size=128, epochs=5, validation_data=(x_test, y_test))

loss, accuracy = model.evaluate(x_test, y_test)
print(f'Test loss: {loss}')
print(f'Test accuracy: {accuracy}')
```

## Conclusion

Congratulations! You have successfully built your first CNN machine learning model in Python using Keras. CNNs are powerful tools for image classification tasks, and with this guide, you are now equipped to explore more advanced CNN architectures and datasets. Happy coding!

Feel free to reach out if you have any questions or need further assistance.
How have you found paid writing gigs?
Tags: writing, freelance, sidehustle
Published: 2024-03-29 17:31:00

---
title: How have you found paid writing gigs?
published: true
description: I'm looking, and don't know where to start
tags: writing, freelance, sidehustle
cover_image: https://www.jakehayes.net/blog-images/tech/2024/notifications.jpg
# Use a ratio of 100:42 for best results.
published_at: 2024-03-29 17:31 +0000
---
Hot Cross Buns
Tags: frontendchallenge, devchallenge, css
Published: 2024-03-29 17:29:34

_This is a submission for DEV Challenge v24.03.20, CSS Art: Favorite Snack._

## Inspiration 
Easter is a time for Hot Cross Buns

## Demo
(Note that codepen is quite slow in displaying this image)
{% codepen https://codepen.io/alohci/pen/gOyGoOo %}

OK, here's the thing. While I consider myself competent at CSS, my artistic skill is close to zero. So I cheated.

While the image created in the codepen above is formed in CSS, the text-shadow was not hand written. I photographed some real hot cross buns, loaded it in a canvas

```js
const canvas = document.getElementById("canvas");
const ctx = canvas.getContext("2d");

const image = new Image();
image.src = "...";
image.addEventListener("load", () => {
  ctx.drawImage(image, 0, 0, 100, 100);

  const imageData = ctx.getImageData(0, 0, 100, 100);
  ...;
});

```
I then looped over the image data pixel by pixel, and wrote it back out as a text-shadow.

```js
  const data = imageData.data;
  let fs = 1;
  let d = 0;
  let ts = [];
  for (let y = 0; y < imageData.height; y++) {
    for (let x = 0; x < imageData.width; x++, d+=4) {
      ts.push((x * fs - 50) + 'vmin ' + (y * fs - 50) + 'vmin ' 
         + '0vmin rgba('
         + data[d] + ', ' 
         + data[d + 1] + ', ' 
         + data[d + 2] + ', ' 
         + data[d + 3] / 255 + ')');
    }
  }
  console.log(ts.join());
```
The text-shadow is of a single character - the Unicode Character 'BLACK SQUARE' “■” (U+25A0) with a transparent colour.

Licence: CC-BY
@Nullable et @NonNull
Tags: java, kotlin, bestpractice, checkerframework
Published: 2024-03-29 17:21:20

Le [framework Checker](https://checkerframework.org/) propose plein d'annotations sympa à placer dans le code pour le sécuriser.

Il permet notamment de répondre au besoin de nullabilité des types (et des retours de fonction): Une fonctionnalité qui existe en Kotlin (par exemple `String?` qui défini un String possiblement `null`), mais qui n'existe pas en Java.

L'idée derrière tout ça est évidemment de faciliter l'intéropérabilité avec Kotlin, mais pas que !

En effet, les IDE sont capables de prendre en compte ces annotations et proposer des corrections de code pour éviter de potentielles erreurs.

## Indiquer la potentielle nullité

Avec `@Nullable`, une fonction pourrait retourner  `null`.

Par exemple: 

```java
@Nullable  
public String creerDossier(DemandeCreationDossier demande) {  
   // Dans cet exemple, la demande peut retourner null cas d'erreur métier
   var demande = creerDossier(demande)
   return demande;
}
```

Si après le code appelant, un accès à la variable est réalisé, l'IDE nous informe que ce code peut lever une erreur et qu'il serait préférable de l'encadrer avec un test de nullité.

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

## Indiquer l'impossibilité de nullité
Avec `@NonNull`, on indique qu'une fonction est assurée de ne pas retourner  `null`.


```java
@NonNull  
public String creerDossier(DemandeCreationDossier demande) throws BusinessException {  
   // Dans cet exemple, la demande est crée ou un BusinessException est levée en cas d'erreur métier
   verifierDemande(demande); 
   // vérification métiers, etc...
   var demande = creerDossier(demande)
   return demande;
}
```

Si dans le code un test de nullité est réalisé, l'IDE nous informe que ce test est superflu.


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



## Et également sur les variables ...
Evidemment cette approche fonctionne également sur les variables.

```java
@NonNull String numeroDossier = null;

@Nullable Car car = findFirstCar(xxx);
```




## Pour aller plus loin : 
* Ces annotations ont beaucoup d'homonymes. C'est le package `org.checkerframework.checker.nullness.qual` qu'il faut utiliser
* Le Checker Framework propose pleins d'autres annotations de contrôle, mais 🥱 la [doc est très spartiate](https://checkerframework.org/manual/) ! 
- [JSR 305](https://jcp.org/en/jsr/detail?id=305) qui voulait standardiser ces annotations... qui n'a malheureusement jamais été validé
- Bonne pratique de dev : [Avoid Null Values if possible](http://www.javapractices.com/topic/TopicAction.do?Id=134).
Best Social Media Accounts Provider
Tags: webdev, javascript, beginners, programming
Published: 2024-03-29 17:21:02

We are providing the best usa uk verified all social media accounts at the very cheap price. 
Visit our site:
https://www.cheapbulkaccounts.com/product/buy-soundcloud-accounts/
https://www.cheapbulkaccounts.com/product/buy-yahoo-accounts/
https://www.cheapbulkaccounts.com/product/buy-twitter-accounts/
https://www.cheapbulkaccounts.com/product/buy-facebook-accounts/
https://www.cheapbulkaccounts.com/product/buy-linkedin-accounts/
https://www.cheapbulkaccounts.com/product/buy-gmail-accounts/
Buy SMM Services Provider
24 Hours Reply/Contact
Email: cheapbulkaccs@gmail.com
Skype: https://join.skype.com/invite/uGVcDkycBmTt
WhatsApp: +1(224) 307-6388
Stay where yer at till I comes where yer to bah !!
Published: 2024-03-29 17:16:00

So I'm a piece of work but it seems that your a piece of work till you see the other side of the sod. So let's exchange stories about this coding world and in a act of Newfoundland hospitality share the stories of the trials and tribulations of this rocky road of internet but with a non snoring spin!!! 
Long may your big jib draw 🥂
My apologies for the sake of the way I feel like I'm going to become a poster child for "the smallest violin.. " story
Published: 2024-03-29 17:10:30

So, first time I have a great place for the sake of your own personal promise to give honest tellings. The audience here ;  to mention I will need to applaud the fact you all are amazing!!! to be able to be providing interest and insight in your own politely worded constructively beautifuly defined criticism and boooooyy the fact that some of the apps that promote positive and respectful behavior... missed the mark by a serious, almost concerning amount.. I have been told to contact my (for lack of a better term) "boss" whom will have to guess my own personal responsibility to be in my exact verbatim instruction for the right thing to do, just to be followed up with the morning e-mails to be told 1) get my ptsd in check (well as it turns out that was a point to the info on my own personal reasons for this behaviour bothersome.)  b) you can explain why the **** you felt the need (likely because you are the reason for the need to make sure I followed your instructions I was  told by you to do asap, I felt like needed to get the role) to send 7 emails of sexual harrasment and trafficking and umm I have kids. Yah okay. Well let's talk about the fact that I am going to send you the entire agreement between us and it's going to become clear!!
Yah I really experienced the likes of the worst of the way in which the human race has been presented to me and my apologies for the sake of your timely stories about the fact that I am not short on the fact I would talk the ear off a dead cat and yah okay you're probably wondering if I stays where yer too till you comes where I'm at?
Nah, I d bet I just made you question life with the last slang term, crazy?! Uhmmm maybe but nope just a I'm Newfie to the world Newfoundland, is the legitimate way to say it, just say it and run with it. Like I love the effort people that are like you much be from newFOUNDland or newfinlind but I mean give me credit where credit is due. I sound like a combination of Irish and Scottish and the speed of a Portuguese. You have the benefit of not hearing that. Ahaha.so I have a question about this post is from the point of your worst of experience online to be treated as such you legitimately said "yah I am so not supporting the likes of that" (hopefully we can put my newfinese at rest or at best I'll let my next post be a dictionary of Newfoundland term. 
So with that tell me your story? How did you get some arsehole to treat you like a second class citizen (I mean no real-life examples)
And what about a complete list of terms and definitions of the Newfoundland dictionary and till then stay we're yer to, till I comes where yer at ... Love yah all,
Jaimee
Serverless Symfony Starter - Deploy Symfony to AWS
Tags: php, symfony, webdev, aws
Published: 2024-03-29 17:00:02

I have just released the first working version of a symfony starter project using [bref.sh](https://bref.sh).

I use bref on my project [livetechhelper](https://livetechhelper.com) and although the docs for bref are amazing, I had some issues at times and figured I would share what I think is a good starting point for a new project setup using this.

It includes:
 - Message queue handling through SQS
 - Sessions using DynamoDB
 - Data cache using DyanmoDB
 - Full serverless.yml config
 - Use of custom domains
 - Addition of DB (WIP)

If you've ever wanted to play around with serverless and Symfony, take a look and let me know what you think. I can definitely improve on the docs and things in general but it's a start. 

My goal in this was to have people skip the pain points I spent countless hours on and realize the awesomeness that is bref and how powerful it is because most of your projects will be free as the AWS free tier is very generous when it comes to lambda invocations.

You can see the project here: [https://github.com/livetechhelper/symfony-bref-starter](https://github.com/livetechhelper/symfony-bref-starter)

Happy coding!
Python script to fetch Instagram users info
Tags: instagram, scraping, python, api
Published: 2024-03-29 17:04:47

In today’s digital age, extracting data from social media platforms is becoming increasingly crucial for businesses, researchers, and developers. Instagram, being a popular platform for sharing visual content, contains a wealth of information that can be harnessed for various purposes. In this blog post, we’ll explore how to use a Python script to fetch Instagram user information effortlessly.


## Introduction to Instagram User Information Extraction

Python offers a wide range of tools and libraries that make data extraction from APIs a straightforward process. In this example, we’ll focus on fetching user information using the swiftInsta API which is published on RapidAPI.

## Fetching User Information Using Python

To get started, you’ll need an API key from [swiftInsta](https://app.swiftinsta.com/), which you can use to access the [swiftInsta API](https://app.swiftinsta.com/). This API provides a convenient way to collect data from Instagram profiles.

```
import requests

url = "https://api.swiftinsta.com/webget_user_info/googleindia"

headers = {
    "X-API-Key": "API_KEY"
}

response = requests.get(url, headers=headers)

if response.status_code == 200:
    data =  response.json()
    if data['status'] == "ok":
        userInfo = data['data']
        print("Id:", userInfo['id'])
        print("username:", userInfo['username'])
        print("full_name:", userInfo['full_name'])
        print("Followers:", userInfo['edge_followed_by']['count'])
        print("Followings:", userInfo['edge_follow']['count'])
        print("Category:", userInfo['business_category_name'])
        print("Private:", userInfo['is_private'])
        print("Verified:", userInfo['is_verified'])



'''
Output:

Id: 8536113897
username: googleindia
full_name: Google India
Followers: 993798
Followings: 19
Category: Business & Utility Services
Private: False
Verified: True

'''
```

API will return lots of information related to a user. You can check sample responses in the [documentation](https://docs.swiftinsta.com/).

For more info, please visit [swiftinsta.com](https://swiftinsta.com/)
Mobile App Development Company in New York - Next Envision
Tags: mobile
Published: 2024-03-29 17:03:57

Looking for a reliable and experienced [mobile app development company in New York](https://nextenvision.com/mobile-app-development-company-in-new-york/)? Look no further! Our team of seasoned professionals offers tailored solutions for iOS, Android, and cross-platform app development. From concept to launch, we ensure top-notch quality and timely delivery. Contact us today for a free consultation and take your app idea to the next level!

Call:+1 951 289 5733
Mail:connect@nextenvision.com
Website:https://nextenvision.com/mobile-app-development-company-in-new-york/
Starting my React js journey
Tags: webdev, react, beginners, programming
Published: 2024-03-29 16:53:17

**So today is the day 1 of my journey**.
So today i started learning react from the youtube. Today i learned just some basic of react like how file structure works,how it fuctions,why it is needed and all of its pros and cons such as it require SEO optimization because the code generated from it is not seo friendly.
_I hope that i will continue this journey and i'll also keep upadting on daily basics._
How to make apps with astro
Tags: astro, webdev, javascript, programming
Published: 2024-03-29 16:40:11

Astro is a framework for making applications with the .astro format simple right well today we will be making a basic astro app so lets get started.
Firstly lets make our project so run

``` npm create astro@latest ```

like this 

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



after that we can open our project so run
```cd yourprojectname```
so now that we are in the project run

``` code ./ ```

like this 

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


.
Now lets run the development server by running 

``` npx astro dev ```

now here you have it a brand new astro app.

Happy coding
Web Share API: One Byte Explainer ✍️
Tags: frontendchallenge, devchallenge, javascript, webdev
Published: 2024-03-29 16:24:02

_This is a submission for DEV Challenge v24.03.20, One Byte Explainer: Browser API or Feature._

## Explainer
Web Share APIs are used to share text, links, files and other contents in web apps by showing the native share dialogs.

`navigator.canShare()` validates content shareability, and `navigator.share()` opens the native share dialog.

## Additional Context
Web Share APIs use the [web-share](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permissions-Policy/web-share) permission policy, and your app must have the permission granted for the API to work. Also, the sharing must be triggered by a UI event (e.g. button click). 

For more information you can visit the [MDN docs](https://developer.mozilla.org/en-US/docs/Web/API/Web_Share_API)

## Other Resources
1. A related [real life issue](https://dev.to/ra_jeeves/how-to-do-copy-to-clipboard-on-duckduckgo-android-programmatically-4ch) I faced while using the `Web Share API` & the `clipboard API`

2. Learn how to make your app receive the shared content and appear in the native share dialogs: [Web Share Target API](https://dev.to/ra_jeeves/web-share-target-api-one-byte-explainer-3p6a)
Getting started with AI Prompts
Tags: powerplatform, ai, gpt3, powerautomate
Published: 2024-03-29 16:23:34

We're kicking off a brand new multi-week video series called "AI in Action - Powering up with Power Automate'. In this series, we'll explore some of the key generative AI features in Power Automate and AI Builder that are changing the automation game.

In the first video of the series, we'll be tackling AI Prompts. AI Prompts are powered by GPT and run on the Azure OpenAI Service. They are powerful tools that enable you to add Generative AI capabilities to your apps, automated workflows, and copilots. The Power Platform provides many template prompts that serve a variety of scenarios but you can also create custom prompts for customised use cases.

In this video, we’ll go over how you can get started with AI Prompts in AI Builder. Showing you where to access the Prompt Builder and how to create custom prompts with instructions, context, and dynamic values. You’ll also learn how to test your custom prompts once they have been created.

Watch here: {% embed https://aka.ms/ai-in-action/prompts %}

If you want to learn more about AI Prompts, check out these amazing resources below:
AI Builder GPT Prompts are generally available: https://aka.ms/PowerAutomate/GPTPromptsGA 
Prompt Engineering Guide: https://aka.ms/promptguide 
Documentation: https://aka.ms/AIPromptsOverview
OpenSwoole and Doctrine
Tags: php, doctrine, swoole, openswoole
Published: 2024-03-29 16:16:15

## Connection issue

The doctrinal issue is that coroutines use the same connection.

On a service with many connections, users end up waiting for SQL queries to finish one after the other.

## Solutions

1) Create a connection for each request

This solution has been adopted in the package diego-ninja/swoole-mysql-doctrine-driver : [diego-ninja/swoole-mysql-doctrine-driver](https://github.com/diego-ninja/swoole-mysql-doctrine-driver)

Two issues arise:
- We are in a long-time process, and connections consume RAM.
- Under heavy load, database server may block due to a large number of open connections.

2) Use a connection pool

The connection pool is a class replacing native driver that store and reuse connections. You can define the max number of concurent connections, determined by the size of your database server.

The process is simple :

For example : we use a pool of 10 connections.

If there is a free connection, we get the connection. Send the connection and release the connection.

If there is no free connections, we sleep a short time and retry.

### small/swoole-pdo-doctrine-driver

This package use [small/swoole-patterns](https://packagist.org/packages/small/swoole-patterns) abstract pool's class.

Here is an example to configure it with symfony :

```yaml
doctrine:
    dbal:
        driver: Small\SwooleDbalPdo\PDODriver
        url: '%env(resolve:DATABASE_URL)%'
```

The source code is available on [https://git.small-project.dev/lib/small-swoole-doctine-dbal-pdo](https://git.small-project.dev/lib/small-swoole-doctine-dbal-pdo)

The composer package is available on [https://packagist.org/packages/small/small-swoole-doctine-dbal-pdo](https://packagist.org/packages/small/small-swoole-doctine-dbal-pdo)