id
stringlengths
36
36
text
stringlengths
1
1.25M
8d2e44a7-c63c-4b6e-9b28-3c1fe57134a7
public static void convolveH(Kernel kernel, int[] inPixels, int[] outPixels, int width, int height, boolean alpha, int edgeAction) { int index = 0; float[] matrix = kernel.getKernelData( null ); int cols = kernel.getWidth(); int cols2 = cols/2; for (int y = 0; y < height; y++) { int ioffset = y*width; ...
e9018ad8-6065-433a-9d33-5135430330dc
public static void convolveV(Kernel kernel, int[] inPixels, int[] outPixels, int width, int height, boolean alpha, int edgeAction) { int index = 0; float[] matrix = kernel.getKernelData( null ); int rows = kernel.getHeight(); int rows2 = rows/2; for (int y = 0; y < height; y++) { for (int x = 0; x < width...
0dbc4702-f75d-489b-846a-4fba8d06de57
public String toString() { return "Blur/Convolve..."; }
4d1576ea-a4c7-42bb-b649-6b57bad7c89f
public BufferedImage createCompatibleDestImage(BufferedImage src, ColorModel dstCM) { if ( dstCM == null ) dstCM = src.getColorModel(); return new BufferedImage(dstCM, dstCM.createCompatibleWritableRaster(src.getWidth(), src.getHeight()), dstCM.isAlphaPremultiplied(), null); }
1d84e236-e82c-4b82-a769-a22b9eb50741
public Rectangle2D getBounds2D( BufferedImage src ) { return new Rectangle(0, 0, src.getWidth(), src.getHeight()); }
143c3a4d-ae02-4441-8cd2-2d29b41d10f2
public Point2D getPoint2D( Point2D srcPt, Point2D dstPt ) { if ( dstPt == null ) dstPt = new Point2D.Double(); dstPt.setLocation( srcPt.getX(), srcPt.getY() ); return dstPt; }
d824461f-1433-434d-8ed1-cf95a8b7284f
public RenderingHints getRenderingHints() { return null; }
a2052be4-b8c6-45fb-8754-e3d6f139dc6b
public int[] getRGB( BufferedImage image, int x, int y, int width, int height, int[] pixels ) { int type = image.getType(); if ( type == BufferedImage.TYPE_INT_ARGB || type == BufferedImage.TYPE_INT_RGB ) return (int [])image.getRaster().getDataElements( x, y, width, height, pixels ); return image.getRGB( x, y...
f56bf9f6-3f99-4635-9f32-22886bc785fb
public void setRGB( BufferedImage image, int x, int y, int width, int height, int[] pixels ) { int type = image.getType(); if ( type == BufferedImage.TYPE_INT_ARGB || type == BufferedImage.TYPE_INT_RGB ) image.getRaster().setDataElements( x, y, width, height, pixels ); else image.setRGB( x, y, width, height...
5dbffb4f-dd6f-4e20-898a-bf8293444037
public static float bias(float a, float b) { // return (float)Math.pow(a, Math.log(b) / Math.log(0.5)); return a/((1.0f/b-2)*(1.0f-a)+1); }
5e706003-6460-4f78-b128-055161b312ea
public static float gain(float a, float b) { /* float p = (float)Math.log(1.0 - b) / (float)Math.log(0.5); if (a < .001) return 0.0f; else if (a > .999) return 1.0f; if (a < 0.5) return (float)Math.pow(2 * a, p) / 2; else return 1.0f - (float)Math.pow(2 * (1. - a), p) / 2; */ float c = (1.0f/b-...
0566e88d-329c-4289-bf9e-297d425b40c4
public static float step(float a, float x) { return (x < a) ? 0.0f : 1.0f; }
90b6b506-b1d6-4cc1-97b6-77abc9a27c96
public static float pulse(float a, float b, float x) { return (x < a || x >= b) ? 0.0f : 1.0f; }
d8a2f604-f59f-4097-840c-c40b3018a8d4
public static float smoothPulse(float a1, float a2, float b1, float b2, float x) { if (x < a1 || x >= b2) return 0; if (x >= a2) { if (x < b1) return 1.0f; x = (x - b1) / (b2 - b1); return 1.0f - (x*x * (3.0f - 2.0f*x)); } x = (x - a1) / (a2 - a1); return x*x * (3.0f - 2.0f*x); }
f0110815-dd3a-4173-b52d-cb057f94978f
public static float smoothStep(float a, float b, float x) { if (x < a) return 0; if (x >= b) return 1; x = (x - a) / (b - a); return x*x * (3 - 2*x); }
e156549d-101e-46be-a969-b5f7dfd709d1
public static float circleUp(float x) { x = 1-x; return (float)Math.sqrt(1-x*x); }
e7d0efc9-8a8b-4aa6-9b97-0964f0c6b3ce
public static float circleDown(float x) { return 1.0f-(float)Math.sqrt(1-x*x); }
8de090ce-7a43-46dc-a548-9bd51aaa9bbe
public static float clamp(float x, float a, float b) { return (x < a) ? a : (x > b) ? b : x; }
af721c1e-d29c-427a-944b-1b966218eccf
public static int clamp(int x, int a, int b) { return (x < a) ? a : (x > b) ? b : x; }
caa7bbb1-cfff-4785-9c0c-57c4f57f54b2
public static double mod(double a, double b) { int n = (int)(a/b); a -= n*b; if (a < 0) return a + b; return a; }
c78e475e-edec-42de-8360-02c3c2a2ea24
public static float mod(float a, float b) { int n = (int)(a/b); a -= n*b; if (a < 0) return a + b; return a; }
44cc0370-be74-4758-b211-3dc80fb0f227
public static int mod(int a, int b) { int n = a/b; a -= n*b; if (a < 0) return a + b; return a; }
b5963b8c-01ed-4365-a9ba-611fff3876d6
public static float triangle(float x) { float r = mod(x, 1.0f); return 2.0f*(r < 0.5 ? r : 1-r); }
80a8cc6f-1782-4114-9ee1-e7ab099cb461
public static float lerp(float t, float a, float b) { return a + t * (b - a); }
e8676e32-cf58-45e4-bd96-d79442c6e282
public static int lerp(float t, int a, int b) { return (int)(a + t * (b - a)); }
b3879c61-f6ae-46be-90a3-4dac19d008f4
public static int mixColors(float t, int rgb1, int rgb2) { int a1 = (rgb1 >> 24) & 0xff; int r1 = (rgb1 >> 16) & 0xff; int g1 = (rgb1 >> 8) & 0xff; int b1 = rgb1 & 0xff; int a2 = (rgb2 >> 24) & 0xff; int r2 = (rgb2 >> 16) & 0xff; int g2 = (rgb2 >> 8) & 0xff; int b2 = rgb2 & 0xff; a1 = lerp(t, a1, a2);...
45e124f9-5fe0-4a13-aadf-fc4200a73db7
public static int bilinearInterpolate(float x, float y, int[] p) { float m0, m1; int a0 = (p[0] >> 24) & 0xff; int r0 = (p[0] >> 16) & 0xff; int g0 = (p[0] >> 8) & 0xff; int b0 = p[0] & 0xff; int a1 = (p[1] >> 24) & 0xff; int r1 = (p[1] >> 16) & 0xff; int g1 = (p[1] >> 8) & 0xff; int b1 = p[1] & 0xff;...
72fb246e-015a-4ad8-8fdb-70ba1efbcef7
public static int brightnessNTSC(int rgb) { int r = (rgb >> 16) & 0xff; int g = (rgb >> 8) & 0xff; int b = rgb & 0xff; return (int)(r*0.299f + g*0.587f + b*0.114f); }
9c94e7be-807f-4626-8792-fb87583d8e18
public static float spline(float x, int numKnots, float[] knots) { int span; int numSpans = numKnots - 3; float k0, k1, k2, k3; float c0, c1, c2, c3; if (numSpans < 1) throw new IllegalArgumentException("Too few knots in spline"); x = clamp(x, 0, 1) * numSpans; span = (int)x; if (span > numKnot...
19bea463-a6a9-4846-a9b0-821e74493978
public static float spline(float x, int numKnots, int[] xknots, int[] yknots) { int span; int numSpans = numKnots - 3; float k0, k1, k2, k3; float c0, c1, c2, c3; if (numSpans < 1) throw new IllegalArgumentException("Too few knots in spline"); for (span = 0; span < numSpans; span++) if (xknots[s...
967c9b54-ac0a-4e4b-9447-0d3813881069
public static int colorSpline(float x, int numKnots, int[] knots) { int span; int numSpans = numKnots - 3; float k0, k1, k2, k3; float c0, c1, c2, c3; if (numSpans < 1) throw new IllegalArgumentException("Too few knots in spline"); x = clamp(x, 0, 1) * numSpans; span = (int)x; if (span > numKno...
897abc92-5044-4fbb-986f-88301571c9ae
public static int colorSpline(int x, int numKnots, int[] xknots, int[] yknots) { int span; int numSpans = numKnots - 3; float k0, k1, k2, k3; float c0, c1, c2, c3; if (numSpans < 1) throw new IllegalArgumentException("Too few knots in spline"); for (span = 0; span < numSpans; span++) if (xknots[...
21a76ad0-9bbf-4e97-850c-63f331ef64b8
public static void resample(int[] source, int[] dest, int length, int offset, int stride, float[] out) { int i, j; float intensity; float sizfac; float inSegment; float outSegment; int a, r, g, b, nextA, nextR, nextG, nextB; float aSum, rSum, gSum, bSum; float[] in; int srcIndex = offset; int destIn...
8bbc53dc-f98d-4506-a3ec-a3f7c1e88adc
public GaussianFilter() { this(2); }
771715ca-c1b4-4d84-acf3-1e67053fc428
public GaussianFilter(float radius) { setRadius(radius); }
bf894652-e793-4b80-b077-9905cfb0b23d
public void setRadius(float radius) { this.radius = radius; kernel = makeKernel(radius); }
823be327-ae35-45ae-83f5-fb2704a9aa49
public float getRadius() { return radius; }
627ed6d4-c070-43a2-8fd6-0aaac974c9fe
public BufferedImage filter( BufferedImage src, BufferedImage dst ) { int width = src.getWidth(); int height = src.getHeight(); if ( dst == null ) dst = createCompatibleDestImage( src, null ); int[] inPixels = new int[width*height]; int[] outPixels = new int[width*h...
5bda6ee6-f536-430b-9a08-3ce61209e1f8
public static void convolveAndTranspose(Kernel kernel, int[] inPixels, int[] outPixels, int width, int height, boolean alpha, int edgeAction) { float[] matrix = kernel.getKernelData( null ); int cols = kernel.getWidth(); int cols2 = cols/2; for (int y = 0; y < height; y++) { int index = y; int ioffset = ...
db80b396-e5e2-45e6-a811-24198feb1cb0
public static Kernel makeKernel(float radius) { int r = (int)Math.ceil(radius); int rows = r*2+1; float[] matrix = new float[rows]; float sigma = radius/3; float sigma22 = 2*sigma*sigma; float sigmaPi2 = 2*ImageMath.PI*sigma; float sqrtSigmaPi2 = (float)Math.sqrt(sigmaPi2); float radius2 = radius*radius...
a815d1b7-d757-4fb5-bdaf-554304cee84f
public String toString() { return "Blur/Gaussian Blur..."; }
dc198590-b539-42b7-a35c-b5250b074326
public static void setUsuario(String Usuario) { Conexion.Usuario = Usuario; }
e5511d62-2653-4c7d-9ba0-3dafc4000377
public static void setCadena(String Cadena) { Conexion.Cadena = Cadena; }
45b52cd2-8c04-4f37-a11a-7c6f92e5033c
public static void setClave(String Clave) { Conexion.Clave = Clave; }
513eb73e-9327-4d9c-9874-97bc973cf260
public static Conexion GetInstancia() { if (Instancia == null) { Instancia=new Conexion( ); } return Instancia; }
1dae5275-a101-4591-8054-d154731cc38f
public void Conectar() { try { ConexionDatos= DriverManager.getConnection(Cadena, Usuario, Clave); } catch(SQLException ex) { ex.getStackTrace(); } }
f8c8c25d-fa65-4c4d-8d1a-efa37cb91e95
public void Desconectar() { try { ConexionDatos.close(); } catch(SQLException ex) { ex.getStackTrace(); } }
06bf2375-b4ed-4700-8f6e-e1b4807fab72
public void Ejecutar(String Cadena) throws SQLException { try { Sentencia= ConexionDatos.prepareStatement(Cadena); Sentencia.executeUpdate(); } catch(SQLException ex) { throw ex; } }
c74b8e6f-7b8b-4b6e-8508-fcd00d3eb308
public ResultSet EjecutarConsulta (String Cadena) throws SQLException { try { Sentencia = ConexionDatos.prepareStatement(Cadena); ConjuntoDatos = Sentencia.executeQuery(); return ConjuntoDatos; } catch(SQLException ex) { ...
9f6b045f-4fe5-4b7f-99b1-da5ca6789ca8
public static void main(String[] args) { // TODO code application logic here }
34f567ff-0580-4ab0-af66-54c036e22c88
public void PasarDeInterfazDeNegocio() { gestioncliente.getCliente().setCedula(txtcedula.getText()); gestioncliente.getCliente().setNombre(txtnombre.getText()); gestioncliente.getCliente().setDireccion(txtdireccion.getText()); gestioncliente.getCliente().setCupo(Double.parseDouble(tx...
bd019b7b-1f18-4b52-8341-12bbd2d798d9
public void PasarDeNegocioAInterfaz() { txtcedula.setText(gestioncliente.getCliente().getCedula()); txtnombre.setText(gestioncliente.getCliente().getNombre()); txtdireccion.setText(gestioncliente.getCliente().getDireccion()); txtcupo.setText(Double.toString(gestioncliente.getCliente(...
1c64e576-2351-41e6-9a07-065a2b5b7469
public Cliente() { initComponents(); }
01705a42-1919-4a37-aa9d-84a7396baa16
@SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { txtcedula = new javax.swing.JTextField(); label1 = new java.awt.Label(); txtnombre = new javax.swing.JTextField(); label2 = ne...
0d18ee72-3f35-41b5-9333-1c188c7034b0
public void actionPerformed(java.awt.event.ActionEvent evt) { btnModificarActionPerformed(evt); }
50834381-d834-4cd4-9489-f525e1e15d93
public void actionPerformed(java.awt.event.ActionEvent evt) { btnConsultarActionPerformed(evt); }
e63e8556-32df-43a6-adb0-5e926392ce62
public void actionPerformed(java.awt.event.ActionEvent evt) { btnGrabarActionPerformed(evt); }
9eeb942d-af18-408a-8bc0-74633db51613
public void actionPerformed(java.awt.event.ActionEvent evt) { btnEliminarActionPerformed(evt); }
66ead777-54fa-428c-8fd4-0f56786ee9b5
public void actionPerformed(java.awt.event.ActionEvent evt) { btnSalirActionPerformed(evt); }
cf67b975-7252-430b-813d-8f784656b4d6
public void actionPerformed(java.awt.event.ActionEvent evt) { btnNuevoActionPerformed(evt); }
b9283292-caf3-45bf-825c-1cc29b185c26
private void btnModificarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnModificarActionPerformed PasarDeInterfazDeNegocio(); try { gestioncliente.Modificar(); JOptionPane.showMessageDialog(this, "El dato se modificó correctamente"); } ...
e875c66c-a84b-4764-aeae-ba068381c5a5
private void btnGrabarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGrabarActionPerformed PasarDeInterfazDeNegocio(); try { gestioncliente.Grabar(); JOptionPane.showMessageDialog(this, "El dato se grabó correctamente"); } catch(SQLEx...
74e961cb-e27f-4dcf-93e4-70a8737c40de
private void btnEliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEliminarActionPerformed PasarDeInterfazDeNegocio(); try { gestioncliente.Eliminar(); JOptionPane.showMessageDialog(this, "El dato se eliminó correctamente"); } ca...
bb6df048-b70b-493b-b7f0-ea898d10f776
private void btnConsultarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnConsultarActionPerformed gestioncliente.getCliente().setCedula(txtcedula.getText()); try { gestioncliente.Consultar(); PasarDeNegocioAInterfaz(); ...
96251c95-8298-4a73-8929-1cadd79ae005
private void btnNuevoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNuevoActionPerformed try { gestioncliente.Nuevo(); } catch (SQLException ex) { JOptionPane.showMessageDialog(this, ex.getMessage()); } ...
6eafcb55-8f5e-4c1c-810e-ca8045a21207
private void btnSalirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSalirActionPerformed System.exit(0); }//GEN-LAST:event_btnSalirActionPerformed
e95a18db-6fce-4116-8304-7088cd464094
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
96db41fe-8302-449a-9cb8-b0d0432b0b9a
public void run() { new Cliente().setVisible(true); }
b2895283-843d-4318-aa2c-1e140d32e72e
public GestionCliente() { Conexion.setCadena("jdbc:mysql://localhost/facturacion"); Conexion.setUsuario("root"); Conexion.setClave(""); }
5e8859bb-a89c-42c7-b222-9d77bb21668d
public Cliente getCliente() { return cliente; }
890d45f3-1012-4119-be0b-4091c6480ed5
public void setCliente (Cliente cliente) { this.cliente = cliente; }
22089561-c494-42ab-a103-1f02107ee30e
@Override public void Grabar() throws SQLException { try { Conexion.GetInstancia().Conectar(); Conexion.GetInstancia().Ejecutar("INSERT INTO cliente (Cedula, Nombre, Direccion, Cupo) VALUES ('"+cliente.getCedula()+"','"+cliente.getNombre()+"','"+cliente.getDirecc...
cd73d87f-1f3e-4518-b7ae-dc26652cd5fd
@Override public void Modificar() throws SQLException { try { Conexion.GetInstancia().Conectar(); Conexion.GetInstancia().Ejecutar("UPDATE cliente SET Nombre = '"+cliente.getNombre()+"', Direccion = '"+cliente.getDireccion()+"', Cupo = '"+cliente.getCupo()+"' WHERE Cedul...
527d1166-d115-4445-ae96-9651e792fc95
@Override public void Nuevo() throws SQLException { cliente.setCedula("000000000-0"); cliente.setNombre("SD"); cliente.setDireccion("SD"); cliente.setCupo(00); }
a204e6cc-8a49-4dce-ae45-9b9e6b2f64ab
@Override public void Eliminar() throws SQLException { try { Conexion.GetInstancia().Conectar(); Conexion.GetInstancia().Ejecutar("DELETE FROM cliente WHERE Cedula = "+cliente.getCedula()); } catch(SQLException ex) { throw ex; ...
33670751-375e-4bd4-9be6-7bb52a1ce9a2
@Override public void Consultar() throws SQLException { try { Conexion.GetInstancia().Conectar(); ResultSet rs = Conexion.GetInstancia().EjecutarConsulta("SELECT Nombre, Direccion, Cupo FROM cliente WHERE Cedula = '"+cliente.getCedula()+"';"); w...
36963c6d-7ed5-4892-84c3-0c9d3fdabca5
public void Grabar () throws SQLException;
b5b765d8-13cd-46f8-8a35-37c14efb97f8
public void Modificar() throws SQLException;
022d4227-5f5d-4318-b441-9c123152652c
public void Nuevo() throws SQLException;
3e2f15b7-25ef-4fe9-98c9-a6e8a81c4ef6
public void Eliminar() throws SQLException;
fea6e09e-dd3d-460b-af8e-05882de1807d
public void Consultar() throws SQLException;
f444bb67-4b3d-4ae1-a710-a2c82b1bb10d
public String getCedula() { return Cedula; }
f859ee02-0706-47f0-bd16-81af86e0899b
public void setCedula(String Cedula) { this.Cedula = Cedula; }
efe506c1-b80e-452e-872f-fe753c8b3d90
public String getNombre() { return Nombre; }
921cbb5d-2f52-4c9f-b4c3-05a4f89987ba
public void setNombre(String Nombre) { this.Nombre = Nombre; }
8d8a03f4-e876-4100-a6f7-887ebd5b78c8
public String getDireccion() { return Direccion; }
2227c65a-a4ce-4bea-afbd-e5cc04f6c964
public void setDireccion(String Direccion) { this.Direccion = Direccion; }
cc78e41c-40fe-442d-b864-ad33220b90ea
public double getCupo() { return Cupo; }
141e34f3-4726-4656-aaf5-3f290491d377
public void setCupo(double Cupo) { this.Cupo = Cupo; }
8631b451-ec64-42f0-aad8-eb7b26da96ad
public Cliente(String Cedula, String Nombre, String Direccion, double Cupo) { this.Cedula = Cedula; this.Nombre = Nombre; this.Direccion = Direccion; this.Cupo = Cupo; }
caae3a4c-d78a-440f-a23e-620b59967e37
public LecteurFichierPalindrome(String f) { super(f); // TODO Auto-generated constructor stub }
a46f8ff5-c34b-4ece-9c77-073d8ab2547e
@Override public void affiche() { System.out.println("Affichage Palindrome : "); for (String s : contenu) { System.out.println(s); } for (int i = contenu.size()-1 ; i >= 0 ; i--) { for (int j = contenu.get(i).length()-1 ; j >= 0; j--) { System.out.print(contenu.get(i).charAt(j)); } Sys...
50e2b1b0-f87c-465b-84d0-7f27cc2a734d
public boolean openAndCheck();
b8f0905f-9cee-4b41-9dc4-b05e6aa59746
public void readFichier() throws IOException;
b34cfcdd-8792-4933-bcef-329d9991d843
public void affiche();
d4461e3b-ff6e-46b4-85cb-8eba06e0a65e
public static void main(String[] args) { // LecteurFichier freverse = new LecteurFichierReverse("C:/Users/licence.FC-CIM-10/Desktop/Julie NGUYEN/Essai.txt"); // LecteurFichier fpalin = new LecteurFichierPalindrome("C:/Users/licence.FC-CIM-10/Desktop/Julie NGUYEN/Essai.txt"); LecteurFichierReverse freverse = n...
1673b66b-62c8-4579-927b-642686d2520a
public static void main(String[] args) { /* Open VoltDB connection */ VoltDbConnection conn = new VoltDbConnection("weatherpoints"); System.out.println("Opened connection to VoltDB"); /* Create a weather point */ WeatherPoint wp = new WeatherPoint(); wp.dewPoint = 50; wp.maxTemp = 9001; wp.minTemp = 3...
b42019ae-f9d2-46f1-bf49-7ab632d08c2e
public static void main(String[] args) { System.out.println("Running NDFD Populator."); // Set up the connection to VoltDB // TODO: Will // Set up connection to NDFD // TODO: Sean NDFDConnection ndfd = new NDFDConnection(); // Pull data from NDFD // TODO: Sean LinkedList <WeatherPoint> newData = nd...
2a0e462f-f205-4687-83a2-0dc402286191
public LinkedList <WeatherPoint> pullData() { LinkedList <WeatherPoint> newPoints = new LinkedList <WeatherPoint>(); // This will make a new connection to the NDFD database. // Start and End times to pull for. Note, this has to be in the future (because it's a forecast database) String beginTime = "2014-12-...
ea2d7a8b-121a-4e6f-aacf-cf095e83b7e1
private int getValue(Node n) { int ret = -1; for (int i = 0;i < n.getChildNodes().getLength();i++) { Node a = n.getChildNodes().item(i); // System.out.println("Looking at child " + i + ", node name " + a.getNodeName() + ", node value " + a.getNodeValue()+", text content "+a.getTextContent()); if (a.getN...