teleren/devto huggingface dataset:
Python 101: Introduction to Modern Python. 
Tags: python, computerscience
Published: 2022-02-13 10:13:21

## <u>**What is Python**</u>
Python is a high-level programming language that is multipurpose, versatile and cross-platform; a Python program written on a Macintosh computer will run on a Linux system and vice-versa.
It is applicable pretty much anywhere that uses data and mathematical computation. It is also used in web development.


## <u>**Development of Python programming**</u>
It was designed by Guido van Rossum in 1991 and developed by Python Software Foundation. It was mainly developed for emphasis on code readability, and its syntax allows programmers to express concepts in fewer lines of code.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/udioxjh21q1sycj417du.jpg)**_<u>Figure:</u>_** **Guido van Rossum**
History narrates that it was started firstly as a hobby project . It is said to have succeeded ABC Programming Language. Guido had already helped to create ABC earlier in his career and had seen some issues with ABC but liked most of the features. He took its syntax and some of its good features while fixing its issues completely, ending up creating a very good scripting language which had removed all the flaws.
**_Side-note_**: The 'Python' name isn't an abbreviation or acronym, but rather, simply the result of its creator, Guido van Rossum, being an avid Monty Python fan.
The language was finally released  in 1991. It used a lot fewer codes to express the concepts, when we compare it with Java, C++ and C. In its design philosophy, its main objective is to provide code readability and advanced developer productivity. When it was released, it had more than enough capability to provide classes with inheritance, several core data types exception handling and functions.
Python 3.10.2 is the latest version. Its development has been in strides. It is the most popular coding language in the world having turned 30 recently.
For various purposes such as developing, scripting, generation and software testing, this language is utilized. Due to its elegance and simplicity, top technology organizations like Dropbox, Google, Quora, Mozilla, Hewlett-Packard, Qualcomm, IBM, and Cisco have implemented Python.
Python has been an inspiration for many other coding languages such as Ruby, Cobra, Boo, CoffeeScript ECMAScript, Groovy, Swift Go, OCaml, Julia etc.
Its major drawback has to be the length of time it takes to execute since it is an interpreted language and its dynamically typed.

## **<u>Conclusion</u>**
Python remains a favorite of many developers. It is easily readable and maintainable; code resembles plain English. It supports both function-oriented and structure-oriented programming. It is also compatible with all popular operating systems and platforms. Python supports a large built-in library from which we can extract any feature to implement in the form of packages. Thus it enables one to implement a feature without writing excess code.
All this goes to show how attractive it is to learn, master and use Python in the modern programming universe.
INTRODUCTION TO MODERN DAY PYTHON:
Tags: beginners, programming, python
Published: 2022-02-13 10:10:26


## What is Python Programming Language?

Python is high-level interpreted language whose design is aimed at code readability and to help  programmers write clear logic code for large and small projects.

Python may  sound new to most of us but it has been in existence for over two decades and right now it is the most popular programming language.

## **What makes Python Popular?**
Do you find python amazing? Lets look at the reasons why python is  mostly preferred by developers:

1.**Easy To learn**
The python language is one of the most accessible programming languages available because it has simplified syntax and not complicated, which gives more emphasis on natural language.

2.**Matured and Supportive Community**
A language can not grow if there is no active support around it. Today you will find over 100+ active communities offering support to python users and learners with resources required to grow and  ensure users and learner can get instant support from developers of all levels ranging from beginner to expert in the  community. 

3.**Lots of Python Libraries and Frameworks**
Python offers cross-platform support through library-like tools, which are beneficial when it comes to time saving during the cycle development.
_**Examples of libraries and Frameworks in Python:**_

- NumPy for scientific computing

- Django for server-side web development

- Matplotib for plotting charts and graphs

- SciPy for engineering applications, science, and mathematics

4.**Open Source**

Python is open-source and the community is always contributing to it to improve it. It is free and its source code is freely available to the public. You can download Python from the official Python Website.

5.**Extensible and Embeddable**

Python is extensible. You can use code from other languages like C++ in your Python code.
It is also embeddable. You can embed your Python code in other languages like C++.

There are more features associated with python ranging from productivity, Speed, GUIX support etc.
Get to learn and understand python by visiting https://www.python.org and kickstart your journey in python through the help of the python community.

> 
“Learning to write programs stretches your mind, and helps you think better, creates a way of thinking about things that I think is helpful in all domains.”

> 
—Bill Gates, Co-Chairman, Bill & Melinda Gates Foundation, Co-Founder, Microsoft
JavaScript Calculator
Tags: codepen, javascript, beginners, css
Published: 2022-02-13 09:52:16

 Here is my second project,

{% codepen https://codepen.io/whitewolfdot/pen/eYeEdaM %}

It's a simple JavaScript Calculator with an awesome classic UI..
It is made using pure JavaScript.
## Supported

-Simple arithmetic calculations: addition, subtraction, multiplication and division,

-Floating points.
## Not Supported

-Complex calculations (like a scientific calculator),

-Negative values,

-Exponential values.

Don't forget to give a ⭐ on [github](https://github.com/WhiteWolfDot/JS-Calculator)❤️.
Design Patterns for Resilient Serving - Continued Model Evaluation
Tags: machinelearning, datascience
Published: 2022-02-13 09:41:18

This design pattern helps detect and take action when a deployed model is no longer fit-for-purpose.

### Reasons for model degradation

1. Concept drift
2. Data drift

| Concept drift | Data drift |
| - | - |
| Relationship between the model inputs and target have changed | Any change that has occurred to the data being fed to the model for predictions as compared to the data that was used for training. |

### Identifying model deterioration

1. Continuous monitoring of the model's predictive performance over time
2. Assess this performance with the same evaluation metrics used during development

Continuous model evaluation provides a framework to evaluate a deployed mode's performance *exclusively* on new data. This means we can detect a model's staleness as early as possible. This information helps to do either of the following:

1. Retrain the model
2. Replace the existing model with a new version entirely.

This is done by capturing the following:

1. ground truth
2. prediction inputs and outputs for comparing with ground truth values
3. model versions
4. timestamp of prediction requests

### Triggers for retraining

Whether to retrain or not based on an evaluation report depends on **what amount of deterioration of performance is acceptable in relation to the cost of retraining**.

Setting a higher threshold for model performance ensures a higher-quality model in production but will require more frequent retraining jobs which is costly.

Having a lower threshold on the other hand, would mean more cost effective but there is a chance of having a stale model in production.

### Scheduled retraining

| Continuous evaluation | Scheduled retraining | 
| - | - |
| May happen everyday | May occur only every week or every month |
How do React Fragments work under the hood?
Tags: javascript, react, webdev, programming
Published: 2022-02-13 09:33:09

React aims to stay neat and clean that's why fragments are out there. They allow getting rid of excess wrappers while rendering multiple elements!

That's pretty cool, but how do they work under the hood?

## 👉 React Fragment is just a React Element of a special type!

JSX is a syntax sugar for calling `React.createElement`
This function expects only three possible groups of types:
- tag name for basic HTML elements
- class/function for user-defined components
- React fragment type

```js
// what you write
const Items = () => {
  return (
    <>
      <li>First element</li>
      <li>Second element</li>
      <li>Third element</li>
    </>
  );
}

// what React gets after babel transpilation
const Items = () => {
  return React.createElement(
    React.Fragment, 
    null,
    React.createElement("li", null, "First element"),
    React.createElement("li", null, "Second element"),
    React.createElement("li", null, "Third element")
  );
};
```

## 👉 How does React work with fragments? 
After all, there are no corresponding DOM elements!

React doesn't need real DOM elements to deal with fragments.
It forms a virtual DOM instead 💡

```js
// Items() return this
{
  "type": Symbol(react.fragment),
  "key": null,
  "ref": null,
  "props": {
    "children": [
      {
        "type": "li",
        "key": null,
        "ref": null,
        "props": {
          "children": "First element"
        },
      },
      // ...
    ]
  }
}
```

`ReactDOM`, in turn, ignores fragments and renders all children without any wrappers. 

## 👉 Verify that it works yourself!
Go to [reactjs.org](https://reactjs.org) and paste [the `Items` component](https://github.com/fromaline/twitter-snippets/blob/master/snippets/25_Jan_2022/index.js).

If DOM looks the same as here 👇, you've done a great job!
```html
<div id="___gatsby">
  <li>First element</li>
  <li>Second element</li>
  <li>Third element</li>
</div>
```

---

P.S. [Follow me on Twitter](https://twitter.com/fromaline) for more content like this!

{% twitter 1492403718284886016 %}
Python dictionary and dictionary methods
Tags: python, beginners, tutorial, programming
Published: 2022-02-13 09:27:40

> [Sign up to my newsletter!](https://baransel.dev/newsletter/).

## What is Dictionary?

We have said that there are mutable (modifiable) data types that contain different data types such as `Tuple` and `List` data types in dictionaries and are shown with **curly braces**.

`Dictionaries` are a little different because `Dictionaries` consist of two parts; `keys` and `values`, value part can contain all data type but keys part can only be of `string` and `int` type.

## How to Use Dictionaries?

Before I show its usage, Lets explain why dictionary; Imagine that you are making an English dictionary, how would it be without a database. You have to write an `if` condition for each word. Each word is a conditional cycle, which makes the program tiring. Let me show you with an example;

```python
"""Romanian Dictionary Application"""
word = input("Enter the english word: ")

if word == "Computer":
    print("Calculator")
elif word == "School":
    print("Şcoală")
elif word == "Memory":
    print("Memorie")
elif word == "House":
    print("Casa")
elif word == "Bus":
    print("Autobuz")
elif word == "Car":
    print("Mașină")
```

You will probably have written code like this.

Let's write the same application with Dictionaries.

```python
"""Romanian Dictionary Application"""
word = input("Enter the english word: ")
 
dictionary = {"Computer":"Calculator","School":"Şcoală","Memory":"Memorie",
"House":"Casa","Bus":"Autobuz","Car":"Mașină"}
```

In this way, you will have written more neat and readable code, and since Dictionaries are mutable (modifiable) data types, they can be easily added, deleted, changed, etc. we can do the work.

### Accessing Dictionary Items

Dictionaries are based on `key=value` relationships, and every **value** has a **key** value. Then we can reach the **value** with the **key** we know. Let's give an example right away;

```python
dictionary = {"Computer":"Calculator","School":"Şcoală","Memory":"Memorie",
"House":"Casa","Bus":"Autobuz","Car":"Mașină"}

print(dictionary["Computer"])

# Calculator
```

### Dictionary Methods

Let's list the dictionary methods immediately;

```python
['__class__', '__contains__', '__delattr__', '__delitem__', '__dir__',
 '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__',
 '__getitem__', '__gt__', '__hash__', '__init__', '__iter__', '__le__',
 '__len__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__',
 '__repr__', '__setattr__', '__setitem__', '__sizeof__', '__str__',
 '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'items', 'keys',
 'pop', 'popitem', 'setdefault', 'update', 'values']
```

If we omit `__X__` private methods

```python
['clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values']
```

We will cover their methods.

### `keys` Method
Continue this post on my blog! [Python dictionary and dictionary methods](https://baransel.dev/post/python-dictionary-and-dictionary-methods/).


[Sign up to my newsletter!](https://baransel.dev/newsletter/).
Higher Order Functions
Tags: dart, flutter, beginners, tutorial
Published: 2022-02-13 09:24:05

> **What Is Higher order function?**
> _In dart programming language can accept a function as an argument, this type of functions is called higher order functions._ 


_for example :-_


```
void printUser(String Function() getUser)
{
    // getting user maybe it's from api like etc.
    String user = getUser();

   // and print the user.
    print(user);
  }
```

Here the PrintUser is a higher order function because `printUser` function is accept a function named `getUser` as an argument, that `void printUser(String Function() getUser){ }`.

> _The functions are first class citizens in dart programming language because, They can be assigned to a variable, passed as an argument to another function, returned from a function, stored in other Data collections, and created in any scope._


**What is callback function?**

```

// this function called higher order function.
void higherOrderFunction(String Function() callbackFunction)
{

  // this function called callback function generally.
  callbackFunction();

 }
```

> A function passed as the argument of another function , this kind of function is called callback functions and which function is accepted the callback function that function is called higher order function.
How a message is sent from one computer to another through the internet?  (Simplified!)

Tags: internet, networking, webdev
Published: 2022-02-13 09:09:42


The computers are not(generally) directly connected to each other, rather they are connected to a special device called Router. Router's job is to send the data to its correct destination.

The data is broken down into small packets before sending it to receiver's end. It is done to increase the speed and reduce latency .Each packet have its "source" and "destination" address ( IP Address ).

The packets can be sent through different paths, so as to reduce the traffic

Also the packets have one more information, which is "offset". It helps in reassembling of all the packets after they are received.
How does React allow creating custom components?
Tags: javascript, react, webdev, programming
Published: 2022-02-13 08:41:10

React strives to give its users the ability to build encapsulated, reusable components, but how does it implement this logic in JSX?

Here is a simple example of a custom user-defined component, named `Greeting`. It renders inside a well-known `App` component.

```jsx
// Greeting.jsx
const Greeting = ({name}) => {
  return <span>Hi, {name} 👋</span>;
}

// App.jsx
const App = () => {
  return (
    <div>
      <Greeting name="Nikita" />
    </div>
  );
}
```

Let's break it down!

## 👉 How `Greeting` works?
- `Greeting` is just a function, which returns JSX. JSX is syntax sugar for calling `React.createElement` 
- `React.createElement` expects three arguments:
	- type
	- props
	- children 

Let's rewrite our `Greeting` component with this new knowledge.

```js
// Greeting.jsx
const Greeting = ({name}) => {
  return React.createElement(
    'span', 
    null, 
    'Hi, ', name, ' 👋');
}
```

## 👉 How to use the `Greeting` now? 

Turns out, `createElement` expects three values as type: 
- tag name, like `div` or `span` 
- a class or a function, that defines custom component 
- React fragment type

```js
// App.jsx
const App = () => {
 return React.createElement(
   'div',
   null,
   React.createElement(Greeting, {name})
 );
}
```

Simply put, `createElement` calls the passed function internally and uses its return value to form the component tree.

```js
// Internal intermediate result
const App = () => {
 return React.createElement(
   'div',
   null,
   React.createElement(
     'span', 
     null, 
     'Hi, ', 'Nikita', ' 👋'
   )
 );
}
```

## 👉 Verify that it works yourself!

Go to reactjs.org, open the console and paste [the last code snippet](https://github.com/fromaline/twitter-snippets/blob/master/snippets/24_Jan_2022/index.js) there.

Then call the `App()` and see the end result. 
If it's the same as here 👇, you've done a great job!

```js
{
  "type": "div",
  "key": null,
  "ref": null,
  "props": {
    "children": {
      "type": "span",
      "key": null,
      "ref": null,
      "props": {
        "children": [
          "Hi, ",
          "Nikita",
          " 👋"
        ]
      },
      "_owner": null
    }
  },
  "_owner": null
}
```

---

P.S. [Follow me on Twitter](https://twitter.com/fromaline) for more content like this!

{% twitter 1486750941814484995 %}
Watch Star Wars Movie In Command Prompt(cmd)
Tags: cmd, windows, computerscience, starwars
Published: 2022-02-13 08:40:37

## Do you wanna watch STAR WARS Movie through Command Prompt?
> If yes, then go ahead and follow the instructions below. 😊


### Instructions:-

1. Type "cmd" in your Search Bar and hit Enter. Alternatively, you can also use the shortcut key `Windows + R` and then type "cmd" and hit Enter.
2. When the command prompt opens up, type the following command -
```cmd
telnet towel.blinkenlights.nl
```
3. Now hit Enter
4. You're done 🎉

Now enjoy the movie with 😎 and 🍿. 

After a few seconds, you'll see this kind of image - 
![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1644739973185/QgyjUiKls.png)

--- 
**Note:- If you see any error like -**   
` 'telnet' is not recognized as an internal or external command, operable program or batch file.
`
**then follow the instructions below.**

---

### Instructions to Solve the Issue:-

1. Type `add or remove programs` in your Search box and hit Enter.
2. A dialog box of Settings will appear and now click on Programs and Features option highlighted below 👇 
![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1644740320451/ZNYilp1ZR.png)
3. Now the **Programs and Features** dialog box will appear and then click on **Turn Windows features on or off** as highlighted below 👇 
![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1644740555060/KnJ3-tLvm.png)
4. Now a dialog box will appear and you have to scroll down and find **"Telnet Client"** 
![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1644740766491/-ZJncHzJI.png)
5. Now check the box beside Telnet Client and click "OK". 
![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1644740892003/M8-U5QJzn.png)
6. After that you'll see a dialog box will appear. Now wait for a few minutes and let your computer install the telnet client on your Windows System.
![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1644739753295/5iJkn6Cpp.png)
7. Now close this dialog box and all other boxes. 
![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1644739828423/2K1EQGz8t.png)
8. Now you're all set. 🎉

Go ahead and follow the above instructions to watch the movie in your Command Prompt. 

--- 

#### You can also watch this [video](https://youtu.be/seZUKcd4-nE) for clarity.

## Hope this helps you. Thank you for reading, and let's connect!
Thank you for reading my blog. Feel free to subscribe to my [YouTube Channel](https://www.youtube.com/channel/UCsuzc8lqAbgUYo4yzpjtfSw) and connect on [LinkedIn](https://www.linkedin.com/in/susmita-dey-15a15a210/) or [Twitter](https://twitter.com/its_SusmitaDey).
Also, feel free to [support](https://www.buymeacoffee.com/susmitadey) my work.😊
A Fun Programming Joke To Start Your Day
Tags: jokes, dailydeveloperjokes
Published: 2022-02-13 08:00:10

---
title: "A Fun Programming Joke To Start Your Day"
description: "Check out today's daily developer joke! (a project by Fred Adams at xtrp.io)"
series: "Daily Developer Jokes"
published: true
tags: #jokes, #dailydeveloperjokes
---

Hi there! Here's today's Daily Developer Joke. We hope you enjoy it; it's a good one.

![Joke Image](https://private.xtrp.io/projects/DailyDeveloperJokes/public_image_server/images/5e1258e86d537.png)

---

For more jokes, and to submit your own joke to get featured, check out the [Daily Developer Jokes Website](https://dailydeveloperjokes.github.io/). We're also open sourced, so feel free to view [our GitHub Profile](https://github.com/dailydeveloperjokes).

### Leave this post a ❤️ if you liked today's joke, and stay tuned for tomorrow's joke too!

_This joke comes from [Dad-Jokes GitHub Repo by Wes Bos](https://github.com/wesbos/dad-jokes) (thank you!), whose owner has given me permission to use this joke with credit._

<!--
Joke text:
___Q:___ How does a developer make a cheer?

___A:___ ["hip","hip"] // (hip hip array!)
 -->
OpenBSD の pkg_add が ocsp verify failed エラーで失敗
Tags: openbsd, server, virtualbox, troubleshooting
Published: 2022-02-13 07:56:53

## 何が起こったか

[OpenBSD](https://www.openbsd.org/) を [VirtualBox](https://www.virtualbox.org/) でインストールした直後のことです。`syspatch` も `pkg_add` も以下のエラーで使えませんでした:

```console
$ doas pkg_add -u 
https://cdn.openbsd.org/pub/OpenBSD/7.0/packages-stable/amd64/: TLS handshake failure: ocsp verify failed: ocsp response not current
https://cdn.openbsd.org/pub/OpenBSD/7.0/packages/amd64/: TLS handshake failure: ocsp verify failed: ocsp response not current
https://cdn.openbsd.org/pub/OpenBSD/7.0/packages/amd64/: empty
```

`ping cdn.openbsd.org` は成功していたにも関わらず、です。

## 解決した方法

`/etc/installurl` を変更しました:

```console
$ doas vi /etc/installurl
```

以下のように向き先を FTP サーバーに変えたのです:

```diff
- https://cdn.openbsd.org/pub/OpenBSD
+ https://ftp.openbsd.org/pub/OpenBSD
```

すると `pkg_add` が成功するようになりました。

```console
$ doas pkg_add -u
quirks-4.54 signed on 2022-02-12T18:54:43Z
quirks-4.54: ok
```

## なぜ起こったか (推測)

しばらく (1 時間) のち、`/etc/installurl` をもとに戻しました:

```diff
- https://ftp.openbsd.org/pub/OpenBSD
+ https://cdn.openbsd.org/pub/OpenBSD
```

今度はエラーが起こりませんでした:

```console
$ doas pkg_add -u
quirks-4.54 signed on 2022-02-12T18:54:43Z
```

驚いたことに、時間が経つと直ったようです。あるいは一度 ftp サーバーで成功したからでしょうか。

推測ですが ntp のステータスによるものだったのかもしれません。物理サーバーに OpenBSD をインストールした時には、このようなエラーは見たことが確か無かったはずです。

ご参考までに、復旧後に確認した ntp ステータスは以下の通りでした:

```console
$ doas ntpctl -s status
5/5 peers valid, constraint offset -32564s, clock unsynced, clock offset is -32561707.819ms
```