??xml version="1.0" encoding="utf-8" standalone="yes"?>
import java.awt.Dimension;
import java.awt.event.WindowEvent;
import java.awt.event.WindowAdapter;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
/*******************************************************************************
*
* 关闭前提?br /> *
* Author: NeedJava
*
* Modofied: 2005.04.02
*
******************************************************************************/
class AlarmBeforeClosed extends JFrame
{
public AlarmBeforeClosed( String title )
{
//讄E序标题?br /> this.setTitle( title );
//不给最大化
this.setResizable( false );
//讄E序界面大小
this.setSize( new Dimension( 500, 400 ) );
//程序居中放|(Ҏ1Q?br /> Dimension paneSize=this.getSize();
Dimension screenSize=Toolkit.getDefaultToolkit().getScreenSize();
this.setLocation( ( screenSize.width-paneSize.width )/2, ( screenSize.height-paneSize.height )/2 );
//程序居中放|(Ҏ2Q?br /> //this.setLocationRelativeTo( null );
//讄E序关闭的类型,防止关闭
this.setDefaultCloseOperation( JFrame.DO_NOTHING_ON_CLOSE );
//讄关闭E序
this.addWindowListener( new WindowAdapter()
{
public void windowClosing( WindowEvent e )
{
closeApplication();
}
} );
}
/*****************************************************************************
*
* 关闭E序
*
****************************************************************************/
private void closeApplication()
{
Toolkit.getDefaultToolkit().beep();
int answer=JOptionPane.showConfirmDialog( AlarmBeforeClosed.this,
"您真的要退出此pȝQ?,
"退出程?,
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE,
null );
if( answer==JOptionPane.YES_OPTION ) //选择“是?br /> {
System.exit( 0 );
}
else if( answer==JOptionPane.NO_OPTION ) //选择“否?br /> {
return;
}
}
/*****************************************************************************
*
* 入口ȝ?br /> *
****************************************************************************/
public static void main( String[] args )
{
new AlarmBeforeClosed( "关闭前提? ).setVisible( true );
}
}
long temp=0L;
long begin=0L;
////////////////////////////////////////////////////////////////////////////
//
// dividend/1024{效于dividend>>10
//
////////////////////////////////////////////////////////////////////////////
begin=System.currentTimeMillis();
for( int i=0; i<10000000; i++ )
{
temp=dividend/1024;
}
System.out.println( temp+" d耗时Q?+( System.currentTimeMillis()-begin )+"毫秒" );
begin=System.currentTimeMillis();
for( int i=0; i<10000000; i++ )
{
temp=dividend>>10;
}
System.out.println( temp+" d耗时Q?+( System.currentTimeMillis()-begin )+"毫秒\r\n" );
////////////////////////////////////////////////////////////////////////////
//
// dividend*1024{效于dividend<<10
//
////////////////////////////////////////////////////////////////////////////
begin=System.currentTimeMillis();
for( int i=0; i<10000000; i++ )
{
temp=dividend*1024;
}
System.out.println( temp+" d耗时Q?+( System.currentTimeMillis()-begin )+"毫秒" );
begin=System.currentTimeMillis();
for( int i=0; i<10000000; i++ )
{
temp=dividend<<10;
}
System.out.println( temp+" d耗时Q?+( System.currentTimeMillis()-begin )+"毫秒\r\n" );
////////////////////////////////////////////////////////////////////////////
//
// dividend%1024{效于dividend-( dividend>>10<<10 )
//
////////////////////////////////////////////////////////////////////////////
begin=System.currentTimeMillis();
for( int i=0; i<10000000; i++ )
{
temp=dividend%1024;
}
System.out.println( temp+" d耗时Q?+( System.currentTimeMillis()-begin )+"毫秒" );
begin=System.currentTimeMillis();
for( int i=0; i<10000000; i++ )
{
temp=dividend-( dividend>>10<<10 );
}
System.out.println( temp+" d耗时Q?+( System.currentTimeMillis()-begin )+"毫秒\r\n" );
}
}
long start=0L;
String temp=null;
/*/
start=System.currentTimeMillis();
temp=null;
for( int i=0; i<times; i++ )
{
temp=times+"";
}
System.out.println( temp+" "+( System.currentTimeMillis()-start ) );
/*/
start=System.currentTimeMillis();
temp=null;
for( int i=0; i<times; i++ )
{
temp=Long.toString( times );
}
System.out.println( temp+" "+( System.currentTimeMillis()-start ) );
//*/
}
}
/*******************************************************************************
*
*
* Author: NeedJava
*
* Modified: 2007.08.26
*
******************************************************************************/
public final class ReadFaster
{
/*****************************************************************************
*
* 构造函敎ͼ默认使用当前路径
*
****************************************************************************/
public ReadFaster()
{
this( "." );
}
public ReadFaster( String fileName )
{
this.listPictures( null, fileName );
}
/*****************************************************************************
*
* 列出当前目录下的文g列表Q包括文件和文g?br /> *
****************************************************************************/
private final void listPictures( File path, String fileName )
{
File file=new File( path, fileName );
if( file.isDirectory() )
{
//得到当前目录下的文g列表Q包括文件和文g?br /> String[] children=file.list();
//如果子集为空Q就攑ּ后面的操?br /> if( children==null )
{
return;
}
//排序
//java.util.Arrays.sort( children );
//如果子集不ؓI,则显C?br /> for( int i=0; i<children.length; i++ )
{
listPictures( file, children[i] );
}
}
else if( file.isFile() )
{
if( isPictureSuffix( file.getPath() ) )
{
readPicture( file );
}
}
}
/*****************************************************************************
*
* Ҏ后缀名判断是否是有效的图片,q且q回写的后~?br /> *
****************************************************************************/
private final boolean isPictureSuffix( String fileName )
{
if( fileName==null )
{
return false;
}
int length=fileName.length();
//可能存在?jpg”这L文gQ即4个字W?br /> if( length>=4 )
{
char c=fileName.charAt( length-4 );
if( c=='.' )
{
c=fileName.charAt( length-3 );
if( c=='j'||c=='J' )
{
c=fileName.charAt( length-2 );
if( c=='p'||c=='P' )
{
c=fileName.charAt( length-1 );
if( c=='g'||c=='G' )
{
return true;
}
else if( c=='e'||c=='E' )
{
return true;
}
}
}
else if( c=='t'||c=='T' )
{
c=fileName.charAt( length-2 );
if( c=='i'||c=='I' )
{
c=fileName.charAt( length-1 );
if( c=='f'||c=='F' )
{
return true;
}
}
}
}
else if( c=='j'||c=='J' )
{
c=fileName.charAt( length-3 );
if( c=='p'||c=='P' )
{
c=fileName.charAt( length-2 );
if( c=='e'||c=='E' )
{
c=fileName.charAt( length-1 );
if( c=='g'||c=='G' )
{
return true;
}
}
}
else if( c=='f'||c=='F' )
{
c=fileName.charAt( length-2 );
if( c=='i'||c=='I' )
{
c=fileName.charAt( length-1 );
if( c=='f'||c=='F' )
{
return true;
}
}
}
}
else if( c=='t'||c=='T' )
{
c=fileName.charAt( length-3 );
if( c=='i'||c=='I' )
{
c=fileName.charAt( length-2 );
if( c=='f'||c=='F' )
{
c=fileName.charAt( length-1 );
if( c=='f'||c=='F' )
{
return true;
}
}
}
}
}
return false;
}
/*****************************************************************************
*
* 大于10240的,每次?024?048
*
* 于10240的,?0240一ơ即?br /> *
****************************************************************************/
private final String readPicture( File file )
{
try{ FileInputStream fis=new FileInputStream( file );
//于10K的忽?br /> if( fis.available()<10240 )
{
return "";
}
long num=0L;
//Buffered的默认有2048?192
//*/ No.1
byte[] buffer=new byte[10240];
if( fis.read( buffer )==10240 )
{
for( int i=0; i<10240; i++ )
{
num++;
}
}
//*/
/*/ No.3
byte[] buffer=new byte[5120];
for( int j=0; j<2; j++ )
{
if( fis.read( buffer )==5120 )
{
for( int i=0; i<5120; i++ )
{
num++;
}
}
}
//*/
/*/ No.2
byte[] buffer=new byte[2048];
for( int j=0; j<5; j++ )
{
if( fis.read( buffer )==2048 )
{
for( int i=0; i<2048; i++ )
{
num++;
}
}
}
//*/
/*/ No.4
byte[] buffer=new byte[1024];
for( int j=0; j<10; j++ )
{
if( fis.read( buffer )==1024 )
{
for( int i=0; i<1024; i++ )
{
num++;
}
}
}
//*/
fis.close();
}
catch( FileNotFoundException fnfe )
{
fnfe.printStackTrace();
}
catch( IOException ioe )
{
ioe.printStackTrace();
}
catch( Exception e )
{
e.printStackTrace();
}
return "";
}
/*****************************************************************************
*
* d数入?br /> *
****************************************************************************/
public static void main( String[] args )
{
try{ long begin=System.currentTimeMillis();
ReadFaster rf=new ReadFaster();
System.out.println( "d耗时Q?+( System.currentTimeMillis()-begin )+"毫秒\r\n" );
}
catch( Exception e )
{
e.printStackTrace();
}
}
}
int length=12;
String temp="12345678901234567890"
+"12345678901234567890"
+"12345678901234567890"
+"12345678901234567890"
+"12345678901234567890"
+"黑客帝国忍者神龟变形金?
+"12345678901234567890"
+"12345678901234567890"
+"12345678901234567890"
+"12345678901234567890"
+"12345678901234567890";
int times=10000000; //千万
/*/
int begin=100;
int length=120;
String temp="12345678901234567890"
+"12345678901234567890"
+"12345678901234567890"
+"12345678901234567890"
+"12345678901234567890"
+"黑客帝国忍者神龟变形金?
+"黑客帝国忍者神龟变形金?
+"黑客帝国忍者神龟变形金?
+"黑客帝国忍者神龟变形金?
+"黑客帝国忍者神龟变形金?
+"黑客帝国忍者神龟变形金?
+"黑客帝国忍者神龟变形金?
+"黑客帝国忍者神龟变形金?
+"黑客帝国忍者神龟变形金?
+"黑客帝国忍者神龟变形金?
+"12345678901234567890"
+"12345678901234567890"
+"12345678901234567890"
+"12345678901234567890"
+"12345678901234567890";
int times=1000000; //百万
//*/
char[] oldArray=temp.toCharArray();
char[] newArray=null;
long start=0L;
////////////////////////////////////////////////////////////////////////////
//
// 单纯赋?br /> //
////////////////////////////////////////////////////////////////////////////
newArray=new char[length];
start=System.currentTimeMillis();
for( int i=0; i<times; i++ )
{
for( int j=0; j<length; j++ )
{
newArray[j]=oldArray[begin+j];
}
}
System.out.println( new String( newArray )+" "+( System.currentTimeMillis()-start ) );
////////////////////////////////////////////////////////////////////////////
//
// System.arraycopy
//
////////////////////////////////////////////////////////////////////////////
newArray=new char[length];
start=System.currentTimeMillis();
for( int i=0; i<times; i++ )
{
System.arraycopy( oldArray, begin, newArray, 0, length );
}
System.out.println( new String( newArray )+" "+( System.currentTimeMillis()-start ) );
}
}
中央银行通过调整存款准备金率Q可以媄响金融机构的信贷扩张能力Q从而间接调控货币供应量。存Ƒև备金占金融机构存ƾ总额的比例则叫做存款准备金率?
打比方说Q如果存Ƒև备金率ؓQ0Q,意味着金融机构每吸ӞQ0Q万元存ƾ,要向央行~存Q0Q万元的存款准备金,用于发放h的资金ؓQ0Q万元。如果将存款准备金率提高刎ͼQ%Q那么金融机构的可贷资金减到Q0Q万元?
在存Ƒև备金制度下,金融机构不能其吸收的存Ƒօ部用于发放贷ƾ,必须保留一定的资金卛_Ƒև备金Q以备客hƄ需要,因此存款准备金制度有利于保证金融机构对客L正常支付?/font>
打个比方Q不太恰当,我没谈GQ前Q老妈Q中央银行)Z控制我(国内其他银行或合法存h机构Q的pQ决定每月按照我当月的工资向她上~一定比例的钱,q个比例是存款准备金率Q这部分钱就是存Ƒև备金Q这部分上缴的钱我是可以随时甌使用的,但必ȝ后补全。但是我哥们多,借钱也多Q我又好施舍Q贷ƾ)Q结果一些h借了׃q,老妈得知非常生气Q决定提高上~比例(上调存款准备金率Q,q样我每月可供用的钱就了Q我借钱的时候就得认真考虑了:q小子还Ơ我钱(信用评审Q,不能借;那小子找我借钱赌博Q风险项目投资)Q风险大Q不能借;另外q个子有东西存我这Q抵押或质押Q,我不怕他Ơ钱Q借给他?/font>
q次央行上调存款准备金率和贷Ƒֈ息,均是Z减少q度hQ减资金流动过快,以及通货膨胀Q其实我感觉像是在打压股市的q度投资Q说不定财政部过D|间又要有措施了,五月份他们刚调整的印qQ这ơ不知道他们又有何D动?
央行行长周小川现在最惛_的歌是Q你Q钱Q快回来Q我的手心一直在冒汗Q你Q钱Q快回来Q银行依你而存在?br />
/*******************************************************************************
*
* Ҏ字或文g名排?br /> *
* 没有考虑汉字昄时占两个位置的情况,卛_文g名处理不太好
*
* Author: NeedJava
*
* Modified: 2007.09.09
*
******************************************************************************/
public final class DotAlign
{
private DotAlign(){}
private static final String align( String string,
char prefix,
char suffix,
int prefixLength,
int suffixLength,
boolean isNumber )
{
if( string==null||string.equals( "" )||string.equals( "." )||prefixLength<0||suffixLength<0 )
{
return string;
}
//如果没有数Q那么按照常理,数点也应该省略
char[] buffer=new char[( suffixLength>0 ? prefixLength+1+suffixLength : prefixLength )];
int stringLength=string.length();
int dot=stringLength-1;
//扑ֈ数点位|,可以用lastIndexOf()代替
while( dot>-1 )
{
if( string.charAt( dot-- )=='.' )
{
dot++;
break;
}
}
//System.out.print( Integer.toString( dot )+"\t" );
//★整数部分,从小数点左位向左U?br /> int pointer=( dot>-1 ? dot-1 : stringLength-1 );
for( int i=prefixLength-1; i>-1; i-- )
{
if( pointer>-1 )
{
buffer[i]=string.charAt( pointer-- );
}
else{ buffer[i]=prefix;
}
}
//如果没有数部分Q那么按照常理,数点应该省?br /> if( suffixLength>0 )
{
//★小数点
buffer[prefixLength]=( dot>-1||isNumber ? '.' : suffix );
//★小数部分,从小数点右位向右U?br /> pointer=( dot>-1 ? dot+1 : stringLength );
for( int i=prefixLength+1; i<buffer.length; i++ )
{
if( pointer<stringLength )
{
buffer[i]=string.charAt( pointer++ );
}
else{ buffer[i]=suffix;
}
}
}
return new String( buffer );
}
public final static void main( String[] args )
{
System.out.println( "\r\n-------------------------------------------\r\n" );
String[] number={ "",
".",
".5",
".56",
".567",
".5678",
"1234",
"1234.",
"1234.5",
"1234.56",
"1234.567",
"1234.5678" };
for( int i=0; i<number.length; i++ )
{
System.out.println( "["+DotAlign.align( number[i], ' ', '0', 7, 2, true )+"] ["+number[i]+"]" );
}
System.out.println( "\r\n-------------------------------------------\r\n" );
String[] file={ "",
".",
".j",
".jp",
".jpe",
".jpeg",
"1234",
"1234.",
"1234.j",
"1234.jp",
"1234.jpe",
"1234.jpeg" };
for( int i=0; i<file.length; i++ )
{
System.out.println( "["+DotAlign.align( file[i], ' ', ' ', 7, 5, false )+"] ["+file[i]+"]" );
}
System.out.println( "\r\n-------------------------------------------\r\n" );
}
}
Ҏ RSSOwlLoader.java 中的
[code]
private static void startupProcess( String[] args )
{
...
if( !System.getProperties().containsKey( PROPERTY_ALLOW_MULTI_INSTANCES )&&StartupManager.isRSSOwlRunning( feedArgument ) )
...
}
[/code]
q踪?StartupManager.java 见下Q?/font>
q踪?StartupManager.isRSSOwlRunning( String message ) 用途ؓ建立ServerSocketQ监听本?794端口
[code]
static ServerSocket applLockSocket;
public static boolean isRSSOwlRunning( String message )
{
try{ applLockSocket=new ServerSocket( 8794, 50, InetAddress.getByName( "127.0.0.1" ) ); //1987q??日出生?
handleSocketUnBound(); //
return false;
}
catch( java.net.BindException e ) //Another instance already running
{
...
handleSocketBound( message ); //
return true;
}
catch( IOException e ) //Other Error
{
...
return false;
}
}
[/code]
q踪?StartupManager.handleSocketUnBound() ?StartupManager.handleSocketBound( String message )
[code]
private static void handleSocketBound( String message )
{
Socket socket;
try{ socket=new Socket( InetAddress.getByName( "127.0.0.1" ), 8794 );
PrintWriter writer=new PrintWriter( new OutputStreamWriter( socket.getOutputStream() ) );
writer.println( ( message!=null&&message.length()>0 ) ? message : DEFAULT_MESSAGE );
writer.flush();
}
catch( UnknownHostException e )
{
...
}
catch( IOException e )
{
...
}
}
[/code]
[code]
/**
* Server not yet running. Start it and listen for incoming messages.
*/
private static void handleSocketUnBound()
{
listen(); //转向Qؓ了对U好看?q是Z兼容Q?br />}
/**
* Listen for incoming messages.看看接受的连接发送了什么内?br /> */
private static void listen()
{
//Run the Server inside a Thread
server=new ExtendedThread() //extends from Thread
{
public void run()
{
while( !isStopped()&&!isInterrupted() )
{
BufferedReader buffReader=null;
try{ //Read a single line from the Socket
Socket socket=applLockSocket.accept();
buffReader=new BufferedReader( new InputStreamReader( socket.getInputStream() ) );
final String message=buffReader.readLine();
socket.close();
//Check the received message
if( ( message!=null&&message.length()>0 )&&GUI.display!=null&&!GUI.display.isDisposed() ) //ȀzL个GUI的代码在此,我们q去看看
{
GUI.display.asyncExec( new Runnable()
{
public void run()
{
//Restore the RSSOwl Window and handle Message
if( GUI.isAlive() )
{
GUI.rssOwlGui.restoreWindow(); //扑ֈ了,转到GUI.java
//Handle the message as Link if valid argument
if( RSSOwlLoader.isValidArgument( message ) )
{
GUI.rssOwlGui.getEventManager().actionHandleSuppliedLink( message );
}
}
}
} );
}
}
catch( IOException e )
{
...
}
finally{ //关闭?br /> }
}
}
};
server.setDaemon( true );
server.setName( "Startup Manager Thread" );
server.start();
}
[/code]
q踪?GUI.java 见下Q?/font>
q踪到GUI.restoreWindow()
[code]
/**
* Restore the application window either from taskbar or the tray.
*/
public void restoreWindow()
{
//RSSOwl is minimized to Tray
if( GlobalSettings.useSystemTray()&&rssOwlSystray!=null&&rssOwlSystray.isMinimizedToTray() )
{
rssOwlSystray.restoreWindow();
}
else{ //RSSOwl is not active
shell.forceActive(); //是它了
shell.setMinimized( false );
}
}
[/code]
原理如下Q?
在本?794端口建立服务监听Qƈ且一直监听此端口Q试图接受此端口其它实例Q其它程序?Q发送的输入
如果d数据Q好像没有判断数据的合法性,仅仅判断数据不ؓI)Qƈ且自׃是“激zZ状态,“激zZ自己;
如果建立服务监听不成功,说明已经有实例(其它E序Q)占用此端口了Q向此端口发送数据唤醒前一个实例,停几U以便前一个实例接受,然后退出?
E序用的是SWTQ激zL法用的是shell.forceActive()Qbut it's not good for core java.
以上分析如有不对Q恳h正?/font>
import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
import java.io.FileOutputStream;
import java.io.FileNotFoundException;
import javax.swing.JFrame;
/*******************************************************************************
*
* 只运行一个实?br /> *
* Just single instance
*
*
* Author: NeedJava
*
* Modified: 2007.08.29
*
*
* 你可以用此E序于Q何地方,但请保留E序作者及注释的完整。如果你改进了程序,
*
* 请在原作者后d姓名Q如QAuthor: NeedJava/Jack/MikeQ版本及修改旉同理?br /> *
******************************************************************************/
public final class SingleInstance
{
/*****************************************************************************
*
* 构造函?br /> *
****************************************************************************/
private SingleInstance()
{
this( "vab", ".vab", "vab" );
}
public SingleInstance( String filePrefixName, String fileSuffixName, String directoryName )
{
this.init( filePrefixName, fileSuffixName, directoryName );
}
/*****************************************************************************
*
* 原理Q?br /> *
* 用重定向标准错误输出流定向C个日志文Ӟ占用它,使其不能被删?br /> *
* 以后的实例试囑ְ存在的此日志文g改名q且另存为某个文件夹?br /> *
* 如果成功Q说明没有程序占用它Q不排除你在用它Q缺PQ,正好保存日志
*
* 如果不成功,退出、renameTo命o有一双雕的作用
*
****************************************************************************/
private final void init( String filePrefixName, String fileSuffixName, String directoryName )
{
if( filePrefixName==null||fileSuffixName==null||directoryName==null )
{
exitWithWarning( "Error: Invalid file name.", 10 );
}
//We need check the fileSuffixName here? From the tail?
String fileName=filePrefixName+fileSuffixName;
try{ File error=new File( fileName );
if( error.exists() )
{
File directory=new File( directoryName );
String newFileName=directoryName+File.separator+convertMillisecond2DateTime( error.lastModified() )+fileSuffixName;
//System.out.println( newFileName );
if( directory.exists() )
{
if( directory.isDirectory() )
{
//renameTo也是好东东,既可以改名,q可以移文g
if( !error.renameTo( new File( newFileName ) ) )
{
exitWithWarning( "Error: The instance already exists, I will exit.", 11 );
}
}
else{ exitWithWarning( "Error: The \'"+directoryName+"\' is not a valid directory.", 21 );
}
}
else{ if( directory.mkdirs() )
{
//renameTo也是好东东,既可以改名,q可以移文g
if( !error.renameTo( new File( newFileName ) ) )
{
exitWithWarning( "Error: The instance already exists, I will exit.", 11 );
}
}
else{ exitWithWarning( "Error: Failed to create the \'"+directoryName+"\' directory.", 22 );
}
}
}
//重定向标准错误输出流Q所有功能全靠它。来Q啵一?br /> System.setErr( new PrintStream( new FileOutputStream( fileName ) ) );
}
catch( FileNotFoundException fnfe )
{
//fnfe.printStackTrace();
exitWithWarning( fnfe.toString(), 23 );
}
catch( IOException ioe )
{
//ioe.printStackTrace();
exitWithWarning( ioe.toString(), 29 );
}
catch( Exception e )
{
//e.printStackTrace();
exitWithWarning( e.toString(), 99 );
}
}
/*****************************************************************************
*
* You can change the milliseconds to the date and time string here
*
* I just return the original
*
* Don't get the same string :)
*
****************************************************************************/
private final String convertMillisecond2DateTime( long millisecond )
{
return ""+millisecond;
}
/*****************************************************************************
*
* Return the warning and the exit code, then exit the application
*
****************************************************************************/
private final void exitWithWarning( String warning, int code )
{
System.out.println( warning==null ? "" : warning );
System.exit( code );
}
/*****************************************************************************
*
* d数入?br /> *
****************************************************************************/
public final static void main( String[] args )
{
SingleInstance si=new SingleInstance( "error", ".txt", "error" );
final JFrame frame=new JFrame( "Just single instance. By NeedJava. 2007.08.29" );
//I stay here, to make some friends happy.
frame.addWindowListener( new WindowAdapter()
{
public void windowClosing( WindowEvent we )
{
frame.dispose();
System.exit( 0 );
}
} );
frame.setBounds( 200, 200, 700, 70 );
frame.setVisible( true );
}
}
-- 使用Northwind试
USE Northwind
GO
DECLARE @what varchar(800)
SET @what='White' --要搜索的字符?
DECLARE @sql varchar(8000)
DECLARE TableCursor CURSOR LOCAL FOR
SELECT sql='IF EXISTS ( SELECT 1 FROM ['+o.name+'] WHERE ['+c.name+'] LIKE
''%'+@what+'%''
) PRINT ''所在的表及字段Q['+o.name+'].['+c.name+']'''
FROM syscolumns c JOIN sysobjects o ON c.id=o.id
WHERE o.xtype='U' AND c.status>=0 AND c.xusertype IN (175, 239, 231, 167 )
OPEN TableCursor
FETCH NEXT FROM TableCursor INTO @sql
WHILE @@FETCH_STATUS=0
BEGIN
EXEC( @sql )
FETCH NEXT FROM TableCursor INTO @sql
END
CLOSE TableCursor
-- 删除游标引用
DEALLOCATE TableCursor
-- 试l果
所在的表及字段Q[Orders].[ShipName]
所在的表及字段Q[Customers].[CompanyName]
SETLOCAL EnableDelayedExpansion
DEL /F /Q picture.txt 2>NUL
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
:: 原理Q?br />::
:: 一般情况下Q有EXIF信息的照片,会有三处旉Q当然还有特例)Q第一处格式ؓQ?br />::
:: 2001:01:01 02:04:18
::
:: W二、第三处是在一LQ中间有个NULL|如下Q?br />::
:: 2001:01:01 02:04:18[NULL]2001:01:01 02:04:18
::
:: 我通过WindowsXP和ACDSee8分析了很多张囄Q发现第一处的旉很可能有误,
::
:: 也就是说QWindowsXP和ACDSee8实际使用的应该是W二或第三处的时_
::
:: 使用W二处的旉?br />::
::
:: 注意Q?br />::
:: 1、有些h喜欢把一些秘密藏在图片中Q而秘密有可能包含旉Q所以,可能有问题,
::
:: 不过Q这U情况好像很?
::
:: 2、由于FINDSTR.EXE命o的局限性(q真正的正则表辑ּQ,错误是难免的?br />::
::
:: 另外Q?br />::
:: 1、开始我?.jpeg也列入查找,但发?.jpe可以搜烦?.jpegQ只好剔?.jpeg?br />::
:: 2、我讨厌ACDSee8重命名时Q把2001-01-01 02-01-19Ҏ2001-01-01 2-1-19Q不好看Q?br />::
:: 3、其实我写这个的目的是修改囄名称为照相时_剩下的以后写
::
::
:: Author: NeedJava
::
:: Modified: 2007-08-15/2007-08-24/2007-08-25
::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
FOR /R %%a IN ( *.jpg *.jpe *.jfif *.tif ) DO (
CLS
ECHO 正在处理?%%a!?/font>
SET "final=NULL"
IF "!final!"=="NULL" (
SET /A times=0
FOR /F "delims=" %%i IN ( 'FINDSTR.EXE "200 199 201 202" "%%a" 2^>NUL ^| MORE 2^>NUL ^| FINDSTR.EXE /R "\<[1-2][0-9][0-9][0-9][:][0-1][0-9][:][0-3][0-9] [0-2][0-9][:][0-5][0-9][:][0-5][0-9]\>" 2^>NUL' ) DO (
SET /A times+=1
IF !times! EQU 2 (
SET "parse=%%i"
IF "!parse:~-3,1!"==":" IF "!parse:~-9,1!"==" " (
SET "parse=!parse:~-19!"
ECHO Found [!parse!]
FOR /F "tokens=1,2,3,4,5,6 delims=: " %%A IN ( "!parse!" ) DO (
SET "final=%%A-%%B-%%C %%D-%%E-%%F"
)
)
)
)
)
IF "!final!"=="NULL" (
FOR /F "delims=" %%i IN ( 'FINDSTR.EXE /I "DateTimeOriginal" "%%a" 2^>NUL' ) DO (
SET "parse=%%i"
IF /I "!parse:~-24,7!"=="</exif:" IF "!parse:~-30,1!"=="+" (
SET "parse=!parse:~-49,19!"
ECHO Found [!parse!]
FOR /F "tokens=1,2,3,4,5,6 delims=-:T" %%A IN ( "!parse!" ) DO (
SET "final=%%A-%%B-%%C %%D-%%E-%%F"
)
)
)
)
IF NOT "!final!"=="NULL" (
ECHO Parse [!final!]
ECHO [%%~nxa]>>picture.txt
ECHO !final!>>picture.txt
ECHO;>>picture.txt
)
)
GOTO :EOF
@ECHO ON
剩下的就是改名了Q由于要防备同名Q也是一U内拍了两三张这L情况Q所以需要追加数字序?br />
SETLOCAL EnableDelayedExpansion
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
:: 需要区别FAT32和NTFS格式下的回收?br />::
:: FAT32回收站结构如下:
::
:: [Recycled]
:: desktop.ini
:: INFO2
::
:: NTFS回收站结构如下:
::
:: [Recycler]
:: [S-1-5-21-1409082233-448539723-725345543-500]
:: desktop.ini
:: INFO2
:: [S-1-5-21-1844237615-2139871995-1417001333-500]
:: desktop.ini
:: INFO2
:: [S-1-5-21-606747145-261478967-839522115-500]
:: desktop.ini
:: INFO2
::
:: 其中Q?br />::
:: desktop.ini用来定义文g夹,告诉pȝQ你把存我的文g夹变成回收站的样?br />::
:: INFO2用来存放当前盘符下删除的文g的原来\径,?.3短文件名Q以及与改名文g对应关系
::
:: 我们是用的INFO2文gQ将里面存放的信息通过两次查找qo出来
::
:: 重点Q?br />::
:: FIND.EXE ":" "C:\Recycled\INFO2" 2>NUL | FINDSTR.EXE /R "^[A-z]:[\\]" 2>NUL
::
:: 参考:
::
::
http://www.cn-dos.net/forum/viewthread.php?tid=25053&fpage=1&highlight=tokens%3D1%2B&page=1
::
:: 感谢Q?br />::
:: 中国DOS联盟论坛里所有给予我启发的热心hQ我受益匪!
::
:: Author: NeedJava
::
:: Modified: 2007.08.13
::
:: BTW: 今晚23时东北方向有׃座流星雨Q我已经调好照相Z
::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
DEL /F /Q deleted.txt 2>NUL
FOR %%a IN ( C D E F G H I J K L M N O P Q R S T U V Y X Y Z ) DO (
IF EXIST "%%a:\" (
ECHO 正在搜烦?%a:〕盘下的回收站…?/font>
FOR /F "delims=" %%i IN ( 'DIR /AH-D /B /S "%%a:\Recycler\INFO2" 2^>NUL' ) DO (
REM ECHO [%%i] & PAUSE
CALL :parse %%i
)
FOR /F "delims=" %%I IN ( 'DIR /AH-D /B /S "%%a:\Recycled\INFO2" 2^>NUL' ) DO (
REM ECHO [%%I] & PAUSE
CALL :parse %%I
)
)
)
@ECHO ON
GOTO :EOF
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
:: 重点Q?br />::
:: FIND.EXE ":" "C:\Recycled\INFO2" 2>NUL | FINDSTR.EXE /R "^[A-z]:[\\]" 2>NUL
::
:: 详细解释请关注上面的|站Q无奈何版主的叙qͼ呵呵Q本人坐板凳?br />::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:parse
ECHO [%1]>>deleted.txt
FOR /F "delims=" %%m IN ( 'FIND.EXE ":" "%1" 2^>NUL ^| FINDSTR.EXE /R "^[A-z]:[\\]" 2^>NUL' ) DO (
ECHO %%m>>deleted.txt
)
ECHO.>>deleted.txt
后记Q鉴于很多病毒喜Ƣ往回收站里面钻Q通过查找真正被删除的文g列表Q找到对应的删除文gQ那么剩下的文g可以看着办了Q估计先要用IS杀掉进E?/font>