KTUGFaq

KTUG FAQ

PerlTeX (rev. 1.5)

α:
йȣ:
His heart was yours from the first moment that you met.
ѱLaTeXkotex&value=WinEdtTip/ȣԷYourWordLaTeXWrokshop/FrontPage占쏙옙타占쌉글꼴삼옙占쏙옙歐占 › PerlTeX
[]

Ұ


Perl ڵ带 LaTeX ũθ Դ ִ Ű̴. Perl ũΰ LaTeX ũη Ǵ ̴. ̷ν LaTeX ɷ° Perl α׷ ɷ ְ ȴ.

[]

ں \usepackage{perltex} Ѵ. \perlnewcommand, \perlrenewcommand, \perlnewenvironment, \perlrenewenvironment װ ̿ ִ.

perltex.pl̶ ũƮ Ѵ. ɼ .
--latex=program
        ⺻ latex  ٸ (:pdflatex)   ִ.
--nosafe
        ⺻  Perlڵ(: ϻ)  ʵ Ǿ ִµ
         ɼ ġ Ǯش.  Perl ڵ尡 ״ ȴ.
--permit=feature
        Ư Perlڵ常 ġκ Ѵ.  ɼ   ִ.

[]

1: ѱ Sorting

TeXδ ڿ ϴ ڵ带 ¥Ⱑ ʴ. PerlTeX ̷ Ա⺸ .

test.tex:
\documentclass[a4paper]{article}
\usepackage{perltex}
\usepackage{dhhangul}
\perlnewcommand{\sortarg}[1]{join ',', sort split ',', $_[0]}
\newcommand{\teststring}{ѱ,,츮,ѹα}
\begin{document}
\begin{center}
\teststring\\
$\Downarrow$\\
\sortarg{\teststring}
\end{center}
\end{document}
PerlTeX TeX ũθ ̸ Ȯ(expand) Perl óѴ. Ȯ ϰ Ϸ \noexpand TeX ũ տ ̸ ȴ.

:
$ perltex.pl --latex=lambda --nosafe test.tex

: perltexsortexample.png

~ ⸸ ص ųϴ. :D --Progress

[]

2: DB List Plot ׸

DB(MySQL Ǵ MSSQL) Ǿ ִ ġ ͸ Perl Ͽ ̸ PSTricks ̿Ͽ List plot ׸ ̴. ⼭ 츮 ϴ List plot ü հ ִ밪, ּҰ perl Ͽ ̸ ٷ TeX ϴ ִ ̴. Linux ϴ ϰ testϿ Windows 밡ϸ ȴ.

[]

DB ϱ

DB Ŵ Ͱ Ǿ ְ ̸ ̴.

1. MySQL
#! /usr/bin/perl -w
# connect.pl - connect to the MySQL server

use strict;
use DBI;

# 
 localhost perf_best1̶ MySQL DB Ѵٰ
# Ͽ.
my $dsn = "DBI:mysql:host=localhost;database=perf_best1";

# ⼭
# mysqluser MySQL  
# mysqlpasswd  MySQL password ̴. (ڱ ȯ濡  ٲٱ ٶ.)
my $mysqldbh = DBI->connect ($dsn, "mysqluser", "mysqlpasswd")
    or die "Cannot connect to server\n";

# 10 ͸ ϸ
my $month='10';

# server-A hostname    ڷḦ  
my @hostnames = ('server-A');

# BMC Best1 ̶ ǰ  
# test    Ʒ  format   SQL  ϸ
#  ̴.
#  ¥     հ       ִ밪       ּҰ  
#   01        30                    50                  10
#   02        40                    70                  20 
#   ...        ...                    ...                  ...
#
my $mysqlsth= $mysqldbh->prepare(
    "SELECT SUBSTRING(C.Int_start_date,7,8), AVG(CPU_UTIL), MAX(CPU_UTIL), MIN(CPU_UTIL)
    FROM CAXNODE A,
    CAXNODED B,
    CAXINTVL C
    WHERE A.INDEXX=B.SYSTEMS AND B.INTVL=C.INDEXX AND
    C.INTTYPE=? AND (A.NODE_ALIAS=?) AND B.CPU_UTIL>=0 AND
    Int_start_date LIKE ?
    GROUP BY C.Int_start_date
    ORDER BY C.Int_start_date"
);

foreach my $hostname (@hostnames) {

    open(AVGFH, ">cpu_avg_" . "$hostname". "_" . $month . ".dat");
    open(MAXFH, ">cpu_max_" . "$hostname". "_" . $month . ".dat");
    open(MINFH, ">cpu_min_" . "$hostname". "_" . $month . ".dat");

#  SQL ?    'M',   $hostname,     '04/' .$month . '/%'
#  ü ȴ.
# '04/' .$month . '/%'  '04/10/%'    ̴. ( .  ڿ  operator)
    $mysqlsth->execute('M', $hostname, '04/' .$month . '/%');
    my $count = 0;
    while (my @val = $mysqlsth->fetchrow_array ())
    {
        my $day = $val[0];
        my $avg = $val[1];
        my $max = $val[2];
        my $min = $val[3];

        print AVGFH "$val[0]\t$avg\n";
        print MAXFH "$val[0]\t$max\n";
        print MINFH "$val[0]\t$min\n";
        ++$count;
    }
    $mysqlsth->finish();
    print "$count rows were returned\n"
}


^
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2008-01-11 00:52:35
Processing time 0.0385 sec