Sunday, February 19, 2012

三寸天堂 v.s. 夢のしずく v.s. Braveheart - 聽得出來嗎? (C調)



第一次聽到 严艺丹的《三寸天堂》 是有那麼一點似曾相識的感覺。 但批評人家抄襲, 我認為這些人有點酸葡萄心理。
http://www.wenzhousx.com/yule/yulebagua/39426.html

我倒覺得 严艺丹《三寸天堂》 和 松たか子《夢のしずく》 是有那麼一點學 Horner為影片《Braveheart》所做的配樂。

《三寸天堂》中的中國胡琴演奏增添了中國古典風味 與 《Braveheart》的蘇格蘭風笛 有著異曲同工之妙。
讓人覺得 严艺丹《三寸天堂》 有那麼一點點奧斯卡的味道。 難怪聽了以後, 感覺餘音繞樑, 久久不能忘記。
而 松たか子《夢のしずく》 就是一般流行歌曲, 感覺遜色的多了。

严艺丹《步步惊心》片尾曲《三寸天堂》【抄袭原曲-松隆子《梦的点滴》】? 這些網路上的批評文章 真的有點好笑。

P.S.
Braveheart Soundtrack: http://www.youtube.com/watch?v=9AN04imFDK8
严艺丹《三寸天堂》: http://www.youtube.com/watch?v=HKryDrp2Nds
松たか子《夢のしずく》: http://www.youtube.com/watch?v=wWnu-1gChko

Thursday, January 26, 2012

Awk Sed Sort Command Sample

Get the strings you need from a file, sort the strings, and then save it into another file.

cat 10000ACRB_wm_pdf.xsl | sed 's/RefID/RefID\n/' | 
grep RefType | sed 's/.*RefType/RefType/' | 
sed 's/RefType=./RT_/' | sed 's/.].*//' | 
sort | tee ACRB_RefTypes.txt

Read the new file line by line and then add strings you need.

while read line
do
if echo ${line} | grep -q ${preline}
then
equal=${line}
else
preline=${line}
echo ${line}
fi
done < ./ACRB_RefTypes.txt |
sed 's/RT_//' |
awk '{print "Map(XPath(\"/PmtRec/*s/RefInfo/*s/RefID\"), XPath(\"/DocMap/*s/ACRB_RefTypes/*s/RT_"
   $0
   "\"), [], \""
   $0
   "\")," }'

Tuesday, July 5, 2011

Is application/package running in 32-bit or 64-bit in a 64-bit kernel?

In Solaris:

If the hardware is 64-bit capable, a new software install will, by default, install the 64-bit packages. To check to see if the 64-bit packages have been installed, use the pkginfo command.

/usr/bin > pkginfo | grep 64
application SUNWbdb                         BerkeleyDB-Base 4.2.52 (sun-private) Solaris Sparc 32-bit and 64-bit Architecture
application SUNWbdbj                        BerkeleyDB-Java(sun-private) 4.2.52 Solaris Sparc 32-bit and 64-bit Architecture
system      SUNWkfb                         Sun XVR-2500 Graphics System Software/Device Driver (64-bit)
system      SUNWnfb                         Sun XVR-300 Graphics System Software/Device Driver (64-bit)
application SUNWnfbcf                       Sun XVR-300 Graphics Configuration Software (64-bit)
application SUNWnfbw                        Sun XVR-300 Graphics Window System Support (64-bit)
system      SUNWrtvc                        SunVideo Device Driver (64-bit)
/usr/bin >
/usr/bin >

If no package names are returned, then only 32-bit packages are installed.

Use pkginfo -l to verify the package is installed:
/usr/bin > pkginfo -l SUNWkfb
   PKGINST:  SUNWkfb
      NAME:  Sun XVR-2500 Graphics System Software/Device Driver (64-bit)
  CATEGORY:  system,graphics
      ARCH:  sparc.sun4v
   VERSION:  10.0.0,REV=2007.05.24
   BASEDIR:  /
    VENDOR:  Sun Microsystems, Inc.
      DESC:  Device driver for the PCI-E Bus Sun XVR-2500 graphics accelerator (64-bit)
    PSTAMP:  zubat20081229020311
  INSTDATE:  Mar 05 2011 21:28
   HOTLINE:  Please contact your local service provider
    STATUS:  completely installed
     FILES:        6 installed pathnames
                   5 shared pathnames
                   5 directories
                   1 executables
                2800 blocks used (approx)


-----------------------------------------------------------
In Linux:

List all installed packages using rpm -qa option:
>rpm -qa | grep htmldoc
htmldoc-1.8.27.1-0

Display more information about package using rpm -qi <package> command:
>rpm -qi htmldoc
Name        : htmldoc                      Relocations: (not relocatable)
Version     : 1.8.27.1                          Vendor: Easy Software Products
Release     : 0                             Build Date: Tue Aug 29 21:01:51 2006
Install Date: Tue Mar  2 17:26:33 2010         Build Host: amd64.lab.easysw.com
Group       : Applications                  Source RPM: htmldoc-1.8.27.1-0.src.rpm
Size        : 8052423                          License: 1997-2006 by Easy Software Products, All Rights Reserved.
Signature   : (none)
Packager    : mike@amd64.lab.easysw.com
Summary     : HTMLDOC
Description :
HTMLDOC converts HTML files and web pages to PDF and PostScript.

Is Unix running in 32-bit or 64 bit?

In Solaris:

You can determine the currently running kernel with this command:

/usr/bin > /usr/bin/isainfo -kv
64-bit sparcv9 kernel modules
/usr/bin > isainfo -v
64-bit sparcv9 applications
        asi_blk_init vis2 vis popc
32-bit sparc applications
        asi_blk_init vis2 vis popc v8plus div32 mul32
This machine is able to run 64 bit applications, thus it has a 64 bit kernel running. If you only saw a 32-bit response or even "Command not found" then you are running with a 32 bit kernel.

-------------------------------------------------------
In Linux:
>uname -a
Linux linux-machine 2.6.18-194.8.1.el5 #1 SMP Wed Jun 23 10:52:51 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux

>uname -m
x86_64
If it prints i686 then your kernel is 32 bit, if you see x86_64 then it's 64 bit,

Thursday, March 3, 2011

Remove CVS folder

hsual@DTC2700311CD565$ find . | grep CVS
./PMP_Report/DEFAULT/C3.1_STND/CVS
./PMP_Report/DEFAULT/C3.1_STND/CVS/Entries
./PMP_Report/DEFAULT/C3.1_STND/CVS/Repository
./PMP_Report/DEFAULT/C3.1_STND/CVS/Root
./PMP_Report/DEFAULT/CVS
./PMP_Report/DEFAULT/CVS/Entries
./PMP_Report/DEFAULT/CVS/Repository
./PMP_Report/DEFAULT/CVS/Root
./PMP_Report/DEFAULT/PAYROLL/CVS
./PMP_Report/DEFAULT/PAYROLL/CVS/Entries
./PMP_Report/DEFAULT/PAYROLL/CVS/Repository
./PMP_Report/DEFAULT/PAYROLL/CVS/Root
hsual@DTC2700311CD565$ 
hsual@DTC2700311CD565$ 
hsual@DTC2700311CD565$ 
hsual@DTC2700311CD565$ find . | grep CVS$ | xargs rm -rf
hsual@DTC2700311CD565$ find . | grep CVS
hsual@DTC2700311CD565$ 

Thursday, February 24, 2011

Java Read/Write Fixed Length file sample

public static void TempPreProcessor_Fixed(String input, String output){
 BufferedReader reader = null;
 BufferedWriter writer = null;
 try 
 {
  String inputfilename = input;
  String outputfilename = output;
  
  reader = new BufferedReader(
     new InputStreamReader(
       new FileInputStream(inputfilename)));
  writer = new BufferedWriter(
     new OutputStreamWriter(
       new FileOutputStream(outputfilename)));
  
  String thisLine = null;

  //line 1
  if((thisLine =reader.readLine()) != null) 
   writer.write("AA,"+thisLine+"\n");

  //line 2-4
  for(int i = 0; i<3; i++){
   if((thisLine =reader.readLine()) != null)
    writer.write(thisLine+"\n");
  }
  
  //remaining lines
  while((thisLine=reader.readLine()) != null){   
   //add AB to start of line
   writer.write("AB,"+thisLine+"\n");
   //copy with no change
   if((thisLine=reader.readLine()) != null)
    writer.write(thisLine+"\n");
  } 
 }catch(Exception e){
  throw new ServiceException("TempPreProcessor: Unknown errors: " + e.toString());
 }finally{
  try{
   if(writer != null) writer.flush();
   if(reader != null) reader.close();
   if(writer != null) writer.close();
   reader=null; writer=null;
  }catch(Exception e){
   throw new ServiceException("TempPreProcessor: Unknown errors: " + e.toString());
  }
 }
}

Java Read/Write CSV file sample

public static void TempPreProcessor_CSV(String input, String output){
 //IDataSharedCursor idc = pipeline.getSharedCursor();
 BufferedReader reader = null;
 BufferedWriter writer = null;
 try 
 {
  String inputfilename = input;
  String outputfilename = output;

  reader = new BufferedReader(
               new InputStreamReader(
                   new FileInputStream(inputfilename)));
  writer = new BufferedWriter(
               new OutputStreamWriter(
                   new FileOutputStream(outputfilename)));
  int lineNum = 1;
  String checkNum = "";
  
  String thisLine = "";

  // comma, which is not enclosed in quotes
  String delims = ",(?=([^\"]*\"[^\"]*\")*[^\"]*$)";

  while((thisLine=reader.readLine()) != null){// till end of file
     StringBuffer sb = new StringBuffer();
     if(thisLine.trim().equals("")) 
                           continue; // ignore blank lines
   
     if (lineNum++ == 1){
      sb.append(thisLine + "\n");
      writer.write(sb.toString());
      continue;  
     }

     String[] thisTokens = thisLine.split(delims);                           
     if (!checkNum.equalsIgnoreCase(thisTokens[0].toString())){
         checkNum = thisTokens[0].toString();
         sb.append("AA," + thisLine);
     }else{
         sb.append("AB," + thisLine);
     }
     sb.append("\n");
     writer.write(sb.toString());
  }
 }catch(Exception e){
  //throw new ServiceException(
  //  "TempPreProcessor: Unknown errors: " + e.toString());
 }finally{
  try {
   if(writer != null) writer.flush();
   if(reader != null) reader.close();
   if(writer != null) writer.close();
   reader=null;
   writer=null;
   //idc.destroy();
  }catch(Exception e){
   //throw new ServiceException(
   //  "TempPreProcessor: Unknown errors: " + e.toString());
  }
 }
}