teleren/devto huggingface dataset:
Top three altcoins to watch in April
Tags: discuss, cryptocurrency, trade, tutorial
Published: 2024-04-30 15:57:22

‼️Amid pre-halving volatility, altcoins react variously. Notably, TON and WBT showcase promising trends. 

🔺TON surged after news of USDt integration with Telegram Open Network at TOKEN2049. It rose by over 16% on April 19, reaching 9th position in crypto ranks. Despite resistance at $5.55, it surged past $5.68 with increased trading volume, hinting at targets of $7.15 and $8.05. Positive liquidation levels suggest a reset of speculative interest, possibly around $7.43.

🔺Similarly, WBT, native to WhiteBIT, sustained an uptrend despite corrections. Recent gains, supported by listing announcements and stablecoin activity, signal buying pressure. Exponential moving averages suggest a continued uptrend, with potential gains to $11.34 - $13.05 according to AMBCrypto.

🔺ENA witnessed institutional buying before a correction, indicating long-term bullishness. However, it faces selling pressure, evident in increased asset withdrawals. Ethena Labs' "Season 2" announcement led to withdrawal surge for staking, while ENA futures' open interest declined.

🫢Disclaimer: This article provides information for educational purposes; trade at your own risk and conduct thorough research.
A Quick Utility Module
Tags: elixir, utility, validation
Published: 2024-04-30 15:36:51

I was working on some code with a friend of mine and we came up with what seems a relatively clever way to do a couple of validations.  I'm putting this post here to share this in case it benefits anyone else:

```
defmodule Validations do
  @moduledoc """
  This module contains a few validation predicate functions.
  """

  @doc """
  Checks if a string contains only specified characters.  The specified characters are passed in a list. The list can be one or more characters. You could pass an empty list if you wished but that would always return false.

  ## Examples

      iex> Validations.string_contains_only_specified_chars?("abc", ["a", "b", "c"])
      true

      iex> Validations.string_contains_only_specified_chars?("abr", ["a", "b", "c"])
      false
  """

  @spec string_contains_only_specified_chars?(String.t(), [String.t(), ...]) :: boolean
  def string_contains_only_specified_chars?(string, list)
      when is_binary(string) and is_list(list) do
    string
    |> String.graphemes()
    |> Enum.reduce(true, fn letter, acc -> letter in list && acc end)
  end

  @doc """
  Checks if a string is of a specified length or not.

  ## Examples

      iex> Validations.string_expected_length?("abc", 3)
      true

      iex> Validations.string_expected_length?("abc", 2)
      false
  """
  @spec string_expected_length?(String.t(), integer) :: boolean
  def string_expected_length?(string, length) when is_binary(string) and is_integer(length) do
    String.length(string) == length
  end
end

```

Nothing innovative or surprising--just a little something I whipped up that I wanted to share for the potential benefit of others.
UCB
Published: 2024-04-30 15:27:52

Upper Confidence Bound (UCB) applications are a strategy used in multi-armed bandit problems. These types of problems usually arise where there is more than one option and each option yields a certain amount of money.

The UCB discount accounts for the expected products of each option (or “strand”) and the uncertainty of that reward. A "confidence interval" is created for each lever, and the upper limit of that interval (i.e., the best possible outcome) is used to determine when to pull that lever.

Uncertainty increases with how little a lever is pulled. So, if a branch is monitored too frequently, the more performance it has about it and the times it decreases. However, if a branch is rarely tracked, there will be less performance about it and performance will increase.

The UCB strategy attracts both companies that are in the high expected league (i.e. “exploitation” or “exploitation”) and companies that have few exposures and their high uncertainty (i.e. “exploration” or “exploration”). This allows the agent to both exploit existing usage and acquire new information.

For example, let's consider an online advertising scenario. A company wants to determine which ad is more likely to be blocked at the same time. He holds her ad as a "lever" and holds it as a "reward" for clicking on it. UCB discounts can be used to determine which ads are likely to generate more clicks.

In this case, the UCB pull-up both keeps the most clicked ads intermittent (i.e. "don't consume") and displays other ads that sign up less but may potentially have high click-through rates (i.e. "explore"). This way, the company can use both existing and good ads and discover new, potentially better ads.
Write and view functions in Solidity
Published: 2024-04-30 15:23:14

As a frontend developer building dApps on Ethereum, you need to know the difference between "view" and "write" functions.

When you write a function in Solidity to do something, to change something in the state of the blockchain, that function will cost gas. It will require a fee, real money to be executed.

View functions are the opposite. When a Solidity function has the "view" keyword on it, and does not do any operation that changes the state of the blockchain, it will not cost gas.

Say that you just want to see how much of some token an account has, since that knowledge is public, and you accessing it does not change the state of the blockchain, the function in Solidity would be a view function.

When interacting with Solidity functions using wagmi React hooks, you use "useWriteContract" hook to interact with functions that change the state, like sending a token from one contract to another.

While interacting with view functions, you'd use the "useReadContract" hook. When you compare the two hooks, you'll see that the useWriteContract takes arguments while the useReadContract does not.
SQL | DDL, DQL, DML, DCL and TCL Commands
Tags: sql, database
Published: 2024-04-30 15:18:57

## SQL Overview
SQL (Structured Query Language), We can use this language to create database. 
SQL contains commands like CREATE,DROP,INSERT, etc. to carry out required tasks

SQL Commands are categorized into five types.
1. DDL - Data definition Language
2. DQL - Data Query Language.
3. DML - Data Manipulation Language.
4. DCL - Data Control Language.
5. TCL - Transaction Control Language.

## DDL (Data Definition Language)

List of DDL Commands

- CREATE - the Command is used to create the database or its objects like (table, index, function, views, stored procedure, and triggers)
- DROP - This command is used to delete objects from the database.
- ALTER - This is used to alter the structure of the database.
- TRUNCATE - This is used to remove all recors from the table, includeing all spaces allocated for the recors are removed.
- COMMENT: This is used to add comments to the data dictionary.
- RENAME: This is used to rename an object existing in the database.

## DQL (Data Query Language)

List of DQL Commands
- SELECT : It is used to retrieve data from the database.

## DML(Data Manipulation Language)
Deals with manipulation of data present in the database

List of DML commands: 

- INSERT: It is used to insert data into a table.
- UPDATE: It is used to update existing data within a table.
- DELETE: It is used to delete records from a database table.
- LOCK: Table control concurrency.
- CALL: Call a PL/SQL or JAVA subprogram.
- EXPLAIN PLAN: It describes the access path to data.

## DCL (Data Control Language)
DCL includes commands such as GRANT and REVOKE which mainly deal with the rights, permissions, and other controls of the database system. 

List of  DCL commands: 

- GRANT: This command gives users access privileges to the database.
- REVOKE: This command withdraws the user’s access privileges given by using the GRANT command.


## TCL (Transaction Control Language)

List of TCL Commands:

- BEGIN: Opens a Transaction.
- COMMIT: Commits a Transaction.
- ROLLBACK: Rollbacks a transaction in case of any error occurs
- SAVEPOINT: Sets a save point within a transaction.
🔄 Simplified Approach: Asynchronous Request-Reply
Tags: webdev, beginners, programming, tutorial
Published: 2024-04-30 15:14:14


In modern app development, when clients need to interact with remote APIs for business logic or services, the Asynchronous Request-Reply pattern shines. Here's how it works :

- Client Makes Request: The client (like a web browser) sends a request to the backend API over HTTP(S).

- Backend Acknowledges: Upon receiving the request, the backend immediately acknowledges it, letting the client know it's been received.

- Backend Processes Asynchronously: Instead of making the client wait, the backend processes the request asynchronously. This means it can handle multiple tasks simultaneously without blocking.

- Immediate Response: While the backend works, the client gets an immediate response, indicating the request has been accepted.

- Notification of Completion: Once processing is complete, the backend notifies the client, providing the result or status update.
Benefits:

- Improved Responsiveness: Clients get immediate feedback, making interactions smoother.

- Efficient Resource Utilization: Asynchronous processing allows the backend to handle tasks concurrently, optimizing resource usage.

- Scalability: The system can handle more requests without sacrificing performance.

This approach simplifies communication between clients and servers, making applications more responsive and scalable.


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

**✅ When to Use This Pattern:**

- Client-Side Code: Ideal for client-side applications like browsers where setting up callback endpoints or long-running connections is complex.

- Service Calls Over HTTP: Useful when only HTTP protocol is available and firewall restrictions prevent callback firing on the client-side.

- Integration with Legacy Architectures: When integrating with older systems that lack support for modern callback technologies such as WebSockets or webhooks.


**❌ When Not to Use This Pattern:**

- Alternative Services Available: If there's a service designed for asynchronous notifications like Azure Event Grid, it may be a better fit.

- Real-Time Streaming Required: Not suitable when real-time streaming responses are needed.

- Many Results with Low Latency: For scenarios where the client needs to collect numerous results with low latency, consider a service bus pattern instead.

- Persistent Network Connections Supported: If server-side persistent network connections like WebSockets or SignalR are feasible, they can be used for real-time result notifications.

- Network Design Constraints: If network design allows for opening ports to receive asynchronous callbacks or webhooks, consider those options.

- Using the Asynchronous Request-Reply pattern can simplify communication in certain scenarios, but it's essential to consider alternative solutions when they better align with specific requirements or constraints.

---

**More Details :**

1- https://learn.microsoft.com/en-us/azure/architecture/patterns/async-request-reply?WT.mc_id=DX-MVP-5004571

2- https://youtu.be/LCbR58sCmvQ?si=qrSA_2zlzG0cV9_i
What is the OpenAPI Specification? 🌐⚡🚀
Tags: webdev, javascript, programming, beginners
Published: 2024-04-30 15:13:15

The OpenAPI Specification (OAS) is a framework to build applications that interact with REST APIs. The specification defines how to communicate with an API, what information can be requested, and what information can be returned.

An OpenAPI file describes an API by including:

 - Endpoints: which are available (/users) and operations on each (GET /users, POST /users)
 - Authentication methods
 - Operation parameters for each operation (Input and output)
 - Contact information, terms of use, license, and other information

Why use an OpenAPI Specification?

 - Single point of truth - The OAS allows the import of API definitions into API clients for manual testing and ensures each piece of the system can be verified against the specification
 - Documentation - OAS makes it much easier to generate API documentation automatically.
 - De facto industry standard- OpenAPI is the current de facto industry standard for API definition. This means that any user can access services from an API using this specification without any extra setup.

Are you currently using OpenAPI specifications in your projects? If yes, what tools do you find most effective for working with OpenAPI specs, and how do they help streamline your development process?
Can I use gRPC within React.js app as a server
Tags: react, reactjsdevelopment, grpc
Published: 2024-04-30 14:54:11

Hi there,

I'm working on a React.js project and am currently implementing gRPC for backend communication. I have a question:

I need to receive instructions from the server that are independent of the client-side functionality. Can I use gRPC within the React.js application itself as a server to achieve this?
Job Seekers' Guide: How to Apply and Connect with Employers
Tags: jobs, jobhunt, search, jobsearch
Published: 2024-04-30 14:41:54

In today's job market, landing that ideal job involves more than just submitting a typical application. It's about standing out and making a memorable impact on hiring managers. Whether you're seasoned in your field or just beginning, refining your job application skills and building connections with recruiters can significantly increase your chances of securing that dream job.

Here's a detailed roadmap to help you navigate this process with confidence:

1- **Make sure to review the Job Description (JD)** before applying for any position. It's essential to understand the required skills, qualifications, and responsibilities to determine if you're a match for the role.

2- **Customizing your resume and cover letter** is crucial. Highlight your skills and experiences that align with the job requirements. Incorporate keywords from the JD to showcase your suitability for the role and emphasize your value proposition.

3- **Researching the company's culture, values, and mission statement is key**. Tailor your application to demonstrate your understanding of the company and articulate why you're eager to contribute to its success.

4- **When contacting recruiters**, specify the job you're interested in and explain why you consider yourself a strong candidate for the role. Personalize your message to convey interest and enthusiasm for the position.

5- **Highlight Your Accomplishments:** Use your application to showcase your achievements and accomplishments that are relevant to the job. Quantify your impact whenever possible and provide concrete examples of how you've contributed to the success of previous projects or organizations.

6- **Follow Up:** After submitting your application, follow up with recruiters to express your continued interest in the position. Keep your communication professional and courteous, and use this opportunity to reiterate your qualifications and enthusiasm for the role.

7- **Prepare for Interviews:** If you're selected for an interview, prepare thoroughly by researching common interview questions, practicing your responses, and showcasing your skills and experiences with confidence.

Remember, applying for a job is not just about meeting the minimum requirements—it's about demonstrating your passion, enthusiasm, and ability to add value to the organization. By following these steps and taking a proactive approach to your job search, you can increase your chances of landing your dream job and advancing your career.

Happy job hunting!
Python vs JavaScript performance
Tags: python, javascript, performance, comparison
Published: 2024-04-30 14:35:39

**<u>Understanding Python's Performance</u>**

**Python** is tailored for readability and ease of use, though it is not the swiftest due to its interpreted nature. It stands out with effective memory management and robust data structures, making it a prime choice for data analysis and machine learning where quick prototyping is crucial.

Using libraries like NumPy and SciPy can boost Python’s numerical computation capabilities, enhancing performance for specialized tasks. Thus, Python is well-suited for projects where code clarity and maintenance are prioritized over execution speed, particularly in data-intensive and scientific computing fields.

**<u>Unveiling JavaScript's Performance</u>**

**JavaScript** functions as a dynamic and high-level scripting language that finds its strength in web development and real-time applications. Key to its performance are browser compatibility and the asynchronous nature that facilitates non-blocking code execution, contributing to smooth user experiences.

JavaScript excels in creating responsive interfaces due to its integration with HTML and CSS, crucial for front-end development. Despite its strengths, JavaScript’s performance might lag with bloated code. Nonetheless, employing strategies like code minification and lazy loading can dramatically enhance efficiency.

**<u>Comparing Python And JavaScript Performance</u>**

Let's break down the performance metrics of these [two popular languages](https://bluebirdinternational.com/python-vs-javascript-performance/):

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/29be9ir10mlrhp7tk2yq.jpg)

**<u>Real-World Performance Considerations</u>**

In practical scenarios, the choice between Python and JavaScript should align with project needs. Python dominates in scientific computing and large data applications but may falter in high-performance tasks requiring quick responses. Conversely, JavaScript is unmatched in front-end development, offering tools like React and Angular for sophisticated applications.

**<u>Optimization Techniques For Python And JavaScript</u>**

Optimizing your code is crucial for both languages to achieve enhanced performance:

**Code Optimization:** Refine the logic to reduce redundancy and enhance logic efficiency.
**Caching:** Utilize techniques like lru_cache in Python and memoization in JavaScript to reuse frequently accessed data efficiently.
**Built-in Libraries and Frameworks:** Leverage powerful libraries (NumPy for Python, React for JavaScript) to streamline development and boost performance.
**Minimizing I/O Operations:** Adopt asynchronous I/O and lazy loading to reduce I/O bottlenecks.
**Memory Optimization:** Implement strategies to reduce memory usage, like using generators in Python or managing object life cycles in JavaScript.
Why MongoDB is not great for complex reporting?
Tags: mongodb, sql, database, discuss
Published: 2024-04-30 14:30:57

I use MongoDB for logs and time-series data, which it is usually perfect for. With large datasets ( I am storing 100 million+ time series logs), SQL databases can become sluggish and slow down, even with indexes and optimizing queries.

However, for 90% of my use cases, I still stick with MySQL and other SQL databases.

## Why?

SQL is mature and easy to work with, especially if you have deep relational data. MongoDB is great for flat document-type data structures.

Here's an example of a painful MongoDB query:

```python
pipeline = [
  {
    '$match': {
      'merchant_id': 2138
    }
  }, {
    '$group': {
      '_id': {
        'date': '$date'
      }, 
      'menu_special_price': {
        '$min': '$menu_special_price'
      }, 
      'menu_price': {
        '$max': '$menu_price'
      }
    }
  }
];
```

A simple aggregated pipeline example. This is such a simple task, yet it looks so convoluted.

In SQL, you could do:
```sql
SELECT
MIN(menu_special_price) as min_price,
MAX(menu_price) as max_price
FROM menus
WHERE merchant_id=2138
GROUP BY date; 
```

Which is easier to maintain and read?

> Do you like this sort of content? Please subscribe to my newsletter [here](https://kevincoder.co.za/newsletter) to get weekly thought-provoking articles on web dev and machine learning.
In App Background Audio Player on OutSystems Mobile App
Tags: outsystems, mobile, javascript
Published: 2024-04-30 14:29:04

## Requirements
An audio player that will continue playing in the background (whether the users exits the app or navigates to different screens within the app)

## Problem
For OutSystems Mobile App, React is used for its frontend. For React developers, one would probably develop in a way where the audio player component will be placed at the top level, so that when the app traverses from page to page, the audio player will not be re-rendered.

In OutSystems, one would think of placing the audio player component in the layout web block or menu (navigation) web block, where it will most likely be the common block used through all the screens. However, the whole page (Layout Web Block and its components within) re-renders with each screen transition. Thus, the audio player also re-renders and the audio stops playing when the screen transits to another.

## Compromise
Initially I was thinking of proposing a compromise to the stakeholders and asked if it was acceptable to have the audio "pause" as the screen transits and the audio "continue" to play when the new screen transits in. This will mean the app will probably have to store the last played time in the `localStorage` in the [On Destroy event](https://success.outsystems.com/documentation/11/building_apps/application_logic/screen_and_block_lifecycle_events/#on-destroy) (when the transition to the new Screen ends). Then in the new screen's On Render Event, retrieve the last played time from the `localStorage`, seek to the last played time and then play the audio.

## Solution
As I was testing the "compromise", I remembered and that the React root is the "top-level" `<div>` and not `<body>`. Then, it was clear to me that if I can place the Audio Player outside of the React root, which would always re-render, the Audio Player can keep on playing so as long as the page does not refresh.

The root React element in OutSystems is `<div id="reactContainer">`. You can probably put in the following Javascript in the OnApplicationReady event to append the Audio Player element in the save level as `<div id="reactContainer">` (append to `<body>`).

    var jwPlayerElement = document.createElement('div')
    jwPlayerElement.id = 'jw-player';
    document.getElementsByTagName('body')[0].appendChild(jwPlayerElement);

    var jwPlayer = jwplayer('jw-player');
    jwPlayer.setup({
        sources: [
            {file: "https://domain.com/playlist.m3u8"}
        ]
    })

Change the initialisation codes according to your Audio Player's requirements. As JWPlayer allows the retrieval of the instance through `jwplayer('jw-player')` at any location, I can just call it again to change the source or call its methods (play, pause, etc.) If your player does provide such a functionality, you may have to include a script to store the audio player instance to a global variable.

## TODO

- Image and Diagrams to explain the steps better.

- Sample OutSystems OML file.
Eclat Algorithm
Published: 2024-04-30 14:28:45

The Eclat algorithm is a depth search algorithm frequently used in data mining and is often used to find frequently occurring sets of items in a data set. This is a similar goal to the Apriori algorithm, but Eclat uses a different approach.

The Eclat algorithm uses the orthogonal data format to determine the frequency of itemsets. That is, it stores which transactions each item was involved in. This is an approach unlike Apriori's horizontal format, which stores which elements were involved in each transaction.

The Eclat algorithm usually consists of two steps:

Lists all operations of single items and performs operations on these lists.
It creates larger sets of items and calculates their frequency, discarding those below a certain threshold.
This process continues until no more itemsets can be created. As a result, frequently occurring item clusters are identified.

The Eclat algorithm is generally faster than Apriori because it makes fewer comparisons and uses less memory. However, it can still be slow on very large data sets because there is a need to calculate the frequency of entire sets of items.