teleren/devto huggingface dataset:
react-native: install react-native-vector-icons
Published: 2022-06-09 03:44:01

### Version
```json
"react-native-vector-icons": "^9.1.0",
"@types/react-native-vector-icons": "^6.4.10",
"react-native": "0.68.2",
```

### Install react-native-vector-icons
```bash
yarn add react-native-vector-icons

# if use typescript
yarn add @types/react-native-vector-icons -D

# install on ios
cd ios && pod install
```

### Config for IOS
- Autolink from react-navive > v6.0 => no need to run react-native link anymore
- Autolink will auto copy resource (file .ttf) => no need to copy resource file anymore
- Add this meta-data to `info.list`
```
<key>UIAppFonts</key>
<array>
  <string>AntDesign.ttf</string>
  <string>Entypo.ttf</string>
  <string>EvilIcons.ttf</string>
  <string>Feather.ttf</string>
  <string>FontAwesome.ttf</string>
  <string>FontAwesome5_Brands.ttf</string>
  <string>FontAwesome5_Regular.ttf</string>
  <string>FontAwesome5_Solid.ttf</string>
  <string>Foundation.ttf</string>
  <string>Ionicons.ttf</string>
  <string>MaterialIcons.ttf</string>
  <string>MaterialCommunityIcons.ttf</string>
  <string>SimpleLineIcons.ttf</string>
  <string>Octicons.ttf</string>
  <string>Zocial.ttf</string>
</array>
```

### Config for Android

- Open file `android/app/build.gradle` not file `android/build.gradle`

- Add Config
```gradle
apply plugin: "com.android.application" 
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle" // <-- this line
```

### Check
```jsx
import Icon from 'react-native-vector-icons/FontAwesome';
const myIcon = <Icon name="rocket" size={30} color="#900" />;
```
My first time using docker for deploying static website
Tags: docker, nginx, ubuntu, devops
Published: 2022-06-09 03:38:47

im using **AWS EC2** for VPS, **Ubuntu 20.04** for operating system, and **nginx** as a web server.


**First we need to install the docker**
maybe you want to read more in their [documentation](https://docs.docker.com/engine/install/)

or using my method, step by step install docker

login as root

1. `apt -y update `
2. `apt -y install apt-transport-https ca-certificates curl gnupg-agent software-properties-common`
3. `'curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -`
4. `apt-key fingerprint 0EBFCD88`
5. `add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"`
6. `apt -y update`
7. `apt -y install docker-ce docker-ce-cli containerd.io`

and for checking the docker running
`systemctl status docker`



after the docker installation, choose your static website that you want to deploy.

after that, create a `Dockerfile`

`nano Dockerfile`

inside the `Dockerfile` type this

```
# Choose the image
FROM nginx
# Remove the default file
RUN rm -rf /usr/share/nginx/html/*
# Copy and move your own website file to the nginx html folder
COPY ./{your directory website} /usr/share/nginx/html
```

its time to build your image
`docker build -t {image name} .`

for example 
`docker build -t theia .`

and to check if your image build success
`docker images`

```
REPOSITORY   TAG       IMAGE ID       CREATED          SIZE
theia        latest    b8b7870c8621   24 minutes ago   143MB
nginx        latest    0e901e68141f   11 days ago      142MB
```

if you see your docker image, now were gonna run it

`docker run -d(for running in background) -p 8080:80(choose your not used port) --name(name your container) (your image)`

for example

`docker run -d -p 8080:80 --name thalia theia`


and finally you can access your website using your public ip and port

example mine is `54.183.74.95:8080`


if you have another method, feel free to discuss.
thanks for reading, have a nice day
Programadores Java irão dominar o mundo? Ou estão a beira da extinção?
Tags: braziliandevs, discuss, java, dotnet
Published: 2022-06-09 03:14:52

Algo que tenho notado em vagas para desenvolvedores é a grande procura por desenvolvedores Java, sou desenvolvedor .NET e amo o C#, mas fico pensando seriamente em aprender Java.

Diante disso, atualmente quem sabe Java, pode escolher em qual das milhares de vagas irá aplicar.

Seria isso apenas uma impressão minha? Vale a pena trocar C# por Java?
The Complete Guide to Temp Email Addresses and How They are Protecting Your Business Name
Tags: tempmail
Published: 2022-06-09 03:10:23

**What is a Temporary Email Address?**
A disposable email is a temporary email account that you can use for online shopping, online banking, and other private matters.

[Tempmail gmail](https://smailpro.com/) inbox is a mailbox where you can receive emails without revealing your real address.

The temporary mailbox is an email account that you can use to get your emails from different websites.

**How Do Temp Emails Help with 6 Amazing Use Cases?**
Temporary mail addresses are useful for a variety of reasons. They can be used to set up temporary websites, manage online marketing campaigns, or even to give your business a more professional appearance.

What are the Best Temporary Email Services to Choose from?
When you need to protect your privacy, temporary email services are the best option. One of the most popular temp email services is [smailpro.com](https://smailpro.com/). You can use it to create a temporary email address with a new password and then delete it when you are finished with it. It also has strong encryption so that your information is safe and secure when you send emails or store them in the account.

Another popular temp email service is [Tempmail](https://smailpro.com/). It uses end-to-end encryption and doesn't store any personal information about its users on their servers. The company also has an open source code so that anyone can verify their claims of security and privacy.

**How to Keep Your Email from Being Hacked or Spammed with a Temp Address?**
There are many ways to protect your email from spam, but the one way that is most effective is by using a temporary email address.

A temporary email address will not be listed in any public databases and will not be associated with you or your business.

This makes it much harder for hackers to find and use it to send spam messages or emails.

Temporary email addresses are also very easy to create and use, which means you can switch between them in seconds as needed.

Email is the most common way of communication in the world today, which means that you should be protecting yours at all times.

The best way to do this is by using a temporary email address instead of your personal one.
Sort an Array
Tags: leetcode, dsa, theabbie
Published: 2022-06-09 03:00:44

Given an array of integers `nums`, sort the array in ascending order.

**Example 1:**

**Input:** nums = \[5,2,3,1\]
**Output:** \[1,2,3,5\]

**Example 2:**

**Input:** nums = \[5,1,1,2,0,0\]
**Output:** \[0,0,1,1,2,5\]

**Constraints:**

*   `1 <= nums.length <= 5 * 104`
*   `-5 * 104 <= nums[i] <= 5 * 104`

**SOLUTION:**

    import heapq
    
    class Solution:
        def sortArray(self, nums: List[int]) -> List[int]:
            n = len(nums)
            heapq.heapify(nums)
            return heapq.nsmallest(n, nums)
Poll: On ðe use of þorn and eþ in English, what would you do?
Tags: poll, language, english, watercooler
Published: 2022-06-09 02:18:20

[Ðis is a poll I made on Reddit's r/linguistics](https://www.reddit.com/r/linguistics/comments/v82iyy/on_%C3%B0e_use_of_%C3%BEorn_and_e%C3%BE_in_english_what_would/).

Based on [ðe þesis I wrote](https://dev.to/baenencalin/a-compelling-argument-as-to-why-we-should-use-eth-and-thorn-4mj4), what would you do if þorn and eþ were added back to English?

<ol type="A">
<li>Accept ðem into ðe English alphabet.</li>
<li>Recognize ðem as characters (possibly have ðem taught) but not include ðem in ðe alphabet.</li>
Or
<li>
Ignore ðem and continue using "th".</li>
</ol>
Web3 Solidity + JavaScript 32 hour course recap #12
Tags: blockchain, tutorial, devjournal
Published: 2022-06-09 02:12:13

timestamps: 4:11:11 - 4:22:02

This is a recap of me making my way through the 32 hour course by Patrick Collins posted on [FreeCodeCamp](https://www.youtube.com/watch?v=gyMwXuJrbJQ).

There was a lot of user error this time -.-;

However, we made a lot of progress in our "FundMe" SmartContract. 

Basically, to have $50 in ethereum, we have to use 50 and set it to 10e18:

`uint256 public minimumUsd = 50 * 1e18;`

This is because WEI is 18 decimal places.

Then we completed the `getBlockchainPrice` function. Which connects to the Aggregator with the address provided in Chainlink.

`AggregatorV3Interface priceFeed = AggregatorV3Interface(ethToUsdAddress);`

This function also taught us about Solidity destructing, which is possible as long as you leave in the commas to account for the values that you don't need to use.

`(, int256 price, , ,) = priceFeed.latestRoundData();`

One of the variables lets you know about the decimal place, but in order for it to display the correct currency amount is is only e10.

` return uint256(price * 1e10);`

Next, the `getConversionRate` method takes in the global value that was sent with the transaction, and converts it to the correct amount of Ethereum, by getting the current price of Ethereum:
`uint256 ethPrice = getBlockchainPrice();`

and then 

`uint256 ethAmountInUsd = (ethPrice * ethAmount) / 1e18;`

With solidity, you have to multiply first and then divide so basically 101/100 to get 1%. Something Something floating point math, and we want to be accurate when it comes to money.

I didn't get terribly far today, but we made good progress in the app. If I had to guess, we'll be getting to the meat of the `fund` method soon!
Daily Temperatures
Tags: leetcode, dsa, theabbie
Published: 2022-06-09 02:00:45

Given an array of integers `temperatures` represents the daily temperatures, return _an array_ `answer` _such that_ `answer[i]` _is the number of days you have to wait after the_ `ith` _day to get a warmer temperature_. If there is no future day for which this is possible, keep `answer[i] == 0` instead.

**Example 1:**

**Input:** temperatures = \[73,74,75,71,69,72,76,73\]
**Output:** \[1,1,4,2,1,1,0,0\]

**Example 2:**

**Input:** temperatures = \[30,40,50,60\]
**Output:** \[1,1,1,0\]

**Example 3:**

**Input:** temperatures = \[30,60,90\]
**Output:** \[1,1,0\]

**Constraints:**

*   `1 <= temperatures.length <= 105`
*   `30 <= temperatures[i] <= 100`

**SOLUTION:**

    class Solution:
        def dailyTemperatures(self, temperatures: List[int]) -> List[int]:
            n = len(temperatures)
            answer = [0 for i in range(n)]
            stack = []
            for i in range(n):
                while len(stack) > 0 and temperatures[i] > temperatures[stack[-1]]:
                    curr = stack.pop()
                    answer[curr] = i - curr
                stack.append(i)
            return answer
New Episode! Chris Oliver on Code and the Coding Coders who Code it
Tags: podcast, ruby, rails, webdev
Published: 2022-06-09 01:34:29

{% embed https://dev.to/coding-coders/episode-7-chris-oliver %}
Chris Oliver joins the show to discuss all the adventures he's been having. He tells us about the various projects he has going on, including: rewriting Hatchbox, hiring his first employee, and what the future of learning Rails could look like. He also is building a house which definitely takes some time to put together! There was so much to talk about this episode that it's certainly getting the 1st place spot for longest episode!

Links:

- [On Twitter @excid3](https://twitter.com/excid3)
- [GitHub](https://github.com/excid3)
- [Pay gem](https://github.com/pay-rails/pay)
- [GoRails Screencasts](https://gorails.com/)
- [Jumpstart Rails](https://jumpstartrails.com/)
- [Hatchbox](https://www.hatchbox.io/)
- [Remote Ruby Podcast](https://remoteruby.transistor.fm/)
- ["Surely You're Joking, Mr. Feynman!" Book](https://en.wikipedia.org/wiki/Surely_You%27re_Joking,_Mr._Feynman!)
Kids With the Greatest Number of Candies
Tags: leetcode, dsa, theabbie
Published: 2022-06-09 01:30:38

There are `n` kids with candies. You are given an integer array `candies`, where each `candies[i]` represents the number of candies the `ith` kid has, and an integer `extraCandies`, denoting the number of extra candies that you have.

Return _a boolean array_ `result` _of length_ `n`_, where_ `result[i]` _is_ `true` _if, after giving the_ `ith` _kid all the_ `extraCandies`_, they will have the **greatest** number of candies among all the kids__, or_ `false` _otherwise_.

Note that **multiple** kids can have the **greatest** number of candies.

**Example 1:**

**Input:** candies = \[2,3,5,1,3\], extraCandies = 3
**Output:** \[true,true,true,false,true\] 
**Explanation:** If you give all extraCandies to:
- Kid 1, they will have 2 + 3 = 5 candies, which is the greatest among the kids.
- Kid 2, they will have 3 + 3 = 6 candies, which is the greatest among the kids.
- Kid 3, they will have 5 + 3 = 8 candies, which is the greatest among the kids.
- Kid 4, they will have 1 + 3 = 4 candies, which is not the greatest among the kids.
- Kid 5, they will have 3 + 3 = 6 candies, which is the greatest among the kids.

**Example 2:**

**Input:** candies = \[4,2,1,1,2\], extraCandies = 1
**Output:** \[true,false,false,false,false\] 
**Explanation:** There is only 1 extra candy.
Kid 1 will always have the greatest number of candies, even if a different kid is given the extra candy.

**Example 3:**

**Input:** candies = \[12,1,12\], extraCandies = 10
**Output:** \[true,false,true\]

**Constraints:**

*   `n == candies.length`
*   `2 <= n <= 100`
*   `1 <= candies[i] <= 100`
*   `1 <= extraCandies <= 50`

**SOLUTION:**

    class Solution:
        def kidsWithCandies(self, candies: List[int], extraCandies: int) -> List[bool]:
            mx = max(candies)
            return [c + extraCandies >= mx for c in candies]
react-native: run application on specific ios simulator
Tags: reactnative, ios
Published: 2022-06-09 01:09:35

This post will guide you how to run your application on specific ios simulator

```bash
# list all ios simulator
xcrun simctl list devices
# == Devices ==
# -- iOS 13.3 --
#    iPhone 8 (F71514A5-9B42-4FFF-93B0-AAAA)
#    iPhone 8 Plus (EE9676FF-8508-4B7C-B955-BBBB) 

# -- iOS 13.6 --
#    iPhone 8 (F71514A5-9B42-4FFF-93B0-XXXX)
#    iPhone 8 Plus (EE9676FF-8508-4B7C-B955-YYYY) 

```

### Run with device name
```json
// package.json
{
  "scripts": {
    "start:iphone8": "react-native run-ios --simulator='iPhone 8'"
    // will choose F71514A5-9B42-4FFF-93B0-AAAA
  }
}
```

### Run with uuid
- In some case you want to specific version of iOS (13.3, 13.6)
```json
// package.json
{
  "scripts": {
    "start:iphone8Plus": "react-native run-ios --udid EE9676FF-8508-4B7C-B955-YYYY"
  }
}
```

### Run on the real device
```bash
npx react-native run-ios --configuration Release --device 'Boss's iPhone'
```
Replace Elements with Greatest Element on Right Side
Tags: leetcode, dsa, theabbie
Published: 2022-06-08 22:30:38

Given an array `arr`, replace every element in that array with the greatest element among the elements to its right, and replace the last element with `-1`.

After doing so, return the array.

**Example 1:**

**Input:** arr = \[17,18,5,4,6,1\]
**Output:** \[18,6,6,6,1,-1\]
**Explanation:** 
- index 0 --> the greatest element to the right of index 0 is index 1 (18).
- index 1 --> the greatest element to the right of index 1 is index 4 (6).
- index 2 --> the greatest element to the right of index 2 is index 4 (6).
- index 3 --> the greatest element to the right of index 3 is index 4 (6).
- index 4 --> the greatest element to the right of index 4 is index 5 (1).
- index 5 --> there are no elements to the right of index 5, so we put -1.

**Example 2:**

**Input:** arr = \[400\]
**Output:** \[-1\]
**Explanation:** There are no elements to the right of index 0.

**Constraints:**

*   `1 <= arr.length <= 104`
*   `1 <= arr[i] <= 105`

**SOLUTION:**

    class Solution:
    #     def makeSeg(self, arr, i, j):
    #         seg = self.seg
    #         if (i, j) in seg:
    #             return seg[(i, j)]
    #         if i == j:
    #             seg[(i, j)] = arr[i]
    #             return arr[i]
    #         mid = (i + j) // 2
    #         curr = max(self.makeSeg(arr, i, mid), self.makeSeg(arr, mid + 1, j))
    #         seg[(i, j)] = curr
    #         return curr
        
    #     def getMax(self, arr, i, j, ni, nj):
    #         seg = self.seg
    #         if ni >= i and nj <= j:
    #             return seg[(ni, nj)]
    #         if (ni < i and nj < i) or (ni > j and nj > j):
    #             return float('-inf')
    #         mid = (ni + nj) // 2
    #         return max(self.getMax(arr, i, j, ni, mid), self.getMax(arr, i, j, mid + 1, nj))
        
    #     def replaceElements(self, arr: List[int]) -> List[int]:
    #         n = len(arr)
    #         self.seg = {}
    #         self.makeSeg(arr, 0, n - 1)
    #         for i in range(n):
    #             if i < n - 1:
    #                 arr[i] = self.getMax(arr, i + 1, n, 0, n - 1)
    #             else:
    #                 arr[i] = -1
    #         return arr
    
        def replaceElements(self, arr: List[int]) -> List[int]:
            n = len(arr)
            op = [-1] * n
            currMax = float('-inf')
            for i in range(n - 1, 0, -1):
                currMax = max(currMax, arr[i])
                op[i - 1] = currMax
            return op
Longest Palindrome by Concatenating Two Letter Words
Tags: leetcode, dsa, theabbie
Published: 2022-06-09 01:00:46

You are given an array of strings `words`. Each element of `words` consists of **two** lowercase English letters.

Create the **longest possible palindrome** by selecting some elements from `words` and concatenating them in **any order**. Each element can be selected **at most once**.

Return _the **length** of the longest palindrome that you can create_. If it is impossible to create any palindrome, return `0`.

A **palindrome** is a string that reads the same forward and backward.

**Example 1:**

**Input:** words = \["lc","cl","gg"\]
**Output:** 6
**Explanation:** One longest palindrome is "lc" + "gg" + "cl" = "lcggcl", of length 6.
Note that "clgglc" is another longest palindrome that can be created.

**Example 2:**

**Input:** words = \["ab","ty","yt","lc","cl","ab"\]
**Output:** 8
**Explanation:** One longest palindrome is "ty" + "lc" + "cl" + "yt" = "tylcclyt", of length 8.
Note that "lcyttycl" is another longest palindrome that can be created.

**Example 3:**

**Input:** words = \["cc","ll","xx"\]
**Output:** 2
**Explanation:** One longest palindrome is "cc", of length 2.
Note that "ll" is another longest palindrome that can be created, and so is "xx".

**Constraints:**

*   `1 <= words.length <= 105`
*   `words[i].length == 2`
*   `words[i]` consists of lowercase English letters.

**SOLUTION:**

    from collections import Counter
    
    class Solution:
        def longestPalindrome(self, words: List[str]) -> int:
            ctr = Counter(words)
            longest = 0
            isDouble = False
            for word in list(ctr.keys()):
                if word[0] == word[1]:
                    longest += 4 * (ctr[word] // 2)
                    rem = ctr[word] % 2
                    ctr[word] = rem
                    if rem == 1:
                        isDouble = True
                else:
                    k = min(ctr[word], ctr[word[::-1]])
                    longest += 4 * k
                    ctr[word] -= k
                    ctr[word[::-1]] -= k
            if isDouble:
                longest += 2
            return longest
Perl Mojolicious Hypnotoad Change Port
Published: 2022-06-09 00:51:09

Hello.  I am new to Mojolicious.  I am trying to change the port in the full app mode.  W\Web server is Hypnotoad.  In the examples I see reference to a configuration (i.e. myWebSite.conf) yet when I use 

```
mojo generate app myWebSite
```
then it produces a YML file (i.e. myWebSite.yml).  When I try to update the yml config file with example code from conf files I get errors.
I have tried:
```
---

  secrets:
- 9b2a56894703626d68a8d6bc347c4efcxxxd17fx

app->config(hypnotoad => {listen => ['http://*:8083']});
```

Does not work.

I have tried:
```{
  secrets => ['9b2a56894703626d68a8d6bc347c4efcxxxd17fx'],
  hypnotoad => {
    listen => ['http://127.0.0.1:8083'],
    workers => 10
    }
}
```
Does not work.
The script file is:
```#!/usr/bin/env perl

use strict;
use warnings;

use Mojo::File qw(curfile);
use lib curfile->dirname->sibling('lib')->to_string;
use Mojolicious::Commands;

# Start command line interface for application
Mojolicious::Commands->start_app('myWebSite');
```

The error is:

```
alpha@localhost:~/myWebSite/script$ hypnotoad myWebSite
Can't load application from file "/home/alpha/myWebSite/script/myWebSite": Can't load configuration from file "/home/alpha/myWebSite/myWebSite.yml": CPAN::Meta::YAML failed to classify line 'app->config(hypnotoad => {listen => ['http://*:8083']});' at /usr/local/share/perl/5.34.0/Mojolicious/Plugin/NotYAMLConfig.pm line 19.
Compilation failed in require at (eval 102) line 1.
```
How to Display a Web Application with Basic Authentication in WebView using Jetpack Compose (Android)
Tags: android, jetpack, compose, kotlin
Published: 2022-06-09 00:44:47

This article shows how to display a web application with Basic Authentication in WebView using Jetpack Compose.
 The sample code on this article was made with reference to [the thread on StackOverflow](https://stackoverflow.com/questions/2585055/using-webview-sethttpauthusernamepassword). StackOverflow's code is written in Java, but this article shows you the sample code in kotlin.

## Source Code

```kotlin
class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent{ MyWebClient(url = "https://hogehoge.hoge")}
    }
}

@SuppressLint("SetJavaScriptEnabled")
@Composable
fun MyWebClient(url: String) {

    AndroidView(factory = ::WebView,
    update = { webView ->
        webView.webViewClient = MyWebViewClient()
        webView.settings.javaScriptEnabled = true
        webView.loadUrl(url)

    })
}

// Ovverride onReceivedHttpAuthRequest in new class which extends WebViewClient().
private class MyWebViewClient: WebViewClient() {
    @Override
    override fun onReceivedHttpAuthRequest(
        view: WebView?,
        handler: HttpAuthHandler?,
        host: String?,
        realm: String?
    ) {
        if (handler != null) {
            handler.proceed("The user name to Basic Auth.", "The password to Basic Auth.")
        }
    }
}
```

## The Result
I cannot show you the contents of the web application. But I guess that you can check that all contents (text and images) are loaded.

![The Preview of Execution](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qn2pnjkzfiyputgnk1uf.png)

---

This original article is the following that is written by me. This is a translation of a portion of this original article from Japanese to English.
{% embed https://zenn.dev/akira_kashihara/articles/a05bcc4099fa48 %}