teleren/devto huggingface dataset:
Should Perl die gracefully?
Tags: perl
Published: 2021-06-01 14:18:10

---
title: Should Perl die gracefully?
published: true
date: 2021-06-01 14:00:00 UTC
tags: Perl
canonical_url: https://phoenixtrap.com/2021/06/01/should-perl-die-gracefully/?utm_source=rss&utm_medium=rss&utm_campaign=should-perl-die-gracefully
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0j7f7lox058o64v71d27.jpeg
---

A [comment](https://medium.com/@willsmithorg/as-somebody-who-wrote-loads-of-perl-in-the-2000-2005-time-frame-and-has-now-like-almost-everybody-6ced8384a977) on the [Medium version of last week’s article](https://medium.com/codex/perl-can-do-that-now-10191006af0e) got to me:

> I wish they’d just leave Perl static. Then we wouldn’t have to waste money retesting legacy Perl apps on the newest version every couple of years, in case new features we don’t want breaks code that’s been unchanged for years. […] Sometimes things should just be left to die gracefully.
> 
> <cite><a href="https://medium.com/@willsmithorg">William Smith</a></cite>

Programming languages, like all software, change to meet new challenges. Developers add new feature enhancements, users find bugs for them to fix, and occasional design errors need to be corrected. In Perl’s case, the Perl 5 Porters (the group of volunteers that develop and maintain Perl) have had an [explicit backward compatibility and deprecation policy](https://perldoc.pl/perlpolicy#BACKWARD-COMPATIBILITY-AND-DEPRECATION) since 2011 that tries to protect the Perl user community from the breakage of old code while still moving the language forward. In short, they do their absolute best to **minimize your testing and changes**.

To that end, the Perl developers have done an amazing job presenting new syntactical features as only enabled when adding the appropriate `use feature` or `use VERSION` construct. If you do not add this code, the new syntax will not be enabled and **your legacy code will not break**. Incompatible changes, if there are any, are always documented in a release’s [`perldelta` document](https://perldoc.pl/perl#History) (hint: it’s under the heading “Incompatible Changes”).

Given all this, **it is a monstrous thing to demand an entire volunteer community stop enhancing their platform** so that your particular applications can remain static while continuing to take advantage of the [support policy generously offered](https://perldoc.pl/perlpolicy#MAINTENANCE-AND-SUPPORT) for recent releases. **If you need an unchanging platform, don’t upgrade it**—and take all the responsibility that implies, such as the backporting of security fixes beyond the three-year support commitment offered (again, _gratis_) by Perl’s developers.

You have no right to demand Perl stands still and “dies gracefully” any more than anyone has the right to demand that of you.
Light/dark mode: avoid flickering on reload
Tags: webdev, css, javascript
Published: 2021-06-01 13:38:42

## Presentation of the issue

If you already added a dark mode to your website, and if you are allowing your users to pick the mode they prefer, you may already save their preferences so that they don't have to pick it again the next time they visit your website.

But now, you have to restore their preference on page load. And if this is done within your application, you cannot guarantee that this will be the 1st action done by the browser when loading the JS (specially if you lazy loaded the javascript code).

This can result in a flicker when users visit your website: they picked the dark mode, but when loading the website, for a fragment of seconds, a white background can be displayed.
Here is an example of this magnified:

{% codepen https://codepen.io/ayc0/pen/oNZpzRP %}

## The fix

The way the browsers work is that if there is a `<script>` tag in your head or at the very beginning of your body, this script will block the rendering of the page until it hasn't completed.

In general you want to avoid this, as you add unnecessary burden on the rendering of the page, and it will delay everything else.
But for critical rendering like this one, this is okay.

All you have to do is add something like the following in your HTML:

```html
<body>
  <script>
    const theme = localStorage.getItem('theme') || 'light';
    document.documentElement.dataset.theme = theme;
  </script>

  <!-- rest of your html -->
</body>
```

{% codepen https://codepen.io/ayc0/pen/KKWZNMW %}

## Drawback

Now the logic for handling the theme gets duplicated: in this script tag and in your main JS.

My advice would be to either:
- if your logic is really simple, to put everything in this script tag,
- if you logic is more complex - like handled by a framework like React (you can call it a library if you want), or if you need to fetch it from a database, or else - only put the critical logic in this blocking script tag.

## Conclusion

In my opinion, when dealing with themes, avoiding flickering on load is one of the most important things to care about. Otherwise you'll irritate your users fairly quickly.

This is why I considered earlier this code snippet as critical.

If you want to read about how to implement a light/dark mode for your users, you can read the other articles from [this series](https://dev.to/ayc0/series/12983).
Frontend challenge - Car bidders dashboard.
Tags: javascript, react, tailwindcss
Published: 2021-06-01 13:28:09

I had an Interview with **Travclan** and for the technical round, I had to submit a solution for this frontend challenge. 

```
# Front-end Test Task
## Task

Develop a Single page application with following mentioned features
but not necessarily limited to it.

#Must:

1. Display a list of customers (with pagination).
2. Each customer bas several bids, by default only the maximum bid
should be displayed. Also add a toggle button so that on switching
toggle only the minimum bid is displayed.
3. Enable sorting of customer list by bid amount.
4. Front-end part should be developed as SPA with ES6, React(Hooks).

#Good to have:

1. Using Context Api or Custom Hooks will be a big plus.
2. Clicking on any row should redirect to a separate url where all the
selected customer's bids should be displayed. (use your creativity on
how to display the data).

3. Styling is not a priority but using Material Ui(https://material-
ui.com) entirely will be a plus.

Use following API to retrieve the data - `https://intense-tor-
76305.herokuapp.com/merchants`

## Data structure example

Customer {
id: string,
firstname: string,
lastname: string,
avatarUrl: string,
email: string,
phone: string,
hasPremium: boolean,
bids: Array<Bid>
}

Bid {
id: string,
carTitle: string,
amount: number,
created: string
}

## Table expected
__________________________________________________________________
| Customer name (with avtar) | Email | Phone | Premium | Max/Min bid |
__________________________________________________________________

```

My solution: - 

- live - [Car Bidders Dashboard [Netlify]](https://car-bidding.netlify.app/)
- GitHub - [Car Bidders List](https://github.com/Rajesh-Royal/car-bidding-system-react)

{% github Rajesh-Royal/car-bidding-system-react %}

**Result:**  I was not selected for next round.
Prestashop B2B wholesale module
Tags: prestashop
Published: 2021-06-01 13:15:21

Prestashop is an eCommerce improvement platform. Covering a huge variety of eCommerce-developed markets. We at addify develop top rate exceptional Prestashop modules. Addify has been developing plugins, extensions, and modules for some time now and offers its customers premium quality products with great customer support. One of our top-rated Prestashop modules is Prestashop B2B & wholesale which offers great functionality and unique feature of wholesalers online.
https://addify.co/product/prestashop-b2b-wholesale-module/
Let's Build a Jamstack App Together!
Tags: css, webdev, eleventy, jamstack
Published: 2021-06-01 13:07:10

> **[Join me on Twitch](https://twitch.tv/5t3phDev)** as we build an RSS Reader using Eleventy and Modern CSS

We'll start from absolute zero and create project requirements, architect [the Eleventy (11ty) project](https://11ty.rocks), design in the browser using [modern CSS](https://moderncss.dev), and all the other bits required to get a project launched.

Building an RSS feed reader will let us explore:

- Setting up an 11ty static site project
- Creating data sources
- Using modern CSS to create a functional UI
- Possibly serverless functions (TBD pending "app" architecture)
- Other features as determined by the chat participants

> In our first stream [we created a feature list](https://gist.github.com/5t3ph/755c4eac0d4fffab732f7a8b7b39bb01) which you can feel free to comment on!

## Stream Schedule

There will be two streams this week - [follow on Twitch for go-live notifications](https://twitch.tv/5t3phDev):

- Tuesday, June 1 - 1 PM CT - _[check local time​](https://time.is/0100PM_1_June_2021_in_CT)_
- Thursday, June 3 - 9 AM CT - _[check local time​](https://time.is/0900AM_3_June_2021_in_CT)_

Sometimes I need to change stream times which I announce [over on Twitter](https://twitter.com/5t3ph).

To find out about future streams, and keep updated on my [many other projects](https://thinkdobecreate.com), **[subscribe to my newsletter](https://moderncss.dev/newsletter)**.
Answer: curved navigation bar make it tappable
Published: 2021-06-01 13:06:33

{% stackoverflow 59891404 %}


import 'package:flutter/material.dart';
import 'package:curved_navigation_bar/curved_navigation_bar.dart';
import 'page1.dart'
import 'page2.dart'

void main() => runApp(MaterialApp(home: BottomNavBar()));

class BottomNavBar extends StatefulWidget {
  @override
  _BottomNavBarState createState() => _BottomNavBarState();
}

class _BottomNavBarState extends State<BottomNavBar> {
  int _pageIndex = 0;
  GlobalKey _bottomNavigationKey = GlobalKey();

  List pages = [
    MyRoute(
      iconData: Icons.add,
      page: Page1(),
    ),
    MyRoute(
      iconData: Icons.compare_arrows,
      page: Page2(),
    )
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      bottomNavigationBar: CurvedNavigationBar(
        key: _bottomNavigationKey,
        index: 0,
        height: 50.0,
        items: pages
            .map((p) => Icon(
                  p.iconData,
                  size: 30,
                ))
            .toList(),
        color: Colors.white,
        buttonBackgroundColor: Colors.white,
        backgroundColor: Colors.blueAccent,
        animationCurve: Curves.easeInOut,
        animationDuration: Duration(milliseconds: 600),
        onTap: (index) {
          setState(() {
            _pageIndex = index;
          });
        },
      ),
      backgroundColor: Colors.blueAccent,
      body: pages[_pageIndex].page,
    );
  }
}

class MyRoute {
  final IconData iconData;
  final Widget page;

  MyRoute({this.iconData, this.page});
}
Get 3 Months Free of Tabnine Pro
Tags: productivity, programming, tooling, webdev
Published: 2021-06-01 12:52:41

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sr75445zxxbe7cweksap.png)

International #LeaveTheOfficeEarlyDay is happening tomorrow! We're here to help make it a guilt-free fun afternoon so that you can hit the beach, boardwalk, or basketball court without worrying about a bitter boss. 
So... to help you get your code done faster, we're giving away 3 months free of Tabnine Pro until Wednesday 4:00 PM EST, hoping to catch you at the beach by then :)

https://www.tabnine.com/pricing/checkout?planInterval=month&promotionCode=EARLYLEAVE
How to Create a User Engaging Website
Tags: websitedevelopmentcompany, webdevelopmentcompany, ecommercedevelopmentcompany
Published: 2021-06-01 12:31:25

A website is an efficient tool for connecting thousands of customers online. A website with a catchy design can retain visitors. And it will help them to convert into reliable customers.

If you are looking to make an engaging website then you have to keep in mind some points. Below are the key points how to make an engaging website:

·         Easy and simple design
·         Easy and Fast navigational features
·         Use a clear call to action
·         Content is less and effective
·         Proper use of white space
·         Eye-catching colors used
·         Fonts are easy to read
·         Drive traffic through videos and images
·         Fonts used should be Attractive and Easy to Read
·         Engage users with Videos & images
·         Make a responsive website
·         Website must mobile-friendly

While creating an engaging website, ensure that it conveys the message of your brand. And the fonts, colors are used in the right way so that it becomes more engaging. Relatable images and videos will help you to drive more traffic.

We at Teckskytechnologies also build you the best website that delivers more traffic to your business. We have 6+years of experience in Website development and design.

Make a responsive website
GUI container on the Docker
Published: 2021-06-01 12:29:55

GUI container on the Docker
🔷 Launch a container on Docker in GUI mode 
🔷 Run any GUI software on the container
In this Article I have explained how to launch firefox and Jupyter Notebook GUI application inside Docker container.

step 1:  **docker run -it --net=host --env=DISPLAY centos**
this will pull centos image and run both at a time.

step 2:  **yum install firefox -y**

step 3:  **yum install python3 -y**

step 4:  **pip3 install jupyter**

step 4:   **jupyter notebook --allow-root**

**This will successfully run Jupyter notebook on Firefox browser.**
Connection Leak in MSSQL
Tags: sql, todayilearned, beginners, discuss
Published: 2021-06-01 12:22:56

### The error occurs as a result of connection leaks in the application.

Any applications getting connection timeouts to MS-SQL Server will see the following error.
```
Message=Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and the max pool size was reached.
```
Most of the time, this failure happens due to connection leaks in the application. Run the following query to check the list of connection requests in the MSSQL Server:
```
select count(1) conection_count, program_name, host_name, status, host_process_id from sys.dm_exec_sessions where is_user_process = 1 group by program_name, host_name, status, host_process_id order by 1 desc
```
The connection requests are of two categories.

* running

* sleeping

The above query returns a list of connections, i.e., both running and sleeping.

![](https://cdn-images-1.medium.com/max/2000/1*hwx_1NLca5lH1qnA3nU4Rw.png)

Currently, in the above output, I don’t have any sleeping thread.

But by default, ADO.Net in C# application sets a max pool size to 100 connections per “host_process_id.” So if a process is holding up more than 100 sleeping connections, there is a possibility it might leak.

Thank you for reading, and I hope you liked the article. Please provide your feedback in the comment section.

## Follow me on

[C# Publication](https://medium.com/c-sharp-progarmming), [LinkedIn](https://www.linkedin.com/in/sukhpinder-singh-532284a2/), [Instagram](https://www.instagram.com/sukhpindersukh/), [Twitter](https://twitter.com/sukhsukhpinder), [Dev.to](https://dev.to/ssukhpinder), [Pinterest](https://in.pinterest.com/ssukhpinder/_created/), [Substack](https://sukhpinder.substack.com/), [Wix](https://www.csharp-dotnet.com/).
Running GUI container on the Docker

Published: 2021-06-01 12:21:23

**Task 2**

Task Description

a) GUI container on the Docker

b) Launch a container on docker in GUI mode

c) Run any GUI software on the container.

Pre-requisites:

1. Host OS should be GUI
2. Docker installed in your OS

Launch a container on docker in GUI mode

a)   First create a workspace
b)  Create custom Docker Image


We'll be using Dockerfile to run in GUI mode -

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

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

To launch the Docker container with GUI, Install PackageKit-gtk3-module and libcanberra-gtk2 module

libcanberra-gtk2: Libcanberra is an implementation of the XDG Sound Theme and Name Specifications, for generating event sounds on free desktops, such as GNOME. It comes with several backends (ALSA, PulseAudio, OSS, GStreamer, null) and is designed to be portable.

packagekit-gtk3-module: PackageKit is a system designed to make installing and updating software on your computer easier. The primary design goal is to unify all the software graphical tools used in different distributions and use some of the latest technology like PolicyKit. 

Build the image: `docker build -t <imagename>:<tag>  .`

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

Launch the Docker Container -
`docker run -it --name <name of os> --env="DISPLAY" --net=host <imagename:tag>`

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

Launching Firefox & Jupyter notebook -

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

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pa762xqt3aibyx4w29wg.png)
Day 13/30 : Toggle ON OFF Switch Button using HTML and CSS
Tags: html, css, webdev, tutorial
Published: 2021-06-01 12:17:08

Welcome to Day 13 of this [Challenge](https://dev.to/somanathgoudar/30dayschallenge-30-days-extreme-html-css-challenge-50k1). This is what I created today. 

**➜ Here is the Demo :**
![Toggle ON OFF Switch Button](https://1.bp.blogspot.com/--7ZSDKGtyfI/YKilt_Nlj3I/AAAAAAAAAEw/aDySb0W_wqQ1aP5O0D9ROuVxldg1De6bACLcBGAsYHQ/s600/13.gif)

**➜ Video Tutorial :**

{% youtube E1lCCB6y_JE %}
**➜ Source Code :**
https://www.futurecodersweb.com/2021/06/css-toggle-on-off-switch-button-using.html


**➜ Instagram Post and Reel for Day 13 :**
[See Post and Reel](https://www.instagram.com/future_coderss/)

------------------------------------------------------------------

Hey, If You don't know what is happening here. Don't Worry, I am doing a crazy challenge 😅. Read More about it from the post below.

{% link https://dev.to/somanathgoudar/30dayschallenge-30-days-extreme-html-css-challenge-50k1 %}

**Support Me :**
👉 Buy me a Coffee: https://www.buymeacoffee.com/somanathgoudar
👉 [Follow Me on Instagram](https://www.instagram.com/somanath_goudar/)
👉 [Follow Future Coders on Instagram](https://www.instagram.com/future_coderss/)
👉 [Subscribe to My Main Channel](https://www.youtube.com/channel/UC_nTrhTr5fnBGjOxnkPUmmA)
👉 [Subscribe to Channel Created for this Challenge](https://www.youtube.com/channel/UCzGSyMOf2jPt1MkNBB3SJ3g)

------------------------------------------------------------------
How to auto-generate detailed Swagger/OpenAPI for all your Rails routes
Tags: rails, techtalks
Published: 2021-06-01 12:13:31

Welcome back to my [RailsConf 2021](https://www.railsconf.org/) presentation recap! Check out [Part 1](https://appland.com/blog/2021/05/25/rails-conf-recap-pt1/) and [Part 2](https://appland.com/blog/2021/05/27/rails-conf-recap-pt2/) in case you missed them last week. This post recaps the second demo I gave as part of my talk. Using rswag and the [`appmap_swagger` gem](https://appland.com/docs/reference/appmap-swagger-ruby.html), I showed RailsConf attendees how to auto-generate Swagger files instead of manually writing them.

**Note: AppMap Swagger has been updated and incorporated into AppMap core. Learn more about how to generate OpenAPI (formerly Swagger) documentation in the [AppMap developer docs](http://appmap.io/docs/openapi)**

The Swagger UI takes JSON or YAML files and generates an interactive catalog of your web services. The catalog contains routes, methods, status codes, parameters, request body, authentication methods and more. With Swagger, you can:

* See your whole web services catalog and actively interact with all of the API functions
* Debug your webservices in a very granular way
* Observe your web services test coverage visually
* Diff the web services changes by committing your Swagger YAML and comparing across versions using standard source diff

![How Swagger works](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ewtgih6zj9vw10ixnusy.png)

Writing Swagger files -- and keeping them accurate and up-to-date -- is a real challenge, so here are two ways of auto-generating these files:

1. **With a gem called `rswag`** Swagger can be auto-generated from test cases. Rswag ensures a valid Swagger file thanks to assertion checks performed by rswag, and it’s very customizable. 
2. **With `appmap-swagger`** Swagger can be auto-generated from AppMap files, which are recorded from test cases. appmap-swagger also ensures a valid Swagger file, but achieves more complete API coverage faster. You also don’t need to learn as much about the OpenAPI format to use appmap-swagger. 

You can watch this portion of my RailsConf talk in the video clip above. If you want to follow along in the code or look it up later, I’ve created [a branch called `swagger` within the Land of Apps fork of the Rails Sample App](http://github.com/land-of-apps/sample_app_6th_ed/tree/swagger). Check it out, and let us know what you think in the [AppMap Discord](https://discord.com/invite/N9VUap6)!

**Coming up next...** In the fourth and final installment of this blog series, I’m going to recap the remaining demo of my RailsConf talk: how to auto-document database schemas.
Transform List to Varargs in Java
Tags: java
Published: 2021-06-01 10:21:46

Hello everyone 😁. For this article we will be transform List to Varargs.

Firstly, I want to show example of varargs in argument of method.
Normally, the varargs is represent as a iterator type that you can loop each element.

```java
class Main {  
  public static void main(String args[]) { 
    System.out.println(concatString("Hello", "world!")); 
  }

  public static String concatString(String... words) {
    StringBuilder sb = new StringBuilder();
    for (String str : words) {
      sb.append(str);
      sb.append(" ");
    }
    return sb.toString().trim();
  }
}
```
But if you seen some library, They receive varargs as a parameter too!. So if you have list of data, you can transform it to array and thrown it to that method.

This is example of code that will show you how to transform it. ✌

```java
import java.util.List;

class Main {  
  public static void main(String args[]) { 
    List<String> words = List.of("Hello", "world!");
    String result = concatString(words.toArray(new String[words.size()]));
    System.out.println(result);
  }

  public static String concatString(String... words) {
    StringBuilder sb = new StringBuilder();
    for (String str : words) {
      sb.append(str);
      sb.append(" ");
    }
    return sb.toString().trim();
  }
}
```

That's it. This is how we can use List as argument of method that received varargs.

Thank you very much for reading. 😄