teleren/devto huggingface dataset:
A inteligência não depende da aparência
Tags: inteligenciaartificial, ai
Published: 2020-07-06 11:16:22

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

Ontem nós falamos sobre a dificuldade de consenso sobre o que é inteligência e que parece contrastante a definição de inteligência artificial (IA). Entretanto, segundo **Pereira (2020, p. 1)**, em 1950, **Alan Turing [2]** propôs um teste capaz de determinar a prensença de atributos inteligentes ou não.

Uma vez que sem definir inteligência não é possível definir inteligência artificial, a base para o teste de Turing apoiava-se na premissa que mesmo não sabendo definir o que era inteligência, sabíamos que os seres humanos são inteligentes. Assim, de acordo com **Pereira (2020, p.2)**,

> se uma máquina fosse capaz de se comportar de tal forma que não pudéssemos distingui-la de um ser humano, essa máquina estaria demonstrando algum tipo de inteligência, que, nesse caso, só poderia ser inteligência artificial.

O teste proposto por Turing consistia, de forma muito simplificada e resumida aqui, em uma entrevista entre um ser humano e um ente remoto via chat, onde se após determinado período de tempo a pessoa não fosse capaz de distiguir o ente entre humano e máquina, a hipótese de existir inteligência artificial era confirmada, de acordo com **Pereira (2020, p.2)**.

Parece ser uma tarefa muito simples passar no Teste de Turing, não? De acordo com **Pereira (2020, p.2)**, não é nada simples, pois o sistema precisaria minimamente das seguintes habilidades

> **(1) processamento de linguagem natural:** para comunicar-se com o usuário;
> **(2) representação de conhecimento:** para armazenar o que sabe ou aprende;
> **(3) raciocínio automatizado:** para usar o conhecimento armazenado com a finalidade de responder perguntas ou tirar novas conclusões;
> **(4) aprendizado de máquina:** para adaptar-se a novas circunstâncias, detectar e extrapolar padrões, a fim de atualizar o seu conhecimento armazenado.

Até neste ponto vimos a definição de inteligência e como podemos mensurá-la. Observamos o funcionamento do teste de Turing, que para alguns é uma das melhores formas de testar a existência de inteligência artificial, mesmo tendo **algumas fraquezas a serem levados em conta [3]**. Mas, o que a história nos conta sobre o uso de inteligência artificial? **A resposta nós encontraremos amanhã na Parte 3**.


**Referências**
[1] Pereira, Silvio do Lago. **_Introdução à Inteligência Artificial_**. Disponível em <https://www.ime.usp.br/~slago/IA-introducao.pdf>. Acesso em: 17 fev. 2020

[2] Veja o filme **O Jogo da Imitação** para saber um pouco mais sobre Alan Turing. O trailer do filme <https://youtu.be/YIkKbMcJL_4>. Acesso em: 17 fev. 2020

[3] Vejas algumas das **Fraquezas do Teste de Turing** aqui <https://pt.wikipedia.org/wiki/Teste_de_Turing#Fraquezas_do_teste>. Acesso em: 17 fev. 2020
Basic Credit Card Checker
Tags: python, creditcardchecker, beginners, github
Published: 2020-07-06 11:00:50

I've made a basic credit card checker using python. It is based oh luhn algorithm.
Check the following image to understand how to check a credit card:

https://codecademy-content.s3.amazonaws.com/PRO/independent-practice-projects/credit-card-checker/diagrams/cc+validator+diagram+1.svg

Though my checker can't say if the cc is alive or dead but it can validate if the number exist or not.

Check my code here:
https://github.com/Shankhesh-16/Credit-Card-Checker
Week 2, Day 1: Building a database & more
Published: 2020-07-06 10:50:46

I considered looking into CMS add-ons for my existing portfolio site so that I could migrate this blog over there, but then it hit me: this is a perfect opportunity just to build my own blogging backend and work on my (slightly rusty) backend skills a bit more. So I started this week out with a plan to build a database and API to post my own blogs to my website.

Hopefully I'm not in over my head.

## The Plan

I started off by creating a brief plan of what my API was going to look like. Foolishly, since it turned out I should probably have focused first on what my database was going to look like before worrying about the API endpoints.

This is why I need more practice.

The plan is pretty simple anyway, for now. This is only a week long project, and I generally only spend ~3 hours on coding a day, so I'm not trying anything ambitious off the bat. I just want something that will take my text and allow me to post it to my site in a blog-reader format.

For now it's just a two table SQL database: one table for articles, and one table for topics. The second isn't even strictly necessary, but I may expand the scope at some point, and anyway it should make it more easily browsable.

The endpoints are going to be similarly simple:
- GET /topics
- GET /articles
- GET /articles/:article_id
- POST /articles
- DELETE /articles/:article_id

## The dreaded DELETE

And of course, as soon as I wrote DELETE, my mind exploded. I forgot that I'm going to need some authentication for this whole thing, so not just anyone can come in and start deleting my blogs, or posting random stuff to it on a whim.

I can't remember if there was much in the way of authentication on the test project I did in Northcoders, but since it was only a portfolio piece I wasn't too worried at the time. I don't think we created any endpoints that could even be used maliciously.

So this is going to be a fun experience in learning about authentication. It's only a personal (though professional) blog, so I'm not super-duper worried, but it's definitely something to concern myself with, especially as I make it so public.

## Copying and pasting

I only started setting up the database today, but so far it feels like a lot of what I'm doing is just copying what I've done before, and it's taking me a little effort to accept that. Logically it's the most efficient way to do this: no need to re-invent the wheel after all. But it also feels like cheating, like I'm not teaching myself anything or showing new skills.

I can justify it to myself in any number of ways: revising old techniques that I've forgotten, practicing those techniques, using them for a more practical purpose; but ultimately, it's something I just need to get over. It's not cheating to work in the most efficient way possible, and it's not even plagiarism if I'm copying my own work.

Anyway, those are just a few of my random thoughts starting this new blog project. Hopefully by the end of the week I'll be able to link people to my own site, or if not I'll have most of it done to finish next week.
Identify models using their name with Laravel
Tags: laravel, snippet
Published: 2020-07-06 10:50:39

---
title: Identify models using their name with Laravel
published: true
description: 
tags: ["laravel","snippet"]
//cover_image: https://direct_url_to_image.jpg
---

Some database objects are atomic - i.e. they're just a name. Think of a Tag, think of a Role, think of a Country... There's really nothing more than the name - or at least the other properties are entirely optional. In such cases you might want an *unique* index on the *name* property, wouldn't you?

Now the name uniquely identifies your object, why not use the name to fetch it? 

```PHP
// instead of...
$role = Role::where('name', '=', 'admin')->firstOrCreate([]);

// ...you want to do 
$role = Role::wrap('admin');
```

Well, that's precisely what today's snippet does for you!

**Note:** the following trait has been designed to create objects that are not found. If you want to protect yourself from typos being written in database I suggest you define the `setNameAttribute` method to implement the security you need.

## Implementation

app/HasName.php
```PHP
namespace App;

use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Support\Collection;

trait HasName
{
    public static function findFromName(string $name): self
    {
        return self::whereName($name)->firstOrFail();
    }

    public static function findOrCreate(string $name): self
    {
        try {
            return self::findFromName($name);
        } catch (ModelNotFoundException $e) {
            return self::create(compact('name'));
        }
    }

    public static function wrap($name): self
    {
        if (is_string($name)) {
            $name = self::findOrCreate($name);
        }

        if (is_array($name)) {
            $name = self::firstOrCreate($name);
        }

        if (! $name instanceof self) {
            throw new \InvalidArgumentException("\$name should be string, array, or " . self::class);
        }

        return $name;
    }

    public static function fromArray(array $array): Collection
    {
        return (new Collection($array))->map(fn($item) => self::wrap($item));
    }
}
```
---

app/Country.php
```PHP
<?php

namespace App;

use App\HasName;
use Illuminate\Database\Eloquent\Model;

class Country extends Model
{
    use HasName;

    protected $fillable = ['name'];
}
```
PrimeVue 2.0.0 is released with 60+ Open Source UI Components featuring Bootstrap, Material Design and Custom Themes
Tags: vue, opensource, javascript, css
Published: 2020-07-06 10:38:50

PrimeTek is thrilled to announce the 2.0.0 release of [PrimeVue](https://www.primefaces.org/primevue/) featuring 60+ UI components, a design agnostic theming api with **Bootstrap**, **Material** and custom themes, the new PrimeFlex CSS utility, modern icons via PrimeIcons v4, all-new demos and showcase. We believe PrimeVue is the most advanced and complete UI solution at the moment for Vue.js.

Take a tour around the [PrimeVue Live Showcase](https://www.primefaces.org/primevue/showcase) to take the library for a test run.

PrimeVue is a free library to use under MIT License and available at [NPM](https://www.npmjs.com/package/primevue).
Changing Flask-Restplus Base URL
Tags: flask, flaskrestplus, python
Published: 2020-07-06 10:38:31

Recently, I have an issue when creating API using Flask.

The basic syntax to create an API using Flask-Restplus is:
```python
from flask import Flask
app = Flask(__name__)

from flask_restplus import Api
api = Api()
api.init_app(app)
```

However, this basic syntax will override the index route on your webpage.
So to fix this, `blueprint` should be imported.

```python
from flask import Flask, Blueprint
from flask_restplus import Api

app = Flask(__name__)
blueprint = Blueprint('api', __name__, url_prefix='/v1')
api = Api(blueprint,
            title="Enrollment API",
            version='v0.1',
            description='Enrollment API for CRUD operation'
        )
app.register_blueprint(blueprint)
```

From here the API base url will not overriding the index route anymore. 
Now lets add the api to get user data by pulling jsonify and importing the model.

**models.py**
```python 
import flask
from application import db
from werkzeug.security import generate_password_hash, check_password_hash

class User(db.Document):
	user_id 	= db.IntField(unique=True)
	first_name 	= db.StringField(max_length=50)
	last_name 	= db.StringField(max_length=50)
	email 		= db.StringField(max_length=30, unique=True)
	password	= db.StringField()

	def set_password(self, password):
		self.password = generate_password_hash(password)
	
	def get_password(self, password):
		return check_password_hash(self.password, password)

```

**route.py**
```python
from application.models import User
from flask import jsonify

@api.route('/api','/api/')
class GetAndPost(Resource):
	''' Get All '''
	def get(self):
		return jsonify(User.objects.all())
```

From the code above, now the API can be access via `localhost:5000/v1/api`. The API will return all User in Jsonformat

**PS:**
Werkzeug need to downgrade to 0.16.1 to use flask_restplus
`pip install Werkzeug==0.16.1`

**More information:**
https://github.com/noirbizarre/flask-restplus/issues/286
Why is integration testing important?
Tags: testing, integrationtesting
Published: 2020-07-06 10:29:43

In our testing condition, the greater part of the organizations and association centers around start to finish testing. All things considered, start to finish testing is vital, however, it needs to cover the genuine use cases. The majority of the analyzers invested 80% of the energy discovering fundamental bugs as opposed to chipping away at the genuine use cases. 

With the correct testing procedure and discharge plan, in reality, there is in every case less time or no ideal opportunity for testing continuous use cases. 

The greater part of the business and association have adjusted uniquely to the Unit testing and Functional testing. It's a portion of the association that has the Integration testing in the testing life cycle. 

<a href="https://www.testingxperts.com/blog/integration-testing">Integration testing</a> is a methodology where modules are created, and testing of modules consistently begins at the best degree of the programming chain of command and proceeds towards the lower levels. It's the augmentation of unit testing. Integration testing takes a littler unit of unit testing and tests their conduct as the entirety. 

What does it require to have integration testing? 

In particular, it requires a Developer with Tester's disposition. 

The executive's consolation to construct a solid Test group that might work and adopts the thought process of an analyzer with advancement ranges of abilities. 

Test Automation Developers need to think past the composing test after the item assembled yet at the beginning phase of improvement. 

Test are composed from the very first moment of the advancement cycles
Understand recursion in 2 minutes
Tags: codenewbie, javascript, beginners
Published: 2020-07-06 10:27:15

Whether you've been in programming for a long time, or just starting out, you'll have heard of recursion, but it can be hard to wrap your head around.

Recursion is the act of something repeating itself until an escape is found.

![fractal-zoom](//images.ctfassets.net/94cla0dmblrb/6rU8OhgM2F2JO8bx3AeNvx/de57a352a84eef4ae45c654d5a2201ba/fractal-zoom.gif)

Let's create a function which we can use recursively. I'm going to create a function which allows us to multiply a number exponentially - multiplying a number by itself.

```js
const multiplyExponential = (number, power) => {
  return index !== 0 
    ? number * multiplyExponential(number, index - 1)
    : 1
}
```

Recursive functions don't have to be complicated, though they can be harder to write as it's a different way of thinking. So what's going on?

```js
// create a function and pass in the number we want to multiply, and how many times we want to multiply it.
const multiplyExponential = (number, power) => {
  return power !== 0 
    // if the calculation hasn't completed, we return the number multiplied by the value returned from the function
    ? number * multiplyExponential(number, power - 1)
    //if we're at the end, we just want to multiply by 1 so nothing changes
    : 1
}

multiplyExponential(7, 4)
// 7 * 7 * 7 * 7 * 1
//<- 2401
```

Warning! When writing code you don't want to create an infinite loop, you need a way to stop eventually. Make sure you always have a way to escape.

Recursive functions have a fancy name but aren't too different from regular functions. The key difference is that it is a function which calls itself - and that's it!

Mathematics is a great place to start learning about recursive functions but they can be used in other areas of web development too. I've used recursive components to create navigation menus with nested menus.
How to display a value in html with php without using the echo keyowrd using the short echo tag
Published: 2020-07-06 10:08:29

I have been coding with php since 2015, I have always been curious to know how to output values on the webpage without using templates like twig or Laravel blade Template engine. I got my answer recently which is this tag that was disabled in earlier versions of php but made available from php 5.4 and above.
This code
<?php echo $name; ?> 
is the same thing as this
<?= $name ?>
This makes the code shorter and more readable. 
You can make changes to this in your php.ini using
; short_open_tag
;   Default Value: On
Default value can either be on or off.
It is enabled by default on Shared hosting services, so you don't have to worry about compatibility.
I hope you find this helpful check back again for my posts
SAP Migration
Tags: oraclecloudmigration, sapmigration, usingoracleravello, usinghypervimage
Published: 2020-07-06 09:52:07

Vast Edge specializes in SAP migration to Oracle cloud platform using proven tools to reduce costs and help mitigate risks. Since 2004, Vast Edge has complete 2 large and several smaller SAP migrations across data centers and one migration to Oracle cloud platform.
PyLadies Global Chapter Websites
Tags: pyladies
Published: 2020-07-06 09:48:03

This is related to PyLadies Dublin website, and I think it stemmed from my initial problem of domain not forwarding to right place and setting up my landing page.

PyLadies kickstarted a big tidy and asked its community to add their chapter to the new PyLadies Chapter website as a submodule on github.

If you run PyLadies and are not on [PyLadies slack](https://slackin.pyladies.com/), you should join it and check out `#project-tech-infra` channel!

You can find information on how to add your chapter's website to PyLadies Chapter website here:

{% github pyladies/chapter-websites %}

# Example of adding PyLadies Dublin's submodule
Here's the PyLadies Dublin issue (don't do what I did, fill it out and didn't submit, and have to fill it out again as I closed the tab when Lorena from PyLadies asked about filling an issue. 😓 Heh, these things happen): 
{% github https://github.com/pyladies/chapter-websites/issues/11 %}

And here's my pull request:

{% github https://github.com/pyladies/chapter-websites/pull/10 %}
Techniques to ensure your privacy
Published: 2020-07-06 09:42:24

There are strategies that can increase your privacy level and spreading these techniques through the whole crypto world can help nullify the impact of coin predators. It's strong cryptography when it comes to blockchain, only affects fraud and forgery when there is human interference. It will make anonymity difficult when users decide to make business transactions and multiple Bitcoin wallets would broadcast your real IP address, so if the right person wanted to, they might connect it to your real address. 
Bitcoin, however, is still much more private than credit cards, and not as private as cash. It poses quite a few issues for businesses and people who take their privacy seriously. Your Bitcoin address discloses details without having been connected to the personal information of any entity or party. Those pieces of information are: 
•	How much currency your address carries. 
•	Every single coin you got. 
•	The address from which you got those coins. 
•	The user's address you sent those coins to. 
They show a lot of details which can be very intimidating to anyone who is aware of their knowledge. Yet a person's technological ways of being more anonymous when using cryptocurrency exist. This may involve using a VPN built to protect the user and his / her privacy. 
https://cryptoinside.online/trading-bitcoin-for-beginners/
Road to Genius: advanced #41
Tags: javascript, beginners, computerscience, codenewbie
Published: 2020-07-06 09:11:24

Each day I solve several coding challenges and puzzles from Codr's ranked mode. The goal is to reach genius rank, along the way I explain how I solve them. You do not need any programming background to get started, and you will learn a ton of new and interesting things as you go.

```JS
let S = 0;
for (let i = 0; i < 150; i💧) {
  let h = Math.floor(i / 💎);
  if (h > 0)
    S += i % h;
}

// 💧 = ? (operator)
// 💎 = ? (number)
// such that S = 73 (number)
```

Here's a pretty short code for an advanced challenge, let's have a look. The core of the code is a for-loop that runs from 0 to 150 (excluded), and then depending on the if-condition it increases `S`'s value.

We won't have to fully analyze the code since fixing the two required bugs is pretty simple.


The first one 💧 has to be the `++` operator, to ensure the for-loop works correctly.

The second bug 💎 is quite tricky, you can't determine its value in an easy way, it could be any number. Either you reverse engineer the code to ensure that `S = 73` at the end, or take a peek at the possible answers for 💎: 0, 2 and 150. Dividing `i` by 0 or 150 will never yield a value larger than 0, so the if-condition is never going to trigger. The only choice left is 2:

![coding challenge answer](https://dev-to-uploads.s3.amazonaws.com/i/iown3185tagw9anh5w9h.png)

By solving these challenges you train yourself to be a better programmer. You'll learn newer and better ways of analyzing, debugging and improving code. As a result you'll be more productive and valuable in business. Get started and become a certified Codr today at https://nevolin.be/codr/
How to Lockdown an iPad to Single App Kiosk Mode
Tags: ios, security, ipad, kiosk
Published: 2020-07-06 09:25:06

A step-by-step guide to [lockdown or restrict iPads to single or one app kiosk mode](https://blog.scalefusion.com/how-to-lock-ipad-to-one-app-or-specific-app-mode/) using Scalefusion iOS kiosk software for your home, businesses and educational purpose.

Easy, isn’t it? Scalefusion as an all-inclusive iOS Kiosk Software makes it a breeze to setup your iPad to single App Mode, promising total ease-of-use and purposefulness for your business requirements. In addition, Scalefusion provides various other tools to remotely monitor, control and secure all your iPads across your organization, which gives a clear boost to your device performance, employee productivity, and overall business efficiency.
Starting with D3js like a pro

Published: 2020-07-06 09:20:55

D3 is one of the most popular libraries for data visualisation, and learning its modules (APIs) is extremely powerful when you aim to create beautiful custom infographics.
D3 stands for Data Driven Development as the name applies, by using it we visually express our most important thing: data.
https://medium.com/@Sentinelone_tech/starting-with-d3js-like-a-pro-682b65d4eee7
My first experience creating and testing a PWA
Tags: pwa, webdev, nuxt, chineselearning
Published: 2020-07-06 09:14:10

Today, I have some experience regarding both creating a PWA, and testing it.

[This website](https://www.zhquiz.cc/), actually.

Since this was creating using Nuxt.js, I did not create [`manifest.webmanifest`](https://web.dev/add-manifest/) directly. Instead, I use [@nuxtjs/pwa](https://pwa.nuxtjs.org/).

Upon opening the website in mobile (Android), it now prompted web to add to home screen, and I said no this time (because the name was wrong. `@nuxtjs/pwa`'s fault.)

I also think that Add to Home Screen notification **is annoying**. (It is much less obtrusive in Desktop, though.)

After correcting the name, I tried to Add to Home Screen, but now the button is missing... It is hidden inside the `vertical three dots`.

Benefits I can see from Adding to Home Screen?

- Definitely a benefit on mobile, as the space is limited. No more annoying top bar or bottom bar (in case of Brave browser)
- Can still drag down to refresh. Which is still needed, as this app is still not perfect.

_First published [in my homepage](https://www.polv.cc/post/2020/07/first-exp-creating-pwa)._