This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main(string[] args) | |
{ | |
Sorvete s = new Sorvete(); | |
Console.WriteLine("Sorvete:"); | |
Console.WriteLine("{0:c}", s.Preco); | |
Console.WriteLine(); | |
SorveteComCobertura c; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
import MySQLdb | |
mydb = MySQLdb.connect(host='127.0.0.1', user='root', password='', database='all_db') | |
with open('cars.csv') as csv_file: | |
csvfile = csv.reader(csv_file, delimiter=',') | |
all_value = [] | |
for row in csvfile: | |
value = (row[0], row[1], row[2]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.http import HttpResponse | |
from django.template.loader import render_to_string | |
def index(request): | |
t = render_to_string("blog/template.html") | |
return HttpResponse(t) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<!-- Required meta tags --> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | |
<!-- Bootstrap CSS --> | |
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Abordagem mais legível. | |
public static bool FormIsOpen(string formName) | |
{ | |
bool formIsOpen = Application.OpenForms.Cast<Form>().Any(form => form.Name == formName); | |
return formIsOpen; | |
} | |
//Utilizando Array Function. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Pacote necessário para trabalhar com EF e MySQL. | |
//MySql.EntityFrameworkCore | |
//Pacote necessário para trabalhar com Migrations. | |
//Microsoft.EntityFrameworkCore.Tools | |
public class MyDbContext: DbContext { | |
//Construtor. | |
public MyDbContext(DbContextOptions < MyDbContext > options): base(options) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Django Automatic CRUD. | |
#Instalação: pip install django-automatic-crud | |
#Verificação das dependências: pip freeze. | |
""" | |
asgiref==3.4.1 | |
Django==3.2.7 | |
django-automatic-crud==1.2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Useful Pandas Snippets. | |
# Data Types and Conversion. | |
# Convert Series datatype to numeric (will error if column has non-numeric values) | |
pd.to_numeric(df['Column Name']) | |
# Convert Series datatype to numeric, changing non-numeric values to NaN. | |
pd.to_numeric(df['Column Name'], errors='coerce) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
polls/ | |
__init__.py | |
models.py | |
management/ | |
__init__.py | |
commands/ | |
__init__.py | |
_private.py | |
closepoll.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Raising a 404 error | |
#polls/views.py | |
from django.http import Http404 | |
from django.shortcuts import render | |
from .models import Question | |
#... |
OlderNewer