tMap Filtrar Java nulos (null)

row1.postal_code!=null&&row1.gender.equals(“F”)

Source: tMap expression syntax – Talend Knowledge Base – Talend Online Documentation & Knowledge Base

tMap expression syntax – Talend Knowledge Base – Talend Online Documentation & Knowledge Base

Advertisements
Posted in Tech | Tagged , , ,

Create zip file from single file with ZipOutputStream | Examples Java Code Geeks – 2016

Source: Create zip file from single file with ZipOutputStream | Examples Java Code Geeks – 2016

package com.javacodegeeks.snippets.core;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;

public class CreateZipFileFromSingleFileWithZipOutputStream {

public static void main(String[] args) {

String zipFile = “C:/archive.zip”;
String srcFilename = “C:/srcfile.txt”;

try {

// create byte buffer
byte[] buffer = new byte[1024];

FileOutputStream fos = new FileOutputStream(zipFile);

ZipOutputStream zos = new ZipOutputStream(fos);

File srcFile = new File(srcFilename);

FileInputStream fis = new FileInputStream(srcFile);

// begin writing a new ZIP entry, positions the stream to the start of the entry data
zos.putNextEntry(new ZipEntry(srcFile.getName()));

int length;

while ((length = fis.read(buffer)) > 0) {
zos.write(buffer, 0, length);
}

zos.closeEntry();

// close the InputStream
fis.close();

// close the ZipOutputStream
zos.close();

}
catch (IOException ioe) {
System.out.println(“Error creating zip file” + ioe);
}

}

}

Posted in General

Talend – compare 2 files and keep entries that are not common to both

Source: Talend – compare 2 files and keep entries that are not common to both

Posted in General

Conversion string float (tMap)

Convertir texto en float y al mismo tiempo reemplazar coma (,)
(row1.Nb_Litres.replace(‘,’,’.’))

code non testé

Source: Conversion string float (tMap)

Posted in General

Understanding Floating numbers with pizza

Imagine that you are trying to slice up pizzas. You have a robotic pizza cutter that can cut pizza slices exactly in half. It can halve a whole pizza, or it can halve an existing slice, but in any case, the halving is always exact.That pizza cutter has very fine movements, and if you start with a whole pizza, then halve that, and continue halving the smallest slice each time, you can do the halving 53 times before the slice is too small for even its high-precision abilities. At that point, you can no longer halve that very thin slice, but must either include or exclude it as is.Now, how would you piece all the slices in such a way that would add up to one-tenth (0.1) or one-fifth (0.2) of a pizza? Really think about it, and try working it out. You can even try to use a real pizza, if you have a mythical precision pizza cutter at hand. :-)

 

 

Most experienced programmers, of course, know the real answer, which is that there is no way to piece together an exact tenth or fifth of the pizza using those slices, no matter how finely you slice them. You can do a pretty good approximation, and if you add up the approximation of 0.1 with the approximation of 0.2, you get a pretty good approximation of 0.3, but it’s still just that, an approximation.

For double-precision numbers (which is the precision that allows you to halve your pizza 53 times), the numbers immediately less and greater than 0.1 are 0.09999999999999999167332731531132594682276248931884765625 and 0.1000000000000000055511151231257827021181583404541015625. The latter is quite a bit closer to 0.1 than the former, so a numeric parser will, given an input of 0.1, favour the latter.

(The difference between those two numbers is the “smallest slice” that we must decide to either include, which introduces an upward bias, or exclude, which introduces a downward bias. The technical term for that smallest slice is an ulp.)

In the case of 0.2, the numbers are all the same, just scaled up by a factor of 2. Again, we favour the value that’s slightly higher than 0.2.

Notice that in both cases, the approximations for 0.1 and 0.2 have a slight upward bias. If we add enough of these biases in, they will push the number further and further away from what we want, and in fact, in the case of 0.1 + 0.2, the bias is high enough that the resulting number is no longer the closest number to 0.3.

In particular, 0.1 + 0.2 is really 0.1000000000000000055511151231257827021181583404541015625 + 0.200000000000000011102230246251565404236316680908203125 = 0.3000000000000000444089209850062616169452667236328125, whereas the number closest to 0.3 is actually 0.299999999999999988897769753748434595763683319091796875.

Source: language agnostic – Is floating point math broken? – Stack Overflow

Posted in General

Free Online Barcode Generator: Create Barcodes for Free!

http://barcode.tec-it.com/en

Generate Free Barcodes OnlineLinear Barcodes, 2D Codes, GS1 DataBar, Postal Barcodes and many more!

Source: Free Online Barcode Generator: Create Barcodes for Free!

Posted in Tech | Tagged , ,

Bekwam Blog: Protecting Yourself in Talend Open Studio

The tMsgBox uses the Run If trigger to invoke the delete operations if the user selects “Yes”. To use the Run If, Right-click on the tMsgBox Select Trigger > Run If Connect to the following subjob. Select the If connector Enter a condition like the

following((String)globalMap.get(“tMsgBox_1_RESULT”)).equals(“0”)

 

“0 indicates a success or “Yes” value; “1” indicates a “No”. There is no explicit handling of a No, the job stops.Other possible comparisons are listed below. Return values are based on the Buttons select in the tMsgBox Component View. YES_OPTION = 0 NO_OPTION = 1 CANCEL_OPTION = 2 OK_OPTION = 0 CLOSED_OPTION = -1

Source: Bekwam Blog: Protecting Yourself in Talend Open Studio

Posted in Compus | Tagged , , , ,