\documentclass[12pt,a4paper,oneside]{article} % Font size, paper size, one or two-sided pages. \usepackage[utf8]{inputenc} % Input encoding. \usepackage[spanish,es-noshorthands]{babel} % Language support. \usepackage{ifthen} % If-then-else, for optional content. \usepackage{amssymb} % Required for checkboxes. \newcommand{\checkbox}[2]{\ifthenelse{\equal{#1}{c}} {\makebox[0pt][l]{$\square$}\raisebox{.15ex}{\hspace{0.1em}$\checkmark$} } {\makebox[0pt][l]{$\square$}\raisebox{.15ex}{} \hspace{1em}} } % End newcommand \begin{document} \noindent \checkbox{c} \textbf{Opción 1} \checkbox{c} \textbf{Opción 4}\\ \checkbox{ } \textbf{Opción 2} \\ \checkbox{c} \textbf{Opción 3} \\ \end{document}
jueves, 18 de febrero de 2016
Dibujar checkbox con LaTeX
Insertar código en Blogger
Panel Control Blogger -> Plantilla -> Editar Html
Copiar el siguiente código entre las etiquetas head.
Para insertar código hacerlo así:
Copiar el siguiente código entre las etiquetas head.
<link href='http://alexgorbatchev.com/pub/sh/current/styles/shCore.css' rel='stylesheet' type='text/css'/> <link href='http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css' rel='stylesheet' type='text/css'/> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCpp.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCSharp.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCss.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPhp.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPython.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushRuby.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushSql.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushVb.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js' type='text/javascript'></script> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPerl.js' type='text/javascript'></script>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPlain.js' type='text/javascript'></script> <script language='javascript'> SyntaxHighlighter.config.bloggerMode = true; SyntaxHighlighter.config.clipboardSwf = 'http://alexgorbatchev.com/pub/sh/current/scripts/clipboard.swf'; SyntaxHighlighter.all();
Para insertar código hacerlo así:
Lenguajes soportados en la página del desarrollador: aqui// Comment public class Testing { public Testing() { } public void Method() { /* Another Comment on multiple lines */ int x = 9; } }
lunes, 15 de febrero de 2016
Crear Servicio WEB con MAVEN y TOMCAT
1.- File -> Maven Project . maven-archetype-webapp
2.- GroupId:es.example
ArtifactId: webServerTomcat
Click->Finish.
3.- Add this to pom.xml file.
4.- Create and complete file sun-jaxws.xml in the folder: src/main/webapp/WEB-INFcom.sun.xml.ws jaxws-rt 2.2.5
5.- Create or modify web.xml (src/main/webapp/WEB-INF/) Plantilla. (Creo que no es necesario)
6.- Crear la carpeta src/main/java y luego el paquete es.example.webServiceTomcat 7.- Crear las siguientes clases BaseClass.javaMy First Tomcat Web Service com.sun.xml.ws.transport.http.servlet.WSServletContextListener appwebservicetomcat com.sun.xml.ws.transport.http.servlet.WSServlet 1 appwebservicetomcat /AppExampleWSt 120
package es.example.webServiceTomcat; public class BaseClass { protected Error error = null; public Error getError() { return error; } public void setError(Error error) { this.error = error; } }Error.java
package es.example.webServiceTomcat; public class Error extends BaseClass implements java.io.Serializable { /** * Movida para serializar */ private static final long serialVersionUID = 1L; /** * Variables miembro */ private String code; private String description; private String stackTrace; /** * Constructor 1 */ public Error() { super(); } /** * Constructor 2 * * @param code */ public Error(String code) { super(); this.code = code; this.description = ""; this.stackTrace = ""; } /** * Constructor 3 * * @param code * @param descripcion */ public Error(String code, String descripcion) { super(); this.code = code; this.description = descripcion; this.stackTrace = ""; } /** * Constructor 4 * * @param code * @param descripcion * @param stackTrace */ public Error(String code, String descripcion, String stackTrace) { super(); this.code = code; this.description = descripcion; this.stackTrace = stackTrace; } /** * Getters */ public String getCode() { return code; } public String getDescription() { return description; } public String getStackTrace() { return stackTrace; } /** * Setters */ public void setCode(String string) { this.code = string; } public void setDescription(String string) { this.description = string; } public void setStackTrace(String string) { this.stackTrace = string; } }Persona.java
package es.example.webServiceTomcat; public class Persona extends BaseClass implements java.io.Serializable { private static final long serialVersionUID = 4L; String dni; String nombre; String apellido1; String apellido2; public Persona(String dni, String nombre) { this.dni = dni; this.nombre = nombre; } public Persona() { } public String getDni() { return dni; } public void setDni(String dni) { this.dni = dni; } public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } public String getApellido1() { return apellido1; } public void setApellido1(String apellido1) { this.apellido1 = apellido1; } public String getApellido2() { return apellido2; } public void setApellido2(String apellido2) { this.apellido2 = apellido2; } }DatosPersonales.java
package es.example.webServiceTomcat; //import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebService; import javax.jws.soap.SOAPBinding; import javax.jws.soap.SOAPBinding.Style; @WebService public class DatosPersonales extends BaseClass { public DatosPersonales() { } @SOAPBinding(style = Style.DOCUMENT) public Persona getDatosPersonales( @WebParam(name = "dni") String dni, @WebParam(name = "nombre") String nombre) { Persona per = new Persona(); // Si el dni no es "9999999999" entonces devolvemos un error. if (dni.equals("9999999999") == true) { per.dni = dni; per.nombre = nombre; } else { per.setError(new Error("01","Error not found.","For example: traceerror from exception")); } // Mejor hacer un try catch en vez de un if return per; } }Operations.java // Esta es otra clase para hacer otro servicio web sencillo a parte del anterior.
package es.example.webServiceTomcat; import javax.jws.WebMethod; import javax.jws.WebService; @WebService public class Operations extends BaseClass { @WebMethod public double suma(double a, double b) { return a + b; } @WebMethod public double producto(double a, double b) { return a * b; } @WebMethod public double resta(double a, double b) { return a - b; } }8.- Ejecutar SOAP UI con la siguiente url http://localhost:8080/webServiceTomcat/DatosPersonalesWS?wsdl Probar con dni 9999999999 o cualquier otro.
viernes, 12 de febrero de 2016
Crear Servicio Web con MAVEN como aplicación JAVA.
A continuación voy a describir cómo crear un servicio web con MAVEN sin la necesidad de ejecutar la apliación sobre Tomcat u otro contenedor de servlet.
1.-Abrir eclipse.
File -> MAVEN Project -> Archetype: maven-archetype-quickstart
GroupId: es.example
ArtifactId: webServiceExample
Click en el botón -> Finish.
2.- Añadir dependencia en pom.xml
3.-Crear clase del Web Service. Ej: MyWebService
4.-Crear la clase con el método main()
5.-Introducimos esta dirección en el navegador: http://localhost:8080/MyFirstWebService?wsdl
1.-Abrir eclipse.
File -> MAVEN Project -> Archetype: maven-archetype-quickstart
GroupId: es.example
ArtifactId: webServiceExample
Click en el botón -> Finish.
2.- Añadir dependencia en pom.xml
Guardar los cambios.com.sun.xml.ws jaxws-rt 2.2.5 compile
3.-Crear clase del Web Service. Ej: MyWebService
package es.example.webserviceExample; import javax.jws.WebMethod; import javax.jws.WebService; @WebService public class MyWebService { @WebMethod public double suma(double a, double b) { return a + b; } @WebMethod public double producto(double a, double b) { return a * b; } @WebMethod public double resta(double a, double b) { return a - b; } }
4.-Crear la clase con el método main()
package es.example.webserviceExample; import javax.xml.ws.Endpoint; /** * Class App * */ public class App { public static void main( String[] args ) { Endpoint.publish("http://localhost:8080/MyFirstWebService", new MiWebService()); } }4.-Ejecutamos la aplicación. Run As -> JAVA Application
5.-Introducimos esta dirección en el navegador: http://localhost:8080/MyFirstWebService?wsdl
Suscribirse a:
Entradas (Atom)