teleren/devto huggingface dataset:
🚀 Launched our 🤖 AI for Python Developers
Tags: python
Published: 2023-04-19 13:11:10

😅 We know the job market right now is brutally competitive and when applying for jobs it's hard to communicate to recruiters your skill level accurately with a CV, especially for more junior developers.

🤖 We created Rankode.ai our ML model that analyzes a developer's skill level across 6 categories using either a GitHub link or 500 lines of code to produce an easy to read report. This report when sent along with your CV demonstrates your skill level making it easier to stand out in a sea of applicants.

💻 Everything to know about a developer is in the code. We want to eliminate stressful and lengthy coding tests for hard skills in the hiring process.

🚀 For our launch we are making our reports FREE for the DEV community if you'd like to get one just go to this link: https://www.rankode.ai/upload


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

🔠 We will be launching Rankode reports for more languages soon so you can also let us know what language you'd like to have analyzed.

🎉 Thanks for your support. Happy to have any feedback or questions.
Sample Code on how to build a ten neuron SNN USING STDP Learning rule
Tags: machinelearning, python, snn
Published: 2023-04-19 13:10:27

```
import numpy as np
import matplotlib.pyplot as plt

# Parameters
num_neurons = 10
num_layers = 3
num_timesteps = 100
dt = 0.001

# Neuron model
V_rest = -70
V_threshold = -55
V_reset = -75
tau_m = 0.02
tau_ref = 0.002

# Synaptic connections
W_ff = np.random.rand(num_neurons, num_neurons) * 0.1
W_fb = np.random.rand(num_neurons, num_neurons) * 0.1

# Spike-Timing Dependent Plasticity (STDP) learning rule
tau_stdp = 0.02
A_plus = 0.01
A_minus = -0.01

# Input data
X = np.random.rand(num_neurons, num_timesteps)

# Initialize variables
V = np.zeros((num_neurons, num_timesteps))
V[:, 0] = V_rest
spikes = np.zeros((num_neurons, num_timesteps))

# Simulation loop
for t in range(1, num_timesteps):
    # Calculate feedforward current
    I_ff = np.dot(W_ff, spikes[:, t-1])

    # Calculate feedbackward current
    I_fb = np.dot(W_fb, spikes[:, t-1])

    # Calculate total input current
    I_in = X[:, t] + I_ff + I_fb

    # Update membrane potential
    V[:, t] = V[:, t-1] + (-V[:, t-1] + V_rest + I_in * dt / tau_m) / tau_m

    # Generate spikes
    spike_indices = np.where(V[:, t] > V_threshold)[0]
    spikes[spike_indices, t] = 1
    V[spike_indices, t] = V_reset

    # Refractory period
    refractory_indices = np.where(spikes[:, t-1] == 1)[0]
    V[refractory_indices, t] = V_rest

    # STDP learning rule
    for i in range(num_neurons):
        for j in range(num_neurons):
            if spikes[i, t-1] == 1 and spikes[j, t] == 1:
                delta_w = A_plus * np.exp(-(t - 1 - tau_stdp) / tau_stdp)
                W_ff[i, j] += delta_w
            elif spikes[i, t-1] == 0 and spikes[j, t] == 1:
                delta_w = A_minus * np.exp(-(t - 1 - tau_stdp) / tau_stdp)
                W_fb[j, i] += delta_w

# Plot results
plt.figure(figsize=(10, 6))
plt.subplot(2, 1, 1)
plt.title("Membrane Potential")
plt.plot(V.T)
plt.xlabel("Time")
plt.ylabel("Voltage (mV)")
plt.ylim(V_reset - 10, V_threshold + 10)
plt.subplot(2, 1, 2)
plt.title("Spikes")
plt.plot(spikes.T, ".")
plt.xlabel("Time")
plt.ylabel("Spike")
plt.show()

```
Please note that you can always change the parameters based on the type of network you are building and you can always change the learning rules too. Please run this, make changes that suit your network and let me know what you have done. 
Happy coding.
Transactions - difference between SQL, SQLAlchemy and Django ORM
Tags: sql, django, sqlalchemy, transaction
Published: 2023-04-19 13:02:40

## What’s a transaction?

In computing, a transaction is a set of related tasks treated as a single action. Together the tasks form a logical unit of work in which all of them must succeed or none of them can succeed. If some tasks succeed but at least one fails, then all successful tasks are reversed, returning the system to its original state before the transaction was initiated. In the context of a database, a transaction is used to create, update, or retrieve data.


A typical case would be a bank transfer. Peter wants to send $100 to Emma. The process would be to decrease Peter’s amount by $100 and increase Emma’s amount by $100.

Below, we’ll implement this scenario in SQL, SQLAlchemy and Django ORM.

## SQL transaction

```
START TRANSACTION;  — initialize transaction

-- removing 10 from user id 1
UPDATE users SET amount = amount - 100 WHERE username = 1;

-- adding 10 to user with id 2
UPDATE users SET amount = amount + 100 WHERE username = 2;

-- committing the change (or roll back in case of failure)
COMMIT;
```

In SQL we have to start a transaction explicitly "_START TRANSACTION_". If all queries are successful, it will be committed. Otherwise, it will be rolled back.


## SQLAlchemy transaction
```
user_1 = User.query.query.filter(id=1).first()
user_1.amount -= 100

user_1 = User.query.query.filter(id=2).first()
user_1.amount += 100

session.commit()
```

SQLAlchemy is transactional by default. Meaning that we can do a lot of queries and we have to "_commit_" only once. So we don’t have to "_START TRANSACTION_" like in SQL. The process is the same: if all queries are successful, they will be committed. Otherwise, they will be rolled back. [SQLAlchemy docs](https://docs.sqlalchemy.org/en/20/orm/session_transaction.html).


## Django ORM transaction

```
with transaction.atomic():
    user_1 = User.objects.get(id=1).update(amount-=100)
    user_2 = User.objects.get(id=2).update(amount+=100)

@transaction.atomic
def transaction_view(request):
    user_1 = User.objects.get(id=1).update(amount-=100)
    user_2 = User.objects.get(id=2).update(amount+=100)

```
Django’s default behavior is to run in auto-commit mode. Each query is immediately committed to the database.

Django ORM is not transactional by default like SQLAlchemy. Each query is immediately committed to the database. We have to use a context manager "with transaction.atomic()" or a decorator "@transaction.atomic" to start a transaction.

If we want to have all of the views "http requests" transactional, we can set "_atomic_requests_" to **True** in the configuration of the database. If we want to prevent views from running in a transaction, we can do:
```
@transaction.non_atomic_requests
def non_atomic_view(request):
    user_1 = User.objects.get(id=1).update(amount-=100)
    user_2 = User.objects.get(id=2).update(amount+=100)
```
But I wouldn’t recommend it. For more, check the [Django docs](https://docs.djangoproject.com/en/4.2/topics/db/transactions/).
Mastering API Workshops with Postman: Introduction and Tips for beginners
Tags: postman, postmanapi
Published: 2023-04-19 12:57:32

Postman is a popular API development and testing tool that allows developers to easily create, test, and manage APIs. Recently, I attended a Postman API workshop at my college Sahrdaya College of Engineering and Technology and wanted to share my experience and learnings with you.

The workshop was conducted by a Postman expert and 2nd year student of our college Joel and was divided into two parts. The first part focused on the basics of API development, while the second part was a hands-on session where we got to create and test our own APIs using Postman.

During the first part of the workshop, we learned about the following topics:

What is an API and why is it important?
HTTP request methods (GET, POST, PUT, DELETE)
API endpoints and parameters
API authentication
API documentation
The instructor provided examples and explained each topic in detail, making it easy to understand even for beginners like me.

In the second part of the workshop, we got to create our own APIs using Postman. We started by creating a simple API endpoint that returned a list of users. We used the mock server feature in Postman to simulate the server response, making it easy to test our API without having to set up a server.

We tried some practical's by entering our information and entering the information of our favourite book using post endpoint and obtained all information by using get endpoint.

Next, we added more functionality to our API, including the ability to add, update, and delete users. We also added error handling to our API, so that it returned meaningful error messages if something went wrong.

Finally, we learned how to document our API using Postman's built-in documentation feature. This allowed us to generate API documentation that was easy to read and understand.

Overall, the workshop was a great learning experience. I learned a lot about API development and how to use Postman to create and test APIs. The instructor was knowledgeable and made the workshop fun and engaging. If you're interested in learning more about API development, I highly recommend attending a Postman workshop.
Why I made Awayto.Dev
Published: 2023-04-19 12:52:41

Hi, I'm Joe. I'm the developer of Awayto [V1 Git](https://github.com/keybittech/awayto) [V2 Git](https://github.com/jcmccormick/wc) [YT](https://www.youtube.com/@awayto5530).

Awayto is a framework that deploys easy to manage web applications.

I created this project as a way to speed up my workflow when it came to working with clients and personal websites.

The goal was to architect an easily deplyoable package that covered all the bases with regard to web application resources like the api and database, leaving full control of those resources to the developer.

Over time, the framework grew into something that I felt offered value to myself my clients. So, I decided to formalize it and offer it as a free open source alternative to full stack hosting platforms that obscure and sometimes completely remove access to the entire stack.

Awayto is built ontop of AWS and utilizes free-tier resources, so there is no serious commitment to try it out. Novice developers can use it as a low-effort way to learn about cloud functionalities, web UIs and APIs, and businesses with skilled developers can flip a few configurations and deploy a robust web application primed for rapid growth.

The framework includes features which cover some typical business use cases, in an environment supporting structured development. Out of the box, an admin can login, begin creating users, assigning roles and permissions within the application; developers on the other hand are given a sandbox style environment where they can immediately begin building and deploying.

Now that Awayto is being released, it will continue to exist in its current state. Outside of refactorings and other general maintenance, there will be no expansion to its main core functionalities.

Instead, modules following the given convention can be made to be dropped into any Awayto installation. Share your creations with other developers and implement them into your project simply by dragging them in.

When you're looking for a solution to deploy your next online business, build an upcomming proof of concept, or learn about developing web applications, consider using Awayto.

Thanks for your time!
I released v1.2.0 of my queues package implemented in Golang.
Tags: go, programming, opensource, computerscience
Published: 2023-04-19 12:52:23

https://github.com/adrianbrad/queue

A Circular Queue implementation is now available. Blocking and Priority queues were previously available. All implementations satisfy the Queue interface provided by the package.

The package also contains various artifacts that could interest a broader audience. These artifacts include: CI scripts(coverage, lint, testing), golang-ci lint config file, commitizen, example tests, benchmarks and documentation provided by godoc.
A JavaScript Odyssey (GameDev Online Book)
Tags: javascript, gamedev, beginners, writing
Published: 2023-04-19 12:40:58

Discover our approach to building games from scratch.

Explore the world of pure JavaScript game development as you follow along with the creation of a mini-game.

Whether you're a curious non-developer, an advanced developer seeking inspiration, or a beginner looking to build your own tools, this book has something for you.

[Check it out!](https://www.undeadjs.com/a-javascript-odyssey/a-fallen-hero)
24Seven Commerce Updates Shopify Integration as per Latest API Update: Seamless Integration Ensured
Tags: webdev, productivity, shopify, ecommerce
Published: 2023-04-19 12:35:52

In today’s fast-paced and ever-evolving technological landscape, businesses must stay up-to-date with the latest updates and upgrades to their platforms and integrations. Shopify, one of the leading e-commerce platforms, recently rolled out an update to their API, and it’s important for businesses using the platform to ensure their integrations are also up-to-date. At 24Seven Commerce, we take pride in being proactive about updates and ensuring our integrations are always running smoothly.

We are pleased to announce that we have updated our Shopify integration as per the latest Shopify API update. Our technical team is always prompt in upgrading our integrations as soon as there are any modifications carried out by 3rd party POS or eCommerce platforms, ensuring our clients can continue to operate seamlessly.

This update to our Shopify integration ensures that our clients can continue to enjoy the benefits of our integration without any disruptions. With this update, our clients can rest assured that all their data is up-to-date, and their Shopify store will continue to operate smoothly.

At 24Seven Commerce, we understand that our clients’ success depends on the seamless integration of their Shopify store with their other business systems. That’s why we strive to ensure that our integrations are always up-to-date and running smoothly. Our technical team is always on top of the latest updates and upgrades, ensuring our clients can continue to operate seamlessly and focus on growing their business.

In addition to our commitment to ensuring our integrations are up-to-date, we also take pride in providing excellent customer support. Our support team is available 24/7 to assist our clients with any issues or concerns they may have. Our team is knowledgeable and experienced, and we are always happy to help our clients with any questions or issues they may have.

In conclusion, at [24Seven Commerce](https://www.24sevencommerce.com/), we are committed to providing our clients with the best possible service. Our recent update to our Shopify integration as per the latest Shopify API update ensures that our clients can continue to enjoy the benefits of our integration without any disruptions. Our technical team is always prompt in upgrading our integrations as soon as there are any modifications carried out by 3rd party POS or eCommerce platforms, ensuring our clients can continue to operate seamlessly. We take pride in our commitment to providing excellent customer support and will continue to do so as we move forward.
MOT Monitoring
Tags: opengauss
Published: 2023-04-19 08:34:35

All syntax for monitoring of PG-based FDW tables is supported. This includes Table or Index sizes (as described below). In addition, special functions exist for monitoring MOT memory consumption, including MOT Global Memory, MOT Local Memory and a single client session.

**Table and Index Sizes**
The size of tables and indexes can be monitored by querying pg_relation_size.

For example

**Data Size**

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

**Index**

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

**MOT GLOBAL Memory Details**
Check the size of MOT global memory, which includes primarily the data and indexes.

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

Result –

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

Where –

**·** -1 is the total memory.

**·** 0..7 are NUMA memory nodes.

**MOT LOCAL Memory Details**
Check the size of MOT local memory, which includes session memory.

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

Result –

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

Where –

**·** -1 is the total memory.
**·** 0..7 are NUMA memory nodes.
**Session Memory**
Memory for session management is taken from the MOT local memory.

Memory usage by all active sessions (connections) is possible using the following query –

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

Result –

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

Legend –

**·** total_size – is allocated for the session
**·** free_size – not in use
**·** used_size – In actual use
The following query enables a DBA to determine the state of local memory used by the current session –

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

Result –

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0g8dp1am140w0yztrfji.png)
How to open a react-native app which is bundled as index.android.bundle in another react native app on button click
Tags: reactnative
Published: 2023-04-19 12:33:31

Hi There, I am trying to the below scenario and i am lost in the middle...trying to look into multiple links in stack overflow and finally landed up here....

one liner of my requirement is, 
****in amazon mobile app on selecting payment of gpay it opens as a part of amazon and navigates when we click back it navigates to parent(amazon) app. Here `gpay` is already installed.****

My requirement is similar where i have two React native project, one parent and other child, i need to bundle child app into parent app, where i achieved it. but scenario is on button click it has to navigate to child app. problem here is i shouldn't use android native code in parent. it should go through react native button click. when i tried using react native modules and activity class in java i get null in the place of indent object. 

Is there a way to access a component inside the bundle file and on button click from RN project 1 which displays a Component xyz of React native Project 2.

Following is the snap of the code

In my first React Native project, import the Linking module:
``
import { Linking } from 'react-native';
const handleClick = () => {
  Linking.openURL('index.android.bundle://specific-screen');
}
``
in UI
``
<Button title="Go to Specific Screen" onPress={handleClick} />
``
it throws an error null or undefined cannot be an argument.

I tried multiple other ways like webview similar error 
tried using react-native-fs

none succeeded.

Can anyone help me out. i can also share the original code later.
The Wizard's Apprentice, AI-powered Typescript project suite and CLI.
Published: 2023-04-19 12:28:48

https://github.com/keybittech/wizapp

Hey there, my name is Joe, and I have just finished my second major project, The Wizard's Apprentice. In short, it is intended to be a coding partner that sits along side you and carries out any coding activities that it can.

Ultimately I set out to create a group of functionality that would be beneficial while working on a larger project I am developing, Awayto https://github.com/jcmccormick/wc. This is a large scale framework including a Typescript project which defines the api and ui components. I wanted a tool that would help me make new features in the site, as well as continually work on issues, as if it were a subordinate. 

The Wizard's Apprentice has a bunch of functionality I thought was important like being able to manage prompts, control their desired response formats (insofar as rejecting requests that don't conform), and give me some insight into the validity and success rates of my prompting.

A beta version has just been completed which features a CLI and importable functions so the package can support more use cases and be used for server side tasks if needed. I hope you're able to check it out. Any feedback, questions, or comments, are greatly appreciated! Thanks for your time.
MOT Vacuum
Tags: opengauss
Published: 2023-04-19 08:22:53

Use VACUUM for garbage collection and optionally to analyze a database, , as follows –

**·** [PG]
In Postgress (PG), the VACUUM reclaims storage occupied by dead tuples. In normal PG operation, tuples that are deleted or that are made obsolete by an update are not physically removed from their table. They remain present until a VACUUM is done. Therefore, it is necessary to perform a VACUUM periodically, especially on frequently updated tables.

**·** [MOT Extension]
MOT tables do not need a periodic VACUUM operation, since dead/empty tuples are re‑used by new ones. MOT tables require VACUUM operations only when their size is significantly reduced and they do not expect to grow to their original size in the near future.

For example, an application that periodically (for example, once in a week) performs a large deletion of a table/tables data while inserting new data takes days and does not necessarily require the same quantity of rows. In such cases, it makes sense to activate the VACUUM.

The VACUUM operation on MOT tables is always transformed into a VACUUM FULL with an exclusive table lock.

**·** Supported Syntax and Limitations

Activation of the VACUUM operation is performed in a standard manner.

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

Only the FULL and ANALYZE VACUUM options are supported. The VACUUM operation can only be performed on an entire MOT table.

The following PG vacuum options are not supported:

**·** FREEZE
**·** VERBOSE
**·** Column specification
**·** LAZY mode (partial table scan)
Additionally, the following functionality is not supported –

**·** AUTOVACUUM
Have some confusion about React Development Workflow
Published: 2023-04-19 11:57:18

I want to debug react source code, make some change and use it in my project. so I follow [this](https://legacy.reactjs.org/docs/how-to-contribute.html#development-workflow) document.

But, when I link the build package, the require path in react-dom is "../../package/react" antd "../../package/scheduler"


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

This is obviously wrong，so I use yalc package and publish react,react-dom locally, then add these to my project, it can work now.

My confusion is the right way to development react? I can't find any source map in the build directory, so I still use the compiled file, how can I track the source code?

I think this development process should watch the file change, and build automatically， but I can't find  --watch option in the build command, need I run the build command every time?

can help me