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 click import echo | |
@app.cli.command('init_db') | |
def initialize_database(): | |
"""Initialize the SQLite database.""" | |
database.drop_all() | |
database.create_all() | |
click.echo('Initialized the SQLite database!') | |
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
computed:{ | |
filtro(){ | |
return [ | |
... this.filtros.disponibles ? ['DISPONIBLE'] : [], | |
... this.filtros.emitidas ? ['EMITIDA'] : [], | |
... this.filtros.anuladas ? ['ANULADA'] : [], | |
... this.filtros.contado ? ['CONTADO'] : [], | |
... this.filtros.credito ? ['CREDITO'] : [], | |
] | |
}, |
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) { |