teleren/devto huggingface dataset:
#2 Shorticle: How to read data from S3 bucket using python
Published: 2023-05-14 06:31:20

To read data from an Amazon S3 bucket using Python, you can utilize the boto3 library, which is the official AWS SDK for Python. Follow the steps below to get started:
Install the boto3 library by running the following command in your Python environment:

```
pip install boto3
```
Import the required modules in your Python script:

```
import boto3
```
3. Create a boto3 S3 client or resource object by providing your AWS access key ID and secret access key (or by using an IAM role with appropriate permissions). For example:

```
s3_client = boto3.client('s3', aws_access_key_id='YOUR_ACCESS_KEY', aws_secret_access_key='YOUR_SECRET_KEY')
```
4. Use the client or resource object to interact with your S3 bucket. To read an object (file) from the bucket, you can use the get_object() method:

```
response = s3_client.get_object(Bucket='your-bucket-name', Key='your-object-key')
```
5. In the above code snippet, replace 'your-bucket-name' with the name of your S3 bucket, and 'your-object-key' with the key (path) of the object you want to read.

6. Access the content of the object through the response object. For example, to read the object's content as text:

```
object_content = response['Body'].read().decode('utf-8')
```

7. You can also read the content as bytes by omitting the decode('utf-8') part.
Process or use the data as needed.
Here’s a complete example that demonstrates reading a text file from an S3 bucket:

```
import boto3
# Create an S3 client
s3_client = boto3.client(‘s3’, aws_access_key_id=’YOUR_ACCESS_KEY’, aws_secret_access_key=’YOUR_SECRET_KEY’)
# Read an object from the bucket
response = s3_client.get_object(Bucket=’your-bucket-name’, Key=’your-object-key’)
# Read the object’s content as text
object_content = response[‘Body’].read().decode(‘utf-8’)
# Process or use the content as needed
print(object_content)
```
Remember to replace 'YOUR_ACCESS_KEY', 'YOUR_SECRET_KEY', 'your-bucket-name', and 'your-object-key' with your actual credentials and bucket/object information.

Note: It’s recommended to follow AWS security best practices and avoid hardcoding your access keys in your code. Instead, consider using AWS credentials stored in a secure manner, such as environment variables, AWS profile configuration, or EC2 instance roles, depending on your execution environment.
#1 Shorticle: Why AWS Lambda Throttles?
Tags: awslambda, aws, lambdathrotlle, serverless
Published: 2023-05-14 06:24:14

AWS Lambda throttling refers to the process of limiting the number of concurrent executions or the number of requests per second that a Lambda function can handle. Throttling is designed to prevent excessive resource consumption and ensure the overall stability and performance of the Lambda service.
When a Lambda function receives a high number of requests or exceeds the allocated concurrency limit, AWS may enforce throttling by limiting the rate at which new requests are accepted or the rate at which concurrent executions are allowed. Throttling can occur at different levels:

Account Level Throttling: AWS imposes account-level limits on the total number of concurrent executions across all Lambda functions within an AWS account. If the account limit is reached, any new requests or invocations may be throttled until the load reduces or the concurrency limit is increased.

Function Level Throttling: Each individual Lambda function can have its own concurrency limit, which restricts the maximum number of simultaneous executions for that function. When the function’s concurrency limit is reached, additional requests or invocations may be throttled until existing executions complete or the limit is increased.

Provisioned Concurrency Throttling: If you have provisioned concurrency enabled for your Lambda function, there is a separate limit for the number of provisioned concurrency instances. If this limit is reached, additional requests may be throttled until a provisioned concurrency instance becomes available.

When a Lambda function is throttled, AWS typically responds with a specific error code (e.g., “TooManyRequestsException” or “RequestLimitExceeded”), indicating that the function is currently unable to process the request. Throttled requests may need to be retried or handled accordingly in your application logic.

To mitigate throttling, you can take the following actions:
Monitor your function’s concurrency usage and adjust the concurrency limit based on your workload requirements.
Implement proper error handling and retry mechanisms in your application code to handle throttling errors and resubmit requests if necessary.

Consider using provisioned concurrency to pre-warm your function and ensure a specific number of concurrent instances are always available to handle requests.

Optimize your code and configuration to reduce the time and resources required for each function execution, allowing more efficient use of the available concurrency.

It’s important to note that AWS Lambda provides high scalability and performance, but it’s crucial to design your applications to handle and recover from throttling conditions to ensure smooth operation under varying workloads.
Do read about [Concurrency Limit in AWS Lambda](https://medium.com/@rohitshrivastava87/9-shorticle-concurrency-limit-in-aws-lambda-ac89ef89d3a)
My .vimrc
Tags: vim
Published: 2023-05-14 01:25:33

Below goes my fairly humble `.vimrc`. This post acts primarily as a handy backup for myself and secondarily is yet another `.vimrc` shared in the wild (I've learned a lot on those).

```
" utf-8 displaying in terminal
set encoding=utf-8

" utf-8 writing to file
set fileencoding=utf-8

" common backspace behavior
set backspace=2

" # of spaces of a tab
set tabstop=4

" # of spaces when indenting with << and >>
set shiftwidth=4

" use spaces rather than tab
set expandtab

" show line numbers
set number

" highlight current line
set cursorline

" always show status line
set laststatus=2

" just filename on status line
set statusline=%=%f

" always show tab bar
set showtabline=2

" column guideline
set colorcolumn=120

" lines visible above/below cursor when scrolling
set scrolloff=2

" highlight matches
set hlsearch

" Ctrl+L to clear match highlight
nnoremap <c-l> :nohlsearch<CR><C-L>

" replace globally by default
set gdefault

" case insensitive searches
set ignorecase

" new tab on up arrow
nnoremap <Up> :Texplore<cr>

" close tab on down arrow
nnoremap <Down> :quit<cr>

" previous tab on left arrow
nnoremap <Left> :tabprevious<cr>

" next tab on right arrow
nnoremap <Right> :tabnext<cr>

" enabling mouse
set mouse=a

" mouse scroll up
map <ScrollWheelUp> <c-y>

" mouse scroll down
map <ScrollWheelDown> <c-e>

" bash-like tab completion
set wildmode=longest,list

" syntax highlight
syntax on

"enabling 256 colors required by zenburn
set t_Co=256

" zenburn colorscheme (make sure ~/.vim/colors/zenburn.vim exists)
colorscheme zenburn

" better current tab color
hi TabLineSel ctermbg=102
```

My configuration is fairly vanilla, no plugins and the only external file is for the [zenburn](https://github.com/jnurmine/Zenburn) color scheme.

The unique thing about it is how I remap the arrow keys. Left and right for tab navigation. Down closes tab. Up opens a new tab with Netrw for file browsing (who needs NERDTree?).
HTML Function-ality
Tags: html, dom, javascript, webdev
Published: 2023-05-14 06:19:51

Continuing the discussion of JavaScript functions, I have covered the general outline of a _function_ - as well as _Anonymous functions_. I still have to touch base on _Callback functions_, and now is the perfect time as my current learning topic is manipulating the DOM (The Document Object Model) via HTML using JavaScript code. Over the last week while diving into this subject, I have learned a little more about the inter-connections and functionality shared between HTML and JavaScript languages.


When we are "manipulating the DOM", I am referencing temporarily editing or modifying HTML elements visually on a web page in real time. We do this using the <u>Web Dev Tools</u> to access a console in the browser, and instructing these changes through JavaScript commands.


`(pictured below is a webpage in Google Chrome, utilizing the Dev Tools console to implement changes with JavaScript code commands)`
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/huyfb6del8eczjjiyaiz.png)


When doing this it is crucial to utilize functions, anonymous functions, and callback functions, all of that good stuff. When manipulating the document we usually need to incorporate a callback function.

A **<u>Callback Function</u>** is a function passed as an argument into another function, and then is invoked inside the outer function to complete an action.

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

`(Taking a look back at the earlier example, here you can see we have defined a function, and then used that function as a callback in another function action.)`
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tjf153tfj61ymazio57f.png)

As a busy student with a lot of work to do, I don't have enough time to get too in depth on this topic but figured I'd continue to share my new found knowledge. 

Until next time... 👋
[New] Vue 3.3 `defineModel`
Tags: vue, javascript, programming
Published: 2023-05-14 05:50:18

Previously, for a component to support two-way binding with v-model, it needs to (1) declare a prop and (2) emit a corresponding update:propName event when it intends to update the prop:

```javascript 
<!-- BEFORE -->
<script setup>
const props = defineProps(['modelValue'])
const emit = defineEmits(['update:modelValue'])
console.log(props.modelValue)

function onInput(e) {
  emit('update:modelValue', e.target.value)
}
</script>

<template>
  <input :value="modelValue" @input="onInput" />
</template>
```

3.3 simplifies the usage with the new defineModel macro. The macro automatically registers a prop, and returns a ref that can be directly mutated:

```javascript 
<!-- AFTER -->
<script setup>
const modelValue = defineModel()
console.log(modelValue.value)
</script>

<template>
  <input v-model="modelValue" />
</template>
```

This feature is experimental and requires explicit opt-in.

for more detail follow this detail RFC - https://github.com/vuejs/rfcs/discussions/503

Isn't it cool 😇
How to render the lists in ReactJs
Tags: javascript, react, html, webdev
Published: 2023-05-14 05:48:44

Rendering lists of data is one of the most common tasks in web development. In ReactJS, rendering lists can be done using various approaches. In this blog post, we will explore how to render lists in ReactJS.

## Method 1: Using for loop

```
const fruits = ["Apple", "Banana", "Orange"];

const fruitList = [];

for (let i = 0; i < fruits.length; i++) {
  fruitList.push(<li>{fruits[i]}</li>);
}

return <ul>{fruitList}</ul>;
```

## Method 2: Using Map

Another way to render lists in ReactJS is by using the map method. In this method, we create an array of elements using the map method and then render them on the page.

```
const fruits = ["Apple", "Banana", "Orange"];

return (
  <ul>
    {fruits.map((fruit) => (
      <li>{fruit}</li>
    ))}
  </ul>
);
```

## Method 3: Using Array.prototype.reduce()

The reduce method is a powerful tool that can be used to render lists in ReactJS. In this method, we create an array of elements using the reduce method and then render them on the page.

```
const fruits = ["Apple", "Banana", "Orange"];

return (
  <ul>
    {fruits.reduce((accumulator, fruit) => (
      accumulator.push(<li>{fruit}</li>), accumulator
    ), [])}
  </ul>
);
```
In this blog post, we have explored the different ways to render lists in ReactJS. Although there are several approaches to achieving this, using a map is the most common and recommended way. Using a map not only simplifies the code but also improves its readability. It is essential to choose the right approach depending on the requirements of your project.
My Assignment Experts
Tags: myassignmentexperts, assignmenthelpinaustralia, assignmentwritinghelp, helpmyassignment
Published: 2023-05-14 05:36:58

A brick-and-mortar university gives students the chance to interact and develop personal relationships with people from all over the world. Online classes and learning tools are the only options available to distance learning students. Students can communicate via chat rooms, message boards, emails, and/or video conferencing software, but the environment is not the same as one at a traditional school. Due to the lack of in-person interactions with professors and other students, those taking an online course may find it challenging to keep track of their course work and assignments. because there aren't any ongoing notifications of due dates or outstanding work. All that is necessary to pass a course is commitment and self-motivation. However, the primary drawback of online classes is distraction. I suggest For people who quickly become distracted, taking my online course would be the best course of action. You must use the internet to look for a class assistant.
[My Assignment Expert](https://myassignmentexperts.com)s
มือใหม่หัด Go: Two Sum
Tags: go, beginners
Published: 2023-05-14 05:30:27

โจทย์ปัญหาที่พบได้บ่อยๆ สำหรับมือใหม่ คือ [Two Sum](https://leetcode.com/problems/two-sum/) จาก LeetCode นั่นเอง ในบทความนี้จะมาแสดงวิธีแก้โจทย์ด้วย Go กัน

## Two Sum
- กำหนดให้ **nums**: array ของ int, **target**: int เป็น parameter ของ function เพื่อคืนค่าเป็น index ของสองตัวเลขที่ได้ผลรวมเท่ากับ target
- ในแต่ละ input จะมีผลลัพธ์แค่คำตอบเดียว จึงไม่จำเป็นต้องใช้เลขตัวเดิมมาคิด
- คืนค่าคำตอบไม่จำเป็นต้องเรียงลำดับ

Example:
```
Input: nums = [2,7,11,15], target = 9
Output: [0,1]
```

Answer:
```go
func twoSum(nums []int, target int) []int {
    numMap := make(map[int]int)

    for i, num := range nums {
        complement := target - num
        if _, ok := numMap[complement]; ok {
            return []int{numMap[complement], i}
        }
        numMap[num] = i
    }

    return nil
}
```

Explanation:
- `numMap` ตัวเปล่าใช้ในการเก็บค่าในรูปแบบ key: value ช่วยเก็บคำตอบ
- แตก index `i` and ค่า `num` ออกจาก array
- **Iteration 1** : `num` = 2
	- `complement := target - num` ได้เป็น 7 จาก 9 - 2
	- เช็คว่ามี key 7 อยู่ใน  `numMap` หรือไม่ โดยใช้ `_, ok := numMap[complement]` 
		- ค่าแรกเป็น zero value ของ int = 0 แต่ไม่ได้ใช้จึงละไว้
		- ค่าที่สองเป็น *false* เพราะ `numMap` ยังว่างอยู่
	- จึงทำการ `numMap[num] = i` เพิ่มค่า map เป็น {2: 0}
- **Iteration 2** `num` = 7
	- `complement := target - num` ได้เป็น 2 จาก 9 - 7
	- เช็คว่ามี key 2 อยู่ใน  `numMap` หรือไม่ ซึ่งเป็น *true*
	- เข้าเงื่อนไขให้ return `[]int{numMap[complement], i}` ออกมาเป็น \[0, 1] คือ ตำแหน่ง index ของจำนวนที่รวมกันได้ target
I need help on wsl-ubuntu and SDL
Published: 2023-05-14 04:28:18

I'm using wsl-ubuntu 2004 LTS and I have an SDL project which will involve raycasting in 3D (and video connectivity). I have had a very hard time to set things up. It seems video is not supported by wsl-ubuntu. I have already installed the required SDL2 on the wsl-ubuntu but I'm now stuck. Any help on how to get video connectivity up and running is very much appreciated.
Misleading comments
Tags: rust, beginners
Published: 2023-05-14 03:54:15

I was asked to write a pagination algorithm for two vectors. The first half of the page should be formed from one vector, the second – from another. I thought maybe I should use something like all_pages to store all the pages. But I was told that this approach was wrong and asked to start from scratch. And then I was told that I had to remove half_page_2, which helped form the page if it had an odd number of elements. These comments have me stumped. And the solution I was offered (incomplete) turned out to be very cumbersome. I don't see the point in finishing the suggested code.
I took a break for a couple of weeks and went back to my original idea a few days ago. I created the all_pages vector and began to add pages formed from two vectors there. And then just “flipping through” the vector to the desired page. And voila! As a result, my code is 60% shorter, easier to read, and does exactly what it's supposed to do.
Sometimes the conditions of a task or someone's comments can lead you to a dead end.
In general, it is always important to check yourself for misconceptions. It does not matter who you are in this situation – the author of the task or the one who is trying to solve it.
The situation is odd.


```Rust
fn main() {
	let vec_1 = vec![
    	"_A", "_B", "_C", "_D", "_E", "_F", "_G", "_H", "_J", "_K", "_L", "_M", "_N", "_P", "_Q",
    	"_R", "_S", "_T", "_V", "_W", "_X", "_Y", "_Z",
	];
	let vec_2 = vec![
    	"a ", "b ", "c ", "d ", "e ", "f ", "g ", "h ", "j ", "k ", "l ", "m ", "n ", "p ", "q ",
	];
	let page_size = 7;
	let page_number = 4;
	println!("{:?}", page_builder(page_size, page_number, vec_1, vec_2));
}

fn page_builder(
	page_size: usize,
	page_number: usize,
	vec_1: Vec<&str>,
	vec_2: Vec<&str>,
) -> Vec<String> {
	let half_page_1 = page_size / 2;
	let half_page_2 = page_size - half_page_1;
	let mut all_pages: Vec<String> = vec![];

	let limit = if vec_1.len() > vec_2.len() {
    	vec_1.len()
	} else {
    	vec_2.len()
	};

	for i in 0..limit {
    	let mut halfvec_1: Vec<String> = vec_1
        	.clone()
        	.into_iter()
        	.skip(i * half_page_1)
        	.take(half_page_1)
        	.map(Into::into)
        	.collect();
    	all_pages.append(&mut halfvec_1);

    	let mut halfvec_2: Vec<String> = vec_2
        	.clone()
        	.into_iter()
        	.skip(i * half_page_2)
        	.take(half_page_2)
        	.map(Into::into)
        	.collect();
    	all_pages.append(&mut halfvec_2)
	}

	let result = all_pages
    	.into_iter()
    	.skip(page_number * page_size)
    	.take(page_size)
    	.map(Into::into)
    	.collect();
	result
}
```
T68Bet-Đa dạng thể loại cược với vô vàng giải thưởng hấp dẫn - T68bet
Published: 2023-05-14 03:41:35

T68Bet hiện đang là nhà cái cung cấp nhiều thể loại cược đa dạng nhất trên thị trường cá cược trực tuyến. Vậy nhà cái này ra đời khi nào, hoạt động ra sao và có uy tín hay không là câu hỏi của nhiều rất nhiều người hiện nay    https://t68bet.casino/

https://twitter.com/t68betcasino

https://www.linkedin.com/in/tbet-casino-32a888276/

https://about.me/t68betcasino

https://www.pinterest.com/t68betcasino/

https://www.youtube.com/@t68betcasino/about

https://www.reddit.com/user/t68betcasino

https://www.flickr.com/people/t68betcasino/

https://dribbble.com/t68betcasino/about

https://www.tumblr.com/t68betcasino

http://hawkee.com/profile/3994904/

https://www.twitch.tv/t68betcasino

https://www.diigo.com/profile/t68betcasino

https://linkhay.com/u/t68betcasino

https://tapas.io/t68betcasino1

https://vi.gravatar.com/t68betcasino

https://sketchfab.com/t68betcasino

https://replit.com/@t68betcasino1

https://www.openstreetmap.org/user/t68betcasino

https://folkd.com/user/t68betcasino

http://www.lawrence.com/users/t68betcasino/
Perlukah Membuat Aplikasi yang Berbahasa Inggris?
Published: 2023-05-14 02:47:14

---
title: Perlukah Membuat Aplikasi yang Berbahasa Inggris?
published: true
description: Apakah semua produk digital "wajib" berbahasa Inggris?
tags: 
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-05-14 02:40 +0000
---

Seperti yang kita tau bahwasanya bahasa Inggris adalah bahasa internasional. Ketika kamu menuliskan sesuatu dengan bahasa Inggris, maka akan ada banyak orang yang _paham_ dengan apa yang ingin kamu sampaikan. Makanya, sangat dianjurkan menggunakan bahasa Inggris.

Tapi, bagaimana jika berbahasa Inggris itu malah menjadikanmu menjadi beban dalam membuat aplikasi, membuat tweet, membuat APK, Chrome Extension, dan produk digital lainnya? Padahal, proses yang membuatmu enjoy itu (mungkin itu adalah suatu side project) malah menjadikanmu benci, membuatmu tak ingin lagi membuat aplikasi-aplikasi yang bermanfaat. Maka, tak ada salahnya juga membuat aplikasi dengan bahasa kalian masing-masing. Kalau aku, tentu saja bahasa Indonesia.

Lalu, bagaimana jika tidak ada yang mendownload? Nggak masalah. Kita membuat aplikasi itu (terutama yang side project) adalah untuk diri kita sendiri. Kalau diri kita nyaman membuatnya, nyaman juga menggunakannya, maka itu sudah cukup. Buatlah aplikasi sebanyak-banyaknya, konten sebanyak-banyaknya, tutorial di YouTube sebanyak-banyaknya, lalu kalian nikmati hasil pekerjaan kalian. Yuk, mumpung upload ke YouTube belum dikasih limit. Begitu pula dengan upload aplikasi Android ke PlayStore.

Lalu, untuk masalah pendapatan dari aplikasi yang kalian buat, nggak usah khawatir. Intinya, buat sebanyak-banyaknya. Nyalakan kreativitas kalian. Insya Allah, semua ada jalannya...

[![Iklan dari Shopee Affiliate](https://pbs.twimg.com/media/FvLTIwHaYAAhowI?format=jpg&name=small)](https://shope.ee/8ewhPuCE08?share_channel_code=7…)
Mojo Programming Language: The Future of Data Science?
Tags: new, mojo, datascience, python
Published: 2023-05-14 10:40:13

---
title: Mojo Programming Language: The Future of Data Science?
published: true
date: 2023-05-14 02:30:39 UTC
tags: new, mojo, datascience, python
canonical_url: https://aryan401.hashnode.dev/mojo
---

In recent years, the field of data science has exploded in popularity. With the ever-increasing amount of data being generated, there is a growing demand for professionals who can collect, analyze, and interpret this data. However, one of data scientists' most significant challenges is the lack of a suitable programming language.

Python is the most popular programming language for data science, but it has some significant limitations. For example, Python is inefficient, making it difficult to train large machine-learning models. Additionally, Python is unsuited for writing low-level code, often necessary for working with AI hardware.

This is where Mojo comes in. Mojo is a new programming language that was designed specifically for data science. It combines Python's usability with C's performance, making it the ideal language for developing and deploying AI applications.

## Features of Mojo

- **Performance:** Mojo is up to **35,000** times faster than Python, making it possible to train large machine-learning models in a fraction of the time.

- **Flexibility:** Mojo is a general-purpose programming language that can be used for various tasks.

- **Ease of use:** Mojo has a clean syntax that is easy to learn and use.

- **Community support:** Mojo has a strong community of developers constantly adding new features and improvements.

![Logo of Modular, the company behind Mojo](https://forums.fast.ai/uploads/default/optimized/3X/3/4/3469e0355fff434928bb1134b7b572d9b3b0033c_2_690x329.jpeg)

## Why Mojo Might be a paradigm shift in data science

Mojo has the potential to revolutionize the field of data science by providing a powerful and flexible programming language that is well-suited for developing and deploying AI applications. With its speed, efficiency, and ease of use, Mojo can help data scientists to be more productive and to create more powerful AI models.

## Current Drawbacks

- **Mojo is still under development:** Mojo is a relatively new programming language, and it is still under development. This means there may be some bugs or limitations that have not yet been addressed.

- **Mojo is not as widely adopted as Python:** Mojo is not as widely adopted as Python, which means that fewer resources may be available for learning and using the language.

- **Mojo is not as well-suited for some tasks as Python:** Mojo is a general-purpose programming language but not as well-suited for some tasks as Python. For example, Mojo is not as good at writing web applications as Python.

## Where you can check out the language

The Mojo programming language is still under development but is available for preview on the Modular website. To learn more about Mojo, visit the Modular website or join the Mojo community on Discord.