teleren/devto huggingface dataset:
Scraping Data from Amazon into Google Sheets using ScraperAPI and Google Apps Script
Tags: javascript, api, scraping
Published: 2023-03-11 23:11:52



## Completed Project
https://docs.google.com/spreadsheets/d/1JbF7ptNc6XgcEwxpoFU2RkJFKYefiPKxyglOUavbsy4/edit?usp=drivesdk _(Set to View Only for security reasons)_

## Tools Needed
- Scraper API
- Google Sheets
- Google Apps Script

## Guide
1. Create or sign into your account with ScraperAPI. Head over to your dashboard and grab your ScraperAPI API key. ScraperAPI’s free plan affords you 5,000 calls for your first seven days on registration. Afterwards, yo get 1,000 calls on your free plan.
2. Open up a new Google Sheets file. Mine’s named: Amazon Google Sheets Data.
For convenience and forward compatibility with my script, i recommend that you strucure your G-Sheets as indicated in the picture. However, you can always make adjustments to your code if you'd rather not.
3. For clarity, our column headers are: S/N, Page ID, Product Description, Product URL, Images, Rating, Reviews, and Price. 
4. For ease of use, the search key is expected in the B2 cell.
Let's code up the script:

```
function mainFunction()    
//Attach this function to a trigger of sorts in your Google Sheets
{
    clearRecords();

    var ss = SpreadsheetApp.getActiveSpreadsheet();
    var tableSheet = ss.getSheetByName(‘TABLE’);
    var settingSheet = ss.getSheetByName(‘SETTINGS’);
    var searchValue = tableSheet.getRange(1,2).getValue();
    var API_KEY = xxxxx;

    var url = “http://api.scraperapi.com”;
url += “?api_key=”+api_key
url += “&autoparse=true”;
url += “&url=https://www.amazon.com/s?k=”+searchValue;

// fetch data from API
var response = UrlFetchApp.fetch(url);
var json = response.getContentText();
var data = JSON.parse(json);

var item_count = 1;

for (var i = 0; i = data.results.length; i++)
{
var results = data.results;
var name = results[i].name;
var image = results[i].image;
var list_url = results[i].url;
var stars = results[i].price;
var reviews = results[i].total_reviews;

if (stars == null)
{
    stars = 0;
}

if(reviews == null)
{
    reviews = 0;
}

addRecord(item_count, 1, name, list_url, stars, reviews, price);

item_count+
    }

    var pages = data.pagination;

    if(pages.length > 0)
{
    for {var x = 0; x < pages.length: x++)
    {
        Utilities.sleep(2000);

        var url = “http://api.scraperapi.com”;
url += “?api_key=”+api_key
url += “&autoparse=true”;
url += “&url=”+pages[x];


       function clearRecords()
       {
    var ss= SpreadsheetApp.getActiveSpreadsheet();
    var tableSheet = ss.getSheetByName(‘TABLE’);
    tableSheet.gtRange(‘A4:H1000’).clear();
       }

     function addRecord(coun, page, name, image, list_url, stars, reviews, price){
    var ss = SpreadsheetApp.getActiveSpreadsheet();
    var tableSheet = ss.getSheetByName(‘TABLE’);
    tableSheet.appendRow([count, page, name, image, list_url, stars, reviews, price]);

```
6 Afterwards, head over to your the sheets. Type in your search query into the designated cell. For us, that'd be Cell B2. Here's what our output looks like for a search query of 'Medieval Torces'.
Type Safe, Promise Based, Vue 3 Modals That'll Have You Popping with Joy
Tags: webdev, typescript, vue, javascript
Published: 2023-03-11 22:37:30

> This post is inspired by [promise based modals for React](https://www.bajorunas.tech/blog/promise-based-modals) if you want to find out the reasoning, read that post first

Are you tired of overengineering simple things like showing a modal or a dialog? Look no further! I present to you... *drumroll*... Type Safe, Promise Based, Vue 3 Modals That'll Have You Popping with Joy!

If you're still reading, then you must be interested, or you just like reading long titles. Either way, I've got you covered. 

You can see the youtube video below and click the [stackblitz](https://stackblitz.com/edit/vitejs-vite-8dwcuk?file=src/App.vue) link for a short demo. But if you really want to experience the actual Dev UX of using this, then download and run this in VSCode. 

{% embed https://youtu.be/D5kU5eMhELU %}

In the past, I [overengineered modals](https://dev.to/neophen/usedialog-vue-js-snippets-20j0) like a mad scientist, but after attending a Vilnius.js meetup and seeing a [talk](https://slides.com/gedzis/modal-promises) by [Gediminas Ubartas](https://www.linkedin.com/in/gediminasubartas/) on how they implemented modals in their company, I decided to simplify my approach.

The result? Simply amazing. TypeSafe, Promise Based, Modals/Dialogs simply by providing a component to the `showModal` function in the [`useModalsProvider.ts`](https://stackblitz.com/edit/vitejs-vite-8dwcuk?file=src/components/ModalsProvider.vue) file. Plus, the types ensure that you'll never have to worry about runtime errors again. Return types from the `showModal` show you what to expect. The props argument makes sure that you provide everything the Modal Component requires to work!

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

But that's not all, folks! There are extra things you can add to improve Client Side UX. I've done these extra things in my codebase, but they are very much based on what you prefer and how you prefer to do it. If you want to see these in a post, let me know in the comments. 

So there you have it. Type Safe, Promise Based, Vue 3 Modals That'll Have You Popping with Joy! Don't take my word for it, try it out for yourself. And remember, always keep it simple, my friend.
AI: How SLAPA is Harnessing Developer Thinking to Automate APIs
Tags: ai, gpt3, api
Published: 2023-03-11 22:36:57




Introducing **SLAPA**: A Self-Learning Agent for Performing APIs

OMG just watch this video. Maybe pause and read what's going on the screen. Go on. I'll wait here.

{% embed https://twitter.com/DYtweetshere/status/1631349179934203904?s=20 %}


> When given a task, SLAPA knows to search for the API documentation and learn all the information. Then he create API calls. If they don't work, he learns from his mistake and tries again.

Basically, it's like the advanced example of [LangChain](https://langchain.readthedocs.io/en/latest/)'s app - a game loop implementation that will execute until a win or failure is achieved. Very similar how human brain operates!


![SLAPA diagram explaination](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9jtlay8yczpovyv23m82.png)


> SLAPA's knowledge accumulates. He only needs to read documentation if you ask for a new API he's never encountered before; otherwise, he already knows it. As more people use SLAPA, the more comprehensive his knowledge becomes. He also gets better at writing API calls.

My understanding is that this uses persistance storage like vector search to store this knowledge.

Some other notes:
 - no official demo
 - private beta

Godspeed

PS. Follow me on Twitter or LinkedIn
[https://twitter.com/dom_sipowicz](https://twitter.com/dom_sipowicz)
[https://www.linkedin.com/in/dominiksipowicz/](https://www.linkedin.com/in/dominiksipowicz/)
Enable/disable NestJS devtools integration without changing your code!
Tags: node, nestjs
Published: 2023-03-11 22:24:12

Don't know what NestJS Devtools is? check this out: [Introduction to NestJS Devtools with Kamil Mysliwiec](https://www.youtube.com/watch?v=uEhDafXA2h4)

---

## What?

You can use the devtools integration without changing anything in your code! Just use the package [`nestjs-devtools-loader`](https://www.npmjs.com/package/nestjs-devtools-loader) like this:

```bash
npm i --save-dev @nestjs/devtools-integration nestjs-devtools-loader
#      ^^^ No need to pollute the production environment

## then:
nest start --watch --exec "node -r nestjs-devtools-loader/register"
## or:
export NODE_OPTIONS="-r nestjs-devtools-loader/register"
nest start --watch
```

That's all! Now go to https://devtools.nestjs.com (port `8000`) as usual :)

## Why?

In order to enable the Devtools integration, we need to do the following changes to our source code:

1) Enable the snapshot generation:  
```ts
// ...
const app = await NestFactory.create(AppModule, {
  snapshot: true,
})
```  
2) Import the `DevtoolsModule` dynamic module into the root module:  
```ts
@Module({
  imports: [
    DevtoolsModule.register({
      http: process.env.NODE_ENV !== 'production',
    }),
  ],
  // ...
})
export class AppModule {}
```

To me, this is too intrusive since most of the time I won't use the devtools. Also, I believe that having `snapshot` always enabled will affect the bootstrapping time (so we should use `process.env.NODE_ENV !== 'production'` in there as well).

## How?

Instead, we can leveraging on [monkey patching](https://en.wikipedia.org/wiki/Monkey_patch) and on the `--require` (or `-r`) [Node's CLI option](https://nodejs.org/api/cli.html#-r---require-module) to perform those changes for us only when we need.

Now I have one npm-script that will start the app with devtools integration enabled thanks to `nestjs-devtools-loader` package! Note that that package allows us to define the arguments of `DevtoolsModule.register()` call.

Check out the full code here: https://github.com/micalevisk/nestjs-devtools-loader/blob/main/lib/loader.js#L43
Create Angular project with Jest Testing Framework
Tags: angular, jest, testing, framework
Published: 2023-03-11 22:23:46


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/58t5vioiecjc45zzc3d4.jpeg)
STEP:1
```
npm install -g @angular/cli
```

STEP:2
```
ng new my-app-name
```

STEP:3
```
cd my-app-name
ng serve --open
```

STEP:4
```
npm install jest @types/jest jest-preset-angular --save-dev
```

STEP:5
```
npm uninstall karma karma-chrome-launcher karma-coverage-istanbul-reporter karma-jasmine karma-jasmine-html-reporter @types/jasmine @types/jasminewd2 jasmine-core jasmine-spec-reporter
```
If the above code didn't removed the packages related to **Karma** and **Jasmine**, you can remove it manually from the **package.json** file. And then run the `npm install` to update the **package-lock.json** file. 

STEP:6
Remove **test** from the **angular.json** file

STEP:7
Replace **test** with **jest** on the scripts in **package.json**
`"test": "jest",`

STEP:8
Create new file as **setupJest.ts** on root level and add below code in it
```
import 'jest-preset-angular/setup-jest';
```

STEP:9
Remove if these files exist in the project
**karma.conf.js** and **test.ts**

STEP:10
Update the **types** value in the **tsconfig.spec.json** file
```
"types": [
      "jest",
      "node"
    ]
```

STEP:11
Add below code on the **package.json**

```
"jest": {
    "preset": "jest-preset-angular",
    "setupFilesAfterEnv": [
      "<rootDir>/setupJest.ts"
    ],
    "testPathIgnorePatterns": [
      "<rootDir>/node_modules/",
      "<rootDir>/dist/"
    ],
    "globals": {
      "ts-jest": {
        "tsconfig": "<rootDir>/tsconfig.spec.json",
        "stringifyContentPathRegex": "\\.html$"
      }
   }
}
```

Finally now we can test the application by running the below command on terminal.

```
npm run test
```


If you need boilerplate code for Angular app with Jest test framework, please checkout my **GitHub** repo [Angular-with-Jest](https://github.com/Stabarak/Angular-with-Jest.git)
HTTP/2 in Golang
Tags: go, grpc, programming, http2
Published: 2023-03-11 22:18:25

This is the start of a series of posts about two up-and-coming technologies: HTTP/2 and gRPC. Both are closely related and slowly superseding HTTP/1.1.and conventional REST APIs respectively. In this first post, I would like to give a brief introduction to HTTP/2 and how we can enable Golang clients and servers to talk HTTP/2 over both encrypted and unencrypted connections.
[Read more](https://vivilearns2code.github.io/misc/2023/03/11/http-2-in-golang.html)
FREE AWS Cloud Project Bootcamp Week 3 Part 3
Tags: aws, cloud, awscommunity, 100daysofcloud
Published: 2023-03-11 22:14:46

[70/100] #100DaysOfCloud Today, I completed a part of the Week 3 of the FREE AWS Cloud Project Bootcamp by Andrew Brown but came across an error which is hindering me from moving on to Week 4. 

Here's what I completed:
- Implemented JWT verification/authentication on the server side.
- Watched different approaches to verifying JWTs and understood why an approach wasn't chosen and why we kept it simple and clean.
- Watched Ashish's Week 3 - Decentralized Authentication and understood the different types of Authentication, Cognito and its features, Decentralized Authentication Tokens and a few best practices for Cognito.

By doing this, I should have been able to verify, authenticate and authorize on the server side whenever I login but due to the error, my backend port is not opening and not letting me access the data. Spend the whole day trying to solve it. Tried cross checking with the code of someone else who had the same issue and solved it yet no success. Have asked the person to help me figure out the issue and looking forward to that.

[GitHub](https://github.com/aaditunni/100DaysOfCloud/blob/main/Journey/070/Readme.md)

You can watch the Bootcamp through this YouTube playlist : [FREE AWS Cloud Project Bootcamp playlist](https://youtube.com/playlist?list=PLBfufR7vyJJ7k25byhRXJldB5AiwgNnWv)
Nissan Glove Box PIN Code Calculator
Tags: nissan, car, python, immobiliser
Published: 2023-03-11 22:02:59

To generate a PIN code for **immobiliser programming** in Nissan vehicles, the glove box compartment serial number can be used.

This serial number can be obtained by removing the glove box and locating the sticker with the number.

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

Once the serial number is obtained, a PIN code can be generated using [Radio Code Calculator SDK](https://www.pelock.com/products/radio-code-calculator).

It can be done from Python, JS and PHP

```python
#!/usr/bin/env python

###############################################################################
#
# Radio Code Calculator API - WebApi interface usage example for Nissan 
# Glove Box Immobiliser PIN Code Calculator
#
# In this example, we will demonstrate how to generate a code for a specific
# type of car radio.
#
# Version        : v1.1.2
# Language       : Python
# Author         : Bartosz Wójcik
# Project        : https://www.pelock.com/products/radio-code-calculator
# Homepage       : https://www.pelock.com
#
###############################################################################

#
# include Radio Code Calculator API module
#
from radio_code_calculator import *

#
# create Radio Code Calculator API class instance (we are using our activation key)
#
myRadioCodeCalculator = RadioCodeCalculator("ABCD-ABCD-ABCD-ABCD")

#
# generate radio code (using Web API)
#
error, result = myRadioCodeCalculator.calc(RadioModels.NISSAN_GLOVE_BOX, "E9AB99568498")

if error == RadioErrors.SUCCESS:
    print(f'Radio code is {result["code"]}')
elif error == RadioErrors.INVALID_RADIO_MODEL:
    print("Invalid radio model (not supported)")
elif error == RadioErrors.INVALID_SERIAL_LENGTH:
    print(f'Invalid serial number length (expected {result["serialMaxLen"]} characters)')
elif error == RadioErrors.INVALID_SERIAL_PATTERN:
    print(f'Invalid serial number regular expression pattern (expected {result["serialRegexPattern"]["python"]} regex pattern)')
elif error == RadioErrors.INVALID_SERIAL_NOT_SUPPORTED:
    print("This serial number is not supported")
elif error == RadioErrors.INVALID_EXTRA_LENGTH:
    print(f'Invalid extra data length (expected {result["extraMaxLen"]} characters)')
elif error == RadioErrors.INVALID_EXTRA_PATTERN:
    print(f'Invalid extra data regular expression pattern (expected {result["extraRegexPattern"]["python"]} regex pattern)')
elif error == RadioErrors.INVALID_INPUT:
    print("Invalid input data")
elif error == RadioErrors.INVALID_COMMAND:
    print("Invalid command sent to the Web API interface")
elif error == RadioErrors.INVALID_LICENSE:
    print("Invalid license key")
elif error == RadioErrors.ERROR_CONNECTION:
    print("Something unexpected happen while trying to login to the service.")
else:
    print(f'Unknown error {error}')
```

You can also obtain it online using [Nissan Glove Box PIN Code Calculator](https://www.pelock.com/products/nissan-glove-box-pin-code-calculator)
[Spoken Word] From Head to Heart: How APIs are Helping to Mend the Broken Parts
Tags: api, mentalhealth, beginners, leadership
Published: 2023-03-11 21:56:58

**[TRUE STORY]** 

Last night, I had a dream that left me feeling inspired, and in that dream, I dug deep into my heart and mind and found something valuable: solid gold. As I turned it over, I saw a message inscribed on it, and this is what it said:

In a world where mental health can be tough,
Where getting support can sometimes be rough,
Where stigma and shame can leave you feeling alone,
APIs are a tool that we can all own.

From Headspace to Calm to Moodfit,
APIs are providing access to mental health benefits,
Connecting people to resources and care,
APIs are making mental health more fair.

Breaking down barriers and opening doors,
APIs are providing support like never before,
From tracking moods to finding therapy,
APIs are empowering you and me.

With the power of technology at our fingertips,
APIs are providing support with ease and quickness,
Improving lives and making a change,
APIs for mental health are truly amazing.

So let's embrace this innovation with open hearts,
And use APIs to improve mental health and play our part,
To break the stigma and support one another,
APIs for mental health - we're all in this together.

With that said,
<img width="100%" style="width:100%" src="https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExZjZmY2YwMDI4MDFkMWMzNjNmZDhjZTk0Mzc1ZWRiYmYzYTMxYjM4MiZjdD1n/eYgVBZKw2LG6Y/giphy.gif">
Utilizando a Console Java do Chrome para praticar if + else
Published: 2023-03-11 21:33:23

Bom Dia / Boa tarde / Boa Noite 

Estou iniciando meus estudos pelo If e Else na propria console do Chrome , ainda sem IDE. 

Segue esta dica para praticar,, mesmo sem precisar instalar nenhum programa ou IDe. 

Pra quem esta no Chrome / Edge

( Atalho ) = ctrl + shift + i

# Lembrar se na console usar o ( shift junto do enter para ele pular linha  sem ir executando o codigo ) . 

Secue o script

####### Script Console do Chrome ####### 

#var idade  = 15 
#if ( idade < 18 ) {
#   console.log("Menor de idade !") 
#   } else  {
#   console.log("Maior de idade !")
#   }
# #######  #######  #######  #######  #######


Agora , podemos utilzar do ( document.wrhite(""); )
para poder escrever na tela, utilizando um arquivo salvo em bloco de notas.  


Pode tambem salvar um arquivo de texto com o nome e extenção  "Teste.html"

Dentro dele Cole  o Script abaixo.



#<!DOCTYPE html>
#<meta charset="UTF-8">
#<script>
#    var idade = 18 
#    if ( idade < 18 ) {
#        document.write("Menor de idade , pode ir embora para sua #casa ! ")
#    } else {
#        document.write("Maior de idade, pode beber sua cerveja ! #")
#    }
#</script>
C++ vs Python For Loops
Tags: python, cpp, forloops, beginners
Published: 2023-03-11 21:07:48

The very first programming language I interacted with was C++, and that became the language through which I thought about loops. Seeing my first Python for loop was a scary experience, which was surprising as I had always heard Python described as friendly!

Let's take a look at the same loops in C++ and Python 3. The following C++ and Python code will both loop through an array of three fruits.

**C++**

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

**Python**

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

Both of these will output the following:
Apple 
Banana 
Cherry

Some key differences here are that we have to explain what we want to do a little bit more with C++. Statement 1 is used to set a variable before the loop starts (int i=0), statement 2 will gives the condition for the loop to run, and statement 3 increments or decrements the variable. Python is much less wordy. 

To print the numbers 0 through 5, all we would have to do in Python is the following:

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

And this will output 
0
1
2
3
4
5

Whereas in C++, we would do something like this:

int main() {
  for (int i = 0; i < 6; i++) {
    cout << i << "\n";
  }
  return 0;
}

Though switching to Python felt like a big change at first, I soon realized how intuitive it is. Python is flexible, powerful, and easy to learn, making it a great choice for first-timers or experienced programmers looking for a change of pace.
Brand Reputation
Tags: webdev, javascript, beginners, programming
Published: 2023-03-11 20:55:02

When you code, it is important to code towards good goals. I can tell you from experience, even the best written software can harm society more than it helps.

Realizing this and cleaning up the act is the important part. There are so many people who need help with their technology stacks. I am a bit ashamed to have wasted too much time on a few ill ventures.

Time for a restart!

Happy Coding, keep the keyboard tapping.
A Journey Towards a More Accessible and Inclusive Web.
Tags: a11y, webdev, javascript
Published: 2023-03-11 20:44:27

---
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/itqwmlc5o5ejvjp3ijmq.png
---

![Demo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r2red2ca2nsnyh0m1eup.gif)

Greetings, 

Over the past week or so, I have been diligently crafting an extension to improve web accessibility while promoting inclusivity. This project was conceived during a hackathon I am currently participating and has progressed a bit so far. After days of coding and designing, my creation is ready; an extension designed to facilitate website access for those with/without disabilities. 

The extension offers you personalizable options that allow you to tailor your browsing experience according to your needs; thus enabling more inclusive navigation on the internet which will break down barriers faced by disabled individuals online. Furthermore, this tool comes equipped with an intuitive interface.  

Features that the extension offers including but not limited to:

- Promote inclusivity: With features like text-to-speech and dyslexia-friendly fonts, this extension promotes a more inclusive internet for everyone.
- Available for free: This extension is open source and available for free to use on you favorite web browser.
- Customize any web page: Change the font, colors, and layout of any web page to better suit your needs.
- Easy to use: This extension is easy to use and install, so you can start customizing your web pages right away!

This serves merely as one step towards creating equitable digital environment where everyone has equal opportunity when it comes accessing websites regardless of physical limitations or impairments they might possess. In future iterations, plans are underway for even further improvements through additional powerful elements specifically tailored around helping people navigate easier than before. My hope is that together we can create better prospects in terms of convenience from surfing the net!

Thank you for reading about my endeavor! If inspired feel free to reach out, and lemme know your opinions;

🚀 Let us work together now towards making sure no one gets left behind, again!

## Resources

{% embed https://github.com/wiseaidev/flexify %}


{% embed https://github.com/wiseaidev/flexify-landing-page %}