Implementamos tecnologia y es asi como lo hacemos

Desarrollo Agil de Software

Diciembre 2, 2008 - 8:53 am - Posted by Camilo Nova

Llego al final aquella epoca dorada en la cual uno destinaba 6 meses para desarrollar un proyecto de software, con muchos recursos y tareas repetitivas, junto con un elevado costo.

Hoy en dia los frameworks son mas agiles y permiten una produccion mucho mayor de funcionalidad con menos codigo fuente, esta tendencia provoca que los desarrollos tomen mucho menos tiempo y recursos, lo que implica a su vez que los costos sean menores y que esta industria cada vez sea mas agil.

Yo sigo sorprendido con django, es muy poco el codigo que se debe escribir, basicamente la tarea es de arquitectura y no de codificación, por ahora estoy desarrollando una aplicacion muy sencilla y me ha tomado una tercera parte de lo que me hubiera costado realizarlo en java, creo que he acertado en la tendencia de lenguajes de programacion y esta vez python sigue ganando la batalla.

Etiquetas: , , , , , | Comente »

Convertir numeros y decimales a letras Python

Octubre 16, 2008 - 12:43 pm - Posted by Camilo Nova

Luego de un post anterior sobre convertir numeros a letras en python me ha llegado una modificacion de Ulfang que les presento a continuacion:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
UNIDADES = (
   '',
   'UN ',
   'DOS ',
   'TRES ',
   'CUATRO ',
   'CINCO ',
   'SEIS ',
   'SIETE ',
   'OCHO ',
   'NUEVE ',
   'DIEZ ',
   'ONCE ',
   'DOCE ',
   'TRECE ',
   'CATORCE ',
   'QUINCE ',
   'DIECISEIS ',
   'DIECISIETE ',
   'DIECIOCHO ',
   'DIECINUEVE ',
   'VEINTE '
)
DECENAS = (
   'VENTI',
   'TREINTA ',
   'CUARENTA ',
   'CINCUENTA ',
   'SESENTA ',
   'SETENTA ',
   'OCHENTA ',
   'NOVENTA ',
   'CIEN '
)
CENTENAS = (
   'CIENTO ',
   'DOSCIENTOS ',
   'TRESCIENTOS ',
   'CUATROCIENTOS ',
   'QUINIENTOS ',
   'SEISCIENTOS ',
   'SETECIENTOS ',
   'OCHOCIENTOS ',
   'NOVECIENTOS '
)
 
def toWord(number_in, pesos=True):
 
   """
   Converts a number into string representation
   """
   converted = ''
 
   if type(number_in)  'str':
       number = str(number_in)
   else:
       number = number_in
 
   number = number.replace(",","")
   try:
       number_int, number_dec = number.split(".")
   except ValueError:
       number_int = number
       number_dec = ""
 
   if not (0 < __convertStr(number_int)  0):
           converted += '%sMILLONES ' % __convertNumber(millones)
 
   if(miles):
       if(miles == '001'):
           converted += 'MIL '
       elif(int(miles) > 0):
           converted += '%sMIL ' % __convertNumber(miles)
 
   if(cientos):
       if(cientos == '001'):
           converted += 'UN'
       elif(int(cientos) > 0):
           converted += '%s' % __convertNumber(cientos)
 
   if pesos:
       if number_dec == "":
           number_dec = "00"
       converted += 'PESOS ' + number_dec + "/100 M.N."
   else:
       if number_dec  "":
           converted +=  'PUNTO ' + toWord(number_dec,False)
 
   return converted.title()
 
def __convertNumber(n):
   """
   Max length must be 3 digits
   """
   output = ''
 
   if(n == '100'):
       output = "CIEN "
   elif(n[0] != '0'):
       output = CENTENAS[int(n[0])-1]
 
   k = int(n[1:])
   if(k  30) & (n[2] != '0')):
           output += '%sY %s' % (DECENAS[int(n[1])-2], UNIDADES[int(n[2])])
       else:
           output += '%s%s' % (DECENAS[int(n[1])-2], UNIDADES[int(n[2])])
 
   return output
 
def __convertStr(s):
   """Convert string to either int or float."""
   try:
       ret = int(s)
   except ValueError:
       #Try float.
       ret = float(s)
   return ret

Etiquetas: , | Comente »

Convertir Numeros a Letras Python

Septiembre 11, 2008 - 3:54 pm - Posted by Camilo Nova

Ahora como pueden ver en mi evidente cambio a Python he reescrito el código que convierte de números a letras en esto (70 lineas de codigo menos que en Java y mas facil de entender):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
UNIDADES = (
    '',
    'UN ',
    'DOS ',
    'TRES ',
    'CUATRO ',
    'CINCO ',
    'SEIS ',
    'SIETE ',
    'OCHO ',
    'NUEVE ',
    'DIEZ ',
    'ONCE ',
    'DOCE ',
    'TRECE ',
    'CATORCE ',
    'QUINCE ',
    'DIECISEIS ',
    'DIECISIETE ',
    'DIECIOCHO ',
    'DIECINUEVE ',
    'VEINTE '
)
DECENAS = (
    'VENTI',
    'TREINTA ',
    'CUARENTA ',
    'CINCUENTA ',
    'SESENTA ',
    'SETENTA ',
    'OCHENTA ',
    'NOVENTA ',
    'CIEN '
)
CENTENAS = (
    'CIENTO ',
    'DOSCIENTOS ',
    'TRESCIENTOS ',
    'CUATROCIENTOS ',
    'QUINIENTOS ',
    'SEISCIENTOS ',
    'SETECIENTOS ',
    'OCHOCIENTOS ',
    'NOVECIENTOS '
)
 
def toWord(number):
 
    """
    Converts a number into string representation
    """
    converted = ''
 
    if not (0 < number < 999999999):
 
        return 'No es posible convertir el numero a letras'
 
    number_str = str(number).zfill(9)
    millones = number_str[:3]
    miles = number_str[3:6]
    cientos = number_str[6:]
 
    if(millones):
        if(millones == '001'):
            converted += 'UN MILLON '
        elif(int(millones) > 0):
            converted += '%sMILLONES ' % __convertNumber(millones)
 
    if(miles):
        if(miles == '001'):
            converted += 'MIL '
        elif(int(miles) > 0):
            converted += '%sMIL ' % __convertNumber(miles)
 
    if(cientos):
        if(cientos == '001'):
            converted += 'UN '
        elif(int(cientos) > 0):
            converted += '%s ' % __convertNumber(cientos)
 
    converted += 'PESOS'
 
    return converted.title()
 
def __convertNumber(n):
    """
    Max length must be 3 digits
    """
    output = ''
 
    if(n == '100'):
        output = "CIEN "
    elif(n[0] != '0'):
        output = CENTENAS[int(n[0])-1]
 
    k = int(n[1:])
    if(k <= 20):
        output += UNIDADES[k]
    else:
        if((k > 30) & (n[2] != '0')):
            output += '%sY %s' % (DECENAS[int(n[1])-2], UNIDADES[int(n[2])])
        else:
            output += '%s%s' % (DECENAS[int(n[1])-2], UNIDADES[int(n[2])])
 
    return output

Etiquetas: , | 20 Comentarios »

Exportar Datos Django

Septiembre 2, 2008 - 4:52 pm - Posted by Camilo Nova

Existe una forma muy facil de exportar e importar datos en django, es muy util para cuando se necesita informacion de pruebas que tenga que ser insertada en la aplicacion al momento de hacer un ‘deploy’

Para exportar los datos de tu aplicacion simplemente haces:

python manage.py dumpdata –indent=4 –settings=archivo_settings > salida.json

Para importar los datos basta con

python manage.py loaddata salida.json

Me ha parecido excelente que django tenga esta posibilidad, cada dia me gusta mas…

Enlaces:

[1] http://docs.djangoproject.com/en/dev/howto/initial-data/

Etiquetas: , | Comente »

Desarrolladores Django

Agosto 28, 2008 - 5:38 pm - Posted by Camilo Nova

He encontrado un sitio [1] bastante interesante donde se muestran las personas que trabajamos con Django y Python, el sitio esta desarrollado, por supuesto, en Django, y me ha parecido muy bien logrado.

Enlaces:

[1] http://djangopeople.net/axiacore/

Etiquetas: , , | 2 Comentarios »

AxiaCore Blog

Publicidad

Etiquetas

Nosotros Leemos

Comentarios Recientes:

  • NMarthacecilia: Hola .yo tambien lo conoci en un momento pequeño ,en la fundación molano, es de mi interes volver a...
  • Jorge Chávez: Algo que me ha interesado en los últimos días es intentar agregar nuevos widgets en el filtro, que...
  • Jorge Chávez: Excelente post! Sin duda los filtros son un problema con la falta de documentación oficial, pero en lo...
  • CBTIS_102: pzz la vdd python es un programa muy completo y facil, pero a veces los que enseñan python son pesimos,...
  • katerine: CORIDAL SALUDO, ES HERMOSA ESTA LABOR. ME ENCANTARIA SABER LOS DATOS DE LA FUNDACION PARA ACERCARME A...

Enlaces Recientes:

Archivo

Admin