Skip to content

Instantly share code, notes, and snippets.

View HashRaygoza's full-sized avatar

David Raygoza Gómez HashRaygoza

View GitHub Profile
package mx.hash.print;
import jssc.SerialPort;
import jssc.SerialPortException;
public class PrinterTest {
public static void main(String[] args) {
SerialPort serialPort = new SerialPort("COM7");
@HashRaygoza
HashRaygoza / Diversion.java
Created February 1, 2018 07:14
La diversion de consultar una base de datos
objecto.setCantidad(data.getInt("cantidad"));
objecto.setCantidad(data.getDouble("iva"));
objecto.setCantidad(data.getDouble("precio"));
objecto.setCantidad(data.getDouble("ganancia"));
objecto.setCantidad(data.getDouble("ieps"));
objecto.setCantidad(data.getString("codigo"));
objecto.setCantidad(data.getInt("ventas"));
objecto.setCantidad(data.getDouble("ganancia"));
objecto.setCantidad(data.getDouble("iva22"));
objecto.setCantidad(data.getDouble("iva12"));
@HashRaygoza
HashRaygoza / resize.sh
Created February 11, 2018 00:39
Escalar imagenes con ImageMagick
mogrify -resize 50x50% *.jpg
@HashRaygoza
HashRaygoza / MavenRunner.sh
Created February 11, 2018 01:05
Corriendo un proyecto Maven desde la linea de comandos
mvn exec:java -Dexec.mainClass="mx.hashCode.unica.App"
ventas.stream().forEach((venta) -> {
estados.stream().filter((estado) -> (Objects.equals(venta.getPc(), estado.getPc()))).filter((estado) -> (estado.getPcStatus() != 5)).forEach((_item) -> {
imprimibles.add(venta);
});
});
for (PcUltimaVentaVO venta: ventas) {
for (PcStatusVO estado: estados) {
if (Objects.equals(venta.getPc(), estado.getPc())) {
if (estado.getPcStatus() != 5) {
imprimibles.add(venta);
}
}
}
}
@HashRaygoza
HashRaygoza / PdfBox_dependencia.xml
Created March 11, 2018 09:02
Como agregar PdfBox a un proyecto Maven
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>2.0.8</version>
</dependency>
@HashRaygoza
HashRaygoza / Impresor.java
Created March 11, 2018 19:03
Envia un Pdf a la impresora
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package mx.hash.impresionpdf;
import java.awt.print.PrinterException;
import java.awt.print.PrinterJob;
import java.io.File;
@HashRaygoza
HashRaygoza / PrintiText.java
Created March 13, 2018 01:52
Como enviar un documento iText a la impresora SIN mandarlo a disco duro primero
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package mx.hash.printitext;
import com.itextpdf.kernel.geom.PageSize;
import com.itextpdf.kernel.pdf.PdfDocument;
import com.itextpdf.kernel.pdf.PdfWriter;
@HashRaygoza
HashRaygoza / ImpresionInmediata.java
Last active October 8, 2018 18:24
Envia un documento creado en iText directo a la impresora *SIN* mostrar el dialogo de impresion ni pedir permiso
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package mx.hash.impresioninmediata;
import com.itextpdf.kernel.geom.PageSize;
import com.itextpdf.kernel.pdf.PdfDocument;
import com.itextpdf.kernel.pdf.PdfWriter;