Showing posts with label setup. Show all posts
Showing posts with label setup. Show all posts

Saturday, October 27, 2018

Cloud storage advantage

These days every company has to keep information about their business in digital format, data is related to accounting, operations, clients or whatever the company do to generate money.
Every single piece of this information has  different condition to be store, keep and access according with their nature and sensitivity. The drivers of those conditions are regulatory, strategic or controls; and each section has different set of stakeholders.

In order to keep this big amount of information aligned and fulfilling the big amount of conditions, each company has two possible ways:

1. Build their own infrastructure to keep the information safe.

2. Delegate this management to an expert partner.

Both options are valid and extensive uses by different companies in all sectors of the economy across the world.We will analyze both.

1. Own infrastructure:

Due to the huge set of alternatives that the company could select on this way, it makes this way so complicated, you could start from keep all the information in the hard drive of your computer in a good identified set of folders or you could build a huge data center in a remote location.

In general, each requirement that you have to keep your data will generate an extra cost to your company.

If you have to keep three spreadsheets with accounting information from your first year, those spreadsheets should be stored in a pen drive or a CD that have to pay part of your rent during next X number of years until the Tax authorities said that it's not relevant.

Escalate it to the next level, your company has a small sales team that use a local CRM open source application, you have this application running in the powerful desktop that your company have under your desk. You paid a big amount of money for your machine, you have to keep it running all time and you have to contract a guy to keep it in good shape, also, you have to keep a separate backup of the information in CRM database for at least 1 month. You are investing more than one hour per day in keep your infrastructure running and paying an extra cost in your electricity bill on monthly basis. Also, you have to keep the backup safe in a second location that also should have to pay for rent.

Now, your small CRM is a headache, that is consuming time and resources and generating operative dependencies and additional stress changing the focus of the company to support systems in stead of generate money.

If you escalete it to the next levels, could understand that every single piece of data that you put in your company, will generate an infraestructure cost in the future.

2. Delegate it to an expert, cloud expert:


In the same case, you could start working with the spreadsheets in cloud platform editing it online with free tools, and storing it in an online storage that with bill you a couple of cents per month for the usage, once you stop to use this spreadsheet on daily basis, you could move it to a cold storage that generate just a couple of cents per year.

If you escalete it to the next level, you could buy a CRM for about five dollars per month including infrastructure and backup according with complex requirements according with your business needs; if you need to grow your business, your application could configure to escalete in infraestructure to support more traffic; if you need more applications just add to your package in the same infraestructure and increase your bill according with your needs.





Thursday, September 3, 2015

How to create plain files in Java

How to create plain files in Java

In this section we will show a simple way to create a text file using Java. We use common tools such as Eclipse IDE Luna and JDK 1.7 running in a Windows 10 PC.

1. Go to option File->New then in the popup en la window lookup for Java Project select and then click in  "Next >"

2. You should assign a new name to the project,in our case we will use "ArchivosPlanos", Eclipse give you options to change virutal machine version and directories, at this moment we will continue with default values, to continue click in "Finish" button.
Setteo de un nuevo proyecto
3. Eclipse was created a new project with the following structure:
Estructura del nuevo proyecto
4. Now right click in folder src and then select the option New->Package, Eclise will ask to input the name of the package to use, we will use co.net.seft.entrenamiento.archivosplanos then click in "Finish" button
Creando un nuevo paquete
5. Now we will to create a new class inside the package created, this new class should have their main method. Right click over the package that just created then select the option New->Class then Eclipse will show the following screen, we should fill the field with the class name ArchivoPlanoManager, then click in checkbox of public static void main (String argv[]).


6. Eclipse was generated a empty class with following structure. :

package co.net.seft.entrenamiento.archivosplanos;

public class ArchivoPlanoManager {

public static void main(String[] args) {
// TODO Auto-generated method stub

}

}

7. Vamos a construir dos métodos, uno para escribir el archivo y otro para leerlo. El método de escritura se va llamar writer y el metodo de lectura reader.
public void reader(String fileName){

}

public void writer(String fileName){

}

8. En el método writer vamos a crear un file que escriba cuatro lineas, cada una con el numero de linea e igual numero de caracteres 'x' de la siguiente manera.
public void writer(String fileName) {
FileWriter archivo = null;
PrintWriter printWriter = null;
try {
archivo = new FileWriter(fileName);
printWriter = new PrintWriter(archivo);

for (int i = 0; i < 4; i++) {
String linea = "" + i;
for (int j = 0; j < i; j++) {
linea += "x";
}
printWriter.println(linea);
}

} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (null != archivo)
archivo.close();
} catch (Exception e2) {
e2.printStackTrace();
}
}
}

En este caso el método writer recibe como parámetro el nombre del file a escribir, lo abre mediante el objeto FileWriter y coloca un apuntador de salida (PrintWriter) en el archivo abierto, después ejecuta la lógica de negocio para crear la linea, una vez completada la creación de la linea, la escribe en el archivo mediante el comando printWriter.println(linea);Una vez escritas todas las lineas, se procede a cerrar el file; se utiliza en el bloque finally para evitar que el archivo quede abierto si existe alguna falla en la escritura.
9. En el método reader vamos a leer el file que escribimos e imprimir por pantalla el contenido del file.
public void reader(String fileName) {

File archivo = null;
FileReader fileReader = null;
BufferedReader bufferedReader = null;

try {
archivo = new File(fileName);
fileReader = new FileReader(archivo);
bufferedReader = new BufferedReader(fileReader);

String linea;
while ((linea = bufferedReader.readLine()) != null) {
System.out.println(linea);
}

} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (null != fileReader) {
fileReader.close();
}
} catch (Exception e2) {
e2.printStackTrace();
}
}
}
Utilizamos un objeto File para recibir el archivo, y lo abrimos mediante un objeto FileReader, el contenido lo extraemos mediante un objeto BufferedReader, sobre el cual vamos a iterar para leer cada una de las lineas. Utilizamos un ciclo while con el código (linea = bufferedReader.readLine()) != nullpara realizar la impresión de las lineas hasta que encuentre el fin de linea del file.
Una vez alcanzamos el final de archivo procedemos a cerrar el objeto BufferedReader dentro del bloque finally de la excepcion para evitar que quede abierto el file si algo sale mal en la lectura.

10. Finalmente ponemos todo junto para ser invocado con el main de la siguiente manera.
public static void main(String[] args) {
ArchivoPlanoManager archivoPlanoManager=new ArchivoPlanoManager();
String archivo="c:/Temp/pruebas.txt";
archivoPlanoManager.writer(archivo);
archivoPlanoManager.reader(archivo);
}

Instanciamos la clase que acabamos de crear en la lineas ArchivoPlanoManager archivoPlanoManager=new ArchivoPlanoManager();  posteriormente invocamos el método writer y despues le método reader. La salida de consola de este programa debe ser igual al contenido del archivo.
0
1x
2xx
3xxx
Y el código poniendo todo junto seria:
package co.net.seft.entrenamiento.archivosplanos;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.PrintWriter;

public class ArchivoPlanoManager {

public static void main(String[] args) {
ArchivoPlanoManager archivoPlanoManager=new ArchivoPlanoManager();
String archivo="c:/Temp/pruebas.txt";
archivoPlanoManager.writer(archivo);
archivoPlanoManager.reader(archivo);
}

public void reader(String fileName) {

File archivo = null;
FileReader fileReader = null;
BufferedReader bufferedReader = null;

try {

archivo = new File(fileName);
fileReader = new FileReader(archivo);
bufferedReader = new BufferedReader(fileReader);

String linea;
while ((linea = bufferedReader.readLine()) != null) {
System.out.println(linea);
}

} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (null != fileReader) {
fileReader.close();
}
} catch (Exception e2) {
e2.printStackTrace();
}
}

}

public void writer(String fileName) {
FileWriter archivo = null;
PrintWriter printWriter = null;
try {
archivo = new FileWriter(fileName);
printWriter = new PrintWriter(archivo);

for (int i = 0; i < 4; i++) {
String linea = "" + i;
for (int j = 0; j < i; j++) {
linea += "x";
}
printWriter.println(linea);
}

} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (null != archivo)
archivo.close();
} catch (Exception e2) {
e2.printStackTrace();
}
}
}

}

Saturday, August 23, 2014

Best practices to setup environments

According my experience, the best way to build the environments of one new applications is to draw a diagram...yes, draw a diagram.
 
When you build a diagram, you are able to identify the dependencies and try to solve your concerns about the way to feed your application, the main duties of each components and the workflow of each process.
 
In a formal way, you should use UML and define the model in a schema of 4+1 views to identify and understand all the domains of the application. In a practical way, you should build a diagram easy to understand and easy to share and explain in normal words what will you do; and this diagram could be a handmade diagram in a piece of sheet.
 
Once you have the diagram,  you should identify the external dependencies and identify the posibles ways to feed each of this interfaces. These ways will give you the requeriments to build the environments, I.E if you are able to capture information manually in production environment or put the same information directly in the database for others environments.
 
The conclusion of this analisys will give you a view of the posible features of each of the environments and let you know what are the alternatives to replace a system that is not available to setup in some of the enviroments, I.E, the accounting system is not available to support product estress test...you need to address this output feed to another system in order to analise it in other context and it should be included in the test plan.