Spring Shell Technology For Java development

This post is about the Spring Shell technology and its use in java. Experts of java development India have shared their best knowledge in this post for Spring Shell with the community people. If you have anything to ask, do it at the end. Technology: It is command line tool for Java applications to interact with java applications using spring shell framework. » Read more

Java与C++在语言方面上的不同

1,Java抛弃了头文件、预处理机制、goto语句和多维数组。 2,Java不支持指针。 3,Java抛弃了联合体和结构体。 4,Java不支持独立函数。所有函数必须在类中声明。 5,Java不支持多重继承,可以使用接口模拟多重继承。 6,Java不支持运算符重载。 7,Java中布尔型不再用整数来代替。 8,Java中主函数必须有一个字符串类型的参数。 Java抛弃的C++中的这些机制和结构多数都是“危险”的,减少了语言的复杂性,增强了安全性,虽然在一定程度上减少了其灵活性。        » Read more

Java Calling Native Functions in .DLL on Windows

How to call a function in .dll from Java on Windows is introduced in this post with an example. Platforms used: OS: Microsoft Windows XP [5.1.2600] C to .dll compiler: MS Visual Studio 2008 JDK: java -version java version "1.6.0_05" Java(TM) SE Runtime Environment (build 1.6.0_05-b13) Java HotSpot(TM) Client VM (build 10.0-b19, mixed mode, sharing) 1. Write the Java code As follows. » Read more

JSP Connecting to MySQL

We use tomcat as the container used for instructions in the post.1) Download the driver mysql-connector-java-*.*.*-bin.jar and put it into WEB-INF/lib/, and remember to restart tomcat.2) The example code as follows.String driverName="com.mysql.jdbc.Driver"; String userName="username"; String userPasswd="password"; String dbName="dbname"; String tableName="tablename"; String url="jdbc:mysql://localhost/"+dbName+"?user="+userName+"&password="+userPasswd; Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection conn=DriverManager.getConnection(url); Statement statement = conn.createStatement(); String sql="SELECT * FROM "+tableName; ResultSet rs = statement.executeQuery(sql); // get the result ResultSetMetaData rmeta = rs.getMetaData(); // the the number of columns int numColumns=rmeta.getColumnCount(); // out each field while(rs.next()) { out.print(rs.getString(1)+" "); out.print("|"); out.print(rs.getString(2)); out.print(" "); } out.print(" "); out.print("Operations on the DB is done."); rs.close(); statement.close(); conn.close();        » Read more

Hadoop TeraSort Benchmark

TeraSort is one of Hadoop’s widely used benchmarks. Hadoop’s distribution contains both the input generator and sorting implementations: the TeraGen generates the input and TeraSort conducts the sorting. Here, we provide a short tutorial for using the Hadoop TeraSort benchmark. TeraGen generates random data that can be used as input data for a subsequent running of TeraSort. Generate input by TeraGen The syntax for TeraGen: $ hadoop jar hadoop-*examples*.jar teragen <number of 100-byte rows> <output dir> To make the TeraGen run on multiple nodes with multiple tasks, you may need to specify the number of map tasks (30 here as an example; for Hadoop 2): $ hadoop -D mapreduce.job.maps 30 jar hadoop-*examples*.jar teragen <number of 100-byte rows> <output dir> The number of mappers depends on the number of rows you will generate and the number of nodes you have. » Read more

A Simple Sort Benchmark on Hadoop

After installing Hadoop, we usually run some benchmark programs to test whether the system works well. In the post of the Hadoop install tutorial, we show a very simple to grep strings from a simple sets of files. In this post, we introduce the Sort for testing and benchmarking Hadoop. The Sort program is also included in the Hadoop distribution package, and the package also includes a input data generator which generate 10 GB * (number of slave nodes) input data to sort. » Read more