teleren/devto huggingface dataset:
Which Implementation Should You Use for Stacks In Python?
Tags: python, stack, datastructure, threads
Published: 2021-10-06 06:40:48



## Python Stacks and Threading

Let me just recap what I've read about how to implement Stacks in python so far.

There are 2 options to create a stack in python whether using lists or deques and both of them behave differently if your program has threads.

It's a better sweet not to use lists to implement Stacks or any data structure that can be accessed by multiple threads as lists is not thread-safe. List can potentially have memory reallocation issues and it makes you build the entire functionality of the stacks on your own.


`deaues` is a thread-safe more than list, even if it's more complex than lists, according to [queue class documentation](https://docs.python.org/3/library/queue.html), it clearly states that both the `.append()`and `.pop()` operations are atomic, meaning that they won’t be interrupted by a different thread.

```language
So, while it’s possible to build a thread-safe Python stack 
using a deque, doing so exposes yourself to someone misusing
 it in the future and causing race conditions.

```

For this use [`LifoQueue`](https://docs.python.org/3/library/queue.html) from __queue__ module.


`LifoQueue` is designed to be fully thread-safe. All of its methods are safe to use in a threaded environment. 

EX
```python
from queue import LifoQueue
myStack = LifoQueue()

myStack.put('a')
myStack.put('b')
myStack.put('c')

myStack


myStack.get()

myStack.get()

myStack.get()


# myStack.get() <--- waits forever
myStack.get_nowait()

```




> In notes :

  - Use a deque if you’re not using threading.

  - If your program has threads, then you should use a LifoQueue

  - The interface of both list and deque are the same ,yet deque doesn’t have memory allocation issues, which makes deque the best choice for your non-threaded Python stack.
Space Trash TrackAR - NASA Space Apps Challenge 2021
Tags: hackathon, space, augmentedreality, arkit
Published: 2021-10-06 06:25:43

This weekend I took part in this years [NASA Space Apps Challenge](https://www.spaceappschallenge.org/).

For those unfamiliar with it, I suggest you check it out as it is one of the largest annual online hackathons in the world.

NASA set out 28 different challenges for entrants covering all manner of earth and space science topics.

The challenge I decided to tackle was called [Mapping Space Trash In Real Time](https://2021.spaceappschallenge.org/challenges/statements/mapping-space-trash-in-real-time/details). I took one of the datasets they were providing [Celestrak](https://celestrak.com/) and plotted over 5,000 items orbiting the earth in Augmented Reality.

My first stumbling block was realising that whilst orbit height of items was shown in a datatable, the underlying data in csv format did not include height so needed to be calculated from the other available variables. I also needed to break out my Trigonometry to work out the X & Y coordinates of an item around a circular orbit using the right ascension angle (or so I thought).

After plotting the positions of the items in orbits, I set to work adding additional functionality including
* Tap item to show more information
* Add a circle (very thin torus) to denote the items orbit path
* Speed up/down buttons
* Zoom in/out with pinching gesture
* Rotating everything with pinching gesture
* Double tap screen to hide/show UI buttons


My main regret from the project was not using the correct method for determining satellite position. I had incorrectly assumed I could use inclination and right ascension to calculate an items position but was incorrect. If I were to fix my mistake I would use an off the purpose built satellite code library.

My 30 second project submission video can be seen here.

{% youtube mKms8GQgVO0 %}

While a 2 minute more detailed video can be seen here.

{% youtube hUVkCZpuHdc %}

I have put the (questionable) [code on GitHub](https://github.com/leeenglestone/SpaceTrashTrackAR). TBH. I've not even tidied it up yet.

Almost all of the techniques used in the project are detailed in my book [.NET Developer's Guide to Augmented Reality in iOS](https://amzn.to/3A8GHtz) and on my website [XamarinArkit.com](https://xamarinarkit.com)

I continue to believe that Hackathons are one of the best ways to scratch an itch or experiment with a new technology and learn something new. 

If you haven't entered a hackathon before, I suggest you try it. And if you do, here are some [Hackathon Tips](https://hackathontips.com).

-- Lee
Divtober Day 6: Hungry
Tags: codepen, divtober, css, showdev
Published: 2021-10-06 06:14:16

---
title: Divtober Day 6: Hungry
description: An animated hungry-hungry hippo done with CSS and a single HTML element.
published: true
tags: codepen,divtober,css,showdev
series: divtober
---

The word for day 6 of #divtober is "hungry." So here's an animated hungry-hungry hippo coded with CSS and a single HTML element:

{% codepen https://codepen.io/alvaromontoro/pen/abwgexj %}
Need advise and suggestions 
Tags: programming
Published: 2021-10-06 06:09:08

I have a 1 year hands on experience of docker, k8s, GCP like DevOps things and my current package is 4.5 LPA 

I want my package like 10+ LPA how can i achive this packag in DevOps please suggest me what should i do and which company(remote,WFH,WFO) i should join?
Weekly web development resources #90
Tags: weekly, webdev
Published: 2021-10-06 06:06:44



______

##[LuckyResumeMaker](https://luckyresumemaker.com)
[![LuckyResumeMaker](https://wweb.dev/weekly/content/90/luckyresumemaker.jpg)](https://luckyresumemaker.com)
A tool to make a professional resume and download the PDF for free.

______

##[10 Trending projects on GitHub](https://dev.to/iainfreestone/10-trending-projects-on-github-for-web-developers-1st-october-2021-og4)
[![10 Trending projects on GitHub](https://wweb.dev/weekly/content/90/10-trending-projects.jpg)](https://dev.to/iainfreestone/10-trending-projects-on-github-for-web-developers-1st-october-2021-og4)
The latest part of a nice series of web development repositories.

______

##[Free Background Remover](https://baseline.is/tools/background-remover/)
[![Free Background Remover](https://wweb.dev/weekly/content/90/url-background-remover.jpg)](https://baseline.is/tools/background-remover/)
A tool to automatically delete backgrounds from your photos using artificial intelligence.

______

##[What's new in react 18?](https://yagmurcetintas.com/journal/whats-new-in-react-18)
[![What's new in react 18?](https://wweb.dev/weekly/content/90/react-18.jpg)](https://yagmurcetintas.com/journal/whats-new-in-react-18)
A nice article by Yagmur C. Tas on the new things of React 18.

______

##[Best Online Tools](https://10015.io/)
[![Best Online Tools](https://wweb.dev/weekly/content/90/100L5.jpg)](https://10015.io/)
A curated list of various online tools.

______

##[Putting an image on the page is easy, until it's not](https://paul.kinlan.me/images-are-still-too-hard/)
[![Putting an image on the page is easy, until it's not](https://wweb.dev/weekly/content/90/image-article.jpg)](https://paul.kinlan.me/images-are-still-too-hard/)
An article by Paul Kinlan on how to serve images on the web.

______

##[react-philosophies](https://github.com/mithi/react-philosophies)
[![react-philosophies](https://wweb.dev/weekly/content/90/react-philosophies.jpg)](https://github.com/mithi/react-philosophies)
A list of things to think about when writing React code.

______

##[Funky button](https://jsfiddle.net/hLwxratf/)
[![Funky button](https://wweb.dev/weekly/content/90/funky-button.jpg)](https://jsfiddle.net/hLwxratf/)
A creative button with clip-paths randomize on reload and hover/focus.

______

##[ct.css](https://csswizardry.com/ct/)
[![ct.css](https://wweb.dev/weekly/content/90/css-ct.jpg)](https://csswizardry.com/ct/)
A diagnostic CSS snippet that exposes potential performance issues in your page’s head tags.

______

##[VanillaTreeViewer](https://abhchand.me/vanilla-tree-viewer/)
[![VanillaTreeViewer](https://wweb.dev/weekly/content/90/VanillaTreeViewer.jpg)](https://abhchand.me/vanilla-tree-viewer/)
A minimalist file browser for compactly displaying several files at once. 

______

To see all the weeklies check: [wweb.dev/weekly](https://wweb.dev/weekly)
Are you aware of the 5 Second Rule?
Tags: uiweekly, webdev, productivity, ux
Published: 2021-10-06 06:04:42

_Save for later._
<br/>

#### This rule is commonly applied to Landing Page Design.

It helps to understand if the scope of the page is clear.
<br/>

#### To do : 

1. Show your page to someone for **5 seconds**.
2. Hide it and ask them what they feel the purpose of the page was.

This will tell you, if your page is communicating the same as you intended it to.
<br/>

#### The 3 important elements to take care of :

1. Title
2. CTA (Call to Action)
3. Catchy Image

<br/>
![5 sec rule](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lpie8qhbtfyq4kkpeny0.png)
<br/>

#### You page should communicate : 

1. What your brand/business does
2. What the website is for
3. What the visitor/user is supposed to do, i.e., Call to Action


###<br/> You only have 5 Seconds to get your user involved!


<br/>
Thank you for reading. Please leave a like if you enjoyed the post and follow for upcoming articles!

<br/>P.S. Want the next post to be something specific? Do let me know in the comments.

🤘🏻
<br/>
Connect with me : [Github](https://github.com/deyRupak)
Support me : [Buy me a coffee!](https://paypal.me/deyrdx?locale.x=en_GB)
Render a JSON page in Astro
Tags: javascript, astro
Published: 2021-10-06 05:57:14

I've been working on a search solution for my Astro blog, and building search on top of static site generators is always tricky.

My general idea would be to do it almost the same as my [Eleventy search](https://daily-dev-tips.com/posts/eleventy-creating-a-static-javascript-search/).

## Creating a JSON page in Astro

However, I quickly realized Astro doesn't have a neat permalink structure by default.

Trying out some things, I learned that we could create pages like `search.json.astro`.

These will render as `http://yoursite.com/search.json`

But let's see how we can render a JSON response of all our blog posts in there.

Astro has the cool built-in fetch method for internal pages so let's use that first.

```js
const allPosts = Astro.fetchContent('./posts/*.md');
```

In the next step, I'd like to map these to the output that I can use, which only needs the following three elements.

- title
- description
- slug

Let's see how that would look:

```js
allPosts.map((p) => {
  return {
    title: p.title,
    description: p.description,
    slug: p.url,
  };
});
```

However, let's create a variable from this, and JSON stringify the output.

```js
const json = JSON.stringify(
  allPosts.map((p) => {
    return {
      title: p.title,
      description: p.description,
      slug: p.url,
    };
  })
);
```

Now all that's left is to render the JSON output on the page.

```jsx
// All our code
---
{json}
```

And that's it. We can now leverage a simple JSON file for our search to use.

You can find my [example code on the following file](https://github.com/rebelchris/astro-typesense-search/blob/master/src/pages/search.json.astro).
Or see the [end JSON file](https://loving-wilson-87e511.netlify.app/search.json/) here.

> Note: This process might change if Astro will support this eventually, but for now, this seems like an excellent approach.

### Thank you for reading, and let's connect!

Thank you for reading my blog. Feel free to subscribe to my email newsletter and connect on [Facebook](https://www.facebook.com/DailyDevTipsBlog) or [Twitter](https://twitter.com/DailyDevTips1)
The Complete Web Component Guide: Part 2 — Shadow DOM
Tags: javascript, webdev, tutorial, programming
Published: 2021-10-06 05:51:13

[![](https://cdn-images-1.medium.com/max/2000/1*KE5bZMF41HQnn2bupDozcQ.png)](https://medium.com/front-end-weekly/the-complete-web-component-guide-part-1-custom-elements-a627af805df8?source=rss-f6e6b5239e7f------2)

Become an expert in the future of Web Development

{% medium https://medium.com/@mariusbongarts11/the-complete-web-component-guide-shadow-dom-2e40921eb77 %}
Set SSL and Custom Domain with Cloud Front and Route53
Tags: route53, ssl, mern, aws
Published: 2021-10-06 05:48:38

Hello guys, This is part - 2 of my **serverless mern** series where we're going to setup SSL and a Custom domain with AWS Route53 also lookupon how to configure our s3 Bucket web hosting with CloudFront, to continue [checkout here](https://debarshi-mondal.medium.com/mern-set-ssl-and-custom-domain-with-cloud-front-route53-b1df1781a607)🙂
Deploy MERN app with AWS S3, Lambda, CloudFront, and Route 53.
Tags: serverless, mern, s3, aws
Published: 2021-10-06 05:33:45

Hello guys, This is part - 1 of my **serverless mern** series where we're going to discuss how we can configure and deploy a MERN app with AWS, to continue [checkout here](https://debarshi-mondal.medium.com/deploy-mern-app-with-aws-s3-lambda-cloudfront-and-route-53-2a6aa6b9bcc2)🙂
Empleos en Data y Analytics LATAM — Oct. 2021 - I
Published: 2021-10-06 04:58:00

Te compartimos las ofertas laborales del mes para áreas de Data, Analytics y Cloud 👨‍💻👩‍💻.
✅[Data Scientist - Globant (Perú)](https://www.linkedin.com/jobs/view/2733082184/?alternateChannel=search&refId=WLfknw1KdC8L7shy6jbG%2Fg%3D%3D&trackingId=TLHAyBgU5mE4S3q%2BIpqz3A%3D%3D)
✅[Data Scientist - Toptal (Perú)](https://www.linkedin.com/jobs/view/2734959238/?alternateChannel=search&refId=WLfknw1KdC8L7shy6jbG%2Fg%3D%3D&trackingId=qxm77Qk8LnhkBePHle%2BRiw%3D%3D)
✅[Data Analyst - Pamer (Perú)](https://www.linkedin.com/jobs/view/2742928959/?alternateChannel=search&refId=JA9%2BZ1fyjcZiHt9zE5gY0Q%3D%3D&trackingId=jOcPcB9sh0w47s06IBnAxQ%3D%3D)
✅[Machine Learning Analyst - JPMorgan Chase & Co (Argentina)](https://www.linkedin.com/jobs/view/2733248855/?alternateChannel=search&refId=qJnLYtjUXtMKGSImLSNOnQ%3D%3D&trackingId=mArvJaEKlCbUJYGKmugtlA%3D%3D)
✅[Data Engineer- Globant (Argentina)](https://www.linkedin.com/jobs/view/2715973001/?alternateChannel=search&refId=qJnLYtjUXtMKGSImLSNOnQ%3D%3D&trackingId=YsSNjyjFkgV3hGX0tqP11A%3D%3D)

Aprende, aplica y crece en proyectos de Data y Analytics en Cloud.

Visita nuestra página:
👉🌐 datahack.la
How to filter S3 bucket to download millions of log files
Tags: aws, s3, log
Published: 2021-10-06 03:41:02

I started to have more occasions to download log files which is stored on S3 bucket.

I started to have more occasions to download log files which is stored on S3 bucket.

Whether they are Nginx, or Apache log being aggregated from auto scaling group, OR CloudFront access log.

Those files on S3 bucket are enormously huge number. It is impossible to browse through the management console.

It's impossible to download all logs locally.

Here is how I usually do it.



## Try to narrow down the date and time

Make sure that you minimize the date and time range of the log that you want to acquire.

I have a good habit of trying to log what I've done with timestamp.

For example, when you deploy some new code, you try to create a slack thread, and type comment at the each step of deployment. You don't need to be too precise. Slack has the time stamp automatically.

You could use Google Spreadsheet or Notion to use they checkbox feature. It will record when you check the checkbox.

We use the service called Backlog which is Japanese project management SaaS service which has the checkbox feature when we deploy the code to production or upgrade a CMS system.



## Find a block of logs chronologically through S3 Management Console

Log-in to your AWS Management Console and go into S3 page.

Browse the S3 bucket.

Try to find proper prefix.

For example, the CloudFront log format is like the following

```
[CloudFront ID].YYYY-MM-DD-##.[some ID].gz
```

For CloudFront log, you should be able to get your CloudFront ID,  you could guess the date.

However, it could still be large amount of log file for 1 entire day of access.

You still want to find out which portion of `##` (numbers) logs files you want to get.

So you filter the S3 bucket by `[CloudFront ID].YYYY-MM-DD-`, then from the result, you try to sort by time from the column.

Then find out which `##` of files you want to get.

Let's say you now know you want all of `E0EEEEEEEEEEE0-10-05-05*` log files.



## Get IAM Access Key and Secret to access S3 bucket Log

Issue IAM Access Key, or log-in to EC2 instances which has the IAM Role to access S3 bucket.

## Run `aws s3 cp`

Run the aws s3 cp command to fetch the log files to your local or remote EC2 instance.

For aws s3 commands, you can only filter by path. You cannot use wildcard (*) in the `s3://` URL. You neext to use `--exclude` `--include` options.

First, you exclude all files, then you specify what pattern of object names you want to include.

```
aws s3 cp s3://S3-Bucket-Name/Folder-if-any/ ./ --recursive --exclude "*" --include "[CloudFront ID].YYYY-MM-DD-05*" 
```

From previous example.

```
aws s3 cp s3://S3-Bucket-Name/Folder-if-any/ ./ --recursive --exclude "*" --include "E0EEEEEEEEEEE0-10-05-05*" 
```

Then, you should be able to download all of your desired log files.
Blade Input Error Custom
Published: 2021-10-06 03:40:52

```
@props(['for'])
@error($for)
    @if (strlen($slot->toHtml()) != 0)
        <p {{ $attributes->merge(['class' => 'text-sm text-red-600']) }}>
            {{ $slot }}
        </p>
    @else
        <p {{ $attributes->merge(['class' => 'text-sm text-red-600']) }}>
            {{ $message }}
        </p>
    @endif
@enderror


```
Client Side Form Validation
Tags: javascript, webdev, css, html
Published: 2021-10-06 03:15:06

{% codepen https://codepen.io/Norbert82/pen/bGRPpdW %}

Reference:
Florine Pop Youtube Video - https://www.youtube.com/watch?v=rsd4FNGTRBw&t=1269s&ab_channel=FlorinPop
Job Q V/S Callback Q 
Tags: webdev, javascript, node, beginners
Published: 2021-10-06 03:13:22

### :boxing_glove: Who wins when we have tasks waiting to be implemented in Job queue as well as in Callback queue.

Hmmmm.... let's see who wins with the piece of code below. :speaker:

```js
// setTimeout is a web API which waits for the time as given // in 2nd parameter and then moves the callback function in 
// call back queue   
setTimeout(() => console.log('1'), 0);
setTimeout(() => console.log('2'), 10);

// Promise is a class in JavaScript so the functionality is 
// native, to handle the functions executed we have a Job 
// queue
Promise.resolve('hi').then((data) => console.log('3'))

console.log('4');

```
If you execute this code the logs will be 
```bsh
4
3
1
2
```
This proves that JobQ has priority over callback queue if call stack is empty, Of course!.

> Thoughts in comments

:sauropod: :keyboard:
Divtober Day 5: Tired
Tags: codepen, divtober, css, art
Published: 2021-10-06 02:27:41

---
title: Divtober Day 5: Tired
description: A (self-portrait?) cartoon of a man with a tired look on his face.
published: true
tags: codepen,divtober,css,art
series: divtober
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nwa7yei69od8w2zqivg5.png
---

This is my _entry_ for #divtober day 5. The word is "Tired", so I drew a cartoon of a man with a tired look on his face.

{% codepen https://codepen.io/alvaromontoro/pen/WNOqmzm %}

As with the previous drawing, it is animated... but it will only work on Chrome (for now). I don't fully like the hair. Curly hair looks a bit nicer, but this made it simpler to code 😳

Initially, I thought about making a bicycle because it is "tired". But in the end, I opted for the easy solution.
How to preview a diagram image from PlantUML code on a GitHub page
Tags: github, design
Published: 2021-10-06 01:47:15

In this post, I will explain how to display a diagram image written in PlantUML as a diagram on a GitHub page.

## Key takeaways

- Google Chrome extension [Pegmatite](https://chrome.google.com/webstore/detail/pegmatite/jegkfbnfbfnohncpcfcimepibmhlkldo) can be used to display PlantUML on GitHub as a diagram.
- Set up PlantUML server locally to avoid sending internal information to an external server.

## Pegmatite

[Pegmatite](https://chrome.google.com/webstore/detail/pegmatite/jegkfbnfbfnohncpcfcimepibmhlkldo) is a Google chrome extension. It replaces PlantUML code blocks into preview images. Especially, it runs on the following sites.

> - https://github.com/*
> - https://gist.github.com/*
> - https://gitpitch.com/*
> - https://gitlab.com/*
> - https://bitbucket.org/*
> - https://*.backlog.jp/wiki/*

Let's take a simple state diagram as an example.

```plantuml
[*] --> State1
State1 --> [*]
```

By using Pegmatite, you can see like that.

[![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q6008cl1ptrt86q0nlat.png)](https://gist.github.com/hgsgtk/02ada45495ea2ea012ab6bcaa2ee28a9)

## Add extension

First add this Chrome extension [here](https://chrome.google.com/webstore/detail/pegmatite/jegkfbnfbfnohncpcfcimepibmhlkldo).

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sli5zh7mditg7mo7varj.png)

By adding this, a PlantUML code will be replaced by the preview image when you view it on GitHub.

However, since it is on an externally published URL on PlantUML server, care should be taken to use it in business.

For example, the following URL will make the image accessible. 

> https://www.plantuml.com/plantuml/img/SoWkIImgAStDuUAArefLqDMrKmWkIIn9DUI2K60He0mNbqDgNWfG7G00

## Set up PlantUML server locally
 
Let's set up PlantUML server locally to avoid sending internal information to an external server. There is a Docker image available for setting up a PlantUML server.

https://hub.docker.com/r/plantuml/plantuml-server

Use this to launch a local PlantUML server.

- pull the image

```
docker pull plantuml/plantuml-server
```

- run a server

```
docker run -d -p 8888:8080 plantuml/plantuml-server
```

- specify `Base URL`

Change the configuration to use the local PlantUML server as per README of [dai0304/pegmatite](https://github.com/dai0304/pegmatite).

Go to the Option settings of Pegmatite.

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ndiea7r5lxczcib4scpr.png)

Input `http://localhost:8888/img/`.

That's it. You are ready to view a preview image on GitHub pages.
ms excel basic 10 minutes can directly #part 2
Published: 2021-10-06 01:08:30

Timestamps
1. How to add Image file in Excel
2. How to Number Pages in Excel
3. Tables Titles is On All Pages
4. Easy Way to Print in Excel
5. How to add Sheets an Copas Table

https://youtu.be/Tzk5XH93Ni0