teleren/devto huggingface dataset:
Monitor Tomcat 9 with Prometheus
Tags: prometheus, tomcat
Published: 2022-08-22 01:27:00

Bismillah..

We will configure tomcat server for integration with Prometheus.

Prerequisites:-
- Tomcat 9
- Docker
- Centos 7

**Setting up Tomcat to expose metrics**
Firstly, we need to download [jmx_prometheus_javaagent](https://mvnrepository.com/artifact/io.prometheus.jmx/jmx_prometheus_javaagent) as **jar** and place it in **/tmp**. In this steps, we will be using version _0.16.1_.

Second, we need to create file in $CATALINA_BASE/bin named _setenv.sh_ and add this line into the file:-

```
CATALINA_OPTS="-javaagent:/tmp/jmx_prometheus_javaagent-0.16.1.jar=8088:/tmp/config.yml"
```

Third, we need to create file name config.yml in /tmp and add this line to the file:-

```
startDelaySeconds: 0
ssl: false
lowercaseOutputName: false
lowercaseOutputLabelNames: false
```

Then, we need to restart Tomcat server and the metrics should be available at http://HOST_IP:8088/metrics

you can verify it by running `ps -ef | grep tomcat` 

_Optional_
If not available, this could be you are not open port 8088. To do that, you may follow this step to open it.

```
firewall-cmd --zone=public --add-port=8088/tcp --permanent
firewall-cmd --reload
iptables-save | grep 8088
```

**Configure Prometheus**

1. Create file **promethues.yml** in /home/$USER. And add this line 

```
global:
  scrape_interval:     15s # By default, scrape targets every 15 seconds.

  # Attach these labels to any time series or alerts when communicating with
  # external systems (federation, remote storage, Alertmanager).
  external_labels:
    monitor: 'codelab-monitor'

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: 'prometheus'

    # Override the global default and scrape targets from this job every 5 seconds.
    scrape_interval: 5s

    static_configs:
      - targets: ['localhost:9090']
  - job_name: 'tomcat'
    static_configs:
      - targets: ['HOST_IP:8088']

```
2. Run Prometheus as Docker container 

```
 docker run -d --name=prometheus -p 9090:9090 -v /home/$USER/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus --config.                                                                                                             file=/etc/prometheus/prometheus.yml
```

3. Go to **http://PROMETHEUS_IP:9090** and go to tab **Status->Target**. You will see that Tomcat server status.

[ref](https://www.youtube.com/watch?v=HFE2qHDieSU)

If you're using Tomcat server as container you may execute this

```
docker run -d --name=myapp-p 8080:8080 -p 8088:8088 -v ~/<FILE_NAME>.war:/usr/local/tomcat/webapps/<FILE_NAME>.war -v ~/tomcat-metrics-config/setenv.sh:/usr/local/tomcat/bin/setenv.sh -v ~/tomcat-metrics-config:/tmp -v ~/logs/<FILE_NAME>.log:/usr/local/tomcat/bin/<FILE_NAME>.log tomcat:9-jdk8-corretto
# volume persistence for WAR & LOG file are optional
# make sure you placed the files in the correct location 
```
VS Code Tip of the Week: Tree Find Control
Tags: vscode, vscodetips
Published: 2022-08-22 00:50:00

This week's VS Code tip is the [Tree find control](https://code.visualstudio.com/updates/v1_70#_tree-find-control). Search for files within the tree explorer and have them filter right in the tree view!

Bring focus to your tree explorer in VS Code via keyboard or mouse. From there, press <kbd>CTRL</kbd> + <kbd>F</kbd> (<kbd>CMD</kbd> + <kbd>F</kbd> on macOS) to make the find control appear.

![Tree find control in VS Code](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5je2t9vwn9tilkvpgmwa.png)

In the find control, enter what you're looking for. In my case, I'm looking for files with `svelte` in them.

![Tree find control in VS Code with the word svelte entered](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/54oktefmw59mmv0z3zsm.png)
 
 
Press the filter button or use the keyboard to filter, and voilà!

![Tree find control in VS Code with the word svelte entered displaying filtered files in the tree view](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r7fym384hayk6ej0p79n.png)

And that's it! Happy VS Coding!
GrabJobs - Grow with us!
Tags: recruiting, recruitment
Published: 2022-08-22 00:37:57

GrabJobs is an end-to-end hiring automation platform enabling employers and job seekers to connect seamlessly.

At GrabJobs, we make the job search and application experience accessible and enjoyable: job postings are powered by interview chatbots designed to streamline interactions between candidates and employers.

Employers enjoy an efficient recruiting automation platform packed with all the features you need to hire employees and source the best talent. GrabJobs combines automated candidate scoring and filtering, a user-friendly applicant tracking system, a smart interview scheduler to help you get rid of repetitive traditional hiring tasks, and most importantly, it allows you to post job ads on multiple platforms with one click.

https://grabjobs.co
Tea Shop Recommendation System
Tags: python, algorithms, programming
Published: 2022-08-22 00:09:46

# What is it?
This program is used to return a list of possible items based on the user's input string.

# Why?
I really like Chinese tea just as my father. He owns a tea shop called Orijin Tea. I tried to use the official website and found out that the search results were not so accurate. I suddenly realized that I can improve the search functionality.

# Brief Methodology
There are two major parts to this system: saving data and retrieving data. The raw data are stored in a 2d python list. I put this data set into a hash table before running through the algorithm. To retrieve the correct product, I take the user input and go through each product. If the user input appears inside the product, then we can print that product for the user (in a specific format). 

# Current Progress
Right now, the program can quickly handle the whole tea collection at Orijin Tea (approximately 135 types of Chinese Tea). As the user types in a search text, the program suggests a few possible products, including the rating, price, tea origin, and its name.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d7k85nrxljvc9w4iw2m1.png)
(The ratings section is not set yet.)

The current data retrieval is good enough for small data. I tested it with 20k sized data set (20k tea data) and the time it iterated through the whole data set was approx. 0.04s.

# Next Steps
I am considering to implement this functionality into GUI to visualize it better. Function wise, I am still trying to implement a better algorithm which can handle larger data sets.

If you want to see more details in code, follow on GitHub:
[Link](https://github.com/OrijinTech/TeaRecommendation)


Thank you for reading it through! ^_^
Chrome插件开发 - Switch to vite
Published: 2023-08-13 13:31:09

---
title: Chrome插件开发 - Switch to vite
published: true
date: 2022-08-22 00:00:00 UTC
tags: 
canonical_url: https://manon.icu/blog/translate/build-chrome-extensions/parcel-to-vite
---

在上一篇文章[【Spicing with react】](https://manon.icu/blog/translate/build-chrome-extensions/spicing-with-react)学习了使用 react 创建新标签插件。

这篇文章替换掉 parcel，切换到 vite

删除`.parcel`

删除`package.json`内的`"parcel": "^2.7.0","parcel-reporter-static-files-copy": "^1.3.4",`

添加`vite`

```json
{
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "preview": "vite preview"
  },
  "dependencies": {
    "vite": "^3.0.4"
  },
  "devDependencies": {
    "@vitejs/plugin-react": "^2.0.0"
  }
}
```

重命名文件

- `App.js`=>`App.jsx`
- `Counter.js`=>`Counter.jsx`
- `index.js`=>`index.jsx`

将`index.jsx`移动到`src`

重命名`static`为`public`

由于没有使用`index.html`，所以要在`vite.config.js`特殊声明一下

```js
import {defineConfig} from 'vite'
import react from '@vitejs/plugin-react'

export default defineConfig({
  plugins: [react()],
  build: {
    rollupOptions: {
      input: {
        app: './new-tab.html'
      }
    }
  }
})
```

跑起来

```bash
npm run build
```

[【Source Code】](https://github.com/rebelchris/new-tab-extension/tree/vite)
Data Engineering 101: Introduction to Data Engineering
Tags: dataengineering, python, sql, beginners
Published: 2022-08-21 23:20:00

Data is growing at a very fast speed. Data can be tapped to guide in decision making and predicting the future. The amount of value derived from data is dependant on:

1. the accuracy of the data
2. and the efficiency with which we are able to access the data we need. 
The goal of Data Engineering is to make Data available for the purpose of fact finding and data-driven decision making. 

In layman's language, Data Engineering deals with the flow of data.
The field of Data Engineering involves:

- Collecting Data: this includes extracting, integrating, and organising data.
- Processing Data: this entails cleaning, transforming and preparing data for use. This is where you also design [Data pipelines](https://www.snowflake.com/guides/data-pipeline#:~:text=A%20data%20pipeline%20is%20a,used%20to%20develop%20business%20insights.) for extracting, transforming and loading data.
- Storing Data: this is where you ensure that systems are in place that take care of data privacy 
- Making Data available to users securely: this includes the use of APIs, services and programs for retrieving data for end-users.

Data Engineering involves understanding the complexity of Data and learning how to use data to drive decisions.
The Commute Rule
Tags: productivity
Published: 2022-08-21 23:15:06

**The Commute Rule**: If you are too sick to commute to the office, don’t work from home

This year I have fallen into a bad habit: being moderately sick, but pushing through the sickness and working from home. Since the beginning of COVID I have been working from home. Something I have become aware of is that the barrier to get to work when working from home is extremely low. All I need to do is slink over to my desk, sit upright and clink away on my keyboard. I usually can do that even when I am moderately unwell.

In the past I have written about why I think it is important that we rest when we are sick: [Take a real sick day](https://www.atlassian.com/blog/productivity/take-real-sick-days-work-life-balance) and I still stand by that.

Taking time to recover well seems to lead to shorter illnesses

Working while moderately sick is pretty miserable for everybody and fosters a culture where people feel pressured to work while unwell

Taking a _real_ sick day challenges us to find our self worth outside of our outputs

Sometimes we can be "sick" and it is mild, and has no real impact on our days (eg a small cough). What I needed was some good general rule that I could use for myself that would help me decide whether I was too sick to work from home. A rule I came up with was **the commute rule**: If I don’t think I am well enough to have a shower, get changed, walk to the train station, catch a train for 45m to the city and walk to the office; then I should not work from home. If I was working in the office, I would not be going to work if I was unable to do the commute. I can apply the same test for working from home.

This rule isn't perfect:

- People have different commutes
- You might be not wanting to commute due to infectiousness, and not ability
- Probably a few other reasons

Even though this rule isn’t perfect, I have personally found it useful I thought I would share it.

I hope you are doing well,

Cheers
O que é ORM - Mapeamento objeto-relacional
Tags: orm, ruby, sql
Published: 2022-08-21 23:08:01

Object-Relational Mapping (ORM), em português, mapeamento objeto-relacional, é uma técnica utilizada para fazer o mapeamento entre sistemas orientados a objetos e bancos de dados relacionais. Onde as tabelas do banco de dados são representadas em classes e os registros das tabelas seriam instâncias dessas classes.

No mercado existem dois padrões que são amplamente utilizados, o Data Mapper e o Active Record. Ambos os padrões foram definidos por Martin Fowler em seu livro Padrões de Arquitetura de Aplicações Corporativas.

O ActiveRecord é uma camada de código Ruby que é executada entre seu banco de dados e seu código lógico.

Falando especificamente do Ruby,que faz uso incrível de técnicas de metaprogramação para fornecer uma enorme quantidade de funcionalidades prontas para uso, o que podem parecer mágica às vezes por não estamos acostumados a esse tipo de lógica ou porque não a entendemos completamente.

Um dos benefícios de usar Rails e ActiveRecord é que ele cria uma matriz de acessadores de atributo e métodos de busca dinâmica que correspondem às colunas nas tabelas do banco de dados.

Existem métodos para todos os tipos de transações, inserir, atualizar, localizar, excluir. Todos eles funcionam de maneira semelhante: os parâmetros são recebidos, em seguida, uma consulta SQL é gerada e, em seguida, é executada para que as informações sejam atualizadas no banco de dados.

Quando você precisar fazer alterações no banco de dados, você escreverá o código Ruby e, em seguida, executará "migrações" que farão as alterações reais no banco de dados. A parte legal é que não importa qual banco de dados você está usando: Rails pode lidar com praticamente todos eles, e o formato do método será sempre o mesmo.

Para pessoas desenvolvedoras, é uma  ferramenta importante que ajuda a aumentar sua produtividade, seja criando CRUDs e acessos à dados, ou apenas, quando o desenvolvedor precisa fazer códigos repetitivos, é uma mão na roda.

O ORM pode ser bastante útil para o desenvolvedor que ainda não domina muito bem como funciona a persistência de dados.

Então se você está começando na carreira de desenvolvedor, é importante reservar tempo para estudar ORMs relacionados a sua linguagem de programação preferida.
Why choose Nodejs for your nextjs webscraping project ✔
Published: 2022-08-21 22:57:06

**Something I never understood, was why people forget about NodeJS to web scraping to use Python instead.**

It seems it's forgotten JavaScript it's the language for the web, and always have great libraries been released for good or bad.

On my experience with Web scraping and Web automation, each project has it own issue, and it seems NodeJS has always the tool for what it needs.

- If you have to scrape a simple page, just use libraries to make requests, or maybe even the native Fetch module can fit.

- When scraping a page "JS Rendered"(React, Svelte, Vue) use Puppeteer/Selenium or Playwright the new Browser Automation lib written by Google

- Sometimes when scraping, even using a Browser Automation Lib, websites may block you, using bot detection. Well, that was the main point that you should consider yourself replacing Python by NodeJS for some cases, simple because NodeJS has a great tooling to avoid bot detections when scraping, such as:

1.Puppeteer-extra that comes with great plugins for Puppeteer, and more recently they are updating to use playwright as well. You can use puppeteer-stealth to avoid detection.

2.To avoid bot detection with simple requests scraping, just try to replace the user -agents and other tiny things, libs like Axios, got can make this work totally fine with just some adjustments.

3.And of course, now we have Crawlee, "A full-featured library that helps you build reliable crawlers with NodeJS", think in Scrapy but for NodeJS, this for sure will facilitate the work for all of us, because this lib can handle with Bot detections, Storage, Proxy Management, and other problems related with web scraping out of the box, which can be great for the majority of use cases. 


This post do not intend to claim the NodeJS use for web scraping over python, but let the people know about how NodeJS can be not only suitable, but a great decision for your next scraping project 😁
Javascript Tagalog - String charAt Method
Tags: javascript, tagalog, pinoy, charat
Published: 2022-08-21 22:29:00

**Ano ngaba ang String charAt method sa Javascript?**
**Pano gamitin:**
**First Argument** - bigay mo yung index (number) tapos re return niya yung character na nasa index nayon

```javascript
const x = 'Hello'

console.log( x.charAt(0) ) // H
console.log( x.charAt(1) ) // e
console.log( x.charAt(2) ) // l
console.log( x.charAt(3) ) // l
console.log( x.charAt(4) ) // o

// di naapektuhan yung original string
console.log( x ) // Hello
```


Notice from: [Frank Wisniewski](https://dev.to/frankwisniewski/comment/2162a)
**"this only works as long as the strings do not contain unicode characters"**
so pag may emoji or unicode characters gumamit nalang ng [match](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match) method


---

**More tagalog Javascript Learning Resources:**
https://javascript-methods-in-tagalog.vercel.app/
Encapsulamento Java
Published: 2022-08-21 22:53:32

   Conhecido como um dos pilares da programação orientado a objeto (POO) em Java, em poucas palavras, o encapsulamento é o processo de esconder ou guardar os detalhes do funcionamento de um objeto e o que sobra visível é sua interface, isto é, o conjunto de todas as mensagens que ele pode responder.

   Encapsular “**não é obrigatório**”, mas, é uma boa prática para conduzir Classes mais eficientes.

   De modo mais simples é o ato de deixar privado os atributos do objeto, fazendo com que os mesmos, só podem ser acessados através dos métodos getters e setters, deixo um exemplo nas imagens abaixo.

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

Conheça meu GitHub:  https://github.com/Rodrigopca42
Send Magic Link 500 - Ghost Mail Error - Ghost unable to send emails
Tags: ghost, blog, errors
Published: 2022-08-23 12:07:30

---
title: Send Magic Link 500 - Ghost Mail Error - Ghost unable to send emails
published: true
date: 2022-08-21 22:48:25 UTC
tags: ghost,blog,error
canonical_url: https://lucas-schiavini.com/send-magic-link-500-ghost-mail-error/
---

 ![Send Magic Link 500 - Ghost Mail Error - Ghost unable to send emails](https://images.unsplash.com/photo-1623018035782-b269248df916?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwxMTc3M3wwfDF8c2VhcmNofDF8fGVycm9yfGVufDB8fHx8MTY2MTEyMjA4MA&ixlib=rb-1.2.1&q=80&w=2000)

So after updating to the 5.10 version of ghost to get some native comment functionality, my email sending capacity broke down.

I started getting 500 from the /send-magic-link HTTPS call.

But thanks to this [thread](https://forum.ghost.org/t/ghost-unable-to-send-emails/9934) I managed to sort it out again.

Here's the latest _ **config.production.json** _ that worked for me.

```
 "mail": {
    "from": "<EMAIL>",
    "transport": "SMTP",
    "options": {
      "service": "Mailgun",
      "host": "smtp.mailgun.org",
      "port": 465,
      "secure": true,
      "auth": {
        "user": "<USER>",
        "pass": "<PASS>"
      }
    }
  },
  "tls": {
    "rejectUnauthorized": false
  },
```

Thanks to this dude here for the solution: [https://forum.ghost.org/t/ghost-unable-to-send-emails/9934/33](https://forum.ghost.org/t/ghost-unable-to-send-emails/9934/33)

---

## 😗 Enjoy my writing?
Forward to a friend and let them know where they can subscribe (hint: it’s [here](https://lucas-schiavini.com/#/portal)).

Anything else? Just say hello in the comments :).

Join an Exclusive Tech Friendly Community! Connect with like-minded people who are interested in tech, design, startups, and growing online — apply [here](https://yv4sdz1j7rv.typeform.com/to/lMJ2yhuJ).
From Java 8 to Kotlin, Clojure and Java 17
Tags: java, clojure, kotlin, 100daysofcode
Published: 2022-08-21 22:41:00

# Clojure
### 100DaysOfCode
💻 Clojure implementation. No objects,  no sealed classes, no inheritance. Just pure functions with immutable data structures. 

📝 Pending : article explaining the differences and principles of the  languages used in the book parser example 

https://github.com/jorgetovar/from-java-8-to-java-17-kotlin-clojure/tree/main/clj-11
Understanding Xamarin and Xamarin.Forms
Tags: xamarin, xamarinforms, mobile, beginners
Published: 2022-08-21 22:21:37

[Xamarin](https://bpbonline.com/products/xamarin-with-visual-studio?_pos=1&_sid=cbe7972eb&_ss=r) is a development technology that makes it possible for developers skilled in C# and the Microsoft stack to build applications for several operating systems.

More specifically, Xamarin groups the following development platforms:

- Xamarin.Android, a set of [.NET](bpbonline.com/search?q=.NET&type=product) libraries and tools that allow you to run C# code on Android devices. This is possible because Xamarin.Android translates, behind the scenes, all the work done in C# into the Java equivalentand invokes the proper Java and Google tools to create theapplication binaries. As an implication, Xamarin. Android requires the Java Software Development Kit (SDK) and tools like the Android SDK Manager and the Android Device Manager. 

- Xamarin.iOS, a set of .NET libraries and tools that allow you to run C# code on iPhone and iPad devices. Behind the scenes, Xamarin.iOS translates all the work done in C# into the Objective C equivalent and invokes the Apple developer tools to create the application binaries. 

- Xamarin.Mac, a set of .NET libraries and tools that allow you to run C# code on macOS machines, building desktop applications. Like Xamarin.iOS, it translates all the work done into the Objective C equivalent and invokes the Apple developer tools to create the application binaries.

- Xamarin.Forms, one library that makes it possible to target multiple platforms from a single, shared codebase. Behind the scenes, Xamarin. Forms invokes both Xamarin.Android and 

- Xamarin.iOS, and then these twoplatforms do the job of invoking the appropriate native tools to create the application binaries.

Xamarin.Android and Xamarin.iOS make it possible to access the native API of the operating systems they target, whereas Xamarin.Forms needs to pass through them. This is also why you will often hear developers talk about Xamarin native when referring to Xamarin.Android and Xamarin.iOS.

**Advantages of Xamarin.Forms**
Xamarin native platforms require you to know the operating systems' API in detail. Moreover, you will still need two different projects: one for Android and one for iOS. You will be able to share some logic between the two, but all the user interface and access to the device features need separate work and effort. 

With Xamarin.Forms, you have the following advantages instead:

- You do not really need to know the native API in detail (though always recommended) because you have code that is common to all the platforms.
- You can target multiple platforms from one codebase.
- Xamarin.Forms can also target the Universal Windows Platform from the same codebase, allowing you to make your code run on Windows 10 as well.
- You write, debug, and maintain code once, not twice, with a reduced effort.
- You will still publish two different applications, but this is also what you would do with Xamarin.Android and Xamarin.iOS. 

Hope this was helpful.
React Journey - My First Project (pt. 1)
Tags: react, javascript, webdev, beginners
Published: 2022-08-21 22:17:00

Hello, World!

I've recently begun dabbling in React and thought I'd document my journey with you guys.

I'm sure most of you can relate to wanting to learn a new language, framework, design pattern, etc., but not having a useful sample project to work on. My solution to this was coming up with a small blog project that will be iteratively improved on as I learn more about the framework.

I've outlined 3 different versions of the blog application, with each version either adding a new feature, or improving an existing feature. 

**v1.0**
- Base React App
- Load blog posts from static JSON file
- Render a feed of posts
- Dockerize and deploy to Dokku server

**v1.1**
- Implement React Router
- Create a blog post page that renders contents of single post

**v1.2**
- Load data from external source (dev.to feed)


By the end of this project I should have a decent understanding of creating a basic React application. Follow along and see my progress as I create more posts!

View v1.1:
http://blog.caldwell.digital