teleren/devto huggingface dataset:
Python Flask with oracledb connection
Published: 2024-01-30 22:49:10

Hello,

I am new to Flask web development. I am building an application with connection to an on premise oracle database. I have a login form and on submission of that form, I use the provided credentials to create an oracle connection pool. I have set up the Oracle connection pool in a function with userid and password as parameters. The oracle connection function is called from the login form by passing in the userid and password. Am I exposing the password by passing it in to the function? My webapp does not need a register form and so I am not writing any hashed password to the database. I am just making the oracle connection, and if it fails, I assume the person does not have an oracle account in our database.

Here is a snippet from my code:
from flask import Flask, render_template, redirect, url_for, session, request, g
from flask_bootstrap import Bootstrap
from flask_wtf import FlaskForm 
from wtforms import StringField, PasswordField, BooleanField
from wtforms.validators import InputRequired, Email, Length
from flask_sqlalchemy  import SQLAlchemy
from werkzeug.security import generate_password_hash, check_password_hash
from flask_login import LoginManager, UserMixin, login_user, login_required, logout_user, current_user
import oracledb
import getpass
from flask_cors import CORS
import bcrypt

# start_pool(): starts the connection pool
def start_pool(user,password):

    if "pool" not in g:
        g.pool = oracledb.create_pool(user=user, password=password,
                             dsn="xxxxxxxxxxxx",
                min=5,
                max=20,
                increment=1,
                )
    return g.pool


app = Flask(__name__)


Then from the login form, on submission I call the above function as follows:
g.pool = start_pool(form.username.data,form.password.data)
pool = g.pool

The above code works fine. But I am concerned about exposing the password. What is the best way to safely send the user provided credentials to the connection pool? 

Thanks in advance for any tips you can provide!
Fitter - open-source instrument for amazing scraping.
Tags: programming, webdev, opensource, go
Published: 2024-01-30 22:46:18

---
title: Fitter - open-source instrument for amazing scraping.
published: true
description: Tool which can do a lot of stuff. 
tags: programming, webdev, opensource, go
cover_image: https://github.com/PxyUp/fitter/raw/master/demo.gif
# Use a ratio of 100:42 for best results.
# published_at: 2024-01-30 21:57 +0000
---

### Hello everyone!

I want to introduce [Fitter](https://github.com/PxyUp/fitter) for you.

{% embed https://github.com/PxyUp/fitter %}

This tool can do a lot of stuff:

1. Read content by XML/XPath/Json/HTML selectors
2. Emulate browser with docker/playwright/chromium
3. Support proxy
4. Global references
5. Fallback on no empty fields
6. Notification Telegram/Http/Redis/Console
7. File downloading
8. Full [README.md](https://github.com/PxyUp/fitter/blob/master/README.md)
9. Can work as golang library
10. Support runtime golang plugins
11. Work as CLI
12. Works on Linux/Mac/Windows.
13. Support different type of fields
14. Support [expression language](https://expr-lang.org/) for field and notification settings


......

N+1. **Best and most important it is gluing of request**

Repository have a multiple examples for CLI/Fitter

### Real world example of the problem

Last week my friend need to monitor pool on some crypto stock. So here his problem:

1. First of all you need get all user positions https://docs.saucerswap.finance/v/developer/saucerswap-v2/liquidity-operations/get-user-positions
2. After that all stock pool https://docs.saucerswap.finance/v/developer/saucerswap-v2/liquidity-operations/fetch-all-pools
3. After that you should check if pool has user positions you should send notification.

Let's see how Fitter can solve this problem:

{% embed https://gist.github.com/PxyUp/f78b3bd5e278df23944f861b9062176f %}

Let me explain what is here:

1. environment variables:

**TELEGRAM_TOKEN** - line 95

**USER_ID** - line 37

So my friend need just run Fitter and add UserIds for Telegram notification(line 95):

```bash
TELEGRAM_TOKEN=xxx USER_ID=xxx ./fitter --path=./config.json
```

2. What happens in config:

2.1 Creating Reference(line 3) on all pools and caching on 60 seconds(line 4). We take the response and create an array of the objects with two fields tokenA and tokenB.

2.2 Creating Reference(line 33) on AccountId will be just string from ENV.

2.3 We create items for monitoring every 10 seconds(line 88) which take values from the server via injecting AccountIdRef(line 52). Response it is array of objects with two field: first it is (line 66) - template string with injecting token name; second is boolean field which show if pair in pool(line 71)

3. Next we will inform if some of the values in array is true(line 93).

We will receive notification in Telegram:

```json
[
 {
  "position": "tokenA=USDC tokenB=USDC[hts]",
  "value": true
 },
 {
  "value": false,
  "position": "tokenA=USDC tokenB=USDT"
 }
]
```
Next.js Codebase Analysis <> create-next-app <> index.ts explained - Part 1.9
Tags: webdev, javascript, nextjs, react
Published: 2024-01-30 22:40:46

In the previous article, I talked about projectPath error handling.

In this article, I will explain the following code snippet:

```
// let's log this and see what is that values its got
  const resolvedProjectPath = path.resolve(projectPath)
  const projectName = path.basename(resolvedProjectPath)
  console.log("resolvedProjectPath", resolvedProjectPath)
  console.log("projectName", projectName)

  const validation = validateNpmName(projectName)
  if (!validation.valid) {
    console.error(
      `[TEST]::Could not create a project called ${red(
        `"${projectName}"`
      )} because of npm naming restrictions:`
    )

    validation.problems.forEach((p) =>
      console.error(`    ${red(bold('*'))} ${p}`)
    )
    process.exit(1)
  }
```

The [validate-prop]:: in validate: prop below, I could not find it when I executed the build with invalid project name.

```
if (!projectPath) {
    // Read more about prompts here: 
    // https://www.npmjs.com/package/prompts
    const res = await prompts({
      // onPromptState is a function available at
      // https://github.com/vercel/next.js/blob/canary/packages/create-next-app/index.ts#L25
      onState: onPromptState,
      type: 'text',
      name: 'path',
      message: 'What is your project named?',
      initial: 'my-app',
      // validates ensures to follow npm package name guidelines
      // availabe here: https://www.npmjs.com/package/validate-npm-package-name
      validate: (name) => {
        const validation = validateNpmName(path.basename(path.resolve(name)))
        if (validation.valid) {
          return true
        }
        return '[validate-prop]::Invalid project name: ' + validation.problems[0]
      },
    })

    if (typeof res.path === 'string') {
      projectPath = res.path.trim()
    }
  }
```

I have updated the console.error with [TEST] and let’s provide an invalid project name and see if this [TEST] is ever logged due to invalid project.

Build the project and execute `npx create-my-app INVALIDPROJECTNAME`


![Project Name Validation](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uomh9wylr8107j7jyvn9.jpeg)

## Conclusion

I wonder what is the purpose of validate property in prompts when this validation error is handled outside of that block. hmm… interesting.

I am building a platform that explains best practices used in open source by elite programmers. [Join the waitlist](https://docs.google.com/forms/d/e/1FAIpQLSe2JCZAaIB5oXzNHLTrYJR4LMZ5SEwrGPgmG5DeFWdDhu8-Gw/viewform) and I will send you the link to the tutorials once they are ready.

If you have any questions, feel free to reach out to me at ramu.narasinga@gmail.com
Unlocking Digital Advertising Mastery: Your Roadmap to Success with Google Ads 🚀💡
Tags: beginners, tutorial, learning, google
Published: 2024-01-30 22:12:03

Embark on a journey to elevate your online presence! 🌐 Our latest guide is your compass to navigating the realm of effective digital advertising. From boosting sales to promoting apps, discover the secrets of driving targeted traffic and maximizing ROI. 📈 Ready to fuel your success? Dive into the details, explore various campaign types, master optimization strategies, and stay ahead of industry trends. Your flourishing with Google Ads begins here! 🚀💻 #GoogleAds #DigitalMarketing

🔗 Read the full guide: [Fuel Your Success: Your Guide to Flourishing with Google Ads](https://davagordon.co.uk/blog/fuel-success-your-guide-to-flourishing-with-google-ads-start-your-journey-now/)"
🛀 CleanUp in React
Tags: webdev, beginners, react, javascript
Published: 2024-01-30 21:47:55

**Task:** Do something after the initial render happens. For instance, log this text ("Hey jorjis, close me ❌") in the console after every second.

**Solution:** 

```jsx
import { useEffect} from "react";

const User = () => {

  useEffect(() => {
    setInterval(() => {
      console.log("Hey jorjis, close me ❌");
    }, 1000);
  }, []);

  return (
    <div className="user-card">
      <h1>Name: Jorjis</h1>
      <h2>Location: Dhaka, Bangladesh</h2>
      <p>Contact: speak.jorjis@gmail.com</p>
    </div>
  );
};

export default User;
```

**WHAT do you think ? Will this code work ? 🧐**

<br>


Okay, let's visualize the outcome:

![A preview of code output](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eoduy60q22zffs4qeu8t.gif)


**Explanation:** Our app requires at least two pages to understand the underlying concept. So, I set up accordingly. Let's zoom in on what's going on here.

- Our code works as we wanted, right?
- There is a glitch. So, When I go from the 'About' page to the 'Contact' page, this function called `setInterval` is supposed to stop, but it doesn't. And then, when I come back to the 'About' page from the 'Contact' page, the `setInterval` function runs faster than before. It's because another `setInterval` function is scheduled to run.
- it will schedule numbers of the `setInterval` function as I navigate back and forth to the `about` page.
- which might lead to memory leaks. We need to build our **CLEANUP** logic to fix it right away.

## Corrected Code (functional-component):

```jsx
import { useEffect} from "react";

const User = () => {
  useEffect(() => {
    const timer = setInterval(() => {
      console.log("Hey jorjis, close me ❌");
    }, 1000);
    return () => {
      clearInterval(timer);
    };
  }, []);
  return (
    <div className="user-card">
      <h1>Name: Jorjis</h1>
      <h2>Location: Dhaka, Bangladesh</h2>
      <p>Contact: speak.jorjis@gmail.com</p>
    </div>
  );
};

export default User;
```

Here, I return a callback function from useEffect. The callback function will be invoked after the component is unmounted. And I wrote the `cleanUp` logic as the task required.

<br>

Now, we'll see how we used to write react code to get this functionality, which refers to refactoring our react code in the class component.

## In Class Component:

```jsx
import {React} from 'react';

class UserClass extends React.Component {
  constructor(props) {
    super(props);
  }

  componentDidMount() {
    this.timer = setInterval(() => {
      console.log("Hey jorjis, close me ❌");
    }, 1000);
  }

  componentWillUnmount() {
    clearInterval(this.timer);
  }

  render() {
    return (
    <div className="user-card">
      <h1>Name: Jorjis</h1>
      <h2>Location: Dhaka, Bangladesh</h2>
      <p>Contact: speak.jorjis@gmail.com</p>
    </div>
    );
  }
}

export default UserClass;
```
Advertica cpa marketing per 1000 view
Tags: webdev, python, react
Published: 2024-01-30 21:45:02

Unlock Your FREE Cash App Gift Card Now!

Ready score some easy cash? We've got an exclusive offer just for YOU!

Why Wait? Claim Your FREE Cash App Gift Card TODAY!

What You Gets

Instant Access to a FREE Cash App Gift Card CPA Exclusive Offer No Strings Attached!

Fast and Easy Redemption Process Valid Worldwide Everyone is Welcome!

[

1. [Claim  Your Gift Card
](https://www.toprevenuegate.com/jtpsijset?key=10bcd020f7b6f1d170e27c9fc838d26d)
$750 Cash App Gift Card Giveaway
Published: 2024-01-30 21:24:08

Unlock Your FREE Cash App Gift Card Now!

Ready score some easy cash? We've got an exclusive offer just for YOU!

Why Wait? Claim Your FREE Cash App Gift Card TODAY!

What You Gets

Instant Access to a FREE Cash App Gift Card CPA Exclusive Offer No Strings Attached!

Fast and Easy Redemption Process Valid Worldwide Everyone is Welcome!

[Clain Your Gift Card](https://www.toprevenuegate.com/jtpsijset?key=10bcd020f7b6f1d170e27c9fc838d26d)
My Mistake: Learning too fast
Tags: learning, computerscience, beginners, programming
Published: 2024-01-30 21:19:57

> Disclaimer 1: The most significant impact I wish for this article to have is on myself.
> Disclaimer 2: The purpose of this article is to encourage a thoughtful slowdown for a beneficial reason.

## Backstory
I always wanted to be knowledgeable in many different areas and have the qualities of a jack of all trades. I have a lot of respect for people who are very good at one thing; they are very important to the progress in their fields and have made a big contribution to the achievements of today.

But knowing that we only have one life motivates me to strive to be a jack of all trades. My drive to discover and acquire as much knowledge as I can stems from the fact that death is inevitable. At first, this method worked for me, but as I moved into my late 20s, I realized that learning at a slower pace could improve my effectiveness. I was anxious to learn as much as I could quickly because I believed that the more I learned, the more I could explore. Despite being reasonable, this way of thinking caused me to only understand many things on the surface, never reaching a level of comprehension that I found satisfactory—a subjective and personal standards.

So what, in my opinion, makes this "satisfactory level"? I'm studying to the point where I can confidently answer questions and mentor others on the subject, providing concise explanations and setting the foundation for the way they learn. 

## The Mistake
From the above 3 paragraphs you probably got the idea of the mistake I am about to talk about i.e learning too fast. I didn't believe that there is something called "learning too fast" until recently when I turned around to see how I got to where I am, don't get me wrong, I am very happy where I am but it is important to acknowledge the mistakes and better one self.

I just think that if I slowed down and took my time learning each topic or in my case, programming languages or a certain technology or concept, than I would have achieved more than what I did as of now, I failed to tell myself that **it's not a race but a marathon**. Going forward I want to set goals trying to slow myself down when it comes to learning and will not fall into the trap of FOMO(Fear of Missing out). 

Next time you feel like you're not learning fast enough just tell yourself that it's okay, it's okay to take your time to learn. **It's okay to slow down at times.**
ESRS Blog Post #1: Project Ideas
Published: 2024-01-30 20:58:52

**Introduction:**

- This project involves large-scale software production. We will be doing a step-by-step account of the development life-cycle with an emphasis on site reliability and scalability. In this post we will start with our ideas. 

**Team Introduction:**

1. Uche Okeke
2. Samuel Adjei
3. Gavin Madanhi
4. Nidhish Nade
5. Sam Hewitt
6. Tyler
What about starting a new platform?
Tags: programming, nextjs, nosql, openai
Published: 2024-01-30 20:58:45

Twenty-five years ago, a significant leap in software development speed occurred when Borland Delphi entered the market with an entirely new approach: component-driven visual programming. Around that time, ideas for integrating relational databases into the object-oriented world evolved into robust ORM concepts. While numerous developers were stuck with either the laborious task of C++ development using the complicated MFC library or the clumsy and limited Visual Basic interpreter, we were eager to dive into this brave new world. With a small team of ten developers, we won a competition over more formidable and larger rivals, becoming one of the IT leaders in our country for the next two decades.

Over the last two years, I have dedicated my time to studying new technologies and observing the trends in modern software development. Now, I have a strong sense of déjà vu. We are once again on the cusp of a new technological shift, and those who quickly board this accelerating train will reap the most significant benefits, vastly outperforming competitors who cling to obsolete platforms and tools.

If I were to start a new platform right now, I would undoubtedly use the following strategies:

1. Full-stack development using Node.js, Next.js, and React Native. This approach is a significant time and effort saver. In our recent projects, we often have developers single-handedly implementing a complete feature—including server-side code, web application, and mobile applications for both Android and iOS—in just one to two weeks. I know teams that adhere to the classic back-end/front-end separation and spend more time just discussing data exchange protocol details.

2. Decouple the ER model from the physical database. This flexibility allows easy switching and mixing of SQL/NoSQL databases. When we were laying the first modules of our Gedemin platform in the late '90s, the low-level integration with the database driver code allowed us to utilize every bit of memory (which was scarce at that time) and maximize CPU cycle efficiency. Times have changed, and computational power is much cheaper now; there's no need to be as frugal as we once were.

3. Avoid manually drawing the UI. Well, JSX is great, but instead of mixing your code with HTML tags, build an engine that renders screens and forms based on ER entities and provided rules. This approach allows you to change the program's look and feel as easily and quickly as a snake sheds its skin during molting.

4. Eliminate even the slightest compatibility concerns. Embrace every novel feature CSS/HTML/JS has to offer without fear. By the time your program hits the market, these technologies will be implemented in even the most basic devices. 

5. Integrate AI services extensively. Functions like natural language queries, human-like summaries and reports, and interpretation of commands and instructions, once the stuff of science fiction books 15–20 years ago, are now just a matter of making calls to the OpenAI API.
Fetch data when empty
Published: 2024-01-30 20:57:04

Earlier I had a task to use view model to fetch data, it worked well, but the problem is it loads data every time the view is loaded, it creates unnecessary amounts of network calls, and can even cause app to crash.

In the challenge I tried to finish, the advice was "Before you start your download, check that your array is empty so that you don’t keep starting the download every time the view is shown."

So to resolve this particular problem, I added a simple check like this and it works pretty well:

```
.task {
        if viewModel.arrayName.isEmpty {
          await viewModel.fetchData()
        }
      }
```
DateDecodingStrategy
Published: 2024-01-30 20:52:38

Example date: "2014-11-24T05:52:18-00:00"
Question: how to decode it into Date type?

Each user registered has a very specific format: `2015-11-10T01:47:18-00:00`. This is known as `ISO-8601`, and is so common that there’s a built-in dateDecodingStrategy called .iso8601 that decodes it automatically.

Solution:
In the URLSession part to decode data, define the decoder to use this dateDecodingStrategy like this:

```
let decoder = JSONDecoder()
decoder.dateDecodingStrategy = .iso8601
```
then return the decode data:

```
return try decoder.decode([T].self, from: data)
```
Introducing GPT-4 Support, Syntax Highlighting and more — Griv
Tags: chatgpt, ai, productivity, macos
Published: 2024-01-30 20:48:02

> _[Griv](https://grivhq.com) is a snappy ChatGPT client for your Mac. Invoke it with a hotkey and harness the power of AI within your workflows. Get it at https://grivhq.com_

We’re excited to launch Griv v2.3.1 📣. Read on to learn about the changes in this latest version.

## 1. GPT-4 Support
Until now, Griv has been using GPT-3.5-Turbo internally. However, you now have the option to use GPT-4 if you prefer.

![ChatGPT4 Support](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2qxa4hi1hr27sh1klmk2.png)

## 2. Syntax Highlighting
Code blocks are now displayed with beautiful syntax highlighting.

![Code Highlight](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4huefsykljgfw2d0zjld.png)

## 3. Shortcut to Search Conversations 🔎

In our last update, we introduced ‘Search Conversations’ to our software. To enhance your search experience, we have also added a keyboard shortcut ⌘+⇧+F (Cmd+Shift+F). This shortcut allows you to quickly initiate your search, making it easier and more convenient. Try it now and experience lightning-fast searching with just a few keystrokes! ⚡

Ready to unleash your productivity? Download Griv at [https://grivhq.com](https://grivhq.com).

Contact support@starlabs.ai ✍ for any questions or feature requests.
sudo su remove `personal_access_tokens`
Tags: php, legacy, laravel, modernization
Published: 2024-01-30 20:21:22

## Legacy projekt Laravelesítése

Legacy projekt Laravelesítése (Laravel 8 - mert a PHP verzió adott ahhoz igazodunk) közben futottam bele abba, hogy az üres adatbázis séma létrehozásakor:

```shell
php artisan schema:dump
php artisan migrate:refresh
```
mindenképpen létrejött a `personal_access_tokens` tábla és a migrációs file:
```shell
Nothing to rollback.
Loading stored database schema: /var/www/html/database/schema/mysql-schema.dump
Loaded stored database schema. (49,714.31ms)
Migrating: 2019_12_14_000001_create_personal_access_tokens_table
Migrated:  2019_12_14_000001_create_personal_access_tokens_table (2,930.78ms)
```

A [Laracast fórumában](https://laracasts.com/discuss/channels/laravel/cant-remove-personal-access-tokens-from-migration) 2 megoldást is találtam a probléma megszüntetésére:

## 1. `laravel/sanctum` csomag eltávolítása

Valamiért a Laravelben alapból mellékelve van a fenti csomag, egyszerűen távolítsuk el (ha kell droppoljuk a token táblát) és utána a séma frissítésekor nem fog létrejönni a migrációs file:
```shell
composer remove laravel/sanctum
```

## 2. Ignoráljuk a migrációját

Az `AppServiceProvider.php` fájlban a `register()` függvényben hívjuk meg az alábbi parancsot (a fájl elejére a `use Laravel\Sanctum\Sanctum;`-ot is tegyük oda):

```php
# app/Providers/AppServiceProvider.php

public function register()
{
    // sudo su ne jojjon letre a `personal_access_tokens` migrations
    Sanctum::ignoreMigrations();
}
```

Mindkettő működik, én a második megoldást választottam. Így talán jobban szem előtt van, miért és hogyan lett "inaktiválva". (A kódban taktikai komment elhelyezésével ha valaki rákeres meg is találja a megfelelő kódrészletet.)
Bramki logiczne w Excelu
Tags: excel, nauka
Published: 2024-01-30 20:41:32

Arkusz kalkulacyjny może być doskonałym narzędziem do nauki. 

Współczesne komputery bazują na dwóch stanach 0 i 1 oraz na 3 prostych bramkach logicznych: AND, OR, NOT. Każda informacja, liczba, tekst, zdjęcie czy film składa się w istocie z serii zer i jedynek zapisanych w pamięci komputera. A same komputery to bardzo skomplikowane urządzenia złożone z bardzo dużej (miliardy) liczby bramek logicznych. 

W sieci można znaleźć zaawansowane programy pozwalające na symulowanie układów elektronicznych złożone z sieci bramek logicznych. Jednak zwykły arkusz kalkulacyjny może z powodzeniem służyć do zobrazowania i symulacji prostych układów elektronicznych, od prostych pojedynczych bramek aż do całych procesorów. 

Na początek przedstawiam wam arkusz kalkulacyjny z prostym 3 bitowym symulatorem. 

Link do arkusza kalkulacyjnego - z prezentacją działania podstawowych bramek logicznych

https://docs.google.com/spreadsheets/d/13_JWoGkYPzL5NPdI42MAoRUFRXRORGx4/edit?usp=sharing&ouid=111887487108574597440&rtpof=true&sd=true