Skip to content

Instantly share code, notes, and snippets.

@zxlooong
zxlooong / ZipFile.java
Last active October 5, 2015 18:07
ZipFile.java
import java.io.*;
import java.util.zip.*;
/**
*功能:zip压缩、解压
*说明:本程序通过ZipOutputStream和ZipInputStream实现了zip压缩和解压功能.
*问题:由于java.util.zip包并不支持汉字,当zip文件中有名字为中文的文件时,
* 就会出现异常:"Exception in thread "main " java.lang.IllegalArgumentException
* at java.util.zip.ZipInputStream.getUTF8String(ZipInputStream.java:285)
*解决:
*  方法1、修改import java.util.zip.ZipInputStream和ZipOutputStream.
@zxlooong
zxlooong / ConnectAccess.java
Last active October 5, 2015 18:07
ConnectAccess.java
import java.sql.*;
class ConnectAccess{
String connStr;
public ConnectAccess(String accessDB_DSN_Name){
//accessDB_DSN_Nameabc为自己创建的系统DSN数据源名,对应一个Access数据库.
//String link="jdbc:odbc:driver={Microsoft Access Driver(*.mdb)};DBQ=H:\\summer\\javaxml\\db.mdb";
connStr = "jdbc:odbc:"+accessDB_DSN_Name;
@zxlooong
zxlooong / GenGUID.java
Last active December 12, 2015 05:48
GenGUID.java
import java.util.UUID;
public class GenUUID {
public static void main(String[] args) {
for(int i=0; i<100; i++){
UUID uuid = UUID.randomUUID();
System.out.println (uuid);
}
@zxlooong
zxlooong / AuthCodePhone.java
Last active December 15, 2015 05:49
AuthCodePhone.java
import java.util.regex.Pattern;
import java.util.regex.Matcher;
public class AuthCodePhone {
public static String parseMsg(String msg) {
String sensitive = "";
Pattern p = Pattern.compile(EXP);
Matcher m = p.matcher(msg);
@zxlooong
zxlooong / BockingIO.cpp
Last active August 15, 2018 09:40
socket
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <unistd.h>
int main()
{
@zxlooong
zxlooong / BubbleSort.cpp
Last active December 15, 2015 16:38
DataStructure^Algorithm
#include <iostream>
using namespace std;
int a[105];
//下标从1开始
void BubbleSort(int a[], int n)
{
int i, j;
for(i = 1; i < n; i++)
{
for(j = 1; j <= n - i; j++)
@zxlooong
zxlooong / jni.h
Created May 23, 2013 06:34
jni.h
/*
* %W% %E%
*
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
/*
* We used part of Netscape's Java Runtime Interface (JRI) as the starting
* point of our design and implementation.
@zxlooong
zxlooong / readInnerZipFile.java
Last active December 18, 2015 12:59
readInnerZipFile.java
public static boolean readInnerZipFile(String oriZipFile,String
innerZipFileEntryName, String outZipFileEntryName) {
ZipFile innerZipFile = null;
try {
innerZipFile = new ZipFile(oriZipFile);
Enumeration entries = innerZipFile.entries();
ZipEntry entryIn = null;
while (entries.hasMoreElements()) {
ZipEntry entry = entries.nextElement();
// System.out.println(entry);
@zxlooong
zxlooong / repo.py
Created June 16, 2013 15:07
repo.py
#!/usr/bin/env python
## repo default configuration
##
from __future__ import print_function
REPO_URL = 'https://gerrit.googlesource.com/git-repo'
REPO_REV = 'stable'
# Copyright (C) 2008 Google Inc.
#
System.out.println(new BigInteger(16 * 8, new Random()).toString(16));