teleren/devto huggingface dataset:
My name on Github Calendar
Tags: github
Published: 2022-07-13 07:00:09


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


Hello guys....Good aaafternoon....
first of all, Thank you for watching my this post.

I wanted to scratch my name on Github Calendar and I did!!!!!🥰🥰🥰
Steam is dying!
Tags: security
Published: 2022-07-13 06:47:08

I experienced a Steam fraud transaction, Steam was clear about what happened, but refused to restore the items. The only two things I got from customer service were no online support and a refusal to restore policy.

Fraudsters have been on Steam for a long time, is Steam doing anything to combat them? Banned two level-0 accounts, and then the scammers still completed their transactions and got the profit.
Can the fraudsters not register new accounts anymore? Of course they can. 

Many new users won't know that Steam doesn't have online support, unless they've experienced fraud. Wouldn't Steam add an authentication mark to distinguish official accounts?

The scammers' disguises are seamless, their conversations are in bubbles, and they seem to know how to format text better, so steam doesn't have a text filter? Is it hard to add a text filter? Aren't you guys pretty good at blocking fxxk in game communication?

In the absence of online support all the time, any conversation that tries to get the user to transfer assets is suspect, when a red warning pops up: this could be a fraudster. Is that hard?
We need to understand one thing, community marketplace transactions are money transactions, and money transactions need to be secure and trustworthy. If a transaction is fraudulent, it should be able to be reversed. If you want to handle money transactions like gifts, then you're really arrogant.

I've asked repeatedly to recoup my losses, but Steam customer service repeats their no-recovery policy. 
I can't help but guess that Steam's underlying motivation for this policy is that Steam doesn't care who is completing community transactions, because it always receives a 17% tax on those transactions.

Users are already familiar with the possible scams at Steam, but they don't understand what they're really up against and look how this nightmare began:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bdxtl5vdriq27ijyrv2l.png)
To go through the whole nightmare, click: https://initdc.github.io/steam_log/Service%20Assistant.mhtml


I blocked my friends list, with the intention of emptying it. I don't know when someone will turn out to be a fraudster, a real-world one among us. I became an island, lonely, but safe, and no one could harm me, not even by refusing to restore the policy.

The Prince of Dubai managed to get his Steam account restored, and I'm happy for him.
Unfortunately, I'm not a prince, and neither are you.

So goodbye, and never see you again.
Omah Koding | Tempat Belajar Koding di Kota Semarang dan Jogja
Tags: omahkoding, semarang, jogja, belajarkoding
Published: 2022-07-13 06:46:02

Omah koding merupakan perusahaan yang bergerak dalam bidang IT yang fokus pada jasa pembuatan website dan aplikasi android.

**Layanan Omah Koding Semarang**

- It Consulting
- Coding Class
- Software Development

Omah Koding juga membuka kelas bahasa pemrograman diantaranya seperti berikut :

- Html
- Css
- Design
- Php
- Scss
- Laravel
- Reactjs
- Codeigniter

Selamat Bergabung di Omah Koding Semarang dan Jogja | Tempat Belajar koding di Kota Semarang.
Binary Search in minutes
Tags: computerscience, beginners, codenewbie, algorithms
Published: 2022-07-13 06:46:00

Binary search is an algorithm that returns the index of a given element within a sorted array. To put it simply, it does this by repreatedly halving the list until the number of possible locations of the wanted element is reduced to one.

**How binary search works?**
1. Say we want to find the position of the element 38 from the following array:
![binary_search_step_1](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bghjinxw06h3d6tk72sh.jpg)

2. First we find the midpoint of the array. We can find the midpoint by using the formula *mid = (low + high) / 2*.
![binary_search_step_2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h98mgw67dgkds5n0erb0.jpg)

3. Compare 38 with the middle element. Since 25 is less than 38, we omit the first half. For the second half, *low = mid + 1*.
![binary_search_step_3](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/18qb4ii139scljot9e1a.jpg)

4. Repeat until mid points to the target element and return the index, which in this case is 6.
![binary_search_step_4](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gpyb24gmxr2pbw3ua54w.jpg)

**Implementation in Python**
```python
# iterative approach
def iterative_binary_search(list, target):
    low = 0
    high = len(list) - 1

    while high > low:
        mid = math.floor((low + high) / 2)
        if list[mid] == target:
            return mid
        elif list[mid] < target:
            low = mid + 1
        else:
            high = mid - 1

    return -1

# recursive approach
def recursive_binary_search(list, target, low, high):
    if low < high:
        mid = math.floor((low + high) / 2)

        if list[mid] == target:
            return mid
        elif list[mid] < target:
            return recursive_binary_search(list, target, mid + 1, high)
        else:
             return recursive_binary_search(list, target, low, mid - 1)
             
    return -1
```

**Time complexity of binary search**

| Case       | Time Complexity |
|------------|-----------------|
| Best       | O(1)            |
| Average    | O(log n)        |
| Worst      | O(log n)        |

* Best case is when target element is positioned exactly in the middle.
* Number of elements = 2<sup>depth</sup> because each element branches into 2 more elements.
* Worst case is when the searches the deepest level of the tree. 
* Depth is approximately log<sub>2</sub>n, where n is the number of elements.

**Space complexity of binary search**
* Iterative binary search requires three pointers(to keep track of the starting, middle and end points) regardless of the size of the array. Hence, its space complexity of is O(1). 

* On the other hand, recursive binary search does not have any loops and the new values are passed onto the next recursive call. The time complexity for recursive binary search is O(log n).
C++ uchun run komandasi
Published: 2022-07-13 06:32:01

**script papka yaratamiz**
 ```
 mkdir ~/scripts
 ```
`run.sh` bash file yaratamiz

```
touch ~/scripts/run.sh
```

`run.sh` fayl ichiga quyidagi _script_ni yozamiz
```
#!/bin /bash
clear && gcc $1 -0 main && ./main
```
`run.sh` faylga execution ruxsatini beramiz
```
chmod +x~/scripts/run.sh
```
**scripts** papkasini global $**PATH**ga doimiy qo'shamiz.
```
echo "export PATH=$PATH:`/scripts" >>~.bash_profile.
```
How to open UPI Apps in React Native | UPI Integration with React Native
Tags: reactnative, upi, javascript
Published: 2022-07-13 06:27:40

This post is going to be more specific for Indian clients or Indian Developers as it targets UPI payment (Unified Payments Interface) which is used in India Only.

- In India majority of people use UPI for transactions as it is much easier to use.

- But what if we want to integrate it to our app ? To be honest it is quite simple but tricky solution.

## First, let's see How UPI generally works using QR Code

- As we all know QR codes are the main method of making transactions in UPI. But how does it work ?

- Well it works on UPI id and a link which is encoded inside the Qrcode for that user.

- When we scan the Qrcode our scanner takes the link and process it with desired UPI App with the help of Deep Links.

- And boom it opens our Phone pay or Google pay app with transaction confirmation screen.

> Deep Links - Not going all in depth for this blog, but deep links are simply some local urls which points to a specific app with given parameters


## Taking a QR Code example

Let's take my UPI QrCode for example


![My UPI Qrcode.. you can donate to it if you want ;) ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jhdnzksk1z6afdln369o.png)

Now scan it with a local scanner or decode it using online scanners and extract the UPI Link

It will look something like this.
> upi://pay?pa=suyashvashishtha@axl&pn=Suyash%20Vashishtha&mc=0000&mode=02&purpose=00


Now all we have to do is , open this link with React Native Linking APi.


## Opening UPI with React Native 

As of now we have a UPI link and a React Native App ( Expo or Cli, doesnt really matter )

Now in order to open our UPI Apps all we have to do is, call `Linking` api from `react-native` and pass the url to it using `OpenURl()` method.

**Code Snippet - **


![Code snippet for UPI Integration in React Native](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/erpnb2fnrewhfkkrtbyj.png)

You can copy the code from [here](https://snippetsauce.tech/snippet?title=How+to+open+UPi+Apps+in+React+Native+%7C+UPI+Integration+with+React+Native&sauce=rnv912366).


.
**That's it , It will open a sheet showing all the UPI apps available in the mobile and which ever you will choose will redirect you to their payment screen for confirmation**



.

Thanks for reading this blog, I will keep uploading more blogs to help our dev community ❤️.

Comment | Share | Like
Entity Framework Core: Logging
Published: 2022-07-13 06:27:07

When we use EF Core in our application, we want to see generated query for debug purpose. And its actually quite easy to set it up.

# ASP.NET

The easiest way to configure it is in appsettings.json. Add EF related category and level in LogLevel node. We can find [categories choices here](https://docs.microsoft.com/en-us/ef/core/logging-events-diagnostics/simple-logging#message-categories)

```json
{  
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning",
      "Microsoft.EntityFrameworkCore.Database": "Information"
    }
  }
...
}
```

# C# code

If configuration won't work, we can always use C# code to enable logging.

We can add logging settings at ``OnConfiguring`` method of our DbContext class. Following example set:

- Information LogLevel
- Database category
- Output to debug console (Visual Studio output)

```csharp
protected override void OnConfiguring(DbContextOptionsBuilder options)
{
    options
        .LogTo(m => Debug.WriteLine(m), new[] { DbLoggerCategory.Database.Name }, LogLevel.Information)
        .EnableSensitiveDataLogging()
        .UseXXX();
}
```
If we want to log to console, we can simply change the first argument.

```csharp
protected override void OnConfiguring(DbContextOptionsBuilder options)
{
    options
        .LogTo(Console.WriteLine, new[] { DbLoggerCategory.Database.Name }, LogLevel.Information)
        .EnableSensitiveDataLogging()
        .UseXXX();
}
```

# Summary

Of course we have so many more ways to configure logging with more granular level. See [EF Logging Doc](https://docs.microsoft.com/en-us/ef/core/logging-events-diagnostics/) for detail.
What is Blockchain ? An Introduction & Brief Overview
Tags: 100daysofcode, blockchain, programming, codenewbie
Published: 2022-07-13 06:23:10

In this video, we will start with a new series and that is on Blockchain.  We will first cover a brief introduction of the Blockchain Technology and together with that we will understand the applications of Blockchain Technology into different industries like finance and medicine. We will also understand in brief about transactions and how blockchain can be used for same by understanding the use case of Bitcoin which is a cryptocurrency. Lastly, we will understand about the SHA256 hash in brief details. 

{% youtube XlZJ_QXs3Uk %}

🐱‍💻 🐱‍💻 Course Links:
Complete Code - https://github.com/The-Nerdy-Dev
Visual Studio Code - https://code.visualstudio.com
Git - https://git-scm.com/downloads

--- 
Support my channel:
💜 Join the Discord community 👨‍👩‍👧‍👦: https://discord.gg/fgbtN2a 
💜 One time donations via PayPal
Thank you! 🙏

---
Follow me on:
👉 Twitter: https://twitter.com/The_Nerdy_Dev
👉 Instagram: https://instagram.com/thenerdydev
👉 My Blog: https://the-nerdy-dev.com
You may consider swicthing from express to aex in 2022
Tags: javascript, node, typescript, webdev
Published: 2022-07-13 06:22:03

Express is very good lightweight web framework for node.js with a very large community.
It is ease to start and very extensible.

So why should we choose another one?

## Problems with Express
It has some problems:

1. It hasn't been update for years

express v5 has not been waited for years. 

2. Lacking of some very important features introduced by node.js and ecma new versions.
One of the most important features is the async/await support.

3. callback paradigm is somewhat unclear for large projects.
a non-intrusive and adherent web framework is somewhat more clear and easier for large projects to be well organised.

## Why other similar projects cannot take over express's project?

express is a very basic web framework, there are only a few similar projects, like koa, fastify

### Koa

Koa is a wrong implementation for promise/async/await.
Koa breaks old express middlewares, takes a lot effort but gain nothing.
Koa introduced a false middleware structure.
So there are not many projects choose it.

### fastify

Fastify is incompatible with express middlewares, and has its own way to construct a web server.

### Other complicated web frameworks is too opinionated.

And MVC is surely not a good place for web frameworks.
Most MVC frameworks are not correct as web frameworks.
Becuase Web frameworks only process request, response, that is to say, process data (such as json, html, xml, and txt) and logic, there are no direct mvc interactions for web frameworks.
And Controller is surely not a proper name for web processing functions/classes.

## Why use [aex](https://github.com/calidion/aex)?

1. Aex uses a new paradigm called Web Straight Line instead of MVC, which is more fix the web processing model, and focus on the web flow and common web processing. 
2. Aex is compatible with almost all express middlewares.
3. Aex is faster, decoratable, non-intrusive, adherent. Which a lot of built-in deocrators, you can greatly improve your working effiency.
4. Aex is about 1.5x more faster than expressjs due to a dependent router, which is far from optimized.
5. Aex is decoratable to classes which makes it non-intrusive and adherent. It will not interfere with business logic, only handles rountine web logic, which follows the Web Straight Line paradigm. Your can first organize your business logic then add web handlers as needed.

```ts
class BussinessLogic {
   businessLogic1();
   businessLogic2();
   ...
   businessLogicN();
   
   @http(...) 
   // common web logics here
   webHandle1();
      
   @http(...) 
   // common web logics here
   webHandle2();
}
```

6. It is almost painless to convert express projects to [aex](https://github.com/calidion/aex) ones.


##

Enjoy [aex](https://github.com/calidion/aex) at [https://github.com/calidion/aex](https://github.com/calidion/aex)
2100. Leetcode Solution in CPP
Tags: cpp
Published: 2022-07-13 06:13:18

```
class Solution {
 public:
  vector<int> goodDaysToRobBank(vector<int>& security, int time) {
    const int n = security.size();
    vector<int> ans;
    vector<int> dec(n);  // dec[i] := continuous decreasings before i
    vector<int> inc(n);  // inc[i] := continuous increasings after i

    for (int i = 1; i < n; ++i)
      if (security[i - 1] >= security[i])
        dec[i] = dec[i - 1] + 1;

    for (int i = n - 2; i >= 0; --i)
      if (security[i] <= security[i + 1])
        inc[i] = inc[i + 1] + 1;

    for (int i = 0; i < n; ++i)
      if (dec[i] >= time && inc[i] >= time)
        ans.push_back(i);

    return ans;
  }
};

```

#Leetcode
#challende
Here is the link for the problem:
https://leetcode.com/problems/find-good-days-to-rob-the-bank/
2055. Leetcode Solution in CPP
Tags: cpp
Published: 2022-07-13 06:11:25

```
class Solution {
 public:
  vector<int> platesBetweenCandles(string s, vector<vector<int>>& queries) {
    vector<int> ans;
    vector<int> A;  // indices of '|'

    for (int i = 0; i < s.length(); ++i)
      if (s[i] == '|')
        A.push_back(i);

    for (const auto& q : queries) {
      const int left = q[0];
      const int right = q[1];
      const int l = lower_bound(begin(A), end(A), left) - begin(A);
      const int r = upper_bound(begin(A), end(A), right) - begin(A) - 1;
      if (l < r) {
        const int lengthBetweenCandles = A[r] - A[l] + 1;
        const int numCandles = r - l + 1;
        ans.push_back(lengthBetweenCandles - numCandles);
      } else {
        ans.push_back(0);
      }
    }

    return ans;
  }
};

```
#Leetcode
#challende
Here is the link for the problem:
https://leetcode.com/problems/plates-between-candles/
1116. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-07-13 06:08:30

```
class Solution {
public:
    vector<int> maxDepthAfterSplit(string seq) {
        int Adepth = 0, Bdepth = 0;
        vector<int> ans(seq.size(), 0);
        for(int i = 0; i < seq.size(); i++){
            if(seq[i] == '('){
                //here the condition is Adepth <= Bdepth
                if(Adepth <= Bdepth){
                    Adepth++;
                    ans[i] = 0;
                }else{
                    Bdepth++;
                    ans[i] = 1;
                }
            }else{
                //here the condition is Adepth > Bdepth
                //(the opposite of Adepth <= Bdepth)
                if(Adepth > Bdepth){
                    Adepth--;
                    ans[i] = 0;
                }else{
                    Bdepth--;
                    ans[i] = 1;
                }
            }
        }
        return ans;
    }
};

```
#Leetcode
#challende
Here is the link for the problem:
https://leetcode.com/problems/maximum-nesting-depth-of-two-valid-parentheses-strings/
1116. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-07-13 06:07:09

```
class ZeroEvenOdd {
private:
    int n;
    mutex mtx;
    condition_variable cv;
    //used to choose next thread
    int next; //-1 for zero, 1 for odd, 0 for even
    //the next integer to print
    int i;
public:
    ZeroEvenOdd(int n) {
        this->n = n;
        this->next = -1;
        this->i = 1;
    }

    // printNumber(x) outputs "x", where x is an integer.
    void zero(function<void(int)> printNumber) {
        //need a while loop
        while(this->i <= this->n){
            unique_lock<mutex> lck(mtx);
            cv.wait(lck, [this](){return this->next == -1;});
            //need to check whether i is valid before printing
            if(this-> i <= this->n){
                printNumber(0);
            }
            //this line should be put outside "if" block!
            //, so other threads can exit
            this->next = i%2;
            //need "unlock" here!
            lck.unlock();
            cv.notify_all();
        }

        return;
    }

    void even(function<void(int)> printNumber) {
        while(this->i <= this->n){
            unique_lock<mutex> lck(mtx);
            cv.wait(lck, [this](){return this->next == 0;});
            if(this-> i <= this->n){
                printNumber(i);
            }
            this->i += 1;
            this->next = -1;
            lck.unlock();
            cv.notify_all();
        }
        return;
    }

    void odd(function<void(int)> printNumber) {
        while(this->i <= this->n){
            unique_lock<mutex> lck(mtx);
            cv.wait(lck, [this](){return this->next == 1;});
            if(this-> i <= this->n){
                printNumber(i);
            }
            this->i += 1;
            this->next = -1;
            lck.unlock();
            cv.notify_all();
        }
        return;
    }
};
```


#Leetcode
#challende
Here is the link for the problem:
https://leetcode.com/problems/print-zero-even-odd/
1161. Leetcode Solution in CPP
Tags: cpp
Published: 2022-07-13 06:05:11

```
/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     TreeNode *left;
 *     TreeNode *right;
 *     TreeNode() : val(0), left(nullptr), right(nullptr) {}
 *     TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
 *     TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
 * };
 */

class Solution {
public:
    int maxLevelSum(TreeNode* root) {
        queue<TreeNode*> qNode;
        queue<int> qLevel;
        int maxLevel = 0, maxSum = INT_MIN;
        int lastLevel = 1, lastSum = 0;
        TreeNode* node;
        
        qNode.push(root);
        qLevel.push(lastLevel);
        
        while(!qNode.empty()){
            node = qNode.front();
            // cout << node->val << endl;
            qNode.pop();
            
            lastLevel = qLevel.front();
            qLevel.pop();
            
            lastSum += node->val;
            
            if(node->left){
                qNode.push(node->left);
                qLevel.push(lastLevel+1);
            }
            
            if(node->right){
                qNode.push(node->right);
                qLevel.push(lastLevel+1);
            }
            
            //clean up before entering new level
            if(lastLevel != qLevel.front()){
                if(lastSum > maxSum){
                    maxSum = lastSum;
                    maxLevel = lastLevel;
                }
                lastSum = 0;
            }
        }
        
        return maxLevel;
    }
};

```


#Leetcode
#challende
Here is the link for the problem:
https://leetcode.com/problems/maximum-level-sum-of-a-binary-tree/
Transform Mapped Types from Snake_ to CamelCase in Typescript
Tags: javascript, programming, typescript, webdev
Published: 2022-07-13 06:04:40

![Snake](https://miro.medium.com/max/1400/0*PG_1fJhxBsgb7Nnk)

Re-mapping Typescript Mapped Types

{% medium https://medium.com/@mariusbongarts/transform-mapped-types-from-snake-to-camelcase-in-typescript-472a2a4843b9 %}
1200. Leetcode Solution in CPP
Tags: cpp
Published: 2022-07-13 06:02:04

```
class Solution {
 public:
  vector<vector<int>> minimumAbsDifference(vector<int>& arr) {
    vector<vector<int>> ans;
    int min = INT_MAX;

    sort(begin(arr), end(arr));

    for (int i = 0; i + 1 < arr.size(); ++i) {
      int diff = arr[i + 1] - arr[i];
      if (diff < min) {
        min = diff;
        ans.clear();
      }
      if (diff == min)
        ans.push_back({arr[i], arr[i + 1]});
    }

    return ans;
  }
};

```
#Leetcode
#challende
Here is the link for the problem:
https://leetcode.com/problems/minimum-absolute-difference/
993.Leetcode Solution in CPP
Tags: cpp
Published: 2022-07-13 06:00:28

```
/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     TreeNode *left;
 *     TreeNode *right;
 *     TreeNode() : val(0), left(nullptr), right(nullptr) {}
 *     TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
 *     TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
 * };
 */
class Solution {
public:
    bool isCousins(TreeNode* root, int x, int y) {
        int depthX = 0, depthY = 0;
        bool sameParent = false;
        helper(root, x, y, 0, depthX, depthY, sameParent);
        return !sameParent && depthX == depthY;
    }
    void helper(TreeNode* node, int x, int y, int cur, int& depthX, int& depthY, bool& sameParent) {
        if (!node) return;
        if (node->val == x) depthX = cur;
        if (node->val == y) depthY = cur;
        if (node->left && node->right) {
            int left = node->left->val, right = node->right->val;
            if ((left == x && right == y) || (left == y && right == x)) sameParent = true;
        }
        helper(node->left, x, y, cur + 1, depthX, depthY, sameParent);
        helper(node->right, x, y, cur + 1, depthX, depthY, sameParent);
    }
};
```

#Leetcode
#challende
Here is the link for the problem:
https://leetcode.com/problems/cousins-in-binary-tree/