teleren/devto huggingface dataset:
Instalar xampp en ChromeOS
Tags: spanish
Published: 2023-07-21 21:02:14

Descargar instalador xampp en linux {% embed https://www.apachefriends.org/es/download.html  %}

Guardar en la carpeta `archivos de linux`

## Terminal

- Otorgar permiso al instalador

```
sudo chmod 755 xampp-linux-x64-8.1.17-0-installer.run
```

- Instalar

```
sudo ./xampp-linux-x64-8.1.17-0-installer.run
```

- Iniciar xampp

```
sudo /opt/lampp/lampp start
```

- Permitir acceso de usuario root al servidor

```
xhost si:localuser:root
```

- Interfaz gráfica

```
cd /opt/lampp
ls -l manager*
sudo ./manager-linux-x64.run &
```

Puedes cambiar el puerto en `configure` a 8080

- Abrir en navegador

```
localhost:8080
```
Microfrontend Architecture: What You Need to Know Before You Start
Tags: webdev, react, frontend, architecture
Published: 2023-07-21 20:30:34

As web applications continue to evolve, frontend developers face new challenges in maintaining large and complex codebases. The rise of microfrontends has emerged as a solution to address these challenges, offering a scalable and flexible architecture pattern. 

If you're about to migrate your monolithic app to use the microfrontend architecture, or you're developing a new project from scratch using this architecture pattern, here are some things you need to do at the start to make the process ✨easy-breezy✨ (or at least _easier_).


### Lock in all inflexible requirements

There are many different ways to implement microfrontends. The best method for your use case depends ENTIRELY on your hard requirements. You may not be able to have _all_ the requirements locked in before you start, but to spare yourself from having to re-architecture your microfrontends system you need to at least know all your _inflexible_ requirements upfront.

### Push for separation of concerns
 
Always be mindful if what you're implementing in one microfrontend depends in some way on what's in another microfrontend. If you make a change in microfrontend _a_, will you have to also make a change in microfrontend _b_? Look for ways to improve separation of concerns. Note that depending on your requirements, a true separation of concerns may not be possible, but you should still try to push for maximum decoupling of microfrontends.

### Ignore frontend framework at the top architecture level

To save yourself and your company many headaches down the line, keep the communication between the microfrontends minimal and framework-agnostic. If the microfrontend is built with React, the other microfrontends should be able to communicate with it even if you (or more likely, another team at a different point in time) reimplement it with Vue or Angular or something else. 


### Plan to spend ~~some~~ a lot of time debugging in prod (especially if it's your first time implementing microfrontends) 

Even though all your microfrontends may be working together properly on your local machine, you ~~may~~ most certainly will run into really strange issues in production. Just be mentally prepared for that, and budget in some time for your debugging party. A good place to start debugging is by looking at your config files (or, if the issues are around styling, start by investigating how your css is packaged for production).

If you're about to embark on your first microfrontend architecture adventure, can I recommend a course? This is not an affiliate link (in fact, you can just look up this course by its title on udemy), but [Microfrontends with React: A Complete Developer's Guide](https://www.udemy.com/course/microfrontend-course/) was a life saver for me. 

Have fun, and good luck!
#DEVDiscuss: Google or Grad School?
Tags: devdiscuss, discuss, career, education
Published: 2023-07-21 20:00:00

Hey Devs, happy Friday 🦥💚

As always, it's been an eventful week in the tech industry. We've got a lot to talk about! And today I want to discuss...whether it's true that [Google Isn't Grad School](https://www.theatlantic.com/ideas/archive/2023/07/illusion-explanatory-depth-humility/674624/).

{% embed https://www.theatlantic.com/ideas/archive/2023/07/illusion-explanatory-depth-humility/674624/ %}

Ok, ok — obviously Google isn't Grad School. But this op ed in The Atlantic got me thinking: when it comes to leveling up your skills in the tech industry, is it nearly as good? And where do online courses fit in?

Share your thoughts in the comments and let's discuss!

---

_Want to submit a question for discussion, or even ask for advice? Visit [Sloan's Inbox](https://docs.google.com/forms/d/e/1FAIpQLSc6wgzJ1hh2OR4WsWlJN9WHUJ8jV4dFkRDF2TUP32urHSAsQg/viewform?usp=sf_link)! You can choose to remain anonymous._
```
Docker extension has insufficient permissions...
Tags: vscode
Published: 2023-07-21 19:37:57

Docker extension is showing insufficient permissions. Failed to connect to a docker running container and Failed to connect to docker.

I tried to run docker sudo and add my username to sudoers file and also create docker group from post build instructions for docker.

A bit of trouble still not sure why this might be?

Anyone know maybe how to get issue to resolve it?
Telling a Story in an Interview
Tags: interview
Published: 2023-07-21 19:18:53

Telling your story in an interview is a great way to **control the interview** in a way that highlights your strengths. Your resume has to tell enough of your story to get you called, but leave enough out that you can tell more stories in the interview. Every single question in the interview is an opportunity to **expand a vision or add to a positive narrative**. If you can tie the answers together with some type of theme or related events then the story feels more complete and they feel more like they know you well.

You are the hero in your story and this is your chance to show that hero’s actions and results from beginning to end. It’s an opportunity to **downplay negatives and upgrade positives.** People love, remember, and share great stories with others. Finally, stories sound better then random facts.

Telling your story also gives you a chance to **anchor the conversation** at the beginning. It allows you to shine a spotlight on what matters to you and where you excel, framing the conversation.

In interviews, all you're doing is talking about your successes and what you learned along the way. Even failures are successes as long as you learned something. There are several key aspects of story telling in an interview:

- **Planning (aka: preparation)** -  Every story has a beginning, characters, and theme. You have to pick which work experiences that flows together to tell a memorable story.
- **Confidence** - Your speech and body language has to convey that you believe in the persona you are sharing.
- **Passion** - Everything you say and do have to scream, “I want this job and have overcome similar challenges before”.
- **Reading the room** - Every interview, from the interviewer to the company culture, is different.
- **Communication** - The interviewer has to be able to hear you, understand you, and enjoy the moment.
- **Showcasing the Authentic you** - The story you are telling needs to be unique to just you.

Tips to prepare for interviews:

1. Make a habit of **weekly mock interviews** with a friend or mentor. Practice telling your story over and over until it feel natural.  
2. **A cheat sheet of highlights and experiences** you can quickly scan and then use. My personal tactic is to “rehearse” the hour before the interview.

If you have tips on crafting a story during the interview, please leave a comment.
What is a Callback function?
Published: 2023-07-21 19:07:15

A callback function is a function that is passed into another function as an argument. In javascript actions are asynchronous, which basically means a fuction will run in the background instead of the code stopping and waiting on the function to executed before continuing. In order for this to work we need promises that will be resolved by a successful completion of the function or the fuction being rejected with sometype of error being returned. Callback functions can be used in response to an event such as a mouse click, this allows for user interaction in the program without the progrmam stopping execution.
Looking for feedback on our Web3 product!
Tags: web3, blockchain, smartcontract, productivity
Published: 2023-07-21 18:12:29

Hey Dev Community! 

I’m Quionie and I’m a part of Esprezzo. We’re currently building our first product, Dispatch, a no-code automation and alerting platform for Web3 projects, brands, and fans.

We’ve recently released our Dispatch Event Monitor Trigger that makes it easy for anyone to create alerts for any smart contract events. 

This would be useful for anyone looking to get alerts for: 
• NFT Transfers, mints, forges, redemptions 
• Key gameplay events 
• Unexpected smart contract activity 
• Event check-ins and phygital experiences. 

We’re currently in beta, and we would love to have feedback from you so we could better shape our product to help Web3 companies simplify their workflows. 

Sign up for an account: dispatch.esprezzo.io/signup 

Learn more about Dispatch: 
esprezzo.io 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4u9beylnhhqfue5zzo2d.gif)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iwp4pnhpih16wn8ygg58.jpeg)
How to run LLAMA 2 on your local computer
Published: 2023-07-21 17:58:01

## Introduction
LLAMA 2 is a large language model that can generate text, translate languages, and answer your questions in an informative way. In this blog post, I will show you how to run LLAMA 2 on your local computer.

## Prerequisite:
1. Install anaconda
2. Install Python 11

## Steps

### Step 1:
1.1: Visit to huggingface.co
Model Link: https://huggingface.co/meta-llama/Llama-2-7b-hf
1.2: Create an account on HuggingFace
1.3: Request for llama model access
It may take a day to get access.
1.4: Go to below link and request llama access
Link: https://ai.meta.com/resources/models-and-libraries/llama-downloads/
1.5: As llama 2 is private repo, login by huggingface and generate a token.
Link: https://huggingface.co/settings/tokens
```
pip install huggingface_hub
```
```
huggingface-cli login
```

### Step 2: Create a conda environment and activate conda environment
```bash
conda create -n py_3_11_lamma2_run python=3.11 -y
```
```bash
conda activate py_3_11_lamma2_run
```

### Step 3: Install library
```bash
pip install transformers torch accelerate
```

### Step 4: Create a file "touch run.py"

```
import time
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM

timeStart = time.time()

tokenizer = AutoTokenizer.from_pretrained(
    "meta-llama/Llama-2-7b-chat-hf"
)

model = AutoModelForCausalLM.from_pretrained(
    "meta-llama/Llama-2-7b-chat-hf",
    torch_dtype=torch.bfloat16,
    low_cpu_mem_usage=True,
)

print("Load model time: ", -timeStart + time.time())

while(True):
    input_str = input('Enter: ')
    input_token_length = input('Enter length: ')
    
    if(input_str == 'exit'):
        break
    
    timeStart = time.time()

    inputs = tokenizer.encode(
        input_str,
        return_tensors="pt"
    )

    outputs = model.generate(
        inputs,
        max_new_tokens=int(input_token_length),
    )

    output_str = tokenizer.decode(outputs[0])

    print(output_str)
    
    print("Time taken: ", -timeStart + time.time())
```

### Step 5: Run python file
```bash
python run.py
```


### Performance:
I am using a CPU with 20 GB of RAM (4 GB + 16 GB).
It took 51 seconds to load the model and 227 seconds to generate a response for 250 tokens.
If you use a GPU, it will take significantly less time.
On Google Colab, i got 16 second for a response.

![Llama 2 load time on CPU](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/huqlq55ozw15u5wjg2kx.png)


## Congratulations! You have successfully run llama on local machine.
Those who didn't go to college, What steps did you take to land an internship?
Tags: codenewbie
Published: 2023-07-21 17:35:53

Trying my hardest to get my foot into the tech industry. Id love to know what resources you used and books you read that gave you the confidence and competency to apply to a company.

C++ in specific since there's tons of jobs in my area that hire for C++ programmers (Austin) but I'm unqualified as of the moment for all of them lol.
Introduction to JavaScript
Tags: javascript, webdev, programming, beginners
Published: 2023-07-21 17:35:52

## What is JavaScript?
JavaScript is a programming language that gives the frontend functionality, and has the ability to connect the it to the backend.

### Why use JavaScript?
Since, 
> Any application that can be written in JavaScript, will eventually be written in JavaScript ~Jeff Atwood

Writing the app in JS in the first place doesn't seem like a bad idea.

JavaScript, created in 1995 by Brendan Eich, is an old yet very used language. Every website uses is in one form or another, some use it in its original form(Vanilla JS), while others use it in a framework (like: ReactJS, Vue, AngularJS, etc.).

##What are JavaScript frameworks?
Javascript frameworks are tools that help developers streamline the process of development by pre-determining some aspects of coding, like DOM management, providing basic structures for single-page applications.

###Do you need  JavaScript framework?
The short answer is "yes". And the long answer is:
It really just depends on what you want to make. Let's take an analogy for example: If you are on a fixed budget and need to buy a home, will you buy a mansion or just rent an apartment?
It is the same thing here. If your goal is just to make a simple website without much functionality, you don't need a framework, but if your goal is making a blazingly fast enterprise app with thousands or millions of users, you should _probably_ use a framework.
It also depends on the amount of efforts you are ready to put into the project. You can use plain JavaScript but you will probably  end up making a worse and less optimized JavaScript framework.

> The last thing this world needs is another JavaScript Framework ~Jeff Delaney(of Fireship)


###Which JavaScript framework should you use?
While there are hundreds if not thousands of JavaScript frameworks that you can use. But the three most popular ones are:

1. ReactJS- By Meta
2. Angular- By Google
3. Vue- By Evan You


![The most popular JavaScript frameworks](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lbnsz5c2ia2ephprrbti.png)
 
####ReactJS
React is the framework with the most weekly downloads. It also has a huge community of developers and a lot of employers hiring.
It is also capable of making good mobile apps through React Native. It also has a large amount of extensions and expandability.
Created and maintained by Meta.

####AngularJS
Angular is the frameworks with the second most weekly downloads. It is most famous for its extreme learning curve.
Created by Google

####Vue
Vue is most liked by small teams and individual developers. It is the third most famous framework. It has a minimal learning curve and a decent range of extensions and expandability.
Created by Evan You and is open sourced.

##Conclusion
In conclusion, JavaScript is a programming language meant for the web. And by using it with a framework, you can drastically improve its functionality and even use it to make mobile apps.
Seamless communication between containers - docker compose
Tags: docker, containers
Published: 2023-07-21 17:30:35

Let's consider an example of a Spring Boot application which interacts with the MySQL database. Couple of images have been created for MySQL and Spring Boot respectively. The images can be run as containers. But how they going to interact with each other?

One way is to create a docker network and spin up the containers within that network. This will work but you have to deal with long commands which is difficult to maintain in bigger projects. This is the problem docker compose solves by making the container communication easy to achieve and maintain.

- Let's consider the following Spring Boot Application which communicates with a MySQL database and provides a basic JWT implementation for securing Rest service endpoints.
https://github.com/pradz13/spring-security-jwt.git


- Spring Boot Application needs to define a Dockerfile as follows -

```
FROM maven:3.9.3-sapmachine-17
WORKDIR .
COPY . .
RUN mvn clean install -DskipTests
CMD mvn spring-boot:run
```

- Define the docker compose configuration file as follows -

```
version: "3.8"

services:
  mysqldb:
    image: mysql:5.7
    restart: unless-stopped
    env_file: ./.env
    environment:
      - MYSQL_ROOT_PASSWORD=$MYSQLDB_ROOT_PASSWORD
      - MYSQL_DATABASE=$MYSQLDB_DATABASE
    ports:
      - $MYSQLDB_LOCAL_PORT:$MYSQLDB_DOCKER_PORT
    volumes:
      - db:/var/lib/mysql

  app:
    depends_on:
      - mysqldb
    build: .
    restart: on-failure
    env_file: ./.env
    ports:
      - $SPRING_LOCAL_PORT:$SPRING_DOCKER_PORT
    environment:
      SPRING_APPLICATION_JSON: '{
            "spring.datasource.url"  : "jdbc:mysql://mysqldb:$MYSQLDB_DOCKER_PORT/$MYSQLDB_DATABASE?useSSL=false",
            "spring.datasource.username" : "$MYSQLDB_USER",
            "spring.datasource.password" : "$MYSQLDB_ROOT_PASSWORD",
            "spring.jpa.properties.hibernate.dialect" : "org.hibernate.dialect.MySQLDialect",
            "spring.jpa.hibernate.ddl-auto" : "update"
          }'
    volumes:
      - .m2:/root/.m2
    stdin_open: true
    tty: true

volumes:
  db:
```

- Create the .env file which will have the configurations.

```
MYSQLDB_USER=root
MYSQLDB_ROOT_PASSWORD=123456
MYSQLDB_DATABASE=bezkoder_db
MYSQLDB_LOCAL_PORT=3307
MYSQLDB_DOCKER_PORT=3306

SPRING_LOCAL_PORT=6868
SPRING_DOCKER_PORT=8080
```

- Run the containers with the following command -

```
docker-compose up -d
```
-d will run it in detached mode.

- To stop the containers following command can be used -

```
docker-compose down
```
To stop the containers and delete the images, use the following command -

```
docker-compose down --rmi all
```
Please note, when docker compose is used, no need to create docker network explicitly, it is taken care by docker compose internally.
Debugging Apache AGE source code using VS Code
Published: 2023-07-21 17:21:09

Hello, in this bog we will be learning how to add a debugger sowe can debug our apache AGE source code.

Today we will simply install the debugger and learn how to use it.

## Prerequisites

1. AGE PostgreSQL Source code installed
2. PostgreSQL Source code installed (with debg enabled)
3. VSCode
4. GDB

## Step 1: Starting your PostgreSQL server

First go to the directory where you postgreSQL is installed

`cd posgresql-16beta1`

Then initialize your DB cluster

`bin/initdb demo`

Start your server

`bin/pg_ctl -D demo -l logfile start`

Then create your database

`bin/createdb demodb`

Then to access the database run

`bin/psql demodb`

## Step 2: Getting backend pid

Using this command to check the backend process ID where postgresql server is running.

SELECT pg_backend_pid();

## Step 3: Setting up AGE in VS Code

Open The AGE source code you have installed and then mainly install the 

- C/C++ Plugin
- C/C++ Extension Pack Plugin 

Both are from microsoft

After this press F5 and you can edit the launch.json file.

Add the path to your postgres like this in the file and save it

```
{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) Attach",
            "type": "cppdbg",
            "request": "attach",
            "program": "/home/hannanaamir/age16/postgresql-16beta1/bin/postgres",
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                },
                {
                    "description": "Set Disassembly Flavor to Intel",
                    "text": "-gdb-set disassembly-flavor intel",
                    "ignoreFailures": true
                }
            ]
        }


    ]
}
```

## Step4: Start Debugging

Now again press F5 and now paste the pid of your server

You have now successfully enabled the debugger

Now in your code you can setup breakpoints and then load AGE in the sever

```
CREATE EXTENSION age;
LOAD 'age';
SET search_path = ag_catalog, "$user", public;

```
Now you can see how the code runs and behave you can also run further querries and see how it behaves with them. I hope this helps.

## Extra

To help with postgreSQL and AGE installation you can follow this blog [https://imranzaheer.hashnode.dev/install-age-psql-from-source](https://imranzaheer.hashnode.dev/install-age-psql-from-source)
Markdown Bot - An AI friend who improves your content
Published: 2023-07-21 17:19:30

With [TinaCMS](https://tina.io), all your content changes are committed directly to Git. This enables your team to create a variety of workflows for reviewing and merging content updates. By leaning on GitHub, you can integrate CI/CD into your content workflow.

To illustrate the potential of this combination, we're excited to introduce **Markdown Bot**, an AI friend who improves your content by making suggestions to your Pull Requests.
{% embed https://www.youtube.com/watch?v=3SkumYmH8nc %}

> Want to skip the reading and jump straight to the code? [Check out the open source repo](https://github.com/tinacms/markdown-bot).

## A Useful Aid, Not a Replacement

AI can be a valuable tool for assisting with writing and editing content. We've designed this bot not to replace content editors, but rather to augment their capabilities. The bot offers content suggestions directly in your pull requests. If you find the suggestions helpful, you can commit them with a click. If not, they're just as easily dismissed.

![AI Suggestion in Github](https://res.cloudinary.com/forestry-demo/image/upload/v1689957451/blog-media/markdown-bot/Screenshot_2023-07-21_at_12.36.48_PM_ztpdes.png "AI Suggestion in Github")

## Markdown Bot Works On Your PRs

There are many AI writing tools out there but if you use them with markdown content it often involved copying and pasting from AI outputs. We wanted something that could interact with our Content in GitHub. That's why we developed a GitHub bot that allows us to receive these suggestions right within a GitHub pull request.

## Working with the GitHub Bot

After you've integrated the bot into your repository, you can command it to make suggestions by commenting `ai fix: <path to file>`. A custom prompt can be added by using `prompt: <Custom Prompt>` underneath. The bot will then offer commit suggestions in the form of a pull request review.

To get started [check out the open source repo](https://github.com/tinacms/markdown-bot "Markdown Bot Github repo").

## Looking Ahead: AI and Git-based Content

Our GitHub bot works hand in hand with TinaCMS to enhance the content creation process. No longer do you need to manually copy and paste suggestions. The bot brings suggestions right to your pull requests for a smooth, efficient experience.

We can envision some impressive custom workflows being built with AI and Git-based content. For instance, you could build off of this bot to:

* Trigger the AI bot with custom events, such as opening a PR.
* Utilize analytics to suggest recommendations based on your top/bottom performing pages.
* Integrate this bot with your feedback widget, to open PRs based on user feedback.
* Catch insensitive, inconsiderate writing with tools like [alex](https://github.com/get-alex/alex)

These are just a few of the many possibilities we see for integrating AI with Git-based content. We're excited about the potential here and look forward to seeing the creative workflows that the community will build.