println

sponsored links

Call java constructor summary

1 constructor must define its class has the same name. Constructor does not return type, not void. (2) class can not declare constructor, then the class declare a method implied body is empty no-arg constructor. But when the class constructor when th

mysql calculate the difference between the two time

String sql = "SELECT w.work_id, w.room_id, rm.name, CAST (sec_to_time (sum (unix_timestamp (statusTime.end_time)-unix_timestamp (statusTime.create_time))) as CHAR) as times" + ", W.number, statusTime.create_time, statusTime.end_time FR

JAVA Shape file created. And add a line in the file

import java.io.File; import java.io.IOException; import com.esri.arcgis.datasourcesfile.ShapefileWorkspaceFactory; import com.esri.arcgis.geodatabase.FeatureClass; import com.esri.arcgis.geodatabase.Field; import com.esri.arcgis.geodatabase.Fields; i

oracle with input and output parameters of the call [Reserved]

Table test, the following is a test data : select * from test; id info ---------------------- 1 Test data 1 2 Test data 2 3 Test data 3 4 Test data 4 5 Test data 5 6 Test data 6 7 Test data 7 8 Test data 8 9 Test data 9 10 Test data 10 11 Test data 1

Selection of TreeMap sorting out the thousands of stocks in the first few

public ArrayList <Stock> getNewsMostStocks () { ArrayList <Stock> stocksList = new ArrayList <Stock> (); TreeMap <Double, String> treeMap = new TreeMap <Double, String> (); Connection conn; try { conn = ConnFactory.getCo

First attempt htmlCleaner with Xpath

//import java.io.File; import java.io.IOException; import java.net.URL; import org.htmlcleaner.CleanerProperties; import org.htmlcleaner.HtmlCleaner; import org.htmlcleaner.PrettyXmlSerializer; import org.htmlcleaner.TagNode; import org.htmlcleaner.X

OJDBC DATE raised the issue of different versions

General database, DATE field only the date, not including the date information, but Oracle Database DATE data type in the date, time, and for different versions of Oracle jdbc driver, for the treatment of the problem are some differences, if you are

Java: synchronized modifier in the static method and the difference between non-static methods

synchronized static method call on that class before you get the lock, and said non-static method before calling this method to obtain the object lock. public class StaticSynDemo { private static String a = "test"; / / Equivalent method pri

Not EWS, how to sync to other systems Calendar Exchange? (2)

import groovyx.net.http.* def username = 'username', password = 'password' def http = new HTTPBuilder( 'https://webmail.domain.com' ) http.post( path: '/exchweb/bin/auth/owaauth.dll', body: [destination:'https://webmail.domain.com/Exchange', flags:'0

java class to read Sina rss

HttpClient httpClient = HttpClientFactory.createNewHttpClient (); GetAccess get = new GetAccess (httpClient); String uri = " http://rss.sina.com.cn/tech/rollnews.xml "; HttpResponse response = get.doGet (uri); String s = HttpUtil.getHtmlInf

Not EWS, how to sync to other systems Calendar Exchange?

Exchange 2007 and later provides the EWS, tantamount to provide a interface to use for other applications, and our 2003 version of Exchange is not EWS, seemingly can not be easily synchronized to other systems to Exchange ... Calendar Some people say

Bash string processing (and Java control) - 9 for the specified location string of characters. Traversal characters in the string

Bash string processing (and Java control) - 9 for the specified location string of characters, through a string of characters In Java Take the character specified index char charAt (int index) Returns the char value at the specified index, where inde

Enter a positive number n, and output all sequence of n consecutive positive

Title: Enter a positive number n, the output of all and for n consecutive positive sequence. For example, enter 15, because 1 +2 +3 +4 +5 = 4 +5 +6 = 7 +8 = 15, so the output of three consecutive sequences 1-5,4-6 and 7-8. Ideas: The simplest way is

First time write so small logic functions, including

public long getByUser(final TimesheetDO timesheetDo, final Integer userId) { long sum = 0; boolean isExist = false; // Are used respectively for the new has to be updated boolean flag = false; @SuppressWarnings("unchecked") final List<TimesheetDO

The binary search tree into a sorted doubly linked list

Title: Enter a binary search tree, the binary search tree into a sort of two-way linked list. Requirements can not create any new nodes, just adjust the pointer to point. 10 / \ 614 / \ / \ 481 216 Into a doubly linked list 4 = 6 = 8 = 10 = 12 = 14 =

JDBC CLOB field in the treatment

public void insertMarketRept (List list, String sql) throws SQLException, IOException { if (list.size ()> 0) { conn = JdbcUtilsOracle.getConnection (); conn.setAutoCommit (false); PreparedStatement prest = conn . PrepareStatement (sql, ResultSet.T

Dom4j manipulate XML

You can just import dom4j.jar Dom4j Parsing XML import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.util.Iterator; import java.util.List; import org.dom4j.Document; import org.dom4j.Element; import org.dom4j.N

Find missing numbers

According to legend is the MS / Google and more IT companies face questions were: There is a set of numbers from 1 to n, a reduction in the number sequence has been disrupted, in a n-1 of the array Please find the missing number, it is best to have the pr

java string formatted date numbers Daquan

In C, you can use a similar printf ("% d% 8.2f \ \ n", 1001, 52.335) of the method to format the output, but in Java System.out.println () does not correspond to the function. To format the output, you must use the classes in the java.text packa

for and foreach to use?

In JDK5.0 added a new feature that FOR-EACH loop. FOR-EACH loop makes the code a short, but also make the code easier to understand, in fact, he did not add any new functionality. He can function with a simple FOR loop instead. for-each usage: int a

Share some good java machine questions.

1. Now enter n numbers, comma, separated; then choose L or descending order; click the submit button on another page is displayed in what order, the result is to provide reset import java.util.*; public class bycomma{ public static String[] splitStri

Insert to the database using Java when large amounts of data to optimize

Insert to the database using jdbc 100,000 records, respectively, using statement, PreparedStatement, and PreparedStatement + batch tested in three ways: / / 1 with the statement insert 100,000 records public void exec(Connection conn){ try { // Start

Environmental monitoring system

JAVA run-time environment so dependent on environmental monitoring, if your machine is not configured JDK environment or the JDK version is too low you can not run the program, so collecting such a thing on the Internet, is now out and share. Other t

Simulation mode set value

*. Jsp <% @ Page language = "java" import = "com.qs.data .*" pageEncoding = "UTF-8"%> <! DOCTYPE HTML PUBLIC "- / / W3C / / DTD HTML 4.01 Transitional / / EN"> <html> <head> <title

Proxy server to access the content code

import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.URL; import java.net.URLConnection; import java.util.Properties; public class ProxyTest { public static void main (String [] args) { String strUrl = "http://roll.ne

Dom4j operation using XML (compare all)

Dom4j can easily complete the creation of XML documents, elements of the modified document query traversal, etc., but dom4j jdom a little bit more complex than that, but in the case of large document dom4j jdom good performance either. Ready First, p

Get screenshot of the computer

public static String capScreenSnapshot () { String outFileName = ""; try { File f = new File (str); if (! (f.exists ())) { f.mkdir (); } outFileName = formatDate (Calendar.getInstance (). getTime (), "Yyyy_MM_dd_HH_mm_ss_SSS") +

Design Patterns: Strategy Pattern

Before all, we have to understand first what a Design Pattern is. A Design pattern is a form to deal with object in the OOP so that it will be easy to change or to upgrade our information system and provide a way to let some part of system vary indep

remote login linux java application and execute the command

http://www.ganymed.ethz.ch/ssh2/ In this download ssh and scp commands a call in jar import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import ch.ethz.ssh2.Connection; import ch.et

oracl update or insert record if there is a new record

DECLARE vcount number; begin select count(*) into vcount from zhang.test where aname='t' and bname='t'; if vcount=0 then insert into zhang.test values(3,'t1','t1','t1','t1',50); else update zhang.test set abcount= abcount + 80 where aname='t' and bna

NoSql of Cassandra query

java before the operation was operating about Cassandra steps: 1 Start cassandra. 2 into $ {cassandra-home} \ bin, execute cassandra-cli -host localhost -port 9160 3. Creating space: create keyspace wingware; 4 Switch to create a good space: use wing

dom4j to read and write XML and save bulk data objects

1 Create a People object package XML; public class People { public People() { // TODO Auto-generated constructor stub } private String name; private int age; private String sex; public void tell(){ // Methods to obtain information System.out.println(

Java code to delete files and directories

import java.io.File; / ** * @ Date 2011-2-6 * @ Author Javaweb.cc * / public class DeleteFileUtil { / ** * * Delete file, can be a single file or folder * * @ Param fileName * File name to be deleted * @ Return the file deleted successful return true

Java code to run cmd command

Command facility: public class CommandFactory { public static CommandLine createCommand (String command, String [] parameter) { if (null == command | | "". equals (command)) { System.out.println ("the command must not null!"); ret

split method of application and removal of the same element in list [transfer]

public class testJava { public static String [] ss = new String [20]; / / Test split method / * Public SplitDemo () { String s = "Thewwwwwwww, uuuuuu,"; / / Character in each space decomposition. ss = s.split (","); } public stati

Jedis operation redis

package org.jzkangta.jedis; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import redis.clients.jedis.Jedis; public class JedisDemo { public void tes

Connection pool configuration steps

1 First in your tomcat / conf / servlet.xml add <Context Path="**" docBase="**" debug="0" reloadable="true"> <Resource name = "jdbc / test" auth = "Container" type = "javax.sql

oracle date milliseconds

oracle date Java Date milliseconds milliseconds with the conversion? Oracle time zone because the date is counted, Java did not count the time zone Therefore, the number of milliseconds oracle date = Java Date in milliseconds milliseconds +8 hours se

4_JAVA + Oracle interview questions (with answers)

Volume-based test questions can not be any surface graffiti writing, asked to write all the answers on the answer sheet, papers must not take away. Choice 1, What will happen when you attempt to compile and run the following code? (3) public class Static

Facade pattern (skin mode)

1 to provide a class that encapsulates the operation of the subsystem, subsystem easier to use (2) provide multiple subsystems, increasing facade class can reduce the dependence between the various subsystems 3. Clients only need to focus on the faca

Chinese fonts installed on red hat

Recently made a demand, in a picture, and with the JAVA program to generate some text up. Need to use "Microsoft elegant black" font, that is not on the linux machine. So a little online search, the solution out First of all, to see what th

java script to export database

Customize a Listener, database backup at a specific time each day: public class AutoBackUpListener implements ServletContextListener{ private Timer timer; public void contextDestroyed(ServletContextEvent arg0) { System.out.println("shut down task.");

oracle backup under linux some heart

1. J2ee recently doing a web project based on this project web server and database are deployed on linux server, which I want to implement database backup and recovery, in fact, java call expdp / impdp, this fact should think quite simple, runtime.ge

Oracle Pack Detailed description

Oracle Package with what effect? Simplify application design, application performance, achieve information hiding, the subroutine overloading. Here is some code Package. create or replace Package FirstPage is - Author: MECON - Created: 2006-7-20 09:3

MongoDB small example (turn)

Original Address: http://lanmh.iteye.com/blog/765844 import java.net.UnknownHostException; import java.util.Set; import com.mongodb.BasicDBObject; import com.mongodb.DB; import com.mongodb.DBCollection; import com.mongodb.DBCursor; import com.mongodb

MongoDB read and write

Reference http://www.cnblogs.com/varlxj/archive/2010/03/12/1684181.html First, download the database and we MongoDb jar package Command to start the database console bin\mongod.exe -dbpath data In our project into jar files, test classes import java.

java stored procedure used in

package poceduretest; import java.sql .*; class MainTest { public static void main (String [] args) { java.sql.Connection con = ConnectionManager.getConnection (); / / first get connected / ** * Basic stored procedure call * / try { java.sql.Callable

Oracle Date field operations (java.util.Date | java.sql.Date | java.sql.Timestamp))

First show a little bit of time these common relationships between the classes A java.util.Date into a String java.util.Date udate=Calendar.getInstance().getTime(); Format f = new SimpleDateFormat("yyyy-MM-dd hh24:mm:ss"); System.out.println(f.form T

Key database-Redis (a) Basic Introduction

Redis knowledge to prepare redis basic introduction: http://blog.csdn.net/Java2King/archive/2010/07/27/5769738.aspx redis installation: http://hanqunfeng.iteye.com/blog/684108 The use of JDBC-Redis redis download the java-jdbc Address: http://code.go

Java program calls system commands for the mysql database backup and restore (mode A)

The first approach Database backup: public class DBBackup { / / Export the database into a sql file public static void backup (String DBName, String file) { String user = "root"; / / database account String password = "123456"; /
Recent
Recent Entries
Tag Cloud
Random Entries