teleren/devto huggingface dataset:
TailwindCSS @apply - the right approach?
Tags: discuss
Published: 2021-03-10 16:35:33

I've been experimenting with Tailwind quite a lot recently and there's one thing that I can't figure out... Which of these is better:

```scss
.element {
  @apply bg-red ... hover:bg-green ... focus:bg-yellow ...;
}
```

or...

```scss
.element {
  @apply bg-red ...;

  &:hover {
     @apply bg-green ...;
  }

  &:focus {
    @apply bg-yellow ...;
  }
}
```

The latter example is probably more readable but on the other hand it doesn't utilize Tailwind's variants. So I'm wondering if there's any difference between one and the other? Maybe performance?
Day 61,62,63,64:100DaysOfCode
Tags: 100daysofcode, programming, productivity
Published: 2021-03-10 16:20:02

completed with constructive problems from cp sheet.

further moving on with power set and bit manipulation..
did some greedy problems on leetcode and cf.

studied activity selection problem and fractional knapsack with greedy approach...

tried some dp easy on leetcode ...

practised virtually contest-1 for amritapuri icpc...
did 1 ques in time :(


(more & more practise ...needed) 
moreover found some dart and java organization under gsoc...coming week would be more dev oriented..
EOD

You can Follow me->
https://github.com/singhtaran1005
https://www.linkedin.com/in/taranpreet-singh-chabbra-27517918a/
Reactive Rails from Bare Bones
Tags: rails, ruby, hotwire, stimulus
Published: 2021-03-10 16:19:59

In the second post in a series on Reactive Rails,
we introduce the simple chat application--and its vanilla Rails implementation--that we use to evaluate Hotwire and Stimulus Reflex

[Reactive Rails from Bare Bones](https://www.beflagrant.com/blog/reactive-rails-bare-bones-chat)
Ethics Are Missing From Software Development
Tags: ethics, software, watercooler
Published: 2021-03-10 16:14:06

There is something conspicuously missing from software development education. As developers, we learn all about how to write, organize, design, share, use, and test software, but the discussion of _how_ that software will actually be used and what it's impact on the world will be is usually an afterthought.

What discussions do happen tend to be around licensing and intellectual property, with the main focus on not getting sued. That stuff matters, but it doesn't come close to addressing and grappling with the total impact of the tech industry.

The effects of software on the world are _enormous_. It affects the way we do everything and shows up in every corner of our lives:

- how we keep in touch with friends and family
- how we get around
- how we work
- how we learn about the world and make decisions
- how we grow up
- how we affect the planet

Preventing our software from making the world worse should be at the top of our minds as technologists, but it's almost always on the backburner. There's a huge disconnect between writing some characters on a computer and seeing effects in the real world.

I'm worried that's a really big problem, though. I really don't think it's an exaggeration to say that some of the most dire problems we need to collectively deal with in my lifetime are caused or exacerbated by software.

Things like the environmental crisis. Bitcoin bullshit already [consumes more resources](https://digiconomist.net/bitcoin-energy-consumption) than many countries. Or the mental health crisis. There's [good evidence](https://www.aeaweb.org/articles?id=10.1257/aer.20190658) that suggests the internet makes us meaner, angrier, and sadder than ever. Or the erosion of democracy worldwide. There's no doubt that social media is responsible for flooding our information ecosystem with disinformation, which [spreads like cancer](https://science.sciencemag.org/content/359/6380/1146.full) through our networks and leads us to making irrational decisions that can have deleterious long term effects.

I'm not advocating for every software engineer to become an ethicist, but we can do a lot better at being aware of the impact our work has on the world. It's definitely not nothing, and sometimes it's everything.
Change the Terminal Name in VSCode
Tags: beginners, vscode, productivity
Published: 2021-03-10 15:51:05

In working with [RedwoodJS](https://redwoodjs.com/) I often have a few running terminals that I switch between. By default the terminal name is usually the type running (`bash`, `powershell`, `node`, etc.) so it can be confusing when you have multiple terminals to run simultaneously. 

# Today's quick lesson: 

Changing the terminal name in VS Code

# Steps
1. Select the terminal you want to rename
2. Press `CTRL+Shift+P` / `⇧⌘P` and search for terminal rename
3. Enter the name you want and press enter 

Done. Your terminal has been renamed! 🎉

I hoped this helped you. If there are other quick tips you'd like, or more in depth topics you'd like me to cover, leave a comment or reach out to me, [@giannelli.tech](https://twitter.com/GiannelliTech)

Thanks for reading! 👩‍💻

Photo by <a href="https://unsplash.com/@codestorm?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Safar Safarov</a> on <a href="/s/photos/code?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a>
using click jquery function to track my clicks on a web page
Tags: javascript, jquery, dom
Published: 2021-03-10 15:33:08

Hello guys I need your help please.
I'm writing some code to track my own clicks activity on a web page. I'm using and it works well but only for some dom elements.
but it doesn't work for some other dom elements, for example when I go on google search page : 
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/61k7vczk3i0kvv57v992.png)
 
When I click on the text search input it detects it but when I click on the google search button it doesn't detect it. It's as if I didn't clicked on anything.
OpenTelemetry KafkaJS Instrumentation for Node.js
Tags: distributedsystems, kafka, opentelemetry, node
Published: 2021-03-10 15:23:43

**TL;DR — Our JS OpenTelemetry plugin for `kafkajs`, is available [here](https://github.com/aspecto-io/opentelemetry-ext-js/tree/master/packages/instrumentation-kafkajs).**

This article describes this plugin for the `kafkajs` package and our thought process behind it.

###Some Background###

[OpenTelemetry](https://opentelemetry.io/) is a CNCF project, which, among other things, enables the collection of distributed traces. 

At [Aspecto](https://bit.ly/2OgbrGV), we use OpenTelemetry at the core of our product.

While implementing it in our backend, we found a few plugins that were missing, especially when dealing with asynchronous communication.

**One of them was kafkaJS.**

We took this opportunity to give back to the community and developed it ourselves. 

###The Plugin###

This plugin allows you to track all Kafka interactions in your collected traces, which means, you get a more comprehensive view of your application behavior when using Kafka as a message broker.


The `kafkajs` plugin captures `producer` and `consumer` operations and creates spans according to [the semantic conventions for Messaging Systems](https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/semantic_conventions/messaging.md).

* Each message being produced and consumed is represented by a span with attributes such as `messaging.destination`(topic name).

* Context is propagated from producers to consumers. When a message is sent to Kafka, the trace will reveal which services consume it and what other cascading operations happen down the pipe.

* Batch operations can aggregate multiple messages into a single batch and receive\process them together. This is handled in the plugin according to the specification.

* The plugin can be extended with hooks, which enable users to run custom logic for adding span attributes depending on the Kafka message.


![simple-trace-example-in-Jaeger-view-Aspecto-opentelemetry-kafkajs-plugin-1024x270.png](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/we6g24vells4l5sfj230.png)



The above screenshot shows an example of a producer application named `kafka-producer`, that exposes an HTTP endpoint (first line), route it in express (second line), and produce two messages to a Kafka topic named `test`, which are then consumed by another application called `kafka-consumer` .

As mentioned above, kafkajs was one of the missing plugins we found and as you are reading this we are working to add more plugins.


Feel free to [reach out to us](https://www.aspecto.io/contact-us/?utm_source=dev-to&utm_medium=post&utm_campaign=kafka-plugin) with any questions as we are very much invested in OpenTelemetry and the OpenTelementry community.
Crossword puzzle generator
Tags: javascript, react, interview, programming
Published: 2021-03-10 15:08:05

##### The code is on GitHub here ---> [Link] (https://github.com/yavord10/crossword-puzzle)


1. The first reason that I want to share this is that I only found one solution online to a crossword puzzle generator, which I found quite complex to read and follow, so I feel it would definitely be of use to share the link to my solution with you.

2. The second reason for sharing is that as you probably know, most of the time one can spend hours solving a coding problem for an interview, and receive a 1-second generic reply, in the end, offering no feedback at all. Therefore, I would be really grateful if I could get some feedback on the code for my solution. 

(SOLUTION: My solution is not meant to generate different puzzles, there is a list of hardcoded words, which are turned into a crossword. However, the main functionality is there. I spend a very limited amount of time on it, and went about it the MVP way - get the app working, and handle the most important cases). 

Thank you in advance for any feedback. I hope this post can be of use to other people presented with the same, or similar task. Also, I would be very happy if others can gain insight by reading the feedback and reviewing the code so that we can all learn from each other and improve.
Are you obsessed by programming? 🧠🤯 
Tags: healthydebate, android, javascript, discuss
Published: 2021-03-10 15:05:55

`Hello World!` [My first three #healthydebate](https://dev.to/devlorenzo/series/11376) generated more than 6000 views and 130 comments! So I decided to create another one, it feels so good to have interactions with other programmers! 

* First -general- question, do you think you are obsessed by programming?

> Obsessions are recurrent, persistent, and intrusive thoughts. (I removed unwanted from the list - as I hope, you love programming!)

* If you work as a programmer, do you code out of work?
* Around how many hours do you code every day?
* How many *do you think* about programming?
* Could you just stop programming for a month? (I add without having problems)
* Fun question - Have you already dreamed of (you) programming or code? Tell us the story!

You have nothing to lose, write that comment!

--> *And don't hesitate to psychoanalyze yourself.* I think it's a good habit

> Another idea to convince you to write a comment. **The comment with more likes/reply will have free advertising on my next discussion post (+2k views per post)**

---

I'm very interested in creating a conversation / a debate thinking if you think that programming is an obsession. I also have in mind to use quotes from this post in my next writings. So don't limit yourself by writing!

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

---

Another very interesting conversation is about "why do you code?"(why do you love programming). I invite you to express yourself there too. [Go check it out!](https://dev.to/devlorenzo/why-do-you-love-programming-o4h)

{% link https://dev.to/devlorenzo/why-do-you-love-programming-o4h %}

---

Recommended reading:

{% link https://dev.to/devlorenzo/the-ultimate-compilation-of-cheat-sheets-100-268g %}.
AzureFunBytes Reminder - @Azure Machine Learning with @hboelman - Thursday, March 11, 2021!
Tags: machinelearning, kubernetes, cloud, beginners
Published: 2021-03-10 15:01:04

AzureFunBytes is a weekly opportunity to learn more about the fundamentals and foundations that make up Azure.  It's a chance for me to understand more about what people across the Azure organization do and how they do it.  

As a person who's been in the Ops world for most of his career machine learning and predictive services are still very new to me.  An entire world of data analysis is capable of providing greater insight into what customers want, [live chat bots](https://cda.ms/21n), and make decisions.  [Is machine learning just one big search on a database?](https://cda.ms/21c)  What are models?  How do I integrate AI services into applications I am currently building?  These questions have been top of mind for me when thinking about [Artificial Intelligence](https://cda.ms/21p) and [Machine Learning](https://cda.ms/21q).  

{% youtube UC3O1qM_Jtc %}

To help me get a better understanding of these services and how they work, I've enlisted [Cloud Advocate Henk Boelman](https://twitter.com/hboelman) to come on the show.  Henk and I have been in places across the world helping people understand Azure, but I certainly know that there are things I need a ton more help to understand.  This week Henk will take some of the mystery out of using ML and AI.

![Cartoon Henk and CyberCado](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n8q7h76drwnwmlrdtf3u.png)

We'll touch on some subjects such ML platform security, [MLOps](https://cda.ms/21m) (DevOps for Machine Learning), what programming languages you can use, and even [how to integrate Azure Kubernetes Service](https://cda.ms/21h).

Join us at 11 AM PST / 2 PM EST for the latest episode! We'll get you the information you need to start building your global scale apps. We can be found every week on [Microsoft LearnTV](https://cda.ms/21r)!  Ask questions, take part in the conversation, and don't miss out!

Learn about Azure fundamentals with me!

Live stream is available on Twitch at 2 pm EST Thursday. You can also find the recordings here as well:

https://twitch.tv/azurefunbytes
https://twitter.com/azurefunbytes
https://aka.ms/jaygordononyoutube
[Azure DevOps YouTube Channel](https://www.youtube.com/channel/UC-ikyViYMM69joIAv7dlMsA)

Useful Docs:

[Get $200 in free Azure Credit](https://cda.ms/219) 
[Azure Machine Learning](https://cda.ms/21b) 
[What is machine learning?](https://cda.ms/21c) 
[Tutorial: Create a classification model with automated ML in Azure Machine Learning](https://cda.ms/21d) 
[Example pipelines & datasets for Azure Machine Learning designer](https://cda.ms/21f) 
[Microsoft Learn: Create machine learning models](https://cda.ms/21g) 
[Microsoft Learn: Explore and analyze data with Python](https://docs.microsoft.com/learn/modules/explore-analyze-data-with-python/?WT.mc_id=devops-15968-jagord) 
[Deploy a model to an Azure Kubernetes Service cluster](https://cda.ms/21j) 
[Machine learning operations (MLOps)](https://cda.ms/21m)
Can 11ty host my podcast for free?
Tags: jamstack, webdev, 11ty, eleventy
Published: 2021-03-11 14:02:23

---
title: Can 11ty host my podcast for free?
description:  "Building a proof of concept"
published: true
date: 2021-03-10 15:00:00 UTC
tags: jamstack, webdev, 11ty, eleventy
cover_image: https://katiekodes.com/images/screenshot-podcast-success.jpg
canonical_url: https://katiekodes.com/11ty-podcast-rss/
---

Check out [a GitHub repository where I’m building a podcast in 11ty](https://github.com/kkgthb/web-site-11ty-06-podcast). I’m feeling too cheap to mess with a proper CDN, since I haven’t fully committed to the idea.

It needs a lot of work, but I’m committing & blogging now because I’m at a success checkpoint where I looked at my own text/art and listened to my own voice in a podcasting app. Wow.

![Screenshot of a podcast app showing my podcast](https://katiekodes.com/images/screenshot-podcast-success.jpg)

Inspiration & imitation credits:

- Dan Miller’s [gatsby-plugin-podcast-feed-mdx](https://github.com/miller-productions/gatsby-plugin-podcast-feed-mdx/blob/master/src/gatsby-node.js)
- Bryan Robinson’s [eleventy-plugin-podcast-tools](https://github.com/brob/eleventy-plugin-podcast-tools)
- W. Ian O’Byrne’s [Use GitHub Pages & Jekyll to host a podcast](https://wiobyrne.com/use-github-pages-jekyll-to-host-a-podcast/)
The 14 Financial Impacts of a Cyber ​​Attack 💸
Tags: cybersecurity, security
Published: 2021-03-10 14:48:47

Cyber ​​attacks are on the increase and can affect businesses, administrations, hospitals or individuals. Prevention and training is the key to guarding against these attacks

We quickly tend to think that the cost of a computer attack is limited to securing post-incident customer data, investigating the source of the incident and improving security measures so that it does not happen again. not. 🤞🏼

The reality is quite different and the costs are actually going to be much higher. There are many things to do in the event of an attack. 🖐🏼

In particular, it has the costs associated with crisis management, as we have seen in very, very large computer attacks.

One can think in particular of the data leak which had taken place on the adulterous dating site in the United States Ashley Madison. 💔

---

In this video, I walk through all of these financial impacts in detail.

{% youtube tcdKOmAvt-E %}
<figure>
  <figcaption>Video with French Audio & English Subtitles</figcaption>
</figure>
*Video supported by [Wild & Secure](https://www.wildnsecure.com)*

---

If you're more in the Reading, here is the Infography I am going through in the video.

![The 14 Financial Impacts of a Cyber ​​Attack](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5tgstzz6e7wyx5w927pl.jpeg)

--- 

*If you like this content, push the like button, that helps spread the message.* 👍🏼
*If you think it can be useful to anyone in your network, share it.* 📨

---

Video produced by [Wild & Secure](https://wildnsecure.com), your consulting firm to all things security and real estate.
If you want to receive weekly quality content about security, subscribe to our newsletter [on our website](https://wildnsecure.com/contact).
Mock a SQS queue with moto
Tags: python, moto, boto3, aws
Published: 2021-03-10 14:39:47

---
title: Mock a SQS queue with moto
published: true
description: an example for using python library moto to mock the aws sqs api
tags: #python #moto #boto3 #aws
//cover_image: https://direct_url_to_image.jpg
---

Below is simple example code to mock the aws sqs api. This can be useful for development so you dont have to actually manage a real SQS queue / connectivity / IAM permissions until you're ready. 

# app.py

A simple function to write a message to a preexisting queue

```python
QUEUE_URL = os.environ.get('QUEUE_URL', '<default value>')
def write_message(data):
    sqs = boto3.client('sqs', region_name = 'us-east-1')
    r = sqs.send_message(
        MessageBody = json.dumps(data),
        QueueUrl = QUEUE_URL
    )
```

# conftest.py

Pytest fixtures to mock up the aws sqs API. `aws_credentials()` also ensures that your pytest functions will not actually write to aws resources.

```python
REGION='us-east-'
@pytest.fixture(scope='function')
def aws_credentials():
    """Mocked AWS Credentials for moto."""
    os.environ['AWS_ACCESS_KEY_ID'] = 'testing'
    os.environ['AWS_SECRET_ACCESS_KEY'] = 'testing'
    os.environ['AWS_SECURITY_TOKEN'] = 'testing'
    os.environ['AWS_SESSION_TOKEN'] = 'testing'


@pytest.fixture(scope='function')
def sqs_client(aws_credentials):
    # setup
    with mock_sqs():
        yield boto3.client('sqs', region_name=REGION)
    # teardown
```

# test_sqs.py

An example test function. Create a queue using the mock client from conftest.py (notice `sqs_client` parameter matches the conftest function name `sqs_client`), invoke your python module function `app.write_message()`. Validate the returned message matches what you sent

```python
def test_write_message(sqs_client):
    queue = sqs_client.create_queue(QueueName='test-msg-sender')
    queue_url = queue['QueueUrl']
    # override function global URL variable
    app.QUEUE_URL = queue_url
    expected_msg = str({'msg':f'this is a test'})
    app.write_message(expected_msg)
    sqs_messages = sqs_client.receive_message(QueueUrl=queue_url)

    assert json.loads(sqs_messages['Messages'][0]['Body']) == expected_msg
```

## Extra

In case you wanted to see my file structure:
```bash
├── README.md
├── app.py
├── requirements.txt
├── requirements_dev.txt
└── tests
    ├── __init__.py
    ├── conftest.py
    └── unit
        ├── __init__.py
        └── test_sqs.py
```

## Thank you

kudos to [Arunkumar Muralidharan](https://qxf2.com/blog/mocking-out-aws-sqs-using-moto) who got me started
🦋Flutter - Manage Widget Permissions
Tags: flutter, dart, productivity, opensource
Published: 2021-03-10 14:24:57

In Flutter, you don't always want to display the same widget.  In many cases, the widget to display depends on the current user.
> **Stay tuned to learn how you can easily display widgets depending on the current user role.**
[_use the widget ->_](https://pub.dev/packages/widget_permission_manager/install)

##The widget that solves the problem
To solve this problem I created a widget that takes the user's current role and an authorization. The authorization basically contains all valid roles. If the passed role is valid for one given widget, the expected widget is displayed. If the role cannot be assigned to an authorization, nothing ( or rather an empty SizedBox widget) is displayed.
The central authorization widget is a stateless widget that uses an AnimatedSwitcher to generate a smooth overflow when roles are changed.

The final widget contains the following attributes...
``` dart
  final List<Tuple2<Authorization, Widget>> children;
  final String role;
  ... and all attributes for an AnimatedSwitcher-Widget
```
a constructor ...
``` dart
 AuthorizationWidget(
      {this.key,
      this.children,
      this.role,
      [...]
      })
      : assert(role != null),
        super(key: key);
```
and uses an Animated Switcher in the build method.
``` dart
@override
  Widget build(BuildContext context) {
    return AnimatedSwitcher(
      key: key ?? GlobalKey(),
      [...]
      child: _getWidget(),
    );
  }
```
The children attribute contains a list of two-tuples (Tuple2). These tuples assign an authorization object to a widget based on the key value principle. If the current role is found in an authorization object, the corresponding widget is displayed. (Please note that only the first widget that matches the criterion is displayed.)

##Result
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/10mcq8fx3s3txylampp6.gif)

The resulting widget is available online on Github and pub.dev and can be integrated into every Flutter project:
See the source code on [Github](https://github.com/lucianojung/authentication_widget)
Integrate in a Flutter Project using [pub.dev](https://pub.dev/packages/widget_permission_manager)

##Feedback
If you have any ideas or suggestions on how to better implement the widget, feel free to comment on this post.
If you want to learn more about Flutter and its mechanisms in the future feel free to follow my profile on [Dev.to](https://dev.to/lucianojung) or on [Github](https://github.com/login?return_to=%2Flucianojung)
Create and deploy Smart-Contracts on VeChain
Tags: smartcontracts, trufflesuite, vechain, javascript
Published: 2021-03-18 10:24:16

---
title: Create and deploy Smart-Contracts on VeChain
published: true
date: 2021-03-10 14:21:39 UTC
tags: smartcontracts,trufflesuite,vechain,javascript
canonical_url: https://medium.com/coinmonks/create-and-deploy-smart-contracts-on-vechain-bf1c94cdb776
---

[![](https://cdn-images-1.medium.com/max/1400/1*tiBe9hK0ceIJ-vvtzBI5CA.jpeg)](https://medium.com/coinmonks/create-and-deploy-smart-contracts-on-vechain-bf1c94cdb776?source=rss----721b17443fd5---4)

This article will walk you through the necessary steps to develop and deploy a smart contract including javascript unit tests on VeChain.

[Continue reading on Coinmonks »](https://medium.com/coinmonks/create-and-deploy-smart-contracts-on-vechain-bf1c94cdb776?source=rss----721b17443fd5---4)