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
def singleton(cls): | |
""" | |
Convert to singleton | |
""" | |
instance = [None] | |
def wrapper(*arg, **kwargs): | |
if instance[0] is None: | |
instance[0] = cls(*arg, **kwargs) | |
return instance[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
version: "3.8" | |
service: | |
database: | |
image: mysql:latest | |
restart: always | |
networks: | |
- default | |
environment: | |
- MYSQL_ROOT_PASSWORD=root |
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
class Database: | |
def __init__(self, **kwargs): | |
self.username = kwargs.get('username') | |
self.password = kwargs.get('password') | |
self.database = kwargs.get('database') | |
self.host = kwargs.get('host') | |
self.port = kwargs.get('port') | |
self.driver = kwargs.get('driver') | |
self.uri = f"{self.driver}://{self.username}:{self.password}@{self.host}:{self.port}/{self.database}?charset=utf-8" |
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
/* actualizar los cambios */ | |
((ProductosAdapter) lv_productos.getAdapter()).notifyDataSetChanged(); | |
((ProductosAdapter) lv_productos.getAdapter()).notifyDataSetInvalidated(); |
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
date_default_timezone_set('America/Asuncion'); |
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
class RegisterProtocol: | |
@staticmethod | |
def register(protocol_key, command): | |
location = winreg.HKEY_CLASSES_ROOT | |
key = winreg.CreateKey(location, protocol_key) | |
winreg.SetValue(key, "URL Protocol", winreg.REG_SZ, "") | |
key = winreg.CreateKey(location, protocol_key + "\\shell\\open\\command") | |
winreg.SetValue(key, None, winreg.REG_SZ, command + " %1") |
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 hashlib | |
from sqlalchemy import create_engine, MetaData, text | |
from sqlalchemy.exc import DatabaseError | |
from sqlalchemy.orm import sessionmaker, declarative_base | |
class Database: | |
def __init__(self, **kwargs): | |
self.username = kwargs.get('username', 'root') |
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
@NonNull | |
@Override | |
public Filter getFilter() { | |
return new Filter() { | |
@Override | |
protected FilterResults performFiltering(CharSequence charSequence) { | |
String filterString = charSequence.toString().toUpperCase(); | |
FilterResults filterResults = new FilterResults(); | |
if (filterString == null || filterString.length() == 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
Hay varios pasos que puedes seguir para mejorar tu lógica en la programación: | |
Practica regularmente. La práctica es clave para mejorar en cualquier habilidad, y la programación no es una excepción. Busca problemas y desafíos en línea y trata de resolverlos utilizando tus habilidades de programación. | |
Aprende y utiliza diferentes lenguajes de programación. Cada lenguaje tiene sus propias características y fortalezas, y aprender múltiples lenguajes te ayudará a desarrollar una comprensión más profunda de la lógica de la programación en general. | |
Lee y estudia el código de otros programadores. La mejor manera de aprender es imitando a los que ya son buenos en lo que hacen. Lee el código de otros programadores y trata de entender cómo se resuelven los problemas. | |
Participa en comunidades de programación en línea. Las comunidades de programación en línea son una excelente manera de aprender de otros programadores y compartir tus propios conocimientos y habilidades. |
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
Hay varios pasos que puedes seguir para mejorar tu productividad al desarrollar código para un proyecto: | |
Identifica tus objetivos y prioriza tus tareas. Esto te ayudará a enfocarte en lo que realmente importa y te permitirá avanzar de manera eficiente. | |
Usa herramientas para gestionar tu tiempo y tus tareas, como un calendario o una lista de tareas pendientes. Esto te ayudará a organizarte y a mantener el control sobre lo que tienes que hacer. | |
Establece un horario de trabajo y trata de cumplirlo de manera consistente. Dedica un tiempo específico a cada tarea y evita distracciones como el teléfono o las redes sociales. | |
Utiliza técnicas de programación eficientes y evita escribir código de manera repetitiva. Esto te ayudará a ahorrar tiempo y a mantener tu código limpio y fácil de mantener. |