Main method.

@param paramArgs
input and output files
@throws Exception
if any exception occurs
343657
public static void main(final String... paramArgs) throws Exception {
        checkArgument(paramArgs.length == 2, "Usage: XMLShredder input.xml output.tnk");

        System.out.print("Shredding '" + paramArgs[0] + "' to '" + paramArgs[1] + "' ... ");
        final long time = System.currentTimeMillis();

        Injector injector =
            Guice.createInjector(new ModuleSetter().setDataFacClass(TreeNodeFactory.class).setMetaFacClass(
                NodeMetaPageFactory.class).createModule());
        IBackendFactory storage = injector.getInstance(IBackendFactory.class);
        IRevisioning revision = injector.getInstance(IRevisioning.class);

        final File target = new File(paramArgs[1]);
        final StorageConfiguration config = new StorageConfiguration(target);
        Storage.truncateStorage(config);
        Storage.createStorage(config);
        final IStorage db = Storage.openStorage(target);
        Properties props = StandardSettings.getProps(target.getAbsolutePath(), "shredded");
        db.createResource(new ResourceConfiguration(props, storage, revision, new TreeNodeFactory(),
            new NodeMetaPageFactory()));
        final ISession session = db.getSession(new SessionConfiguration("shredded", StandardSettings.KEY));
        final INodeWriteTrx wtx = new NodeWriteTrx(session, session.beginBucketWtx(), HashKind.Rolling);
        // generating root node
        final NodeDelegate nodeDel = new NodeDelegate(wtx.getPageWtx().incrementDataKey(), NULL_NODE, 0);
        DocumentRootNode node =
            new DocumentRootNode(nodeDel, new StructNodeDelegate(nodeDel, NULL_NODE, NULL_NODE, NULL_NODE, 0));
        wtx.getPageWtx().setData(node);
        wtx.moveTo(org.treetank.data.IConstants.ROOT_NODE);

        final XMLEventReader reader = createFileReader(new File(paramArgs[0]));
        final XMLShredder shredder = new XMLShredder(wtx, reader, EShredderInsert.ADDASFIRSTCHILD);
        shredder.call();

        wtx.close();
        session.close();

        System.out.println(" done [" + (System.currentTimeMillis() - time) + "ms].");
    }
900068
static public void main(String ... args) throws Exception {
        FileInputStream fin = new FileInputStream(args[0]);
        XMLReader<Sample> reader = new XMLReader<Sample>();
        
        for( Map<String,Object> map : reader.read(fin, Sample.class) ) {
            System.out.println("Next...");
            for( Map.Entry<String,Object> entry : map.entrySet() ) {
                System.out.println("\t" + entry.getKey() + " (" + (entry.getValue() != null ? entry.getValue().getClass().getName() : "") + "): " + entry.getValue());
            }
        }
    }
1367994
public static void main(String[] args) throws Exception {

    SAXProcessor sp = new SAXProcessor();

    // data
    //
    double[] dat = TSProcessor.readFileColumn(DAT_FNAME, 1, 0);
    // TSProcessor tp = new TSProcessor();
    // double[] dat = tp.readTS("src/resources/dataset/asys40.txt", 0);
    // double[] dat = TSProcessor.readFileColumn(filename, columnIdx,
    // sizeLimit)FileColumn(DAT_FNAME, 1, 0);
    LOGGER.info("read {} points from {}", dat.length, DAT_FNAME);

    String str = "win_width: " + cPoint + "; SAX: W " + SAX_WINDOW_SIZE + ", P " + SAX_PAA_SIZE
        + ", A " + SAX_ALPHABET_SIZE + ", STR " + SAX_NR_STRATEGY.toString();

    int frameCounter = 0;
    int startOffset = cPoint;
    while (cPoint < dat.length - startOffset - 1) {

      if (0 == cPoint % 2) {

        BufferedImage tsChart = getChart(dat, cPoint);

        // bitmap 1
        //
        double[] win1 = Arrays.copyOfRange(dat, cPoint - startOffset, cPoint);
        Map<String, Integer> shingledData1 = sp.ts2Shingles(win1, SAX_WINDOW_SIZE, SAX_PAA_SIZE,
            SAX_ALPHABET_SIZE, SAX_NR_STRATEGY, SAX_NORM_THRESHOLD, SHINGLE_SIZE);
        BufferedImage pam1 = getHeatMap(shingledData1, "pre-window");

        double[] win2 = Arrays.copyOfRange(dat, cPoint, cPoint + startOffset);
        Map<String, Integer> shingledData2 = sp.ts2Shingles(win2, SAX_WINDOW_SIZE, SAX_PAA_SIZE,
            SAX_ALPHABET_SIZE, SAX_NR_STRATEGY, SAX_NORM_THRESHOLD, SHINGLE_SIZE);
        BufferedImage pam2 = getHeatMap(shingledData2, "post-window");

        // the assemble
        //
        BufferedImage target = new BufferedImage(800, 530, BufferedImage.TYPE_INT_ARGB);
        Graphics targetGraphics = target.getGraphics();
        targetGraphics.setColor(Color.WHITE);
        targetGraphics.fillRect(0, 0, 799, 529);

        targetGraphics.drawImage(tsChart, 0, 0, null);

        targetGraphics.drawImage(pam1, 10, 410, null);// draws the first image onto it

        targetGraphics.drawImage(pam2, 120, 410, null);// draws the first image onto it

        targetGraphics.setColor(Color.RED);
        targetGraphics.setFont(new Font("monospaced", Font.PLAIN, 16));
        targetGraphics.drawString(str, 300, 420);

        targetGraphics.setColor(Color.BLUE);
        targetGraphics.setFont(new Font("monospaced", Font.PLAIN, 24));
        double dist = ed.distance(toVector(shingledData1), toVector(shingledData2));
        targetGraphics.drawString("ED=" + df.format(dist), 300, 480);

        // String fileName = new SimpleDateFormat("yyyyMMddhhmmssSS'.png'").format(new Date());
        File outputfile = new File("dframe" + String.format("%04d", frameCounter) + ".png");
        ImageIO.write(target, "png", outputfile);
        frameCounter++;
      }

      cPoint++;
    }
  }
797392
public static void main(String[] args) throws Exception {
        OptionParser parser = null;
        OptionSet options = null;
        try {
            parser = getParser();
            options = parser.parse(args);
        } catch(OptionException oe) {
            parser.printHelpOn(System.out);
            printUsageAndDie("Exception when parsing arguments : " + oe.getMessage());
            return;
        }

        /* validate options */
        if(options.has("help")) {
            parser.printHelpOn(System.out);
            printUsage();
            return;
        }
        if(!options.hasArgument("url") || !options.hasArgument("in-dir")
           || !options.hasArgument("out-dir")) {
            parser.printHelpOn(System.out);
            printUsageAndDie("Missing a required argument.");
            return;
        }

        String url = (String) options.valueOf("url");

        String inDir = (String) options.valueOf("in-dir");
        Utils.mkdirs(new File(inDir));

        String outDir = (String) options.valueOf("out-dir");
        Utils.mkdirs(new File(outDir));

        List<String> storeNames = null;
        if(options.hasArgument("store-names")) {
            @SuppressWarnings("unchecked")
            List<String> list = (List<String>) options.valuesOf("store-names");
            storeNames = list;
        }

        Integer keyParallelism = DEFAULT_KEY_PARALLELISM;
        if(options.hasArgument("parallelism")) {
            keyParallelism = (Integer) options.valueOf("parallelism");
        }

        Integer progressPeriodOps = DEFAULT_PROGRESS_PERIOD_OPS;
        if(options.hasArgument("progress-period-ops")) {
            progressPeriodOps = (Integer) options.valueOf("progress-period-ops");
        }

        Integer outputBatchSize = DEFAULT_OUTPUT_BATCH_SIZE;
        if(options.hasArgument("output-batch-size")) {
            outputBatchSize = (Integer) options.valueOf("output-batch-size");
        }

        boolean details = options.has("details");

        try {
            KeyVersionFetcherCLI sampler = new KeyVersionFetcherCLI(url,
                                                                    inDir,
                                                                    outDir,
                                                                    storeNames,
                                                                    keyParallelism,
                                                                    progressPeriodOps,
                                                                    outputBatchSize,
                                                                    details);

            try {
                if(!sampler.sampleStores()) {
                    logger.error("Key-versions were not successfully sampled from some stores.");
                }
            } finally {
                sampler.stop();
            }

        } catch(Exception e) {
            logger.error("Exception during key-version sampling: ", e);
        }
    }
1303150
public static void main(String[] args) throws Exception {

		final ParameterTool params = ParameterTool.fromArgs(args);

		// set up the execution environment
		final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();

		// make parameters available in the web interface
		env.getConfig().setGlobalJobParameters(params);

		// get input data
		DataSet<String> text;
		if (params.has("input")) {
			// read the text file from given input path
			text = env.readTextFile(params.get("input"));
		} else {
			// get default test text data
			System.out.println("Executing WordCount example with default input data set.");
			System.out.println("Use --input to specify file input.");
			text = WordCountData.getDefaultTextLineDataSet(env);
		}

		DataSet<Tuple2<String, Integer>> counts =
				// split up the lines in pairs (2-tuples) containing: (word,1)
				text.flatMap(new Tokenizer())
				// group by the tuple field "0" and sum up tuple field "1"
				.groupBy(0)
				.sum(1);

		// emit result
		if (params.has("output")) {
			counts.writeAsCsv(params.get("output"), "\n", " ");
			// execute program
			env.execute("WordCount Example");
		} else {
			System.out.println("Printing result to stdout. Use --output to specify output path.");
			counts.print();
		}

	}
1083569
public static void main(String[] args) throws Exception {
    parseArgs(args);

    GenMunger rawMunger;
    rawMunger = (hex.genmodel.GenMunger) Class.forName(assemblyClassName).newInstance();

    BufferedReader input = new BufferedReader(new FileReader(inputCSVFileName));
    BufferedWriter output = new BufferedWriter(new FileWriter(outputCSVFileName));

    // Emit outputCSV column names.
    String[] rawHeader = rawMunger.outNames();
    StringBuilder header = new StringBuilder();
    for(int i=0;i<rawHeader.length;++i) {
      header.append("\"").append(rawHeader[i]).append("\"");
      if( i < rawHeader.length - 1 ) header.append(",");
    }
    output.write(header.toString());
    output.write("\n");

    // Loop over inputCSV one row at a time.
    int lineNum = 0;
    String line;
    try {
      while ((line = input.readLine()) != null) {
        lineNum++;

        // skip the header.
        if (lineNum == 1)
          continue;

        // Parse the CSV line.  Somewhat handles quoted commas.  But this ain't no parser test!
        RowData row;
        try {
          row = parseDataRow(line, rawMunger);
        } catch( NumberFormatException nfe) {
          nfe.printStackTrace();
          System.out.println("Failed to parse row: " + lineNum );
          throw new RuntimeException();
        }
        RowData mungedRow = rawMunger.fit(row);

        for(int i=0; i<rawMunger.outNames().length;++i) {
          Object val = mungedRow==null?Double.NaN:mungedRow.get(rawMunger.outNames()[i]);
          if( val instanceof Double ) output.write(String.valueOf(val));
          else                        output.write("\"" + val + "\"");
          if( i < rawMunger.outNames().length - 1) output.write(",");
        }
        output.write("\n");
      }
    }
    catch (Exception e) {
      System.out.println("Caught exception on line " + lineNum);
      System.out.println("");
      e.printStackTrace();
      System.exit(1);
    }
    finally {

      // Clean up.
      output.close();
      input.close();
    }

    // Predictions were successfully generated.  Calling program can now compare them with something.
    System.exit(0);
  }
969884
public static void main(String[] args) throws Exception {

		// Checking input parameters
		final ParameterTool params = ParameterTool.fromArgs(args);

		StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
		env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime);

		DataStream<Integer> trainingData = env.addSource(new FiniteTrainingDataSource());
		DataStream<Integer> newData = env.addSource(new FiniteNewDataSource());

		// build new model on every second of new data
		DataStream<Double[]> model = trainingData
				.assignTimestampsAndWatermarks(new LinearTimestamp())
				.timeWindowAll(Time.of(5000, TimeUnit.MILLISECONDS))
				.apply(new PartialModelBuilder());

		// use partial model for newData
		DataStream<Integer> prediction = newData.connect(model).map(new Predictor());

		// emit result
		if (params.has("output")) {
			prediction.writeAsText(params.get("output"));
		} else {
			System.out.println("Printing result to stdout. Use --output to specify output path.");
			prediction.print();
		}

		// execute program
		env.execute("Streaming Incremental Learning");
	}
402598
public static void main(String[] args) {
        try {
        	CSVDumper app = new CSVDumper();
        	app.parseArgs(args);
        	app.run();
            System.exit(0);
        }
        catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }        
    }
357256
public static void main(String[] args) throws Exception {

		// Checking input parameters
		final ParameterTool params = ParameterTool.fromArgs(args);

		// set up input for the stream of integer pairs

		// obtain execution environment and set setBufferTimeout to 1 to enable
		// continuous flushing of the output buffers (lowest latency)
		StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment()
				.setBufferTimeout(1);

		// make parameters available in the web interface
		env.getConfig().setGlobalJobParameters(params);

		// create input stream of integer pairs
		DataStream<Tuple2<Integer, Integer>> inputStream;
		if (params.has("input")) {
			inputStream = env.readTextFile(params.get("input")).map(new FibonacciInputMap());
		} else {
			System.out.println("Executing Iterate example with default input data set.");
			System.out.println("Use --input to specify file input.");
			inputStream = env.addSource(new RandomFibonacciSource());
		}

		// create an iterative data stream from the input with 5 second timeout
		IterativeStream<Tuple5<Integer, Integer, Integer, Integer, Integer>> it = inputStream.map(new InputMap())
				.iterate(5000);

		// apply the step function to get the next Fibonacci number
		// increment the counter and split the output with the output selector
		SplitStream<Tuple5<Integer, Integer, Integer, Integer, Integer>> step = it.map(new Step())
				.split(new MySelector());

		// close the iteration by selecting the tuples that were directed to the
		// 'iterate' channel in the output selector
		it.closeWith(step.select("iterate"));

		// to produce the final output select the tuples directed to the
		// 'output' channel then get the input pairs that have the greatest iteration counter
		// on a 1 second sliding window
		DataStream<Tuple2<Tuple2<Integer, Integer>, Integer>> numbers = step.select("output")
				.map(new OutputMap());

		// emit results
		if (params.has("output")) {
			numbers.writeAsText(params.get("output"));
		} else {
			System.out.println("Printing result to stdout. Use --output to specify output path.");
			numbers.print();
		}

		// execute the program
		env.execute("Streaming Iteration Example");
	}
562149
public static void main(String[] args) throws Exception {
    Builder builder = Builder.newBuilder();

    Streamlet<Integer> zeroes = builder.newSource(() -> 0);

    builder.newSource(() -> ThreadLocalRandom.current().nextInt(1, 11))
        .setName("random-ints")
        .map(i -> i + 1)
        .setName("add-one")
        .union(zeroes)
        .setName("unify-streams")
        .filter(i -> i != 2)
        .setName("remove-twos")
        .log();

    Config config = Config.newBuilder()
        .setNumContainers(NUM_CONTAINERS)
        .setPerContainerRamInGigabytes(GIGABYTES_OF_RAM)
        .setPerContainerCpu(CPU)
        .build();

    // Fetches the topology name from the first command-line argument
    String topologyName = StreamletUtils.getTopologyName(args);

    // Finally, the processing graph and configuration are passed to the Runner, which converts
    // the graph into a Heron topology that can be run in a Heron cluster.
    new Runner().run(topologyName, config, builder);
  }
225808
public static void main(String args[]) throws Exception {

		// create Options object
		Options options = new Options();
		// add options
		options.addOption("path", true,
				"path to the Linear BDB index that contains the training vectors: e.g. C:/lef/BDB_1024/");
		options.addOption("d", true, "the dimensionality of the training vectors: e.g. 128 or 1024");
		options.addOption("m", true,
				"the number of subvectors to be created (d should be divided exactly by m)");
		options.addOption("c", true, "the number of centroids of each subquantizer: e.g. 256 or 1024");
		options.addOption("transform", true,
				"the type of transformation to apply before learning the product quantizer");
		options.addOption("samples", true, "how many learning vectors to use: e.g. 20000");
		options.addOption("i", true, "the maximum number of clustering iterations (default 100).");
		options.addOption("s", true, "the number of parallel execution slots to use in k-means clustering");

		options.addOption("split", false,
				"whether to also split the training vectors before learning the sub-quantizers");
		options.addOption("ivf", false,
				"whether product quantization will be combined with an inverted file (ivf)");
		options.addOption("cqfile", true, "path to the coarse quantizer file");
		options.addOption("cqcentroids", true, "number of coarse quantizer centroids: e.g. 8192");

		CommandLineParser parser = new PosixParser();
		CommandLine cmd = null;
		try {
			cmd = parser.parse(options, args);
		} catch (ParseException e) {
			System.out.println(e.getMessage());
			System.exit(0);
		}

		HelpFormatter formatter = new HelpFormatter();
		formatter.printHelp("Product quantization learning", options, true);

		// the following two parameters get the default value of false is they are
		// not passed in the console
		boolean split = cmd.hasOption("split");
		if (split) {
			System.out.println("Vectors will be splitted");
		} else {
			System.out.println("Splitting will not be performed");
		}
		String transformationType = null;
		if (cmd.getOptionValue("transform").equals("no")) {
			System.out.println("No transformation will be applied");
			transformationType = "no";
		} else if (cmd.getOptionValue("transform").equals("rr")) {
			System.out.println("Random Rotation will be applied");
			transformationType = "rr";
		} else if (cmd.getOptionValue("transform").equals("rp")) {
			System.out.println("Random Permutation will be applied");
			transformationType = "rp";
		} else {
			throw new Exception("Unsupported transformation type!");
		}
		boolean ivf = cmd.hasOption("ivf");
		String coarseQuantizerFile = "";
		int numCoarseCentroids = 0;
		if (ivf) {
			System.out.println("IVF will be used");
			// parse the other ivf related options
			if (cmd.getOptionValue("cqfile") == null) {
				throw new Exception("IVF selected but coarse quantizer file not given.");
			}
			coarseQuantizerFile = cmd.getOptionValue("cqfile");

			if (cmd.getOptionValue("cqcentroids") == null) {
				throw new Exception("IVF selected but number of coarse quantizer centroids not given.");
			}
			numCoarseCentroids = Integer.parseInt(cmd.getOptionValue("cqcentroids"));
		}

		int numVectors;
		if (cmd.getOptionValue("samples") == null) {
			System.out.println("Using the default 50000 samples for learning.");
			numVectors = 50000;
		} else {
			numVectors = Integer.parseInt(cmd.getOptionValue("samples"));
			System.out.println("Using " + numVectors + " samples for learning.");
		}

		int maxIterations;
		if (cmd.getOptionValue("i") == null) {
			System.out.println("Using the default 100 max iterations.");
			maxIterations = 100;
		} else {
			maxIterations = Integer.parseInt(cmd.getOptionValue("i"));
			System.out.println("Using " + maxIterations + " maximum iterations.");
		}

		String BDBpath = cmd.getOptionValue("path");
		if (cmd.getOptionValue("path") == null) {
			throw new Exception("The path to the training vectors is undefined!");
		}

		int numSlots = 1;
		if (cmd.getOptionValue("s") == null) {
			System.out.println("Using 1 execution slot!");
		}
		numSlots = Integer.parseInt(cmd.getOptionValue("s"));

		int vectorLength;
		if (cmd.getOptionValue("d") == null) {
			throw new Exception("The dimensionality of the training vectors is undefined!");
		}
		vectorLength = Integer.parseInt(cmd.getOptionValue("d"));

		int numProductCentroids;
		if (cmd.getOptionValue("d") == null) {
			throw new Exception("The number of centroids for each sub-quantizer is undefined!");
		}
		numProductCentroids = Integer.parseInt(cmd.getOptionValue("c"));

		int m;
		if (cmd.getOptionValue("m") == null) {
			throw new Exception("The number of sub-vectors is undefined!");
		}
		m = Integer.parseInt(cmd.getOptionValue("m"));
		// checking that m is valid
		int subVectorLength;// the dimensionality of the subvectors
		if (vectorLength % m != 0) { // d is not a multiple of m
			throw new Exception("d is not a multiple of m");
		}
		subVectorLength = vectorLength / m;

		RandomRotation rr = null;
		RandomPermutation rp = null;
		if (transformationType.equals("rr")) {
			rr = new RandomRotation(1, vectorLength);
		} else if (transformationType.equals("rp")) {
			rp = new RandomPermutation(1, vectorLength);
		}

		System.out.println("== Creating subquantizers using " + numVectors + " vectors ==");
		System.out.println("Vector dimensionality: " + vectorLength);
		System.out.println("Sub vector dimensionality: " + subVectorLength);
		System.out.println("Num centroids: " + numProductCentroids);
		System.out.println("Max iterations: " + maxIterations);

		// create a single file to store all the sub-quantizers of the product quantizer
		// construct the filename
		String subquantizersFilename = BDBpath + "/pq_" + vectorLength + "_" + m + "x"
				+ (int) (Math.log(numProductCentroids) / Math.log(2)) + "_" + numVectors;
		if (transformationType.equals("rr")) {
			subquantizersFilename += "_rr";
		} else if (transformationType.equals("rp")) {
			subquantizersFilename += "_rp";
		}
		if (ivf) {
			subquantizersFilename += "_ivf_c" + numCoarseCentroids;
		}
		subquantizersFilename += ".csv";
		BufferedWriter out = new BufferedWriter(new FileWriter(new String(subquantizersFilename)));

		// load the vectors from the Linear index (BDB store)
		Linear vectors = new Linear(vectorLength, numVectors, true, BDBpath, false, true, 0);
		// in case of ivf, load the coarse quantizer so that residual vectors can be computed.
		ResidualVectorComputation res = null;
		if (ivf) {
			double[][] coarseQuantizer = AbstractFeatureAggregator.readQuantizer(coarseQuantizerFile,
					numCoarseCentroids, vectorLength);
			res = new ResidualVectorComputation(coarseQuantizer, vectorLength, numCoarseCentroids);
		}

		// create one Instances object for learning each sub-quantizer
		Instances[] datasets = new Instances[m];
		// creating weka attributes
		ArrayList<Attribute> attributes = new ArrayList<Attribute>();
		for (int i = 0; i < subVectorLength; i++) {
			Attribute attr = new Attribute("feature" + (i + 1));
			attributes.add(attr);
		}
		for (int i = 0; i < m; i++) {
			datasets[i] = new Instances("subvectors", attributes, numVectors);
		}

		// load the sub-vectors into the corresponding Instances objects
		for (int i = 0; i < numVectors; i++) {
			double[] vector = vectors.getVector(i);
			// compute the residual vector if needed
			if (ivf) {
				vector = res.ComputeResidualVector(vector);
			}
			// apply the appropriate transformation
			if (transformationType.equals("rr")) {
				vector = rr.rotate(vector);
			} else if (transformationType.equals("rp")) {
				vector = rp.permute(vector);
			}
			// load each sub-vector into the corresponding Instances object
			for (int j = 0; j < m; j++) {
				double[] subVector = Arrays.copyOfRange(vector, j * subVectorLength, j * subVectorLength
						+ subVectorLength);
				DenseInstance instance = new DenseInstance(1.0, subVector);
				datasets[j].add(instance);
			}
		}

		// learning the sub-quantizers with k-means clustering
		for (int i = 0; i < m; i++) {
			System.out.println("Learning sub-quantizer " + (i + 1));
			double minSSE = Double.MAX_VALUE;
			SimpleKMeans bestClusterer = null;
			// try k-mean using numKmeansRepeats different random seeds and keep the one with lowest SSE
			for (int j = 0; j < numKmeansRepeats; j++) {
				// Create a new k-means instance
				SimpleKMeans clusterer = new SimpleKMeans();
				clusterer.setInitializationMethod(new SelectedTag(SimpleKMeans.KMEANS_PLUS_PLUS,
						SimpleKMeans.TAGS_SELECTION));
				clusterer.setNumExecutionSlots(numSlots);
				clusterer.setNumClusters(numProductCentroids);
				clusterer.setMaxIterations(maxIterations);
				// clusterer.setDebug(false);
				clusterer.setSeed(j + 1);
				// build the clusterer
				clusterer.buildClusterer(datasets[i]);
				double SSE = clusterer.getSquaredError();
				if (SSE < minSSE) {
					minSSE = SSE;
					bestClusterer = (SimpleKMeans) AbstractClusterer.makeCopy(clusterer);
				}
			}

			System.out.println("Mininum SSE: " + minSSE + " Seed: " + bestClusterer.getSeed());
			System.out.println("Saving best sub-quantizer in file..");
			// write the results of the clustering to the new file (csv formated)
			Instances clusterCentroids = bestClusterer.getClusterCentroids();
			for (int j = 0; j < clusterCentroids.numInstances(); j++) {
				Instance centroid = clusterCentroids.instance(j);
				for (int k = 0; k < centroid.numAttributes() - 1; k++) {
					out.write(centroid.value(k) + ",");
				}
				out.write(centroid.value(centroid.numAttributes() - 1) + "\n");
			}

			// check whether fewer than the desired clusters where generated and add fake centroids in that
			// case
			int numCentroidsMissing = numProductCentroids - clusterCentroids.numInstances();
			// add fake, distant centroids so that no vector is quantized in them
			if (numCentroidsMissing > 0) {
				System.out
						.println("Problem! Number of generated clusters is smaller that the desired one. Use more samples!");
				System.out.println("Non empty clusters: " + clusterCentroids.numInstances() + " instead of: "
						+ numProductCentroids);
				// System.exit(1);
				// Random rand = new Random(1);
				for (int k = 0; k < numCentroidsMissing; k++) {
					// int index = rand.nextInt(dataset.numInstances());
					// String instanceString = dataset.instance(index).toStringNoWeight();
					// outputStream.println(instanceString);
					for (int f = 0; f < subVectorLength - 1; f++) {
						out.write("1000,");
					}
					out.write("1000\n");
				}
			}
			out.flush();
		}
		out.close();

	}
68625
public static void main(String[] args) throws Exception {

		ParameterTool params = ParameterTool.fromArgs(args);

		final int numPages = params.getInt("numPages", PageRankData.getNumberOfPages());
		final int maxIterations = params.getInt("iterations", 10);

		// set up execution environment
		final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();

		// make the parameters available to the web ui
		env.getConfig().setGlobalJobParameters(params);

		// get input data
		DataSet<Long> pagesInput = getPagesDataSet(env, params);
		DataSet<Tuple2<Long, Long>> linksInput = getLinksDataSet(env, params);

		// assign initial rank to pages
		DataSet<Tuple2<Long, Double>> pagesWithRanks = pagesInput.
				map(new RankAssigner((1.0d / numPages)));

		// build adjacency list from link input
		DataSet<Tuple2<Long, Long[]>> adjacencyListInput =
				linksInput.groupBy(0).reduceGroup(new BuildOutgoingEdgeList());

		// set iterative data set
		IterativeDataSet<Tuple2<Long, Double>> iteration = pagesWithRanks.iterate(maxIterations);

		DataSet<Tuple2<Long, Double>> newRanks = iteration
				// join pages with outgoing edges and distribute rank
				.join(adjacencyListInput).where(0).equalTo(0).flatMap(new JoinVertexWithEdgesMatch())
				// collect and sum ranks
				.groupBy(0).aggregate(SUM, 1)
				// apply dampening factor
				.map(new Dampener(DAMPENING_FACTOR, numPages));

		DataSet<Tuple2<Long, Double>> finalPageRanks = iteration.closeWith(
				newRanks,
				newRanks.join(iteration).where(0).equalTo(0)
				// termination condition
				.filter(new EpsilonFilter()));

		// emit result
		if (params.has("output")) {
			finalPageRanks.writeAsCsv(params.get("output"), "\n", " ");
			// execute program
			env.execute("Basic Page Rank Example");
		} else {
			System.out.println("Printing result to stdout. Use --output to specify output path.");
			finalPageRanks.print();
		}
	}
565337
public static void main(String[] args) throws Exception {

    NormalAlphabet na = new NormalAlphabet();
    SAXProcessor sp = new SAXProcessor();

    String dataFileName = args[0];

    System.out.println("data file: " + dataFileName);
    double[] ts = TSProcessor.readFileColumn(dataFileName, 0, 0);
    System.out.println("data size: " + ts.length);
    System.out.println("SAX parameters:\n sliding window sizes: " + Arrays.toString(WINDOWS)
        + "\n PAA sizes: " + Arrays.toString(PAAS) + "\n alphabet sizes: "
        + Arrays.toString(ALPHABETS) + "\n NR strategis: " + Arrays.toString(NRS));

    System.out.println(
        "Performing " + NRUNS + " SAX conversion runs for each algorithm implementation ... ");

    // conventional
    //
    long tstamp1 = System.currentTimeMillis();
    for (int slidingWindowSize : WINDOWS) {
      for (int paaSize : PAAS) {
        for (int alphabetSize : ALPHABETS) {
          for (String nrStrategy : NRS) {

            for (int i = 0; i < NRUNS; i++) {
              @SuppressWarnings("unused")
              SAXRecords sequentialRes = sp.ts2saxViaWindow(ts, slidingWindowSize, paaSize,
                  na.getCuts(alphabetSize), NumerosityReductionStrategy.fromString(nrStrategy),
                  N_THRESHOLD);
            }

          }
        }
      }
    }
    long tstamp2 = System.currentTimeMillis();
    System.out.println("single thread conversion: " + String.valueOf(tstamp2 - tstamp1) + ", "
        + SAXProcessor.timeToString(tstamp1, tstamp2));

    // parallel
    for (int threadsNum = MIN_CPUS; threadsNum < MAX_CPUS; threadsNum++) {
      tstamp1 = System.currentTimeMillis();

      for (int slidingWindowSize : WINDOWS) {
        for (int paaSize : PAAS) {
          for (int alphabetSize : ALPHABETS) {
            for (String nrStrategy : NRS) {

              for (int i = 0; i < NRUNS; i++) {
                ParallelSAXImplementation ps = new ParallelSAXImplementation();
                @SuppressWarnings("unused")
                SAXRecords parallelRes = ps.process(ts, threadsNum, slidingWindowSize, paaSize,
                    alphabetSize, NumerosityReductionStrategy.fromString(nrStrategy), N_THRESHOLD);
              }

            }
          }
        }
      }

      tstamp2 = System.currentTimeMillis();
      System.out.println("parallel conversion using " + threadsNum + " threads: "
          + String.valueOf(tstamp2 - tstamp1) + ", " + SAXProcessor.timeToString(tstamp1, tstamp2));
    }
  }
574419
public static void main( String [] args ) throws IOException
    {
        String filename = args[0];
        String param = args[1];
        String value = args[2];

        try (FileReader fr = new FileReader( filename )) {
            String templateText = SimpleTemplate.getStringFromStream( fr );
            SimpleTemplate template = new SimpleTemplate( templateText );

            template.replace( param, value );
            template.write( System.out );
        }
    }
709656
public static void main(String[] args) throws Exception {
        for (String arg : args) {
            Class clazz = Class.forName(arg);
            System.out.println("Examining: " + clazz.getName());
            try {
                examine(clazz);
                System.out.println("Passed");
            } catch (MalformedTypeException e) {
                System.out.println("Malformed type: " + e.getMalformedType().getName());
                for (String message : e.getMessages()) {
                    System.out.println(message);
                }
            }
        }
    }
249870
public static void main(String[] args) throws IOException, AWTException {
        logger.entry();
          
        File file = new File("/home/karsten/samples/65535sects.exe"); 
        ReportCreator reporter = ReportCreator.apply(file);
        reporter.printReport();
//        File file2 = new File("/home/katja/samples/tesla2");
//        List<File> list = new ArrayList<>();
//        list.add(file);
//        list.add(file2);
        // TODO create Unit test for resource type with name!
//        for (File file : folder.listFiles()) {
//            if (!file.isDirectory() && new PESignature(file).exists()) {
//            	System.out.println("Report for " + file.getName());
//            	System.out.println();
//            	DiffReportCreator.newInstance(list).printReport();
//            }
//        }
        
//         VisualizerBuilder builder = new VisualizerBuilder();
//         Visualizer vi = builder.build();
//         final BufferedImage entropyImage = vi.createEntropyImage(file);
//         final BufferedImage structureImage = vi.createImage(file);
//         final BufferedImage appendedImage = ImageUtil.appendImages(
//         entropyImage, structureImage);
//         show(appendedImage);
    }
823604
public static void main(String[] args) {
    System.out.printf("TFile Dumper (TFile %s, BCFile %s)\n", TFile.API_VERSION
        .toString(), BCFile.API_VERSION.toString());
    if (args.length == 0) {
      System.out
          .println("Usage: java ... org.apache.hadoop.io.file.tfile.TFile tfile-path [tfile-path ...]");
      System.exit(0);
    }
    Configuration conf = new Configuration();

    for (String file : args) {
      System.out.println("===" + file + "===");
      try {
        TFileDumper.dumpInfo(file, System.out, conf);
      } catch (IOException e) {
        e.printStackTrace(System.err);
      }
    }
  }