teleren/devto huggingface dataset:
PYTHON IN A NUTSHELL
Published: 2022-04-24 20:15:31

Python is a simple interpreted programming language that has managed to be of great use in almost all fields of computing .
Its syntax allows easy readability  and it boasts of object oriented features like polymorphism  ,inheritance etc. It offers interactive programming , portable , Dynamic typing Built-in types and tools Library utilities, Third party utilities ,Automatic memory management.

Like all languages python uses basic data types like **int ,str** **float and Boolean**. Its other data structures include tuples ,lists and dictionaries that are normally user defined. A tuple consists of values separated by commas. Unlike lists, tuples are enclosed within parentheses. Lists are mutable while tuples are not. Tuples can be hashed, as a key for dictionaries. To find the data type the type() function  is used .
The print () function is used to display things e.g
>>>print(“Hello Newbies, This is python overview”)
This outputs      _Hello Newbies, This is python overview_
NB: Parenthesis that come after the print statement and encloses the content to be displayed. Because its a string its enclosed in single or double quotes. 

There are escape sequences used to include quotes on or special characters that would otherwise be not displayed for conflicting with the code quotes at the ends of the function. Example \n for newline and \t for tab spacing e.g  print(‘it\’s a great day today’) if written without the backslash it will output an error. Its also important to state that Python is sensitive to case.
Understanding rules of declaring variables, making expressions then rules governing operations of addition subtraction, concatenation, bitwise operator, division, flooring, multiplication, modulo, exponents, among others together with knowing the inter data type compatibility is key for construction of sound programs .
Single-line comments begins with a hash (#) symbol. multi line comments are useful on many lines, triple double quote (“ “ “) and single quote(‘ ‘ ‘)are used for multi-line commenting.
Functions make programming more organized and manageable, avoids repetition and makes code reusable. Typically a function is a group of related statements that perform a task. Functions help break programs into chunks. 
A module is a file consisting of Python code. A module can define functions, classes and variables. A module can also include runnable code.
Python also uses the if statement to make decisions. If -else and elif to expand the decision options. The while loop is used to keep doing a task as long as a condition is set .The For statement is used for iterations .
Almost everything in Python is an object, with its properties and methods.A Class is like an object blueprint for creating objects. Class enables use of concepts like inheritance, encapsulation,polymorphism to enable users design complex programs.
Learning typescript for the first time - 2
Published: 2022-04-24 20:08:58

## **Why typescript?**

Let's first talk about JavaScript. JavaScript is an awesome object-oriented language that dynamically set the types of your variables. It is so helpful when you are writing less code. but nowadays JavaScript is so popular that it is being used both frontend and backend. For a large-scale app, you need to write a huge amount of code. So In JS, the most common error that we face is a type error. Typescript solves this issue for us. 

Typescript set the variable types statically.  it will check your code in the code editor and help you to solve it fast.  typescript simplifies JavaScript code for you.  with typescript we can make a huge improvement over plain JavaScript script. It gives us more productivity. It will save us time because it will stop execution immediately after getting an error. TypeScript can help us to avoid painful bugs that developers commonly run into when writing JavaScript by type-checking the code.
Rails custom validation contexts
Tags: rails
Published: 2022-04-24 19:53:30

In rails, it is possible to specify when the validation should happen. sometimes you may want to introduce new validation or skip some. Rails `on` option helps us achieve this.

```rb
class Post < ApplicationRecord
 validates :body, presence: true
 validates :title, uniqueness: true, on: :create 
 validates :published, exclusion: [nil], on: :update 
end
```
From the above validations: 
- it's not possible to create or update a post without a body
- it will be possible to update a post with a duplicate title 
- it will be possible to create a record with published nil 

Apart from the commonly used `on: :create` and `on: :update` rails allow us to provide custom contexts. 

```rb
class Post < ApplicationRecord
 validates :title, presence: true 
 validates :published_at, presence: true, on: :publish
end
```
From the above example, we are validating `published_at` presence `on: :publish`. Custom contexts  are triggered explicitly by passing the name of the context to `valid?` `invalid?` or `save`

```sh
post = Post.new(title: "Rails validations")
post.valid? # true 
post.valid?(context: :publish) # false 
post.save(context: :publish) # false
```
Embed Responsive Maps To Your Website - Mapbox GL API
Tags: javascript, webdev, api, programming
Published: 2022-04-24 19:39:29

Did you know that using maps on your website not only helps users find your location but also signifies trust in the credibility of your organization? Whether you are working on a side project or your web design client asked you to embed an interactive map on their site, there are many reasons why you would want to use one of the map APIs to accomplish that task. I recently used the Mapbox GL API on one of my projects, and here is my experience with it.

## Initial Configuration

It's incredibly simple; with just a few lines of html, CSS, and JavaScript, you'll have an interactive map on your site in no time. Mapbox provides you with a default access token without the need for billing information. Their documentation provides one with clear, step-by-step instructions on how to get your map up and running.

## Extensive Customization Possibilities

Mapbox provides its users with a cool feature known as Mapbox Studio. Here you can customize your map to your desired style. If you want to target a small area like your street or a bigger area like your city, Mapbox has got you covered. It also provides you with different map themes. If you like your map in dark mode or light mode, you won't need to code it from scratch. 

## Controls

Mapbox comes with navigation controls such as zoom buttons and a compass to enable users to maneuver their way around the map. Another feature of Mapbox that I liked is the ability to add marker components to your map. You can embed default markers or customize ones using your own data. 

## Last Thoughts

I just highlighted a few cool features of the Mapbox GL API that I used in my project, Hospital Finder, that is meant to help users locate nearby medical centers and directions in case of medical emergencies. 

[Repo Link] (https://github.com/esthercate/Hospital-Finder)

[Live Link] (https://esthercate.github.io/Hospital-Finder/)
Happy Easter animation
Tags: svg, css, easter
Published: 2022-04-24 19:37:48


![Alt Text](https://media.giphy.com/media/eCLHJ8gTYl8JTv3PEk/giphy.gif)
###link to code
{% github verica02/happy-easter-animation %} 
###demo
https://happy-easter.netlify.app/
Um salário de 100 mil dólares anuais para pessoas desenvolvedoras morando no Brasil é possível?
Published: 2022-04-24 19:33:10

A resposta simples é: sim e até mesmo mais do que isso.

Quando eu fiz a pergunta no Twitter, eu a fiz em inglês e da seguinte forma:

{% twitter 1512776564513116167 %}

Tradução com reescrita: "É possível para uma pessoa desenvolvedora Elixir/Erlang trabalhando remotamente, vivendo em um país do terceiro mundo, ganhar US$ 100.000 por ano ou mais? Ou este nível de salário está disponível apenas para aqueles que moram nos EUA/Europa/Austrália?"

Um problema é que usei a expressão "terceiro mundo". Eu deveria ter usado "países em desenvolvimento". 

A minha inspiração para a pergunta foi este tuíte que faz parte de um fio:

{% twitter 1511508335433986050 %}

Tradução:

> Existem aproximadamente 3 níveis de pagamento para desenvolvedores seniores de Elixir nos EUA:
>   1. Empresas competindo com mercados locais (~$130K)
>   2. Empresas concorrentes com startups do Vale do Silício (US$ 150-175 mil)
>   3. Empresas competindo com o limite superior do pagamento do Vale do Silício (US$ 200 mil ou mais de compensação total) - principalmente grandes empresas (mais de 300 funcionários)

Uma primeira observação importante, caso alguém ainda não saiba, é que nos EUA (e em alguns países da Europa) as pessoas costumam falar em salário anual. Ou seja, 100 mil dólares equivalem a 8.333,33 dólares por mês (na cotação de dólar comercial de 22/04/2022, 40.042,48 reais). 

Não sei exatamente como funciona, mas por lá (EUA) férias são negociadas empresa a empresa e não há décimo terceiro salário. Algumas empresas pagam um ou mais benefícios (plano de saúde, participação em ações, etc.). Acho que é a isto que o Tyler Young fala quando escreve "compensação total". Ou seja, a pessoa recebe, por exemplo, 180 mil em dinheiro e 20 mil em "benefícios". 

Outra observação é que o Tyler Young fala em pessoas desenvolvedoras **senior** trabalhando com **Elixir**. Mas estes níveis salarias não são exclusivos de Elixir. Valem para muitas outras tecnologias (não todas). Em meu tuíte fiz a pergunta sobre Elixir e Erlang pois é lá na comunidade Elixir-Erlang-BEAM que está a maior parte dos meus contatos.

Pelas respostas que obtive, algumas privadas, é possível sim ganhar até mesmo bem mais do que 100 mil dólares anuais. Uma pessoa (que não é brasileira mas é de um país em desenvolvimento) falou que recebe 165 mil dólares anuais. Algumas outras falaram que recebiam na faixa de 100 mil.  

Dá para ter certeza que o que me falaram é verdade? Obviamente que não. Mas eu confio nas pessoas que falaram comigo e, considerando que empresas do Vale do Silício pagam com facilidade até mesmo 350 mil dólares anuais, não é nada de outro mundo pagar 165 mil para uma excelente pessoa desenvolvedora trabalhando remotamente de um país em desenvolvimento.

E você? O que acha? É possível?
Tried no code / low code tool - retool
Tags: lowcode, javascript
Published: 2022-04-24 19:33:03

I tried it for the first time and I must say the product is good and no code / low code is something people should pay attention on...
I also made two simple apps

[Trade Dashboard](https://airvon.retool.com/embedded/public/0f982845-62ad-478d-8800-7eded582a962)
[Customer Info Dashboard](https://airvon.retool.com/embedded/public/08c4bb2e-6ba1-4558-9c4f-ef2bd5fa1166)
WORKING WITH PUBLIC APIs
Tags: javascript, webdev
Published: 2022-04-24 19:31:52

It has been quite some time since I began thinking about learning programming, but two months actively into the actual learning. Over time I had been wondering how some websites I visit have access to a large amount of data, some of which is data that could not be their own. My worries were demystified about 2 weeks ago when I came across Application Programming Interfaces (APIs). 
Simply put, APIs are an interconnection between different computer programs. This includes how one interacts with social media apps like Facebook to log in and transmit messages, checking weather parameters online, looking up hotels online and doing booking. APIs that have been published on the internet for anyone to use freely are called open or public APIs.
There are 4 main API methods which correspond to the CRUD operations of persistence storage. These include:

- GET: Retrieve information about the API resource
- POST:	Create an API resource
- PUT:	Update an API resource
- DELETE:Delete an API resource or related component

In modern JavaScript, with the introduction of promises, fetch command is used to send a GET request to an API. It returns a promise in itself, hence the json() method is used to return the actual json data from the response object. 
POSTMAN is a great tool as it is used to do a mock up of the API methods without writing any code. Once familiar with the operations, one can actually implement them into javascript or any language they are familiar with. API data is in JavaScript Object Notation (JSON) format, which is more like javascript objects with slight differences as below.

```
{
  "monsters": [
    {
      "name": "Chronos",
      "age": 4005.302453418598,
      "description": "Effulgence eldritch shunned foetid. Ululate gibbering tenebrous foetid iridescence daemoniac. Stench nameless gambrel. Amorphous furtive iridescence noisome. Foetid mortal nameless.",
      "id": 1
    },
    {
      "name": "Tartarus",
      "age": 1874.4913565609456,
      "description": "Cyclopean swarthy amorphous singular accursed furtive non-euclidean stygian. Swarthy gibbering charnel eldritch daemoniac gibbous. Cyclopean lurk hideous tentacles squamous immemorial tenebrous mortal. Madness tentacles furtive mortal foetid decadent. Foetid immemorial comprehension.",
      "id": 2
    }
  ]
}
```
It is therefore important to convert data to JSON when updating an API resource using POST method. This is done using the JSON.stringify() method. 
The json server is used to mock an actual database, and can be helpful during learning. One has to start the json server by running the following command on the terminal: 

```
json-server --watch db.json
```
APIs are therefore a great resource in accessing data that could be otherwise difficult to create.
New Hire Me Page
Tags: career, webdev, showdev
Published: 2022-04-24 19:27:36

I added my "Hire Me" page to my portfolio website and I absolutely love it!

![finished product](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d9aafir4piik306x64er.png)

This was inspired by this [CodePen](https://codepen.io/kjjtruong/pen/dMNNeb) for the code. I simply tweaked it to match my own site's style and needs. Please go give the developer some love!! They did such a wonderful job designing this!

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

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

Happy coding!
Python 101: Ultimate Python Tutorial For Begginer
Tags: programming, beginners, python
Published: 2022-04-24 18:10:50

**

#**# Introduction**
**

- Python is a high-level, popular programming language.
- It was created by Guido van Rossum and first released on February 20, 1991.
- It is used for web and software development, mathematics, data analysis, AI and machine learning
- It works on different platforms and it has simple syntax.
- Due to its simplicity, Python is very productive it can help focus on solving developer's problem
- The most recent version of Python is python3. Python is written in an Integrated Development Environment (IDE), such as Pycharm, VS Code, Spyder, Jupyter, Sublime Text, Thonny. Python was designed for readability and it is therefore simple to use
- In this course we are going to learn everything you need to get started with programming in python

## **Installation**

- Python is available on a variety of platforms, that is Windows, Linux ans MacOS
- Open a terminal window and type "python" to check if it is installed already. This is usually the case in most PC's and if it's not you will have to download python on a web browser
- Go to https://www.python.org/downloads/
- Follow the link to download either for Linux/Unix, Windows or MacOSthe latest version of python
- Make sure to add python to path if you are using windows. Next we need to install a code editor where we write our codes. They are many including Pycharm, Jupyter, VS Code.
- Python files are created using .py file extension ##Python Syntax
- Python uses indentation to indicate a block of code

**

## Python Data Types
**
Data types are the classification or categorization of data items. The following are the standard data types of Python:
• Numeric
• Sequence Type
• Boolean
• Set
• Dictionary

## **Python Collections (Arrays)**
There are several collection data types in the Python programming language:

List- A list is a collection which is ordered and changeable. In Python lists are written with square brackets.
`thislist = ["lemon", "lime", "avocado"]
print(thislist)`

*Tuple *-A tuple is a collection which is ordered and unchangeable. In Python tuples are written with round brackets
`thistuple = ("lemon", "lime", "avocado")
print(thistuple)`

Dictionary-A dictionary is a collection which is unordered, changeable and indexed and written with curly brackets, and they have keys and values.
`thisdict = {"brand": "Gucci", "model": "Prada", "year": 2019}
print(thisdict)`

Functions-A function is a block of code that runs when it is called.Function is defined with the def keyword.

`def Year():
print('2022')
`
Year() is calls the function to execute.

In summary, this is what I've learnt in week 1 Python Bootcamp at Lux Academy. Looking forward to building my skills in programming with python.
CSSBattle | #17 Fidget Spinner
Tags: css, cssbattle, challenge, fidgetspinner
Published: 2022-04-24 19:18:13

Welcome to CSSBattle Challenges!

In this short article, I go through my solution for [CSSBattle - #17 Fidget Spinner](https://cssbattle.dev/play/17) challenge. Please refer to the code snippet below to get a better insight into my thought processes and the implementation detail.

---

> #### Challenge:

![Fidget Spinner Challeng](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/im5aicvwix7yna44gmyr.png)

---

> #### Solution:

```html
<div class="container">
  <div class="rectangle"></div>
  <div class="circle top"></div>
  <div class="circle bottom"></div>
  <div class="circle left"></div>
  <div class="circle right"></div>
</div>

<style>
  * {
    box-sizing: border-box;
    padding: 0;
    margin: 0;
  }
  .container {
    width: 100%;
    height: 100%;
    position: relative;
    background: #09042A;
  }
  .rectangle {
  	width: 100px;
    height: 50px;
    background: #E78481;
    top: 50%;
    left: 50%;
    position: absolute;
  	transform: translate(-50%, -50%);
  }
  .circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
  }
  .top, .bottom {
    border: 10px solid #09042A;
    background: #F5BB9C;
    z-index: 2;
  }
  .left, .right {
    border: 10px solid #E78481;
    background: #09042A;
  }
  .left {
    top: 50%;
    left: 50%;
    position: absolute;
  	transform: translate(calc(-50% + -60px), -50%);
  }
  .right {
    top: 50%;
    left: 50%;
    position: absolute;
  	transform: translate(calc(-50% + 60px), -50%);
  }
  .top {
    top: 50%;
    left: 50%;
    position: absolute;
  	transform: translate(-50%, calc(-50% + -53px));
  }
  .bottom {
    top: 50%;
    left: 50%;
    position: absolute;
  	transform: translate(-50%, calc(-50% + 53px));
  }
</style>
```

---

> #### Key Takeaway(s):
- using transform translate to position items relative to parent container

As always, I welcome any feedback or questions regarding the implementation detail of the challenge. Otherwise, I hope this was useful!
An Old Noob #5 - Cloud Resume Challenge, on Balance
Published: 2022-04-24 18:09:08

Hello again and thanks for taking a moment to read what i'm typing.  So far my posts have been specific to my experiences with the [Cloud Resume Challenge](https://cloudresumechallenge.dev/docs/the-challenge/), and while this is no exception it's also not a requirement - i think this pertains to any project, challenge, or goal we set out to achieve. 

So what did i accomplish this week on my project?

[![Absolutely nothing](https://img.youtube.com/vi/6AiGNL0LYN0/0.jpg)](https://www.youtube.com/watch?v=6AiGNL0LYN0)

(you know, i really wish markdown allowed a target="\_blank" option so i'm not sending people away from my post in an effort to add content _to_ my post, but when the reference is just so appropriate...)

what was i saying?

Oh, that's right!  I did absolutely nothing with my cloud resume this week (other than add things to my to-do list).  And it was a break i definitely needed.  I'm that kind of guy who needs to stay busy, and when i get focused on something i can get a little... obsessive?  Add to that the more public nature of this challenge in the publishing about my progress and it's safe to say i was motivated to complete the objectives.  At times i may have even felt a little frantic.

![Daffy Duck](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eylluyz46vzayq93b5ha.gif)

Perhaps.

I do tend to get very focused when problem-solving.  Like blind-to-the-world-around-me focused.  I tend to lose track of time.  And the ability to hear people standing right next to me attempting to make conversation.  For instance, "Hey, you haven't moved in 2 days!"  

&nbsp;
### Fortunately i have a very understanding, supporting family.
&nbsp;

Even when i go a little off the rails.  

Even when i ramble incessantly about technical minutiae like the very existence of the known galaxy hinges upon my success...

My family:

> 
![You Need To Relax](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2albu2xy02tglf4k65we.gif)

&nbsp;
Did i go a little off the rails?  That's not important right now.  What _is_ important is to allow yourself to savor the little victories as they come, and to give yourself some real time to enjoy the bigger victories when you get them.  

That said, i haven't been entirely unproductive this week.  I can't even say i haven't done any work on the challenge, as i've been studying for my ACP (which is, after all, step one of the challenge). 

I'll continue to work on my to-do list, and i found another list of cloud challenges that i haven't looked into in much detail yet but at first glance look intriguing.  Now that i've taken a bit of time off, i'm feeling ready to get back at it.  Never underestimate the magic of giving yourself a break.
History of NLP
Tags: nlp, nlu, ai
Published: 2022-04-24 18:56:53

** First Phase - Machine Translation Phase :  1940-1960**

- The research on NLP started in early 1950s after Booth & Richens’ investigation and Weaver’s memorandum on machine translation in 1949.

- 1954 was the year when a limited experiment on automatic translation from Russian to English demonstrated in the Georgetown-IBM experiment.

- In the same year, the publication of the journal MT (Machine Translation) started.

- The first international conference on Machine Translation (MT) was held in 1952 and second was held in 1956.

- In 1961, the work presented in Teddington International Conference on Machine Translation of Languages and Applied Language analysis was the high point of this phase.

**Second Phase - AI Influenced Phase – 1960-1970**

- In early 1961, the work began on the problems of addressing and constructing data or knowledge base. This work was influenced by AI.

- In the same year, a BASEBALL question-answering system was also developed. The input to this system was restricted and the language processing involved was a simple one.
- A much advanced system was described in Minsky (1968). This system, when compared to the BASEBALL question-answering system, was recognized and provided for the need of inference on the knowledge base in interpreting and responding to language input

**Third Phase - Grammatico-logical Phase – 1970-1980**

- The grammatico-logical approach, towards the end of decade, helped us with powerful general-purpose sentence processors like SRI’s Core Language Engine and Discourse Representation Theory, which offered a means of tackling more extended discourse.

- In this phase we got some practical resources & tools like parsers, e.g. Alvey Natural Language Tools along with more operational and commercial systems, e.g. for database query.

- The work on lexicon in 1980s also pointed in the direction of grammatico-logical approach.

**Fourth Phase - Lexical & Corpus Phase – 1990**
 There was a revolution in natural language processing in this decade with the introduction of machine learning algorithms for language processing.