teleren/devto huggingface dataset:
Applied for AWS community Builder Program
Tags: aws, cloud, awsdevtools, awscommunitybuilder
Published: 2023-01-10 18:13:58

Today, I am excited to announce that I have just applied for the AWS Community Builders Program. The AWS Community Builders Program is an initiative by AWS that aims to support and recognize individuals who are building and engaging with the AWS community. As an AWS Certified and AWS Cloud Engineer, I am deeply interested in the program and am hopeful that I will be selected to join the program.

As a community builder, I believe that one of the most important things is to share knowledge and experience with others, and that is precisely what the AWS Community Builders Program is all about. The program offers a variety of resources and benefits for community builders, such as access to AWS service experts, training, and events. These resources will help me in my efforts to create content, speak at events, and organize user groups.

Furthermore, the program provides an excellent opportunity for me to stay current on the latest AWS services and best practices. AWS is always introducing new services and features, and being a part of the program will allow me to be among the first to know about these new offerings. This will help me to be more effective in my role as a community builder and to provide more value to the community.

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

Another aspect that I am excited about is the opportunity to collaborate with other community builders and experts. The program will bring together a diverse group of individuals who share a passion for AWS and helping others succeed on the cloud. I look forward to the opportunity to get to know and learn from these individuals, and to work together on projects that align with our interests and the needs of the community.

In conclusion, I am thrilled about the opportunity to be a part of the AWS Community Builders Program, and I am hopeful that I will be selected to join the program. If selected, I am confident that I will be able to contribute more to the community and help others to be successful on the cloud.
Leetcode 100. Same Tree
Tags: beginners, programming, tutorial, java
Published: 2023-01-10 18:13:50

Given the roots of two binary trees p and q, write a function to check if they are the same or not.

Two binary trees are considered the same if they are structurally identical, and the nodes have the same value.

 

Example 1:


Input: p = [1,2,3], q = [1,2,3]
Output: true
Example 2:


Input: p = [1,2], q = [1,null,2]
Output: false
Example 3:


Input: p = [1,2,1], q = [1,1,2]
Output: false
 

Constraints:

The number of nodes in both trees is in the range [0, 100].
-10^4 <= Node.val <= 10^4

## Intuition
We just need to traverse both trees and check whether each of the values of the trees is properly matching. So any type of tree traversal will be sufficient.

## Approach
We will be doing recursively(Preorder traversal)
1. Check the base conditions :
-> Check whether both the trees are null, if yes return true.
-> Check whether any of the trees is null, if yes then return false as they are not the same.

2. Check whether the current values at the 2 trees are equal, if yes return true.
3. Continue iteration recursively on the left and right subtree.

## Complexity
- Time complexity:
We are traversing the whole tree. So if there are n number of trees, then the time complexity will be O(n).


- Space complexity:
Space complexity will be O(H) where H = height of the tree

## Code
```java
/**
 * Definition for a binary tree node.
 * public class TreeNode {
 *     int val;
 *     TreeNode left;
 *     TreeNode right;
 *     TreeNode() {}
 *     TreeNode(int val) { this.val = val; }
 *     TreeNode(int val, TreeNode left, TreeNode right) {
 *         this.val = val;
 *         this.left = left;
 *         this.right = right;
 *     }
 * }
 */
class Solution {
    public boolean isSameTree(TreeNode p, TreeNode q) {
        if (p == null && q == null) {
            return true;
        }
        if (p == null || q == null) {
            return false;
        }
        if (p.val != q.val) {
            return false;
        }
        return isSameTree(p.left, q.left) && isSameTree(p.right, q.right);
    }
}
```
Adventures with JavaScript Arrays: Random Numbers Array
Tags: javascript, beginners, tutorial
Published: 2023-01-10 18:03:57

_The JavaScript array is an ubiquitous data structure, thus I'd like to spend some time to get more familiar/reacquainted with the Array object. I'll share my knowledge with you in the form of blog posts._

In this post I'll create a function that returns an array of random whole numbers. 

Let's get started!

```javascript
function randomNumbersArray(length = 10) {
    // return array of random numbers between 1 and 100
	// if length parameter is not provided, length is set to 10
}
```

We know that we want to create an array of random whole numbers between 1 and 100 with either a specified length or 10. Let's first discuss the Array constructor. 

## Calling Array constructor with single number argument
With JavaScript's Array constructor you are able to call it with a single number argument. If you do this, an array will be created with the length of the number that is received. Each element will be `undefined`.


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

In the example above, I am calling the Array constructor with an argument of 10. As you can see, the `length` property is set to 10.

## Array.from()
`Array.from` is a static method on the JavaScript Array object which will create a new array from an iterable/array-like object.

The first parameter of `Array.from`  is an object. So we could do something like this:


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

We call `Array.from` with a string, which is an iterable object, and an array is created from that value.

`Array.from` has an optional second parameter  which is a mapping function. 


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

In the example above, we are using the mapping function to capitalize each letter in the first argument.

## Putting it all together
Let's now take what we know about the JavaScript Array and create the `randomNumbersArray` function.

```javascript
function randomNumbersArray(length = 10) {
  return Array.from(Array(length), () => Math.floor(Math.random() * 100) + 1);
}
```

Here's an example showing the output.

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

We are calling `Array.from` and passing in an array with a length of the value of the `length` argument that is created using the `Array` constructor as the first param, and we are passing in a mapping function that creates a random whole number between 1 and 100 for each element of the array as the second param.

We now have a function that creates an array, with a length of 10, unless a length argument is provided, of whole numbers between 1 and 100.

## Conclusion
Of course there are multiple ways to create an array of random numbers in JavaScript. I thought this approach was interesting as it uses the Array object's constructor and the `from` static method. Thanks for reading! Until next time.
JavaScript Symbols
Tags: javascript
Published: 2023-03-06 19:27:54

---
title: JavaScript Symbols
published: true
date: 2023-01-10 18:00:00 UTC
tags: JavaScript
canonical_url: https://www.90-10.dev/js-symbols/
---

A  symbol is a **unique and immutable data type** that represents an identifier.

Symbols was first introduced in **ECMAScript 6** , and they are used to define properties of an object that cannot be accessed or modified by other parts of the code.

## Creating Symbols

Declaring a symbol doesn't require the new keyword:

```
let mySymbol = Symbol();
```

We can also provide a string when creating a symbol; it acts as a label for the symbol and can help with debugging.

```
let anotherSymbol = Symbol('test2');
```

## Uniqueness

Symbols are unique, even when providing a string for them:

```
Symbol('a') === Symbol('a') // returns: false
```

## Define Constants

Symbols can also be used to define constants by using them as property keys, ensuring that the property cannot be accidentally modified or deleted.

```
const THE_CONSTANT = Symbol();
const theAnswer = {
  [THE_CONSTANT]: 42
};
console.log(theAnswer[THE_CONSTANT]); // prints: 42

theAnswer[THE_CONSTANT] = 3.14;
console.log(theAnswer[THE_CONSTANT]); // prints: 42

delete theAnswer[THE_CONSTANT];
console.log(theAnswer[THE_CONSTANT]); // prints: 42
```

## Hide Information

Symbols can be used to hide information:

```
let mySymbol = Symbol('answer');
let obj = {
  x: 24,
  [mySymbol]: 42
}
console.log(obj.x); // prints: 24
console.log(obj.mySymbol); // prints: undefined
console.log(obj[mySymbol]); // prints: 42

mySymbol.toString() // prints: "Symbol(answer)"
```

One would need to keep `mySymbol` variable around in order to access the second `obj` property.

```
let obj = {
	x: 24,
  [Symbol("answer")]: 42
}

console.log(obj[Symbol("answer")]); // prints: undefined

```

## Private methods

Symbols can also be used to create complex internal logic that can't be accessed from outside the object:

```
const obj = {
  [Symbol.for('sum')]: function(x, y) {
    return x + y;
  },
  add: function(x, y) {
    return this[Symbol.for('sum')](x, y);
  }
};
console.log(obj.add(2, 3)); // prints: 5
console.log(obj.sum(2, 3)); // TypeError: obj.sum is not a function
```

Notice the use of `Symbol.for` to retrieve a symbol from the global symbol registry.

## Global Symbol Registry

The global symbol registry is a "concept" that might not be how actually it is implemented by JS engines but it's useful for the understanding how `Symbol.for` and `Symbol.keyFor` are used to retrieve symbols and keys across different files or global scopes.

```
// returns: false
Symbol('sum') === Symbol('sum')  

// returns: true
Symbol.for('sum') === Symbol.for('sum')  

Symbol.keyFor(Symbol.for("sum")) === "sum"
```

## Reading List

- [MDN](https://developer.mozilla.org/en-US/docs/Glossary/Symbol)
Day 7: Making Cool Raspberry Pi Projects even Cooler with Voice AI (2/4)
Tags: 100daysofcode, challenge, programming, tutorial
Published: 2023-01-10 17:58:09

Continue to show how to make your cool Raspberry Pi projects even cooler with voice AI.

**Building an end-to-end voice recognition:**
Interested in building something similar to Alexa which understand commands such as "Alexa, turn on all the lights"? with a Raspberry Pi? You've come to the right place. [Picovoice Platform SDK](https://picovoice.ai/docs/quick-start/picovoice-raspberrypi/) is what you're looking for. It consists [Porcupine Wake Word]https://picovoice.ai/platform/porcupine/) and [Rhino Speech-to-Intent](https://picovoice.ai/platform/rhino/) Engines.

In this demo we'll use Raspberry Pi Zero - ReSpeaker. 
{% embed https://www.youtube.com/watch?v=X12N2Rn-q5o %}
Let's get started!

**Requirements**
```
sudo apt-get install libasound2-dev
```
**Access Key**
If you don't have one, you can get your AccessKey from the [Picovoice Console](https://console.picovoice.ai/) for free.

**Run**
```
gcc -std=c99 -O3 -o demo/respeaker-rpi0/picovoice_demo_mic \
-I sdk/c/include/ demo/respeaker-rpi0/picovoice_demo_mic.c \
-ldl -lasound
```
Say `Picovoice`
The demo outputs: `[wake word]`
Say `turn on the lights`

You should see the lights turned on and the following message in the terminal:

`{
    is_understood : 'true',
    intent : 'turnLights',
    slots : {
        'state' : 'on',
    }
}`

Try changing the color by saying `Picovoice, set the lights to orange`

The list of commands you can try:
`context:
  expressions:
    turnLights:
      - "[switch, turn] $state:state (all) (the) [light, lights]"
      - "[switch, turn] (all) (the) [light, lights] $state:state"
    changeColor:
      - "[change, set, switch] (all) (the) (light, lights) (color) (to) $color:color"
  slots:
    state:
      - "off"
      - "on"
    color:
      - "blue"
      - "green"
      - "orange"
      - "pink"
      - "purple"
      - "red"
      - "white"
      - "yellow"`

You can check out the [GitHub repo](https://github.com/Picovoice/picovoice/tree/master/demo/respeaker-rpi0) to see more open-source demos
Simple Product enquiry in php with mail function
Tags: php, javascript, mai, webdev
Published: 2023-01-10 17:53:30

Create simple form in the fields of Name, Email, Mobile, Address and Product Count and amount.


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

Now, Fetch submitted **Time and Date** with country wise using PHP

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

submitting the form data to the server.

`isset($_POST['submit'])`

get values submitted via HTTP POST method.

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

While submitting form, Inject the current date and time in hidden type

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

Next step, Send values in **Mail** using php **mailto** function
PHP mail() function is used to send email in PHP. You can send text message, html message and attachment with message using PHP mail() function.

`mailto(to, subject, header, message);`

When you send a text message using PHP then all the content will be treated as simple text. Even if you will include HTML tags in a text message, it will be displayed as simple text and HTML tags will not be formatted according to HTML syntax.

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

Adding simple css for styling..

Preview:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/459u90okrkaqpn2buo1p.PNG)

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


Github : https://github.com/erajamanickam/product-enquire-php-with-mail
Demo : https://erajaman.000webhostapp.com/product-enquire/
Youtube : https://www.youtube.com/watch?v=M_ByzcrmHjQ
Using nvm with fish shell [Linux]
Tags: nvm, fish, node
Published: 2023-01-10 17:34:00

---
title: Using nvm with fish shell [Linux]
published: true
description: Configure node.js versions in fish shell with nvm in Linux
tags: nvm, fish, nodejs
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
---

## Steps
* Install [`nvm`](https://github.com/nvm-sh/nvm#installing-and-updating)
* `nvm` won't work with `fish` 
* Install `bass` and `fish-nvm`
``` bash
omf install https://github.com/fabioantunes/fish-nvm
omf install https://github.com/edc/bass
```
See [this](https://github.com/FabioAntunes/fish-nvm#install) for other install options.
* Install the desired `node` version and set it as default
``` bash
nvm install 18.12.1
nvm alias default 18.12.1
```
<br />
Links: 
* https://github.com/FabioAntunes/fish-nvm#install
* https://stackoverflow.com/a/69448339/7358595
* https://github.com/nvm-sh/nvm#installing-and-updating
* https://github.com/nvm-sh/nvm#set-default-node-version 
* https://eshlox.net/2019/01/27/how-to-use-nvm-with-fish-shell
about frustration while solving problem on leetcode.
Published: 2023-01-10 17:32:33

hello, I have been solving problems on leetcode since one or two months. There are some problems which I solved in few mins. But there are lot of problems which took a so much time. Sometimes it happens that logic strikes but implementation of that logic takes too much time and efforts still leads to failure. And I get frustrated. 
Want to know does this happen with only me? and looking for some tips.
Framework is my name
Tags: webdev, beginners, codenewbie
Published: 2023-01-10 17:07:36

Hi 👋

**Framework** is my name.

I am a ready-made skeletal structure used as your app's primary support system.

In other words, I am like your skeleton—your body's primary support system.

![Framework depicted with a skeleton](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sszolwb46qn7mdqup8nb.jpg)
<figcaption>
Your skeleton is your body's framework. Similarly, a framework is an app's skeleton. (Image by Lothar Dieterich)
</figcaption>

Visit [CodeSweetly](https://codesweetly.com/framework-vs-library) to find out more about me.
How to Process Large EXCEL File with Python Win32com
Tags: python, pandas, excel, datascience
Published: 2023-01-10 17:05:46

When you have a large excel file to handle, say 100M, it is not efficient to read it directly through pandas or openpyxl. 
I have tested myself, to open one 100M size excel file and convert to pickle format, pandas takes around 8 minutes, even in readonly mode in my laptop. 

Although later you can access pickle file with pandas quickly, the first 8 minutes was not acceptable for some task. 

In this blog, we leverage the Excel Application itself to help us to convert excel file to csv format, which is also very easy to be handled by pandas. 

Sometimes you have to admit Microsoft is still the best man to handle excel:)

Using Win32com library, you could reduce the time to around 100 seconds, which is only a fifth of time using pandas. 

```python
from time import time
import win32com.client
from os import path
import os

cwd = os.getcwd()
your_excel_file_path = path.join(cwd, "your_excel_file.xlsx")
export_csv_file_path = path.join(cwd, "new_file.csv")

start = time()

excel_app = win32com.client.Dispatch("Excel.Application")
excel_app.DisplayAlerts = False
wb = excel.Workbooks.Open(Filename=your_excel_file_path , ReadOnly=1)

# make target sheet active
ws = wb.Worksheets("active_sheet_name").Activate() 

wb.SaveAs(Filename=export_csv_file_path , FileFormat="6")  # 6 means csv
wb.Close(False)
excel.Application.Quit()
wb = None
excel_app = None


end = time()
print(start - end)  # around 100 seconds

```
과정보단 결과
Tags: 과정보다결과
Published: 2023-01-10 17:05:18

22년 회고는 아직 작성하지 못했다. 아니 과연 작성할 수 있을까 싶긴 하다. 
지난 19년, 20년, 21년에는 결과보단 과정에 좀 더 집중했던 것 같다. 조직문화에 관심을 가지고 좋은 기업, 조직 문화를 만들기 위해 나름대로의? 노력을 했던 것도 그 일환이었다. 

22년부터 지금은 생각이 많이 달라졌다. 과정이 아무리 훌륭하고 아름다워보여도, 결과가 나오지 않거나 폭발적인 성장이 없다면, 결국 조직원들 전체와 경영진, 투자자, 고객에게 좋을 수 없다는 결론을 내리게 되었다. 

결국, 결과가 모든 과정을 합리화 한다는 내용에 동의하게 되었다. 물론, 그렇다고 목적을 이루기 위해 불법을 저지른다든지, 아니면 사회에 악을 끼치거나 살인을 하면 안 되겠다. 하지만 분명하게 깨달은 사실은, 좋은 조직문화, 좋은 사람들, 좋은 방법들이 좋은 결과를 보장하지 않는다는 사실이다. 또한, 결과가 나쁘면 아무리 좋은 내용도 의미가 없을 수 있으며, 결과가 좋으면, 여러가지 좋지 않은 내용도 미화되어 전달된다는 것이다. 

가장 좋은 것은 좋은 과정과 좋은 결과를 함께 가지는 것인데, 현실적으로 모두 취하기에 어려울 때가 더 많다. 그 경우, 고객 중심으로, 결과 중심으로 선택할 때, 조직원들의 갈등과 반발이 있음에도 불구하고 결정하고 추진해야 한다는 것을 배웠다. 모두의 만족을 이끌어내는, 모두에게 좋은 사람이, 리더가 될 수 없다는 점도 배웠다. 리더가 해야하는 의사결정엔 하기 싫지만 꼭 하고 책임져야 하는 내용들이 많다. 그 동안 어려운 의사결정을 피하지 않았다면 거짓말이다. 조직원 모두에게 좋은 사람이 되고 싶기도 했다. 22년은 좀 달랐고, 그에 따라 필연적으로 나를 좋아하지 않는 조직원들도 꽤 생겼다. 

좋아하고 안 좋아하고를 떠나서, 나를 리더로서 신뢰하느냐의 문제는 또 다른 문제가 될 수 있다. 스토브리그의 제너럴 매니저 남궁민을 보면 과정에서 환영받는 경우는 드물다. 하지만 목표를 달성하고 결과를 내는 것들을 보여주면서 조직원들의 신뢰를 얻더라. 결국 내가 원하는 것은 결과다. 과정, 좋은 문화도 있으면 좋겠지만 결과에 비하면 nice to have 라는 생각이 지배적이다.
Saving money while using AWS
Published: 2023-01-10 16:52:30

AWS (Amazon Web Services) is a powerful and flexible platform that offers a wide range of services to help businesses of all sizes save on costs while also providing them with the tools they need to be successful. In this post, we'll explore a few of the key AWS services that can help you save money and the benefits they provide.

EC2 Reserved Instances: EC2 (Elastic Compute Cloud) is one of the most popular AWS services and it allows you to run virtual machines in the cloud. One way to save money on EC2 is by purchasing Reserved Instances. Reserved Instances provide a significant discount (up to 75%) compared to on-demand instances, and they also offer the ability to convert or exchange your reservation. This can help you optimize your cost savings based on your changing workloads and usage patterns.

S3 Infrequent Access: S3 (Simple Storage Service) is another popular AWS service that allows you to store and retrieve data in the cloud. To save money on S3, you can use the S3 Infrequent Access (IA) storage class. S3 IA is designed for data that is accessed less frequently, and it offers a lower price than the standard S3 storage class. This can be a great option for storing backups, logs, and other data that doesn't need to be accessed frequently.

AWS Lambda: AWS Lambda is a serverless computing service that allows you to run code without provisioning or managing servers. With Lambda, you only pay for the compute time you consume, and there are no additional charges for data transfer or other costs. This can be a cost-effective option for running small, infrequent workloads or for building event-driven applications.

Amazon Elastic Container Service (ECS): ECS is a highly scalable and high-performance container orchestration service that can help with cost savings by automatically scaling and provisioning the resources that you need as your application runs. ECS also allows you to scale your compute resources with minimal manual effort and provides cost optimization for your containerized application with native integration of Amazon CloudWatch Container Insights.

Auto Scaling: Auto Scaling is a service that automatically adjusts the number of Amazon EC2 instances in your application based on the demand for your application. This can help you save money by ensuring that you're not over-provisioning resources when the demand for your application is low.

By taking advantage of these AWS services, you can significantly reduce your cloud computing costs while still getting the benefits of a highly scalable, reliable, and secure infrastructure.

In summary, AWS offers various tools and services to help customers achieve cost savings and optimize their resources usage. It's important to evaluate your usage patterns, workloads, and application requirements and choose the right AWS services that best fit your needs. This can help you reduce costs while still getting the benefits of the powerful and flexible AWS platform.