Les sugiero que tomen apunten de estos tips, pues me di cuenta que aveces también caemos en lo erróneo.
Best Practices
View more presentations from Luis De Bello.
Vía | JavaCurioSities
Pequeño espacio para compartir lo que puedo aprender día a día. Java y muchas cosas más.
import java.io.File;
import java.io.IOException;
import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;
/**
* @author JocLuis
*/
public class NewClass {
public static void main(String[] args) throws IOException, BiffException {
//ruta de la hoja del calculo
Workbook workbook = Workbook.getWorkbook(new File("c://Libro1.xls"));
Sheet sheet = workbook.getSheet(0);//Elegimos la primera hoja
Cell celdaCurso = null;//inicializo el objeto que leerá el valor de la celda
String valorCeldaCurso=null;
celdaCurso= sheet.getCell(7,1);//celda de la columna 7 y fila 1
valorCeldaCurso= celdaCurso.getContents();//obteniendo valor
System.out.println(valorCeldaCurso);
workbook.close();
}
}
response.setContentType ("application/vnd.ms-excel");
response.setHeader ("Content-Disposition", "attachment;filename=\"report.xls\"");
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%
response.setContentType ("application/vnd.ms-excel"); //Tipo de fichero.
response.setHeader ("Content-Disposition", "attachment;filename=\"report.xls\"");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<TABLE border="1">
<TR>
<TH>CICLO</TH>
<TH>CODIGO</TH>
<TH>APELLIDOS Y NOMBRES</TH>
</TR>
<TR>
<TD>1</TD>
<TD>12233</TD>
<TD>JocLuis</TD>
</TR>
</TABLE>
</body>
</html>
<?value="2"?>
<parent name="data" >
<child id="1" name="alpha" >Some Text</child>
<child id="2" name="beta" >
<grandchild id="2.1" name="beta-alpha" ></grandchild>
<grandchild id="2.2" name="beta-beta" ></grandchild>
</child>
<pet name="tigger" type="cat" >
<data>
<birthday month="sept" day="19" ></birthday>
<food name="Acme Cat Food" ></food>
</data>
</pet>
<pet name="Fido" type="dog" >
<description>
Large dog!
</description>
<data>
<birthday month="feb" day="3" ></birthday>
<food name="Acme Dog Food" ></food>
</data>
</pet>
<rogue name="is this real?" >
<data>
Hates dogs!
</data>
</rogue>
<child id="3" name="gamma" mark="yes" >
<!-- A comment -->
<description>
Likes all animals - especially dogs!
</description>
<grandchild id="3.1" name="gamma-alpha" >
<[CDATA[ Some non-parsable character data ]]>
</grandchild>
<grandchild id="3.2" name="gamma-beta" ></grandchild>
</child>
</parent>
shell>mysql -u USUARIO -pCLAVE --xml -e "select * from NOMBRETABLA;" NOMBRE_BD
shell>mysql -u root -proot --xml -e "select * from producto;" sgc
shell>mysql -u root -proot --xml sgc -e "select * from producto" > /tmp/producto.xml
public static void main(String args[]) {
String s = null;
try {
// Determinar en qué SO estamos
String so = System.getProperty("os.name");
String comando;
// Comando para Linux
if (so.equals("Linux"))
comando = "ifconfig";
// Comando para Windows
else
comando = "ipconfig";
// Ejcutamos el comando
Process p = Runtime.getRuntime().exec(comando);
BufferedReader stdInput = new BufferedReader(new InputStreamReader(
p.getInputStream()));
BufferedReader stdError = new BufferedReader(new InputStreamReader(
p.getErrorStream()));
// Leemos la salida del comando
System.out.println("Ésta es la salida standard del comando:\n");
while ((s = stdInput.readLine()) != null) {
System.out.println(s);
}
// Leemos los errores si los hubiera
System.out.println("Ésta es la salida standard de error del comando (si la hay):\n");
while ((s = stdError.readLine()) != null) {
System.out.println(s);
}
System.exit(0);
} catch (IOException e) {
System.out.println("Excepción: ");
e.printStackTrace();
System.exit(-1);
}
}