<button disabled>フォーカスがあたらない</button>
<button aria-disabled="true">フォーカスがあたるが、JavaScriptで「送信できないように」しないと送信できてしまう</button>
const getUploadServer = async () => {
const response = await axios.get(
`https://filemoonapi.com/api/upload/server?key=${apiKey}`
);
if (response.status != 200) console.log("Something went Wrong");
return response.data.result;
// console.log(uploadServer);
}
inicio{
"host":"EC5CD453E55CC8B18AA78DF35C",
"porta":"B1AB9A"
}fim
# SOLID Principles: Improve Object-Oriented Design in Python
This folder provides the code examples for the Real Python tutorial [SOLID Principles: Improve Object-Oriented Design in Python](https://realpython.com/solid-principles-python/).
from abc import ABC, abstractmethod
from math import pi
# Bad example
# class Shape:
# def __init__(self, shape_type, **kwargs):
# self.shape_type = shape_type
# if self.shape_type == "rectangle":
# self.width = kwargs["width"]
# self.height = kwargs["height"]
# elif self.shape_type == "circle":
# self.radius = kwargs["radius"]
# def calculate_area(self):
# if self.shape_type == "rectangle":
#
from abc import ABC, abstractmethod
# Bad example
# class Rectangle:
# def __init__(self, width, height):
# self.width = width
# self.height = height
# def calculate_area(self):
# return self.width * self.height
# class Square(Rectangle):
# def __init__(self, side):
# super().__init__(side, side)
# def __setattr__(self, key, value):
# super().__setattr__(key, value)
# if key in ("width", "height"):
#
from abc import ABC, abstractmethod
# Bad example
# class Printer(ABC):
# @abstractmethod
# def print(self, document):
# pass
# @abstractmethod
# def fax(self, document):
# pass
# @abstractmethod
# def scan(self, document):
# pass
# class OldPrinter(Printer):
# def print(self, document):
# print(f"Printing {document} in black and white...")
# def fax(self, document):
# raise NotImplementedError("F
from pathlib import Path
from zipfile import ZipFile
# Bad example
# class FileManager:
# def __init__(self, filename):
# self.path = Path(filename)
# def read(self, encoding="utf-8"):
# return self.path.read_text(encoding)
# def write(self, data, encoding="utf-8"):
# self.path.write_text(data, encoding)
# def compress(self):
# with ZipFile(self.path.with_suffix(".zip"), mode="w") as archive:
# archive.write(self.pat
from abc import ABC, abstractmethod
# Bad example
# class FrontEnd:
# def __init__(self, back_end):
# self.back_end = back_end
# def display_data(self):
# data = self.back_end.get_data_from_database()
# print("Display data:", data)
# class BackEnd:
# def get_data_from_database(self):
# """Return data from the database."""
# return "Data from the database"
# Good example
class FrontEnd:
def __init__(self, data_sourc
# Python program showing
# abstract base class work
from abc import ABC, abstractmethod
class Polygon(ABC):
@abstractmethod
def noofsides(self):
pass
class Triangle(Polygon):
# overriding abstract method
def noofsides(self):
print("I have 3 sides")
class Pentagon(Polygon):
# overriding abstract method
def noofsides(self):
print("I have 5 sides")
class Hexagon(Polygon):
# overriding abstract method
def noofsides(self):
pr
def function_printer(func):
"""
This decorator enables to print args and kwargs, without modifying the initial function (my_custom_function).
This decorator can be used for many functions : good for DRY principle
"""
def modified_func(*args,**kwargs):
print("Function called with", args, "and", kwargs)
result = func(*args,**kwargs)
print("result is:", result)
return result
return modified_func
@function_printer
def my_custom_function(lst1,
### Start a NextJS App
* [NextJS homepage](https://nextjs.org/)
* `npx create-next-app@latest`
![](https://cdn.cacher.io/attachments/u/36nhbh4a4757e/c20mrNV1egPmlUjBA_WsoQVSjIHDoZT7/Screenshot_2024-06-16_at_3.49.24_PM.png)
* `npm run dev` to start local server
* NextJS uses file structure to create route endpoints
* in `app/{folder_name}/page.js`
* file in folder must be called `page.js`
* can now visit `localhost:3000/{folder_name}/ `
## App Router v Page Router
* Page router is olde
/**
* @param {number[]} nums
* @param {number} n
* @return {number}
*/
var minPatches = function(nums, n) {
// Initialize variables
// 'miss' is the smallest sum in [0,n] that we might be missing
// 'added' is the number of elements that we have added
// 'i' is the index of the current element in the array
let miss = 1, added = 0, i = 0;
// While the smallest sum that we might be missing is within [0,n]
while (miss <= n) {
// If the current element in the
import 'dart:convert';
import 'dart:core';
import 'dart:async';
import 'dart:io';
import 'dart:typed_data';
const hostname = '0.0.0.0'; // Binds to all adapters
const port = 8000;
Future<void> startServer() async {
final server = await ServerSocket.bind(hostname, port);
print('TCP server started at ${server.address}:${server.port}.');
try {
server.listen((Socket socket) {
print(
'New TCP client ${socket.address.address}:${socket.port} connected.');
socket.write
import operator
from typing import Annotated
from dotenv import load_dotenv
from langchain_community.tools.tavily_search import TavilySearchResults
from langchain_core.messages import (AnyMessage, BaseMessage,
HumanMessage, SystemMessage,
ToolMessage)
from langchain_core.messages.ai import AIMessage
from langchain_openai import ChatOpenAI
from langgraph.checkpoint.sqlite import SqliteSaver
from langgraph.graph import END
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'dart:typed_data';
import 'package:flutter/material.dart';
class SocketChannel {
static SocketChannel getSocketChannel(Socket socket) {
final socketChannel = SocketChannel();
socketChannel.setSocket(socket);
socketChannel.setSourcePort(socket.remotePort);
return socketChannel;
}
Socket? _socket;
StreamSubscription<Uint8List>? _streamSubscription;
int _sourcePort = 0;
void setSocket(Socket? socket