This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.BufferedReader; | |
import java.io.BufferedWriter; | |
import java.io.FileWriter; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import java.net.MalformedURLException; | |
import java.net.URL; | |
import java.net.URLConnection; | |
import java.util.ArrayList; | |
import java.util.Date; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Object[] objs = new Object[]{"%" + keyword.toLowerCase() + "%", category, region}; | |
List<SnVideo> snVideos = videoDAO.getHibernateTemplate().find(" from SnVideo where lower(name) LIKE ? and lower(category)= ? and lower(region)= ?",objs); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public List findByName(String name) { | |
String query = "from SnVideo s where lower(s.name) like :name"; | |
return getHibernateTemplate().findByNamedParam(query, "name", "%" + name.toLowerCase() + "%"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Date; | |
import java.sql.Connection; | |
import java.sql.DriverManager; | |
import java.sql.SQLException; | |
import java.sql.Statement; | |
import java.sql.PreparedStatement; | |
import java.sql.ResultSet; | |
public class InfoUpdate { | |
private static String url = "jdbc:mysql://localhost:3306/Yourdatabase"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.sql.Connection; | |
import java.sql.DriverManager; | |
import java.sql.PreparedStatement; | |
import java.sql.ResultSet; | |
import java.sql.SQLException; | |
import java.sql.Statement; | |
public class FashionGenerate { | |
private static String url = "jdbc:mysql://localhost:3306/Database"; | |
private static String user = "UserName"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.sql.Connection; | |
import java.sql.DriverManager; | |
import java.sql.PreparedStatement; | |
import java.sql.ResultSet; | |
import java.sql.SQLException; | |
import java.sql.Statement; | |
public class FashionCount { | |
private static String url = "jdbc:mysql://localhost:3306/ItemsInfo2"; | |
private static String user = "root"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# the number of files and directories in a directory | |
ls | wc -l | |
# A directory is a file but its not a regular file, so the question is not clear enough | |
# If he does not want directory, then something awfull like this should do: | |
echo $(($(ls -l | grep -v ^d | wc -l)-1)) | |
ls *.jpg | wc | |
ls *.jpg | wc -l | |
ls -l | grep ^- | wc | |
ls -l | grep ^- | wc -l |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find command:http://www.oreillynet.com/linux/cmd/cmd.csp?path=f/find | |
find . -maxdepth 1/2/..../n | |
%to just find them and printout: | |
find . -maxdepth 1 -name '[!.]*' -size 0 -printf 'Name: %16f Size: %6s\n' | |
%delete them, may be modified to use | |
find . -maxdepth 1 -name '[!.]*' -size 0 -printf 'Name: %16f Size: %6s\n' | xargs rm | |
http://content.hccfl.edu/pollock/unix/findcmd.htm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.File; | |
import java.io.IOException; | |
import java.io.UnsupportedEncodingException; | |
import java.net.URLEncoder; | |
//import org.apache.commons.io.FileUtils; | |
public class TestFileCharSet { | |
protected static String urlEncode(String string) { | |
try { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
对于item_detail: | |
先用 | |
alter table item_detail drop primary key; | |
删除原来的主键; | |
然后用: | |
alter table item_detail add column id int unsigned not null auto_increment primary key; | |
增加自增的主键id |