Example of SURF extraction, multiVLAD aggregation and PCA-projection of a single image using this
class.

@param args
@throws Exception
342806
public static void main(String args[]) throws Exception {
		String imageFolder = "C:/images/";
		String imagFilename = "test.jpg";
		String[] codebookFiles = { "C:/codebook1.csv", "C:/codebook2.csv", "C:/codebook3.csv",
				"C:/codebook4.csv" };
		int[] numCentroids = { 64, 64, 64, 64 };

		String pcaFilename = "C:/pca.txt";
		int initialLength = numCentroids.length * numCentroids[0] * AbstractFeatureExtractor.SURFLength;
		int targetLength = 128;

		ImageVectorization imvec = new ImageVectorization(imageFolder, imagFilename, targetLength, 512 * 384);
		ImageVectorization.setFeatureExtractor(new SURFExtractor());
		double[][][] codebooks = AbstractFeatureAggregator.readQuantizers(codebookFiles, numCentroids,
				AbstractFeatureExtractor.SURFLength);
		ImageVectorization.setVladAggregator(new VladAggregatorMultipleVocabularies(codebooks));
		if (targetLength < initialLength) {
			PCA pca = new PCA(targetLength, 1, initialLength, true);
			pca.loadPCAFromFile(pcaFilename);
			ImageVectorization.setPcaProjector(pca);
		}
		imvec.setDebug(true);

		ImageVectorizationResult imvr = imvec.call();
		System.out.println(imvr.getImageName() + ": " + Arrays.toString(imvr.getImageVector()));
	}
162312
public static void main(String[] args) throws Exception {

		boolean valid = true;
		boolean requiredArguments = false;

		TileFormatType tileType = null;
		String imageFormat = null;
		boolean rawImage = false;
		File geoPackageFile = null;
		String tileTable = null;
		File outputDirectory = null;
		Integer width = null;
		Integer height = null;

		for (int i = 0; valid && i < args.length; i++) {

			String arg = args[i];

			// Handle optional arguments
			if (arg.startsWith(ARGUMENT_PREFIX)) {

				String argument = arg.substring(ARGUMENT_PREFIX.length());

				switch (argument) {
				case ARGUMENT_TILE_TYPE:
					if (i < args.length) {
						String tiletypeString = args[++i].toUpperCase();
						try {
							tileType = TileFormatType.valueOf(tiletypeString);
						} catch (IllegalArgumentException e) {
							valid = false;
							System.out
									.println("Error: Image Tile Type argument '"
											+ arg
											+ "' must be followed by a valid tile format type. Invalid: "
											+ tiletypeString);
						}
					} else {
						valid = false;
						System.out
								.println("Error: Tile Type argument '"
										+ arg
										+ "' must be followed by a tile type (geopackage, standard, tms)");
					}
					break;

				case ARGUMENT_IMAGE_FORMAT:
					if (i < args.length) {
						imageFormat = args[++i];
					} else {
						valid = false;
						System.out.println("Error: Image Format argument '"
								+ arg + "' must be followed by a image format");
					}
					break;

				case ARGUMENT_RAW_IMAGE:
					rawImage = true;
					break;

				case ARGUMENT_IMAGE_WIDTH:
					if (i < args.length) {
						String widthString = args[++i];
						try {
							width = Integer.valueOf(widthString);
						} catch (NumberFormatException e) {
							valid = false;
							System.out
									.println("Error: Image Width argument '"
											+ arg
											+ "' must be followed by a valid width in pixels. Invalid: "
											+ widthString);
						}
					} else {
						valid = false;
						System.out
								.println("Error: Image Width argument '"
										+ arg
										+ "' must be followed by a image width in pixels");
					}
					break;

				case ARGUMENT_IMAGE_HEIGHT:
					if (i < args.length) {
						String heightString = args[++i];
						try {
							height = Integer.valueOf(heightString);
						} catch (NumberFormatException e) {
							valid = false;
							System.out
									.println("Error: Image Height argument '"
											+ arg
											+ "' must be followed by a valid height in pixels. Invalid: "
											+ heightString);
						}
					} else {
						valid = false;
						System.out
								.println("Error: Image Height argument '"
										+ arg
										+ "' must be followed by a height width in pixels");
					}
					break;

				default:
					valid = false;
					System.out.println("Error: Unsupported arg: '" + arg + "'");
				}

			} else {
				// Set required arguments in order
				if (geoPackageFile == null) {
					geoPackageFile = new File(arg);
				} else if (tileTable == null) {
					tileTable = arg;
				} else if (outputDirectory == null) {
					outputDirectory = new File(arg);
					requiredArguments = true;
				} else {
					valid = false;
					System.out.println("Error: Unsupported extra argument: "
							+ arg);
				}
			}
		}

		if (!valid || !requiredArguments) {
			printUsage();
		} else {
			// Write the tiles
			try {
				writeTiles(geoPackageFile, tileTable, outputDirectory,
						imageFormat, width, height, tileType, rawImage);
			} catch (Exception e) {
				printUsage();
				throw e;
			}
		}

	}
856003
public static void main(String argv[]) throws Exception {
    DnsMonitorSecurityManager.setTheManager();
    AvatarZKShell shell = null;

    shell = new AvatarZKShell();
    int res;
    try {
      res = ToolRunner.run(shell, argv);
    } finally {
      shell.close();
    }
    System.exit(res);
  }
537632
public static void main(String[] args) throws Exception {
    CommandLineParser parser = new DefaultParser();
    Options slaManagerCliOptions = constructCliOptions();

    // parse the help options first.
    Options helpOptions = constructHelpOptions();
    CommandLine cmd = parser.parse(helpOptions, args, true);
    if (cmd.hasOption("h")) {
      usage(slaManagerCliOptions);
      return;
    }

    try {
      cmd = parser.parse(slaManagerCliOptions, args);
    } catch (ParseException e) {
      usage(slaManagerCliOptions);
      throw new RuntimeException("Error parsing command line options: ", e);
    }

    DownloaderMode mode = DownloaderMode.cluster;
    if (cmd.hasOption(CliArgs.MODE.text)) {
      mode = DownloaderMode.valueOf(cmd.getOptionValue(CliArgs.MODE.text, null));
    }

    Config config;
    switch (mode) {
      case cluster:
        config = Config.toClusterMode(Config.newBuilder()
            .putAll(ConfigLoader.loadClusterConfig())
            .build());
        break;

      case local:
        if (!cmd.hasOption(CliArgs.HERON_HOME.text) || !cmd.hasOption(CliArgs.CONFIG_PATH.text)) {
          throw new IllegalArgumentException("Missing heron_home or config_path argument");
        }
        String heronHome = cmd.getOptionValue(CliArgs.HERON_HOME.text, null);
        String configPath = cmd.getOptionValue(CliArgs.CONFIG_PATH.text, null);
        config = Config.toLocalMode(Config.newBuilder()
            .putAll(ConfigLoader.loadConfig(heronHome, configPath, null, null))
            .build());
        break;

      default:
        throw new IllegalArgumentException(
            "Invalid mode: " + cmd.getOptionValue(CliArgs.MODE.text));
    }

    String uri = cmd.getOptionValue(CliArgs.TOPOLOGY_PACKAGE_URI.text, null);
    String destination = cmd.getOptionValue(CliArgs.EXTRACT_DESTINATION.text, null);
    // make it compatible with old param format
    if (uri == null && destination == null) {
      String[] leftOverArgs = cmd.getArgs();
      if (leftOverArgs.length != 2) {
        System.err.println("Usage: downloader <topology-package-uri> <extract-destination>");
        return;
      }
      uri = leftOverArgs[0];
      destination = leftOverArgs[1];
    }

    final URI topologyLocation = new URI(uri);
    final Path topologyDestination = Paths.get(destination);

    final File file = topologyDestination.toFile();
    if (!file.exists()) {
      file.mkdirs();
    }

    Class clazz = Registry.UriToClass(config, topologyLocation);
    final Downloader downloader = Registry.getDownloader(clazz, topologyLocation);
    downloader.download(topologyLocation, topologyDestination);
  }
1002097
public static void main(String[] args) throws Exception {
        String loopBack = null;
        Socket socket = new Socket(loopBack, Integer.parseInt(args[0]));
        InputStream inStream = socket.getInputStream();
        OutputStream outStream = socket.getOutputStream();
        Map<String, Consumer<OutputStream>> outputs = new HashMap<>();
        outputs.put("out", st -> System.setOut(new PrintStream(st, true)));
        outputs.put("err", st -> System.setErr(new PrintStream(st, true)));
        Map<String, Consumer<InputStream>> input = new HashMap<>();
        input.put("in", System::setIn);
        forwardExecutionControlAndIO(new RemoteExecutionControl(), inStream, outStream, outputs, input);
    }
853519
public static void main(String[] args) throws Exception {
		CWSTagger tag = new CWSTagger("../models/seg.m");
		System.out.println("不使用词典的分词：");
		String str = " 媒体计算研究所成立了, 高级数据挖掘(data mining)很难。 乐phone热卖！";
		String s = tag.tag(str);
		System.out.println(s);
		
		//设置英文预处理
		tag.setEnFilter(true);
		s = tag.tag(str);
		System.out.println(s);
//		tag.setEnFilter(false);
		
		System.out.println("\n设置临时词典：");
		ArrayList<String> al = new ArrayList<String>();
		al.add("数据挖掘");
		al.add("媒体计算研究所");
		al.add("乐phone");
		Dictionary dict = new Dictionary(false);
		dict.addSegDict(al);
		tag.setDictionary(dict);
		s = tag.tag(str);
		System.out.println(s);
		
		
		CWSTagger tag2 = new CWSTagger("../models/seg.m", new Dictionary("../models/dict.txt"));
		System.out.println("\n使用词典的分词：");
		String str2 = "媒体计算研究所成立了, 高级数据挖掘很难。 乐phone热卖！";
		String s2 = tag2.tag(str2);
		System.out.println(s2);
		
		//使用不严格的词典
		CWSTagger tag3 = new CWSTagger("../models/seg.m", new Dictionary("../models/dict_ambiguity.txt",true));
		//尽量满足词典，比如词典中有“成立”“成立了”和“了”, 会使用Viterbi决定更合理的输出
		System.out.println("\n使用不严格的词典的分词：");
		String str3 = "媒体计算研究所成立了, 高级数据挖掘很难";
		String s3 = tag3.tag(str3);
		System.out.println(s3);
		str3 = "我送给力学系的同学一个玩具 (送给给力力学力学系都在词典中)";
		s3 = tag3.tag(str3);
		System.out.println(s3);
		
		System.out.println("\n处理文件：");
		String s4 = tag.tagFile("../example-data/data-tag.txt");
		System.out.println(s4);
		
		String s5 = tag2.tagFile("../example-data/data-tag.txt");
		System.out.println(s5);
		
	}
48739
public static void main(String argv[]) throws Exception {   
    DnsMonitorSecurityManager.setTheManager();
    AvatarShell shell = null;
    try {
      shell = new AvatarShell();
    } catch (RPC.VersionMismatch v) {
      System.err.println("Version Mismatch between client and server"
          + "... command aborted.");
      System.exit(-1);
    } catch (IOException e) {
      System.err.println("Bad connection to AvatarNode. command aborted.");
      System.exit(-1);
    }

    int res;
    try {
      res = ToolRunner.run(shell, argv);
    } finally {
      shell.close();
    }
    System.exit(res);
  }
687576
public static void main(String[] args) throws Exception {
        RLogPanel log = new RLogPanel();
        JFrame f = new JFrame();
        f.setContentPane(log);
        f.setVisible(true);
        f.pack();
        Rsession R = RserveSession.newInstanceTry(log, null);
        R.rawEval("ls()");
    }
1208796
static public void main (String[] args) throws Exception {
		if (args.length == 0) {
			String commandLine = "-f 0 -wi 1 -i 1 -t 1 -w 1s -r 1s " // For developement only (fork 0, short runs).
			// + "-bs 2500000 ArrayBenchmark" //
			// + "-rf csv FieldSerializerBenchmark.field FieldSerializerBenchmark.tagged" //
			// + "FieldSerializerBenchmark.tagged" //
			;
			System.out.println(commandLine);
			args = commandLine.split(" ");
		}
		Main.main(args);
	}
698887
@Execute
    public void process() throws Exception {
        if (!concatOr(outFlow == null, doReset)) {
            return;
        }
        checkNull(inFlow, inPit);

        RegionMap regionMap = CoverageUtilities.getRegionParamsFromGridCoverage(inPit);
        cols = regionMap.getCols();
        rows = regionMap.getRows();
        xRes = regionMap.getXres();
        yRes = regionMap.getYres();
        dxySqrt = Math.sqrt(xRes * xRes + yRes * yRes);

        RenderedImage pitfillerRI = inPit.getRenderedImage();
        WritableRaster pitfillerWR = CoverageUtilities.renderedImage2DoubleWritableRaster(pitfillerRI, true);
        RenderedImage flowRI = inFlow.getRenderedImage();
        WritableRaster flowWR = CoverageUtilities.renderedImage2ShortWritableRaster(flowRI, true);

        RandomIter pitRandomIter = RandomIterFactory.create(pitfillerWR, null);

        // create new matrix
        double[] orderedelev = new double[cols * rows];
        int[] indexes = new int[cols * rows];

        int nelev = 0;
        for( int r = 0; r < rows; r++ ) {
            if (pm.isCanceled()) {
                return;
            }
            for( int c = 0; c < cols; c++ ) {
                double pitValue = pitRandomIter.getSampleDouble(c, r, 0);
                int pos = (r * cols) + c;
                orderedelev[pos] = pitValue;
                indexes[pos] = pos + 1;
                if (!isNovalue(pitValue)) {
                    nelev = nelev + 1;
                }
            }
        }

        QuickSortAlgorithm t = new QuickSortAlgorithm(pm);
        t.sort(orderedelev, indexes);

        pm.message(msg.message("draindir.initializematrix"));

        // Initialize new RasterData and set value
        WritableRaster tcaWR = CoverageUtilities.createWritableRaster(cols, rows, Integer.class, null, HMConstants.intNovalue);
        WritableRaster dirWR = CoverageUtilities.createWritableRaster(cols, rows, Short.class, null, HMConstants.shortNovalue);

        // it contains the analyzed cells
        WritableRaster deviationsWR = CoverageUtilities.createWritableRaster(cols, rows, Double.class, null, null);
        BitMatrix analizedMatrix = new BitMatrix(cols, rows);

        if (doLad) {
            orlandiniD8LAD(indexes, deviationsWR, analizedMatrix, pitfillerWR, flowWR, tcaWR, dirWR, nelev);
        } else {
            orlandiniD8LTD(indexes, deviationsWR, analizedMatrix, pitfillerWR, flowWR, tcaWR, dirWR, nelev);
            if (pm.isCanceled()) {
                return;
            }
            // only if required executes this method
            if (inFlownet != null) {
                newDirections(pitfillerWR, dirWR);
            }
        }
        if (pm.isCanceled()) {
            return;
        }
        outFlow = CoverageUtilities.buildCoverage("draindir", dirWR, regionMap, inPit.getCoordinateReferenceSystem());
        outTca = CoverageUtilities.buildCoverage("tca", tcaWR, regionMap, inPit.getCoordinateReferenceSystem());
    }
671684
public static void main(String[] args) throws Exception {
		try (Split ignored = SimonManager.getStopwatch("org.javasimon.examples.jmx.main").start()) {
			Class.forName("org.h2.Driver");
			Class.forName("org.javasimon.jdbc4.Driver");

			MonitoredApplication s = new MonitoredApplication();
			s.setUp();

			Connection conn = null;
			try {
				conn = DriverManager.getConnection("jdbc:simon:h2:mem:db1");

				//noinspection UnusedDeclaration
				try (Split ops = SimonManager.getStopwatch("org.javasimon.examples.jmx.sql").start()) {
					s.doInsert(conn);
					s.doSelect(conn);
				}
			} finally {
				if (conn != null) {
					conn.close();
				}
			}
		}

		System.out.println("Simon monitor hierarchy:\n" + SimonUtils.simonTreeString(SimonManager.getRootSimon()));

		register();
		waitForEnterPressed();
		unregister();
	}
317625
public static void main(String[] args) throws Exception {
    Builder processingGraphBuilder = Builder.newBuilder();

    // A KVStreamlet is produced. Each element is a KeyValue object where the key
    // is the impression ID and the user ID is the value.
    Streamlet<AdImpression> impressions = processingGraphBuilder
        .newSource(AdImpression::new);

    // A KVStreamlet is produced. Each element is a KeyValue object where the key
    // is the ad ID and the user ID is the value.
    Streamlet<AdClick> clicks = processingGraphBuilder
        .newSource(AdClick::new);

    /**
     * Here, the impressions KVStreamlet is joined to the clicks KVStreamlet.
     */
    impressions
        // The join function here essentially provides the reduce function with a streamlet
        // of KeyValue objects where the userId matches across an impression and a click
        // (meaning that the user has clicked on the ad).
        .join(
            // The other streamlet that's being joined to
            clicks,
            // Key extractor for the impressions streamlet
            impression -> impression.getUserId(),
            // Key extractor for the clicks streamlet
            click -> click.getUserId(),
            // Window configuration for the join operation
            WindowConfig.TumblingCountWindow(25),
            // Join type (inner join means that all elements from both streams will be included)
            JoinType.INNER,
            // For each element resulting from the join operation, a value of 1 will be provided
            // if the ad IDs match between the elements (or a value of 0 if they don't).
            (user1, user2) -> (user1.getAdId().equals(user2.getAdId())) ? 1 : 0
        )
        // The reduce function counts the number of ad clicks per user.
        .reduceByKeyAndWindow(
            // Key extractor for the reduce operation
            kv -> String.format("user-%s", kv.getKey().getKey()),
            // Value extractor for the reduce operation
            kv -> kv.getValue(),
            // Window configuration for the reduce operation
            WindowConfig.TumblingCountWindow(50),
            // A running cumulative total is calculated for each key
            (cumulative, incoming) -> cumulative + incoming
        )
        // Finally, the consumer operation provides formatted log output
        .consume(kw -> {
          LOG.info(String.format("(user: %s, clicks: %d)",
              kw.getKey().getKey(),
              kw.getValue()));
        });

    Config config = Config.defaultConfig();

    // 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, processingGraphBuilder);
  }
880772
public static void main(String[] args) throws Exception {
    if (args.length < 1)
      throw new IllegalArgumentException("must supply a set of host:port tuples");

    // Build a list of all member addresses to which to connect.
    List<Address> members = new ArrayList<>();
    for (String arg : args) {
      String[] parts = arg.split(":");
      members.add(new Address(parts[0], Integer.valueOf(parts[1])));
    }

    CopycatClient client = CopycatClient.builder()
      .withTransport(new NettyTransport())
      .withConnectionStrategy(ConnectionStrategies.FIBONACCI_BACKOFF)
      .withRecoveryStrategy(RecoveryStrategies.RECOVER)
      .withServerSelectionStrategy(ServerSelectionStrategies.LEADER)
      .withSessionTimeout(Duration.ofSeconds(15))
      .build();

    client.serializer().register(SetCommand.class, 1);
    client.serializer().register(GetQuery.class, 2);
    client.serializer().register(DeleteCommand.class, 3);

    client.connect(members).join();

    recursiveSet(client);

    while (client.state() != CopycatClient.State.CLOSED) {
      try {
        Thread.sleep(1000);
      } catch (InterruptedException e) {
        break;
      }
    }
  }
275914
public static void main(final String[] args) {

        List<Image> images = describeAllImages();

        if (null != images) {
            for (Image image : images) {
                System.out.println(image.getImageId());
            }
        }

    }
873350
public static void main(String args[]) throws Exception {
        System.out.println("<--Pi4J--> PCA9685 Servo Tester Example ... started.");
        PCA9685GpioServoExample example = new PCA9685GpioServoExample();
        Scanner scanner = new Scanner(System.in);
        char command = ' ';
        while (command != 'x') {
            printUsage();
            command = readCommand(scanner);
            switch (command) {
                case 'c' : // Choose Channel
                    example.chooseChannel(scanner);
                    break;
                case 'n' : // Neutral Position
                    example.approachNeutralPosition();
                    break;
                case 'm' : // Move
                    example.move(scanner);
                    break;
                case 's' : // Sub Trim
                    example.subtrim(scanner);
                    break;
                case 'r' : // Reverse
                    example.reverse();
                    break;
                case 't' : // Travel (adjust endpoints)
                    example.travel(scanner);
                    break;
                case 'p' : // Sweep
                    example.sweep(scanner);
                    break;
                case 'i' : // Info
                    example.info();
                    break;
                case 'x' : // Exit
                    System.out.println("Servo Example - END.");
                    break;
                case ' ' :
                    System.err.println("Invalid input.");
                    break;
                default :
                    System.err.println("Unknown command [" + command + "].");
                    break;
            }
        }

        System.out.println("Exiting PCA9685GpioServoExample");
    }
321403
public static void main(String[] args) throws Exception {
		
		if(!parseParameters(args)) {
			return;
		}
		
		// set up execution environment
		final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
	
		// read input data
		DataSet<Edge> edges = getEdgeDataSet(env);
		
		// project edges by vertex id
		DataSet<Edge> edgesById = edges
				.map(new EdgeByIdProjector());
		
		DataSet<Triad> triangles = edgesById
				// build triads
				.groupBy(Edge.V1).sortGroup(Edge.V2, Order.ASCENDING).reduceGroup(new TriadBuilder())
				// filter triads
				.join(edgesById).where(Triad.V2, Triad.V3).equalTo(Edge.V1, Edge.V2).with(new TriadFilter());

		// emit result
		if(fileOutput) {
			triangles.writeAsCsv(outputPath, "\n", ",");
		} else {
			triangles.print();
		}

		// execute program
		env.execute("Basic Triangle Enumeration Example");

	}
722438
public static void main(final String[] args) throws Exception
    {
        if (args.length == 0)
        {
            System.err.format("Usage: %s <filenames>...%n", SbeTool.class.getName());
            System.exit(-1);
        }

        for (final String fileName : args)
        {
            final Ir ir;
            if (fileName.endsWith(".xml"))
            {
                final String xsdFilename = System.getProperty(SbeTool.VALIDATION_XSD);
                if (xsdFilename != null)
                {
                    validateAgainstSchema(fileName, xsdFilename);
                }

                ir = new IrGenerator().generate(parseSchema(fileName), System.getProperty(TARGET_NAMESPACE));
            }
            else if (fileName.endsWith(".sbeir"))
            {
                ir = new IrDecoder(fileName).decode();
            }
            else
            {
                System.err.println("Input file format not supported: " + fileName);
                System.exit(-1);
                return;
            }

            final String outputDirName = System.getProperty(OUTPUT_DIR, ".");
            if (Boolean.parseBoolean(System.getProperty(GENERATE_STUBS, "true")))
            {
                final String targetLanguage = System.getProperty(TARGET_LANGUAGE, "Java");

                generate(ir, outputDirName, targetLanguage);
            }

            if (Boolean.parseBoolean(System.getProperty(GENERATE_IR, "false")))
            {
                final File inputFile = new File(fileName);
                final String inputFilename = inputFile.getName();
                final int nameEnd = inputFilename.lastIndexOf('.');
                final String namePart = inputFilename.substring(0, nameEnd);
                final File fullPath = new File(outputDirName, namePart + ".sbeir");

                try (IrEncoder irEncoder = new IrEncoder(fullPath.getAbsolutePath(), ir))
                {
                    irEncoder.encode();
                }
            }
        }
    }