プログラミング・メモ pert2
コンピュータ・プログラミングに関する掲示板です。
情報や(ないと思うけど)質問はここへどうぞ。
ほとんどメモ替わりです。改行は<しっかり>入れてください。
// 192 日本語対応INIファイル操作クラス(Propertiesのための変換部分修正版) Fri Nov 2 17:27:44 2001
package nilabj.util;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Properties;
import nilabj.debug.Debug;
/**
* Sections クラスは複数のセクションを所有する機能を持つクラスです。
* セクションとは重複することのないキーと、キーに対応する値をひとつだけ持つオブジェクトです。一般的には Section オブジェクトを示します。
*/
public class Sections
{
/***********************************************************
WinAPI
GetPrivateProfileSection
GetPrivateProfileString
GetPrivateProfileInt
WritePrivateProfileSection
WritePrivateProfileString
section:セクション名
item:エントリ
value:値
CWinApp
GetProfileString( section, item );
GetProfileInt( section, item );
WriteProfileInt( section, item, value );
WriteProfileString( section, item, value );
***********************************************************/
private Hashtable sections = new Hashtable();
/**
* セクションを返します。
* @param section セクション名
*/
public Section getSection( String section )
{
if ( checkSectionName(section) )
return (Section)sections.get(section);
else
return null;
}
/**
* セクションを追加します。
* @param section セクション名
* @param sectionValue セクションの Section オブジェクト
*/
public Section setSection( String section, Section sectionValue )
{
if ( checkSectionName(section) )
return (Section)sections.put( section, sectionValue );
else
throw new RuntimeException();
}
/**
* 新しいセクションを追加します。
* @param section セクション名
*/
public Section setSection( String section )
{
if ( checkSectionName(section) )
return (Section)sections.put( section, new Section() );
else
throw new RuntimeException();
}
/**
* @param section セクション名
* @param item プロパティキー
*/
public String getProperty( String section, String item )
{
Section s = getSection( section );
if ( s == null ) {
return notExistedSection();
}
else {
return s.getProperty( item );
}
}
/**
* @param section セクション名
* @param item プロパティリストに配置されるキー
* @param value itemに対応する値
*/
public String setProperty( String section, String item, String value )
{
Section s;
s = getSection( section );
if ( s == null ) {
// セクションが無いから作る
setSection( section );
s = getSection( section );
}
return (String)s.setProperty( item, value );
}
/** セクションが存在しないという意味を持つ値を返す。 */
protected String notExistedSection()
{
return NOT_EXISTED_SECTION;
}
/** セクションが存在しないという意味を持つ値 */
public static final String NOT_EXISTED_SECTION = null;
/**
*
*/
public Enumeration sectionNames()
{
return sections.keys();
}
/**
* 指定された出力ストリームに、プロパティリストを出力します。このメソッドはデバッグに便利です。
* @param out 出力ストリーム
*/
public void list( PrintWriter out )
{
out.println( "-- listing sections --" );
String sectionName;
Enumeration enum = sectionNames();
while( enum.hasMoreElements() ) {
sectionName = (String)enum.nextElement();
out.println( "[" + sectionName + "]" );
getSection( sectionName ).createProperties().list(out);
}
}
/**
* 指定された出力ストリームに、プロパティリストを出力します。このメソッドはデバッグに便利です。
* @param out 出力ストリーム
*/
public void list( PrintStream out )
{
out.println( "-- listing sections --" );
String sectionName;
Enumeration enum = sectionNames();
while( enum.hasMoreElements() ) {
sectionName = (String)enum.nextElement();
out.println( "[" + sectionName + "]" );
getSection( sectionName ).createProperties().list(out);
}
}
public void load( String inputFilePath ) throws FileNotFoundException
{
load( new FileInputStream(inputFilePath) );
}
public void load( File inputFile ) throws FileNotFoundException
{
load( new FileInputStream(inputFile) );
}
public void load( InputStream inStream )
{
try {
BufferedReader in =
new BufferedReader(new InputStreamReader(inStream));
String line;
while( true ) {
line = in.readLine();
if ( line == null )
return; // 何も読み込めない
if ( isSectionLine(line) )
break;
}
boolean loopFlag = true;
while( loopFlag ) {
String sectionName = getSectionName(line);
ArrayList lines = new ArrayList();
while (true) {
line = in.readLine(); // get next line
if (line == null) {
loopFlag = false; // escape outside loop
break; // escape this loop
}
else if ( isSectionLine(line) ) {
break; // escape this loop
}
else {
lines.add(line);
}
}
setSection( sectionName, loadSection(lines) );
}
}
catch ( Exception e ) {
e.printStackTrace();
throw new RuntimeException();
}
}
private Section loadSection( ArrayList lines )
{
try {
StringBuffer buf = new StringBuffer();
for ( int i = 0; i < lines.size(); i++ ) {
buf.append( toStringforProperties( (String)lines.get(i) ) );
buf.append( System.getProperty("line.separator") );
}
return loadSection( buf.toString() );
}
catch ( Exception e ) {
throw new RuntimeException();
}
}
private Section loadSection( String lines )
{
try {
System.out.println( lines );
ByteArrayInputStream bais = new ByteArrayInputStream( lines.getBytes() );
Properties p = new Properties();
p.load(bais);
return new Section(p);
}
catch ( Exception e ) {
e.printStackTrace();
throw new RuntimeException();
}
}
private String toStringforProperties( String s )
{
int length = s.length();
char ch;
StringBuffer buf = new StringBuffer();
for ( int i = 0; i < length; i++ ) {
ch = s.charAt(i);
if ( ch <= 127 ) {
buf.append( ch );
}
else {
buf.append( UnicodeSheet.toCharacterCode( ch ) );
}
}
return buf.toString();
}
private String getSectionName( String line )
{
if ( !isSectionLine(line) )
throw new RuntimeException();
line = line.trim();
return line.substring(1,line.length()-1);
}
private boolean isSectionLine( String line )
{
line = line.trim();
if ( line.length() <= 2 )
return false;
if ( line.charAt(0) == '[' && line.charAt(line.length()-1) == ']' )
return true;
else
return false;
}
private boolean checkSectionName( String name )
{
if ( name == null || name.equals("") )
return false;
else
return true;
}
}
// 191 日本語対応INIファイル操作クラス(修正版) Fri Nov 2 17:19:48 2001
package nilabj.util;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Properties;
import nilabj.debug.Debug;
/**
* Sections クラスは複数のセクションを所有する機能を持つクラスです。
* セクションとは重複することのないキーと、キーに対応する値をひとつだけ持つオブジェクトです。一般的には Section オブジェクトを示します。
*/
public class Sections
{
/***********************************************************
WinAPI
GetPrivateProfileSection
GetPrivateProfileString
GetPrivateProfileInt
WritePrivateProfileSection
WritePrivateProfileString
section:セクション名
item:エントリ
value:値
CWinApp
GetProfileString( section, item );
GetProfileInt( section, item );
WriteProfileInt( section, item, value );
WriteProfileString( section, item, value );
***********************************************************/
private Hashtable sections = new Hashtable();
/**
* セクションを返します。
* @param section セクション名
*/
public Section getSection( String section )
{
if ( checkSectionName(section) )
return (Section)sections.get(section);
else
return null;
}
/**
* セクションを追加します。
* @param section セクション名
* @param sectionValue セクションの Section オブジェクト
*/
public Section setSection( String section, Section sectionValue )
{
if ( checkSectionName(section) )
return (Section)sections.put( section, sectionValue );
else
throw new RuntimeException();
}
/**
* 新しいセクションを追加します。
* @param section セクション名
*/
public Section setSection( String section )
{
if ( checkSectionName(section) )
return (Section)sections.put( section, new Section() );
else
throw new RuntimeException();
}
/**
* @param section セクション名
* @param item プロパティキー
*/
public String getProperty( String section, String item )
{
Section s = getSection( section );
if ( s == null ) {
return notExistedSection();
}
else {
return s.getProperty( item );
}
}
/**
* @param section セクション名
* @param item プロパティリストに配置されるキー
* @param value itemに対応する値
*/
public String setProperty( String section, String item, String value )
{
Section s;
s = getSection( section );
if ( s == null ) {
// セクションが無いから作る
setSection( section );
s = getSection( section );
}
return (String)s.setProperty( item, value );
}
/** セクションが存在しないという意味を持つ値を返す。 */
protected String notExistedSection()
{
return NOT_EXISTED_SECTION;
}
/** セクションが存在しないという意味を持つ値 */
public static final String NOT_EXISTED_SECTION = null;
/**
*
*/
public Enumeration sectionNames()
{
return sections.keys();
}
/**
* 指定された出力ストリームに、プロパティリストを出力します。このメソッドはデバッグに便利です。
* @param out 出力ストリーム
*/
public void list( PrintWriter out )
{
out.println( "-- listing sections --" );
String sectionName;
Enumeration enum = sectionNames();
while( enum.hasMoreElements() ) {
sectionName = (String)enum.nextElement();
out.println( "[" + sectionName + "]" );
getSection( sectionName ).createProperties().list(out);
}
}
/**
* 指定された出力ストリームに、プロパティリストを出力します。このメソッドはデバッグに便利です。
* @param out 出力ストリーム
*/
public void list( PrintStream out )
{
out.println( "-- listing sections --" );
String sectionName;
Enumeration enum = sectionNames();
while( enum.hasMoreElements() ) {
sectionName = (String)enum.nextElement();
out.println( "[" + sectionName + "]" );
getSection( sectionName ).createProperties().list(out);
}
}
public void load( String inputFilePath ) throws FileNotFoundException
{
load( new FileInputStream(inputFilePath) );
}
public void load( File inputFile ) throws FileNotFoundException
{
load( new FileInputStream(inputFile) );
}
public void load( InputStream inStream )
{
try {
BufferedReader in =
new BufferedReader(new InputStreamReader(inStream));
String line;
while( true ) {
line = in.readLine();
if ( line == null )
return; // 何も読み込めない
if ( isSectionLine(line) )
break;
}
boolean loopFlag = true;
while( loopFlag ) {
String sectionName = getSectionName(line);
ArrayList lines = new ArrayList();
while (true) {
line = in.readLine(); // get next line
if (line == null) {
loopFlag = false; // escape outside loop
break; // escape this loop
}
else if ( isSectionLine(line) ) {
break; // escape this loop
}
else {
lines.add(line);
}
}
setSection( sectionName, loadSection(lines) );
}
}
catch ( Exception e ) {
e.printStackTrace();
throw new RuntimeException();
}
}
private Section loadSection( ArrayList lines )
{
try {
StringBuffer buf = new StringBuffer();
for ( int i = 0; i < lines.size(); i++ ) {
buf.append( toStringforProperties( (String)lines.get(i) ) );
buf.append( System.getProperty("line.separator") );
}
return loadSection( buf.toString() );
}
catch ( Exception e ) {
throw new RuntimeException();
}
}
private Section loadSection( String lines )
{
try {
System.out.println( lines );
ByteArrayInputStream bais = new ByteArrayInputStream( lines.getBytes() );
Properties p = new Properties();
p.load(bais);
return new Section(p);
}
catch ( Exception e ) {
e.printStackTrace();
throw new RuntimeException();
}
}
private String toStringforProperties( String s )
{
int length = s.length();
char ch;
StringBuffer buf = new StringBuffer();
for ( int i = 0; i < length; i++ ) {
ch = s.charAt(i);
switch( ch ) {
case '=':
buf.append("=");
break;
case '#':
buf.append("#");
break;
default:
buf.append( UnicodeSheet.toCharacterCode( ch ) );
break;
}
}
return buf.toString();
}
private String getSectionName( String line )
{
if ( !isSectionLine(line) )
throw new RuntimeException();
line = line.trim();
return line.substring(1,line.length()-1);
}
private boolean isSectionLine( String line )
{
line = line.trim();
if ( line.length() <= 2 )
return false;
if ( line.charAt(0) == '[' && line.charAt(line.length()-1) == ']' )
return true;
else
return false;
}
private boolean checkSectionName( String name )
{
if ( name == null || name.equals("") )
return false;
else
return true;
}
}
// 190 NI-Lab. Wed Oct 3 15:58:36 2001
<tag>
// 189 過去ログ自動生成したい Tue Oct 2 18:16:16 2001
#!/usr/local/bin/perl
########################################################
# makelog ログ作成スクリプト
# @version 1.00
# @since 2001/10/02
# @author made bY NI-Lab.
########################################################
# kind
$KIND = "ST";
$VERSION = "1.00";
### ログファイル名
$LOGFILE = "nibbs.log";
#$LOGFILE = $ARGV[0];
### 出力ファイル名
$OUTFILE = "nibbs.html";
#$OUTFILE = $ARGV[1];
$CANNOT_OPEN_FILE = "ファイルがオープンできません";
# Field of a Record(ログの形式を変えたときだけ変更すること)
$RECORD_FIELDS = 14;
$RETURN_PAGE_NAME = "NI-Lab.";
$RETURN_PAGE = "http://isweb13.infoseek.co.jp/computer/nilab/";
$PAGE_TITLE = "nibbs-log";
# 配色
$BG_COLOR = "#ffbbbb";
$TEXT_COLOR = "#000000";
$LINK_COLOR = "#aa0000";
$VLINK_COLOR = "#aa00aa";
$ALINK_COLOR = "#ff0000";
# 背景色
$BG_RED = 255;
$BG_GREEN = 175;
$BG_BLUE = 175;
$EXPLANATION = "メッセージ";
@messages = printLog( $LOGFILE, $check ); # ログ取得
if ( $check == 3 ) {
&print_error_msg($CANNOT_OPEN_FILE); # エラー表示
exit;
}
# ファイルへ書きこむ
open(OUTHANDLER, ">$OUTFILE") || return 3;
&print_html(@messages);
close(OUTHANDLER);
exit;
### HTMLの表示
sub print_html {
&print_html_head;
&print_records(@_);
&print_html_foot;
}
### HTMLのヘッダ部分を表示
sub print_html_head {
print OUTHANDLER << "__EOS__";
<html><head><title>$PAGE_TITLE</title></head>
<body bgcolor="$BG_COLOR" text="$TEXT_COLOR" link="$LINK_COLOR" vlink="$VLINK_COLOR" alink="$ALINK_COLOR">
<hr>
<div align=right><a href="$RETURN_PAGE">$RETURN_PAGE_NAME</a></div>
<font size=5>$PAGE_TITLE</font><br>
$EXPLANATION<br>
<hr>
__EOS__
}
### サブルーチン ログひとつ表示
sub print_one_record {
local($count, $kind, $namae, $bunsho, $namex, $namey, $msgx, $msgy, $datetime, $red, $green, $blue, $fontsize, $ipadress) = @_;
print OUTHANDLER << "__EOS__";
No.$count Name: <b> $namae </b> $datetime <br>
<div style="color:rgb( $red, $green, $blue );">$bunsho</div>
<hr>
__EOS__
}
### HTMLのフッタ部分を表示
sub print_html_foot {
print OUTHANDLER << "__EOS__";
<div align=right>This page is created by <a href="http://isweb13.infoseek.co.jp/computer/nilab/">NI-Lab.</a>'s makelog $VERSION</div><br><br>
</body>
</html>
__EOS__
}
### ログの表示
sub print_records {
local(@one_record);
local($target_no);
for ($i = 0; $i < (@_ + 1) / $RECORD_FIELDS - 1; $i++) {
$target_no = $RECORD_FIELDS * $i;
for ($j = 0; $j < $RECORD_FIELDS; $j++) {
push @one_record, $_[ $target_no + $j ];
}
&print_one_record(@one_record);
for ($j = 0; $j < $RECORD_FIELDS; $j++ ) {
pop @one_record;
}
}
} # sub print_records ends...
# ログを取得する
# 表示件数($loglines)を0に設定すると全部表示
sub printLog {
my ($logfilename,$check) = @_;
local(@messages); # 戻り値
# ファイルからログを読み込む
local(@record);
# ログファイルをオープンして読み込む
open(LOG, "<$logfilename") or $check = 3;
if ( $check == 3 ) { return @message; }
@record = <LOG>;
close(LOG);
local($count, $kind, $name, $msg, $namex, $namey, $msgx, $msgy, $datetime, $red, $green, $blue, $fontsize, $ipadress);
foreach $one_record(@record)
{
($count, $kind, $name, $msg, $namex, $namey, $msgx, $msgy, $datetime, $red, $green, $blue, $fontsize, $ipadress) = split(/<>/,$one_record);
# ひとつの記事を表示する部分
$datetime = localtime $datetime;
push @messages, ($count, $kind, $name, $msg, $namex, $namey, $msgx, $msgy, $datetime, $red, $green, $blue, $fontsize, $ipadress);
}
$check = 0;
return @messages;
}
// 188 JavaAPIドキュメントをAntで一括作成するbuild.xml Tue Aug 21 15:30:10 2001
<!-- javadocmaker -->
<project name="javaapi" default="document" basedir=".">
<property name="root" value="X:\javadocmaker" />
<property name="src" value="${root}\src" />
<property name="doc" value="${root}\javadoc" />
<!-- DOMCUMENT -->
<target name="document">
<delete dir="${doc}" />
<mkdir dir="${doc}" />
<javadoc
sourcepath="${src}"
destdir="${doc}"
packagenames="*.*" />
</target>
</project>
// 187 MySQLに接続 Mon Aug 20 16:35:23 2001
import java.sql.*;
public class QP
{
public static void main( String[] args )
{
try {
QP qp = new QP();
qp.doit();
}
catch ( Exception e ) {
e.printStackTrace();
}
}
String host = "localhost";
String port = "3306";
String db = "ni";
String user = "root";
String password = "password";
String sql = "select * from abc";
public Connection getConnection() throws ClassNotFoundException, InstantiationException, SQLException, IllegalAccessException
{
String url = "jdbc:mysql://" + host + ":" + port + "/" + db + "?user=" + user + "&password=" + password;
Class.forName( "org.gjt.mm.mysql.Driver" ).newInstance();
return DriverManager.getConnection( url );
}
public void doit() throws Exception
{
Connection con = null;
try {
con = getConnection();
access(con);
}
catch ( SQLException e ) {
e.printStackTrace();
}
finally {
if ( con != null ) {
con.close();
}
}
}
protected void access( Connection con ) throws SQLException
{
Statement state = con.createStatement();
ResultSet rs = state.executeQuery( sql );
String[] names = columnNames(rs);
for ( int i = 0; i < names.length; i++ ) {
System.out.print( names[i] );
System.out.print( " | " );
}
int size = rs.getMetaData().getColumnCount();
while ( rs.next() ) {
for ( int i = 0; i < size; i++ ) {
System.out.print( rs.getString(i+1) );
System.out.print( " | " );
System.out.println();
}
}
}
protected String[] columnNames( ResultSet rs ) throws SQLException
{
ResultSetMetaData rsmd = rs.getMetaData();
int size = rsmd.getColumnCount();
String[] names = new String[size];
for ( int i = 0; i < size; i++ ) {
names[i] = rsmd.getColumnName( i + 1 );
}
return names;
}
}
// 186 システム固有の設定(改行コードなど)を知りたい Wed Jul 18 17:14:37 2001
システム固有の設定としては、改行コード("\r\n","\r","\n")のほかにも、パス区切り文字などがあります。
これらの値を取得するには、System.getPropertyを使います。例えば、改行コードを取得するには、次のようにします。
String crlf = "\n";
try {
crlf = System.getProperty("line.separator");
} catch(SecurityException e) {
}
引数の文字列のリストは、API集の、System.getProperties()に載っています。
また、よく使うパス区切り文字や名前区切り文字は Fileクラスでもともと宣言されていているため、これを使う必要はありません。
// 185 Java で COM を作ろう Tue Jul 17 12:00:37 2001
http://www2.dolphinnetservice.ne.jp/Mattn/AcrobatASP/2.html
// 184 <いかにしてオブジェクト自身への参照を消すのか> Wed Jul 11 12:10:04 2001
<いかにしてオブジェクト自身への参照を消すのか>
public class A implements Runnable
{
private B b;
public A( B b )
{
this.b = b;
}
public void run()
{
System.out.println("aaa");
b.clash();
System.out.println("bbb");
}
}
import java.util.*;
public class B
{
public static void main( String[] args ) throws Exception
{
B b = new B();
b.doit();
}
private ArrayList list = new ArrayList();
private A a;
public void doit() throws Exception
{
a = new A(this);
new Thread(a).start();
Thread.sleep(10000);
System.out.println(a);
}
public void clash()
{
System.out.println("clash");
a = null;
System.out.println("clashend");
}
}
このコードを実行すると、A は自分自身への参照を消すことに成功している。
と思うんだが、スレッドが別だと問題があるのかも(ないような気がするけどなぁ)
// 183 this = null; はダメらしい Wed Jul 11 12:07:08 2001
compile:
[javac] Compiling 87 source files to C:\_nilabj_project\compiled
[javac] C:\xxxxxxxxxxxxx\src\A.java:20: final 変数 this に値を代入することはできません。
[javac] this = null;
[javac] ^
[javac] エラー 1 個
BUILD FAILED
// 182 Java のクラスライブラリとか Fri Jun 22 15:35:32 2001
http://www2s.biglobe.ne.jp/~dat/java/classes/
java.moon
// 181 poo site Wed Jun 20 11:30:37 2001
http://www.poosite.com/
★お絵かき掲示板★など。
// 180 SunSITE Tue Jun 19 18:08:18 2001
http://sunsite.sut.ac.jp/indexj.html
// 179 PEACE Tue Jun 19 12:06:01 2001
http://peace.hauN.org/
WindowsアプリをNetBSDで動かすプログラム
// 178 JAVA で書かれた LISP Fri Jun 15 14:30:05 2001
JAVA LISP 「QUILT」
http://www.cobalt.co.jp/java_lisp/java-lisp1.htm
http://www.cobalt.co.jp/java_lisp/java-lisp2.htm
http://www.cobalt.co.jp/java_lisp/java-lisp3.htm
http://www.cobalt.co.jp/java_lisp/java-lisp4.htm
JAVA PRESS Vol.9
http://www.gihyo.co.jp/javapress/java9/lisp.html
Java Lisp
http://www.remus.dti.ne.jp/~narua2/JLindex.html
pure lisp in java
http://www.hf.rim.or.jp/~tayamagu/program/purelisp/
Java Lisp -- network portable Lisp in Java
http://www.etl.go.jp/~matsui/javalisp/
Kawa, the Java-based Scheme system
http://www.gnu.org/software/kawa/
Java lisp
http://pascal.seg.kobe-u.ac.jp/~shii/lisp/
// 177 http://archive.progeny.com/ Thu Jun 14 14:27:03 2001
http://archive.progeny.com/
// 176 174 Java 変数の初期化記述その1再び Wed Jun 13 13:12:59 2001
new Object[] {new Properties(), new ArrayList() }
// 175 DF(でふ) Wed Jun 13 10:29:27 2001
http://www.vector.co.jp/soft/win95/util/se113286.html
DF(でふ) ファイルやフォルダを高速に比較し並列2画面にわかりやすく表示
diffな感じ。
// 174 Java 変数の初期化記述その1 Sun Jun 10 14:34:14 2001
new int[] {1,2,3,4};
// 173 Windows NT、Terminal Server、および Microsoft Exchange サービスの TCP/IP ポートの使用について Fri Jun 8 14:47:12 2001
Windows NT、Terminal Server、および Microsoft Exchange サービスの TCP/IP ポートの使用について
最終更新日: 2000/05/31
文書番号: JP150543
-------------------------------------------------------------------------------
この資料は以下の製品について記述したものです。
Microsoft Windows NT Server version 4.0
Microsoft Windows NT Server version 4.0、Terminal Server Edition
Microsoft Exchange Server version 5.0
Windows NT Load Balancing Service version 1.0
--------------------------------------------------------------------------------
概要
この資料では、Microsoft Windows NT Version 4.0 および Microsoft Exchange Server
Version 5.0 のサービスで使用される既知の TCP/IP ポート (TCP および/または UDP)
について説明します。このリストの TCP/IP ポート割り当ては、すべてではありません。
TCP/IP のポート割り当ての関連情報については、Microsoft Knowledge Base にある
次の資料を参照してください。
Q174904 Information About TCP/IP Port Assignments
Q176466 XGEN:TCP Ports and Microsoft Exchange:In-depth Discussion
詳細
Windows NT Version 4.0 サービスで使用されるポートのリスト :
Function Static ports
-------- ------------
Browsing UDP:137,138
DHCP Lease UDP:67,68
DHCP Manager TCP:135
Directory Replication UDP:138 TCP:139
DNS Administration TCP:135
DNS Resolution UDP:53
Event Viewer TCP:139
File Sharing TCP:139
Logon Sequence UDP:137,138 TCP139
NetLogon UDP:138
Pass Through Validation UDP:137,138 TCP:139
Performance Monitor TCP:139
PPTP TCP:1723 IP Protocol:47
Printing UDP:137,138 TCP:139
Registry Editor TCP:139
Server Manager TCP:139
Trusts UDP:137,138 TCP:139
User Manager TCP:139
WinNT Diagnostics TCP:139
WinNT Secure Channel UDP:137,138 TCP:139
WINS Replication TCP:42
WINS Manager TCP:135
WINS Registration TCP:137
WLBS および Convoy のクラスタ制御で使用されるポートのリスト :
Function Static ports
-------- ------------
Convoy UDP:1717
WLBS UDP:2504
Microsoft Exchange Server バージョン 5.0 で使用されるポートのリスト :
Function Static ports
-------- ------------
Client/Server Comm. TCP:135
Exchange Administrator TCP:135
IMAP TCP:143
IMAP (SSL) TCP:993
LDAP TCP:389
LDAP (SSL) TCP:636
MTA - X.400 over TCP/IP TCP:102
POP3 TCP:110
POP3 (SSL) TCP:995
RPC TCP:135
SMTP TCP:25
NNTP TCP:119
NNTP (SSL) TCP:563
関連情報については、Microsoft Knowledge Base の以下の資料を参照してください。
Q176466 XGEN:TCP Ports and Microsoft Exchange:In-depth Discussion
Terminal Server Clients で使用されるポートのリスト
Function Static ports
-------- ------------
RDP Client (Microsoft) TCP:3389 (Pre Beta2:1503)
ICA Client (Citrix) TCP:1494<BR/>
注 : Terminal Server はポート 3389 を使用します。
詳細
この資料は米国 Microsoft Corporation から提供されている Knowledge Base の
Article ID Q150543 (最終更新日 2000-05-31) をもとに作成したものです。
// 172 RD-INDEX Thu Jun 7 22:45:34 2001
http://www.ruby-lang.org/en/raa-list.rhtml?name=RDindex
// 171 InstallAndSetupReport Fri Jun 1 18:03:17 2001
http://www.kenji00.com/~kenji00/index.html
// 170 Redirect Thu May 31 21:07:01 2001
// FrontEnd Plus GUI for JAD
// DeCompiled : Redirecter.class
package jikken;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.ServletResponse;
import javax.servlet.http.*;
public class Redirecter extends HttpServlet
{
public Redirecter()
{
}
public void service(HttpServletRequest httpservletrequest, HttpServletResponse httpservletresponse)
throws ServletException, IOException
{
try
{
httpservletresponse.setContentType("text/html");
httpservletresponse.sendRedirect("http://www.google.ne.jp");
}
catch(Exception exception)
{
exception.printStackTrace();
}
}
}
// 169 Perl6 Thu May 31 16:36:03 2001
http://bulknews.net/lib/doc-ja/exegesis2.ja.html
// 168 こんぴゅーた Tue May 29 19:07:35 2001
http://park.ruru.ne.jp/ando/work/who/index.html
// 167 ブックシェルフのリスト IBM BookManager BookServer: Tue May 29 18:40:41 2001
http://www.jbooksrv.japan.ibm.co.jp/cgi-bin/master!request=menu!parms=!xu=SK888005/Shelves
// 166 Java関連多し Tue May 29 11:00:28 2001
http://www01.u-page.so-net.ne.jp/db3/midori/
みどりちゃん のホームページ
// 165 「SPARC/Solaris Q&A」 Mon May 28 14:40:39 2001
http://solaris.sunfish.suginami.tokyo.jp/SD/9806/
// 164 NI-Lab. Mon May 28 14:19:04 2001
http://www.sun.co.jp/tech/faq/solaris2_ja/
Solaris2/FAQ
// 163 java.lang.StrictMathより Fri May 25 15:28:39 2001
http://metalab.unc.edu/
有名なネットワークライブラリである netlib から "Freely Distributable Math
Library" (fdlibm) パッケージとして入手可能です。これらのアルゴリズムは C 言語で
記述されており、すべての浮動小数点演算が Java の浮動小数点演算規則に従って実行さ
れるものと見なされます。
// 162 J2SE1.4.0の以前のバージョンから移行する際に気をつけること。 Thu May 24 15:34:48 2001
JavaTM 2 プラットフォーム 旧バージョンとの互換性
http://java.sun.com/j2se/1.4/ja/compatibility.html
J2SE 1.4.0 から、java.awt.event.MouseEvent クラスの static final フィールド
MOUSE_LAST の値が、507 に変更されました。Java 2 プラットフォームの以前のバージョ
ンでは、MOUSE_LAST の値は 506 でした。
コンパイラが、コンパイル時に static final 値をハードコードするため、MOUSE_LAST
を参照し、1.4.0 より前のバージョンの java.awt.event.MouseEvent を使用してコンパ
イルされたコードは、以前の値を保持します。この種のコードを J2SE 1.4.0 で動作させ
るには、バージョン 1.4.0 のコンパイラで再コンパイルする必要があります
// 161 NI-Lab. Thu May 24 15:34:18 2001
J2SE1.4.0の以前のバージョンから移行する際に気をつけること。
JavaTM 2 プラットフォーム 旧バージョンとの互換性
http://java.sun.com/j2se/1.4/ja/compatibility.html
J2SE 1.4.0 から、java.awt.event.MouseEvent クラスの static final フィールド MOUSE_LAST の値が、507 に変更されました。Java 2 プラットフォームの以前のバージョンでは、MOUSE_LAST の値は 506 でした。
コンパイラが、コンパイル時に static final 値をハードコードするため、MOUSE_LAST を参照し、1.4.0 より前のバージョンの java.awt.event.MouseEvent を使用してコンパイルされたコードは、以前の値を保持します。この種のコードを J2SE 1.4.0 で動作させるには、バージョン 1.4.0 のコンパイラで再コンパイルする必要があります
// 160 某サイトからの激励 Wed May 23 23:55:02 2001
現在、ホームページを作成中です。
今後、プログラムの実験を中心にやっていきたいと思います。
本日の業務指示
仕事しろ!
// 159 横浜工文社 Wed May 23 16:07:38 2001
http://www.kobu.com/
PDFとか
// 158 Javaコード静的解析ツール Wed May 23 13:41:57 2001
http://www.toyo.co.jp/ss/jtaster/
J.Taster
// 157 PostgreSQL 完全攻略ガイド Wed May 23 12:47:00 2001
http://www.sra.co.jp/people/t-ishii/PostgreSQL/postbook/
// 156 デザインパターン Wed May 23 11:37:40 2001
http://www11.u-page.so-net.ne.jp/tk9/ys_oota/mdp/
// 155 かつおぶし Wed May 23 11:31:10 2001
http://www6.airnet.ne.jp/katsuwo/
FreeBSDとか
// 154 EJB Wed May 23 09:10:41 2001
http://www.sun.co.jp/std/notes/A6/Title.html
Sun
http://www-6.ibm.com/jp/software/websphere/appserv/ejb.html
WebSphere
http://www.beasys.co.jp/weblogic/docs/classdocs/API_ejb/EJB_contents.html
WebLogic
// 153 コボル開発者のためのVisual Basic入門講座 〜導入編〜 Tue May 22 13:15:54 2001
http://www.int21.co.jp/pcdn/vb/noriolib/vbmag/9806/cobol/
// 152 Visual Studio Installer Tue May 22 13:11:00 2001
http://www02.so-net.ne.jp/~handa/vsi.html
// 151 めも Tue May 22 11:08:17 2001
http://www.hirax.net/dekirukana5/bust6/index.html
// 150 UmeJam HTML help Mon May 21 09:30:12 2001
http://www.abacuss.com/HTML_help/
// 149 Java Solution Sat May 19 23:16:00 2001
http://www.atmarkit.co.jp/fjava/
// 148 オブジェクト指向設計:MVC Fri May 18 22:52:56 2001
http://www.ongs.net/yuzu/oodesign/index.html
// 147 バージョン管理システム CVS を使う Fri May 18 17:58:36 2001
http://www-vox.dj.kit.ac.jp/nishi/cvs/cvs.html
// 146 ? Fri May 18 01:00:28 2001
http://home.highway.ne.jp/gray/
// 145 Perlクイズ Wed May 16 16:50:02 2001
http://www.hyuki.com/pq/index.html
// 144 JavaDocHelp ってべつにすぐ見れるけどさ…… Wed May 16 13:25:57 2001
使い方: javadoc [options] [packagenames] [sourcefiles] [@files]
-overview <file> HTML ファイルから概要ドキュメントを読み込む
-public public クラスとメンバのみを示す
-protected protected/public クラスとメンバを示す (デフォルト)
-package package/protected/public クラスとメンバを示す
-private すべてのクラスとメンバを示す
-help コマンド行オプションを表示する
-doclet <class> 代替 doclet を介して出力を生成する
-docletpath <path> doclet クラスファイルを探す場所を指定する
-1.1 JDK 1.1 エミュレート doclet を使って出力を生成する
-sourcepath <pathlist> ソースファイルのある場所を指定する
-classpath <pathlist> ユーザクラスファイルのある場所を指定する
-bootclasspath <pathlist> ブートストラップクラスローダによりロードされた
クラスファイルの位置をオーバーライドする
-extdirs <dirlist> 拡張機能がインストールされた位置をオーバーライドする
-verbose Javadoc の動作についてメッセージを出力する
-locale <name> en_US や en_US_WIN などの使用するロケール
-encoding <name> ソースファイルのエンコーディング名
-J<flag> <flag> を実行システムに直接渡す
標準の doclet により提供されるもの:
-d <directory> 出力ファイルの転送先ディレクトリ
-use クラスとパッケージの使用方法ページを作成する
-version @version パラグラフを含める
-author @author パラグラフを含める
-splitindex 1 字ごとに 1 ファイルにインデックスを分割する
-windowtitle <text> ドキュメント用のブラウザウィンドウタイトル
-doctitle <html-code> パッケージインデックス (初期) ページにタイトルを含める
-header <html-code> 各ページにヘッダを含める
-footer <html-code> 各ページにフッタを含める
-bottom <html-code> 各ページに下部テキストを含める
-link <url> <url> に javadoc 出力へのリンクを作成する
-linkoffline <url> <url2> <url2> にあるパッケージリストを使用して <url> の docs
にリンクする
-group <name> <p1>:<p2>.. 概要ページにおいて指定するパッケージをグループ化する
-nodeprecated @deprecated 情報を除外する
-nodeprecatedlist 推奨されないリストを生成しない
-notree クラス階層を生成しない
-noindex インデックスを生成しない
-nohelp ヘルプリンクを生成しない
-nonavbar ナビゲーションバーを生成しない
-helpfile <file> ヘルプリンクのリンク先ファイルを含める
-stylesheetfile <path> 生成されたドキュメントのスタイル変更用ファイル
-docencoding <name> 出力エンコーディング名
// 143 Splash Wed May 16 12:04:29 2001
package nilabj.nwt;
import javax.swing.*;
import java.awt.*;
import java.net.*;
public class Splash extends JWindow
{
public Splash(URL url)
{
super();
ImageIcon icon = new ImageIcon( url );
JLabel label=new JLabel(icon);
this.getContentPane().add(label);
validate();
Dimension dim =getToolkit().getScreenSize();
Dimension dim2=getPreferredSize();
setBounds(dim.width / 2 - dim2.width/2, dim.height / 2 - dim2.height/2, dim2.width, dim2.height);
}
public static void main( String[] args )
{
Splash w = new Splash( Splash.class.getResource( args[0] ) );
w.setVisible( true );
}
}
// 142 MNGを見てみたい&使ってみたい Wed May 16 10:31:27 2001
http://www5b.biglobe.ne.jp/~cyako/icon/use-mng.htm
// 141 Ruby/eRubyによるCGIプログラミング Tue May 15 20:21:51 2001
http://www.shugo.net/article/webdb2/
// 140 画数 Fri May 11 15:27:58 2001
seimei.el
// 139 マルチスレッド化Javaアプリケーションの作成 Fri Apr 27 12:47:44 2001
http://www-6.ibm.com/jp/developerworks/java/010427/j_j-thread.html
// 138 演奏 Thu Apr 26 20:48:26 2001
/**
* 演奏装置インターフェイス。
*/
interface Playback
{
/** 演奏開始 */
void start() throws SoundException
/** 演奏停止 */
void stop() throws
/** 演奏中か? */
boolean inRunning()
/** 演奏進行具合 */
double getPlayedPercent()
過去分詞のスペル
}
// 137 本日の教訓 Wed Apr 18 14:27:37 2001
本日の教訓:Javaのインスタンス変数はoverrideできない(hide)
// 136 DB2探検隊 Mon Apr 16 09:54:20 2001
http://www.asahi-net.or.jp/~jz6h-ymmt/db2/index.htm
// 135 Solaris? 8 Foundation ソースプログラム Fri Apr 13 16:53:52 2001
http://www.sun.co.jp/software/solaris/source/
// 134 二千年紀の文字コード問題 Fri Apr 13 16:53:18 2001
http://www.horagai.com/www/moji/2000b.htm
// 133 管理職のためのハッカー FAQ Tue Apr 10 19:49:45 2001
http://www1.neweb.ne.jp/wa/yamdas/column/technique/hackerj.html
// 132 IE SecurityHole Tue Apr 10 19:49:23 2001
http://www.kriptopolis.com/cua/eml.html
// 131 ruby で楽しいプログラミング Tue Apr 10 12:14:55 2001
http://www2.osk.3web.ne.jp/~nkon/3web/ruby/
// 130 J2EEUnit Tue Apr 10 10:27:02 2001
http://jakarta.apache.org/commons/cactus/
// 129 Python Sat Apr 7 00:20:43 2001
http://www.pythonlabs.com/
// 128 Parrot Sat Apr 7 00:18:15 2001
http://www.perl.com/pub/2001/04/01/parrot.htm
Perl with Python?
// 127 kazu.nori.org Fri Apr 6 19:23:36 2001
http://kazu.nori.org/memo/
// 126 管理職のためのハッカー FAQ Fri Apr 6 18:17:12 2001
http://www1.neweb.ne.jp/wa/yamdas/column/technique/hackerj.html
// 125 Rubyで正規表現(よくわからん) Thu Apr 5 16:47:29 2001
# read
file = File.new( $*[0], "r" )
lines = file.readlines
file.close
# write
file = File.new( $*[1], "w" )
# change
lines.each do |i|
if ( nil != ( i =~ /return "/o) )
i.gsub!( 'return "', '' )
i.gsub!( "\t", '' )
file.print i
end
end
// 124 Antのbuild.xml(参考) Wed Apr 4 12:06:39 2001
<!-- nilabj project -->
<project name="nilabjProject" default="usage" basedir=".">
<property name="src" value="C:\nilabjproject\src" />
<property name="class" value="C:\nilabjproject\compiled" />
<property name="jar" value="C:\nilabjproject\jar" />
<property name="doc" value="C:\nilabjproject\doc" />
<property name="test" value="C:\nilabjproject\test" />
<!-- USAGE -->
<target name="usage">
<echo>
usage: ant [paraemter]
full - * clean, compile, jar, document, test
build - * clean, compile, jar
clean - deleting classes
compile - compile
jar - source files and classes to jarfile
document - javadoc
test - GUI-Testing
ttest - TEXT-Testing
usage - print help message
( * is complex tasks. )
</echo>
</target>
<!-- FULL -->
<target name="full" depends="clean,prepare,compile,jar,document,test" />
<!-- PREPARE -->
<target name="prepare">
<!-- Create the time stamp -->
<tstamp/>
</target>
<!-- COMPILING -->
<target name="compile">
<mkdir dir="${class}" />
<!-- Compile the java code from ${src} into ${class} -->
<javac
srcdir="${src}"
destdir="${class}"
excludes="trashcan/**" />
</target>
<!-- JAR -->
<target name="jar" depends="prepare">
<!-- Create the ${jar} directory -->
<mkdir dir="${jar}" />
<jar jarfile="${jar}/nilabj${DSTAMP}${TSTAMP}.jar" basedir="${class}" />
<jar jarfile="${jar}/src${DSTAMP}${TSTAMP}.jar" basedir="${src}\nilabj" />
</target>
<!-- BUILD -->
<target name="build" depends="clean,compile,jar" />
<!-- DOMCUMENT -->
<target name="document">
<delete dir="${doc}" />
<mkdir dir="${doc}" />
<javadoc sourcepath="${src}" destdir="${doc}" packagenames="nilabj.*" />
</target>
<!-- TEST SWINGUI -->
<target name="test">
<java fork="yes" classname="junit.swingui.TestRunner" taskname="junit" failonerror="true">
<classpath>
<pathelement location="${class}" />
</classpath>
<arg value="nilabjtest.FullTest" />
</java>
</target>
<!-- TESTING TEXTUI-->
<target name="ttest">
<java fork="yes" classname="junit.textui.TestRunner" taskname="junit" failonerror="true">
<classpath>
<pathelement location="${class}" />
</classpath>
<arg value="nilabjtest.FullTest" />
</java>
</target>
<target name="clean">
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${class}" />
</target>
</project>
// 123 PerlのCGIでPOSTとGETの切り分け Wed Apr 4 12:04:38 2001
print "Content-type: text/html\n\n<html><body>\n";
print "すたーと\n";
if ($ENV{REQUEST_METHOD} eq "POST")
{
print "ぽすと\n";
read(STDIN, $kakiko, $ENV{'CONTENT_LENGTH'});
print $kakiko;
print "\n";
@form_query = split(/&/, $kakiko);
foreach (@form_query)
{
($key, $val) = split(/=/);
print $key, "\n", $val, "\n";
}
}
if ($ENV{REQUEST_METHOD} eq "GET")
{
print "げっと\n";
$toriaezu = $ENV{QUERY_STRING};
$REF = $ENV{HTTP_REFERER};
$USER_AGENT = $ENV{HTTP_USER_AGENT};
print $toriaezu;
print "REFERER: " . $REF;
print "USER_AGENT: " . $USER_AGENT;
print "\n";
}
print "</body></html>";
// 122 Java Tue Apr 3 12:45:11 2001
import java.net.*;
import java.io.*;
public class ServerSearch
{
public static void main(String args[])
{
try {
URL url = new URL("http://ntsvnc01/" + args[0]);
URLConnection urlConnection = url.openConnection();
Object obj = urlConnection.getContent();
int contentLength = urlConnection.getContentLength();
byte b[] = new byte[contentLength];
BufferedInputStream in = new BufferedInputStream( (InputStream)obj, contentLength );
for (int i=0; i<contentLength;i++) {
b[i] = (byte)in.read();
}
File file = new File(args[0]);
FileOutputStream out = new FileOutputStream(file);
out.write(b);
out.close();
/*
FileWriter out = new FileWriter( "bea.bmp", true );
InputStreamReader in = new InputStreamReader((InputStream)obj);
BufferedReader br = new BufferedReader(in);
String line;
while ( null != (line = br.readLine()) ) {
out.write(line);
}
out.close();
*/
System.out.println( "ContentLength : " + contentLength );
System.out.println( "ContentType : " + urlConnection.getContentType() );
// System.out.println( "REALContentType : " + URLConnection.guessContentTypeFromStream( urlConnection.getInputStream()) );
System.out.println( "class : " + obj.getClass().getName() );
}
catch ( Exception e ) {
e.printStackTrace();
}
return;
}
}
// 121 JavaでURLを指定してファイルを取得する Tue Apr 3 12:06:48 2001
import java.net.*;
import java.io.*;
public class ServerSearch
{
public static void main(String args[])
{
try {
URL url = new URL("http://localhost/bea.bmp");
URLConnection urlConnection = url.openConnection();
Object obj = urlConnection.getContent();
int contentLength =urlConnection.getContentLength();
byte b[] = new byte[contentLength];
((InputStream)obj).read(b);
File file = new File("bea.bmp");
FileOutputStream out = new FileOutputStream(file);
out.write(b);
out.close();
/*
FileWriter out = new FileWriter( "bea.bmp", true );
InputStreamReader in = new InputStreamReader((InputStream)obj);
BufferedReader br = new BufferedReader(in);
String line;
while ( null != (line = br.readLine()) ) {
out.write(line);
}
out.close();
*/
System.out.println( "ContentType : " + urlConnection.getContentType() );
// System.out.println( "REALContentType : " + URLConnection.guessContentTypeFromStream( urlConnection.getInputStream()) );
System.out.println( "class : " + obj.getClass().getName() );
}
catch ( Exception e ) {
e.printStackTrace();
}
return;
}
}
// 120 BEA WebLogic Server マニュアル・センター Tue Apr 3 09:20:39 2001
http://www.beasys.co.jp/weblogic/docs/resources.html
// 119 Ant-JUnit連携 Mon Apr 2 17:19:32 2001
<target name="junit">
<java fork="yes" classname="junit.swingui.TestRunner" taskname="junit" failonerror="true">
<classpath>
<pathelement location="${build}" />
</classpath>
<arg value="nilabj.test.FullTest" />
</java>
</target>
// 118 PerlでCOOKIE Mon Apr 2 15:57:04 2001
&getCookie;
local($name,$value);
if ( "" ne $ENV{QUERY_STRING} ) {
($fname,$name) = split(/=/, $ENV{QUERY_STRING});
}
else {
$name = $COOKIE{NAMAE};
}
&setCookie( "NAMAE", $name );
print "Content-type: text/html\n";
print "\n";
print "<HTML>\n";
print "<BODY TEXT=black BGCOLOR=white>\n";
print "<HR>\n";
print "<form>";
print "<input type=text name=fname value=$name>";
print "</form>";
print "HTTP_COOKIE:" . $ENV{'HTTP_COOKIE'} . "<br>";
print "NAMAE:" . $COOKIE{NAMAE} . "<br>";
print "</BODY>\n";
print "</HTML>\n";
# setCookie($name,$value)
sub setCookie {
my $name = shift;
my $value = shift;
$value =~ s/(\W)/sprintf("%%%02X", unpack("C", $1))/eg;
print "Set-Cookie: " . $name . "=" . $value . "; ";
}
sub getCookie {
local($xx, $name, $value);
for $xx (split(/; */, $ENV{'HTTP_COOKIE'})) {
($name, $value) = split(/=/, $xx);
$value =~ s/%([0-9A-Fa-f][0-9A-Fa-f])/pack("C", hex($1))/eg;
$COOKIE{$name} = $value;
}
}
// 117 Socket Mon Apr 2 14:58:13 2001
Socket socket = new Socket(args[0], Integer.parseInt(args[1]));
// ソケットの入力ストリームを取得
InputStreamReader isr = new InputStreamReader(socket.getInputStream());
BufferedReader br = new BufferedReader(isr);
PrintWriter out = new PrintWriter(socket.getOutputStream());
out.print("GET /" + args[2] + "\n\n");
out.flush();
String sline;
while((sline = br.readLine()) != null)
{
System.out.println(sline);
}
// 116 WebLogicServer5.1.0 Mon Apr 2 13:20:27 2001
http://localhost:7001/a.js%70
SP無し〜SP4ではソースが見れず。
SP5〜SP8ではソースが見れる。
// 115 WebLogic5.1.0 Mon Apr 2 13:19:43 2001
weblogic.httpd.register.*.%6a%73%70=
weblogic.httpd.initArgs.*.%6a%73%70=
weblogic.httpd.register.*.j%73%70=
weblogic.httpd.initArgs.*.j%73%70=
weblogic.httpd.register.*.%6as%70=
weblogic.httpd.initArgs.*.%6as%70=
weblogic.httpd.register.*.%6a%73p=
weblogic.httpd.initArgs.*.%6a%73p=
weblogic.httpd.register.*.js%70=
weblogic.httpd.initArgs.*.js%70=
weblogic.httpd.register.*.%6asp=
weblogic.httpd.initArgs.*.%6asp=
weblogic.httpd.register.*.j%73p=
weblogic.httpd.initArgs.*.j%73p=
// 114 HttpUnit Mon Apr 2 09:06:32 2001
http://wiki.esm.co.jp:8080/xp/29
// 113 Flage Sat Mar 31 13:07:34 2001
http://www.ipa.go.jp/NEWSOFT/public/Flage/
ネットワーク上の分散環境において、ユーザや他のソフトウェア・モジュールからの
要求の変化に自律的に適応するソフトウェアを構築するためのプログラミング言語
// 112 Flage Sat Mar 31 13:07:19 2001
http://www.ipa.go.jp/NEWSOFT/public/Flage/
ネットワーク上の分散環境において、ユーザや他のソフトウェア・モジュールからの要求の変化に自律的に適応するソフトウェアを構築するためのプログラミング言語
// 111 千 Sat Mar 31 03:10:47 2001
…ごめん、改行入れてなかった…。
// 110 千 Sat Mar 31 03:09:44 2001
ちょっと改訂。bbsフォームです。
<html>
<head>
<title>bbs</title>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<style type="text/css">
<!--
a:hover {text-decoration:}
a:link {color:"#000000"; text-decoration:}
a:visited {color:"#000000"; text-decoration:}
a:active {text-decoration:}
body,tr,td { font-size:10pt; color="#000000"}
-->
</style>
</head>
<body bgcolor="#ffffff">
<a href=D:\DRA\index.html><<HOME</a>
<center>
<font size="6" face="Impact" color="#7b68ee">bbs</font><br><br><br>
<table border="2" width="90%">
<tr><td>
<table align="center" border="1" width="80%">
<tr><td align="right">name : </td>
<td><input type="text" name="name" size="20" maxlength="30"></td></tr>
<tr><td align="right">subject : </td>
<td><input type="text" name="sub" size="30" maxlength="100"></td></tr>
<tr><td align="right">e-mail : </td>
<td><input type="text" name="mail" size="30" maxlength="40"></td></tr>
<tr><td align="right">URL : </td>
<td><input type="text" name="URL" value="http://" size="40" maxlength="60"></td></tr>
<tr><td align="right">messege : </td>
<td><textarea name="messege" rows="5" cols="50"></textarea></td></tr>
<tr></tr><tr><td align="right">titlecolor : </td>
<td><input type="radio" name="color" value="blue">
<font color="#333399">■</font>
<input type="radio" name="color" value="red">
<font color="#990033">■</font>
<input type="radio" name="color" value="green">
<font color="#336633">■</font>
<input type="radio" name="color" value="yerrow">
<font color="#ff9900">■</font>
<input type="radio" name="color" value="paple">
<font color="#ba55d3">■</font></td></tr>
<tr><td colspan="2" align="center"><input type="submit" value="submit">
<input type="reset" value=" reset"></td></tr>
</table>
</tr></td></table>
<br><br><br>
<hr width="80%" size="5">
<br><br><br>
<table width="90%" border="1"><tr><td>
<table bgcolor="#336633" align="center" width="70%" border="0" rules="rows" cellspacing="0" cellpadding="3">
<tr><td align="left" width="70%"><b><font color="#cccccc" size="3">タイトルこんなカンジで</font></b></td>
<td colspan="4" align="right"><font color="#cccccc">2001/03/31/11:00</font></td></tr>
<tr><td width="80%"><font color="#cccccc">name:名無し権兵</font></td><td align="center">>>mail</td><td align="center">>>HOME</td></tr></table>
<table align="center" width="70%" bordercolor="#336633" border="1" rules="rows" cellspacing="0" cellpadding="10">
<tr><td colspan="3" align="left">文章こんなカンジに。改行とかはどうなるのかな。とりあえず任意改行とかできるとうれし
いかも。ついでにメルアドとほめぱげのアドはリンクをはりたいです…(表示は「mail」「home」のままで。)
<br>さらに贅沢を言うと、上の「color」を選択すると、題字・名前のテーブル全体と、メッセージ部分のテーブルの
枠線の色が変わる、ってーのできる?あと、一番外側にあるテーブルラインは最終的には消します。(消した物の例は下に。)
</td></tr>
<tr><td colspan="3" align="right"><input type="button" value=" res "></td></tr></table>
<br>
<table bgcolor="#3333cc" align="center" width="60%" bordercolor="#c0c0c0" border="0" rules="rows" cellspacing="0" cellpadding="3">
<tr><td colspan="1" align="left" width="70%"><b><font color="#cccccc">レスタイトル</font></b></td><td colspan="2" align="right"><font color="#cccccc">2001/03/31/13:00</font></tr>
<tr><td colspan="1" align="left"><font color="#cccccc">name:レス人の名前</font></td><td align="right">>>mail</td></table>
<table align="center" width="60%" bordercolor="#3333cc" border="1" rules="rows" cellspacing="0" cellpadding="10">
<tr><td colspan="3" align="left">で、こんなカンジでレスつけたいですー。あとはタグの使用とかはどうなるのでしょうかね?
出来ればOKにしたいなぁと。
</table>
</td></tr>
</table>
<br><br><br>
<hr width="80%" size="5">
<br><br><br>
<table width="90%" border="0"><tr><td>
<table bgcolor="#990033" align="center" width="70%" border="0" rules="rows" cellspacing="0" cellpadding="3">
<tr><td align="left" width="70%"><b><font color="#cccccc" size="3">さらにこーゆー風に続く。</font></b></td>
<td colspan="4" align="right"><font color="#cccccc">2001/04/01/15:13</font></td></tr>
<tr><td width="80%"><font color="#cccccc">name:権田原源三郎</font></td><td align="center">>>mail</td><td align="center">>>HOME</td></tr></table>
<table align="center" width="70%" bordercolor="#990033" border="1" rules="rows" cellspacing="0" cellpadding="10">
<tr><td colspan="3" align="left">あと、レスボタンのお話ですが、これは…ボタンに出来たのか?
<br>そんでもって各発言の間にある区切り線は必須ですー。
</td></tr>
<tr><td colspan="3" align="right"><input type="button" value=" res "></td></tr></table>
<br>
<table bgcolor="#3333cc" align="center" width="60%" bordercolor="#c0c0c0" border="0" rules="rows" cellspacing="0" cellpadding="3">
<tr><td colspan="1" align="left" width="70%"><b><font color="#cccccc">レスタイトル</font></b></td><td colspan="2" align="right"><font color="#cccccc">2001/03/31/13:00</font></tr>
<tr><td colspan="1" align="left"><font color="#cccccc">name:レス人の名前</font></td><td align="right">>>mail</td></table>
<table align="center" width="60%" bordercolor="#3333cc" border="1" rules="rows" cellspacing="0" cellpadding="10">
<tr><td colspan="3" align="left">さらにさらに贅沢言えば、レス機能は管理人限定で…(汗)とか。
色はこの色オンリーにしちゃうとか。</td></tr>
</table>
</td></tr>
</table>
<br><br><br>
<hr width="80%" size="5">
<br><br><br>
</tr></td></table>
// 109 Date Fri Mar 30 14:44:33 2001
/**
* 現在日付をYYYYMMDDのStringオブジェクトで返す
*/
public static String getNowDate() throws Exception
{
String return_value = null;
try
{
GregorianCalendar gc = new GregorianCalendar();
gc.setTime( new Date() );
String YYYY = addChars( gc.get( gc.YEAR ) );
String MM = addChars( gc.get( gc.MONTH ) );
String DD = addChars( gc.get( gc.DATE ) );
return_value = YYYY + MM + DD;
}
catch ( Exception e )
{
throw e;
}
return return_value;
}
// 108 NiSort.java Fri Mar 30 14:43:14 2001
package nilabj;
// NiSort.java
/********* NiSortクラス **********************************
ソート用のクラス
********** コンストラクタ constructor ********************
public NiSort()
ファイル名を指定する
********** メソッド method *******************************
public void sortLines(Vector v)
ベクトルの要素をソートする
public void swap(Vector v, int index1, int index2)
ベクトルの要素を入れ替える
***********************************************************/
import java.util.*;
public class NiSort
{
///// ベクトルの要素を入れ替える
public void swap(Vector v, int index1, int index2)
{
Vector v2 = new Vector(1);
v2.addElement(v.elementAt(index1));
v.setElementAt(v.elementAt(index2), index1);
v.setElementAt(v2.firstElement(), index2);
}
///// ベクトルの要素をソートする
public void sortLines(Vector v)
{
int loop;
int loop_change;
int factors;
factors = v.size();
for (loop = 0; loop < factors - 1; loop++)
{
for (loop_change = 0; loop_change < factors - loop - 1; loop_change++)
{
// ベクトルの要素を比較して、入れ替える
if (0 < ((String)v.elementAt(loop_change)).compareTo(v.elementAt(loop_change + 1)))
swap(v, loop_change, loop_change + 1);
}
}
}
}
// 107 NiStresser.java Fri Mar 30 14:42:05 2001
package nilabj;
// NiStresser.java
/********* NiStresserクラス *********************************
NiHttpThreadsを利用し、スレッド数を指定して
マルチスレッドでGETorPOSTメソッドでデータをまとめて送信する
データを送るだけで、受信はしない
********** コンストラクタ constructor ********************
public NiStresser(String host) throws Exception
ホスト名を指定する
(例) NiHttpThreads("www.goo.ne.jp")
********** メソッド method *******************************
public void makeThreadsGetType(String filename, int threads) throws Exception
GETメソッド用のスレッドを数を指定して作成
ファイル名を指定する
(例)makeThreadsGetType("cgi-bin/j.pl?namae=nilab", 10)
public void makeThreadsPostType(String filename, String senddata, int threads) throws Exception
POSTメソッド用のスレッドを数を指定して作成
ファイル名を指定する
(例)makeThreadsPostType("cgi-bin/j.pl", "name=nilab", 10)
public void missileGet() throws Exception
makeThreadsGetTypeで設定をした後に使用する
GETメソッドでデータを送る(データを取得しない)
public void missilePost() throws Exception
makeThreadsPostTypeで設定をした後に使用する
POSTメソッドでデータを送る(データを取得しない)
***********************************************************/
import java.net.*;
import java.io.*;
import java.util.*;
import java.rmi.ConnectException;
public class NiStresser
{
public int threads; // スレッドの数
public NiHttpThreads nht[];
public String host;
// コンストラクタ
public NiStresser(String host) throws Exception
{
this.host = host;
}
// GETメソッドでデータを送る(データを取得しない)
public void missileGet() throws Exception
{
// スレッド開始
for (int i = 0 ; i < this.threads ; i++)
{
this.nht[i].start();
}
}
// POSTメソッドでデータを送る(データを取得しない)
public void missilePost() throws Exception
{
// スレッド開始
for (int i = 0 ; i < this.threads ; i++)
{
this.nht[i].start();
}
}
// GETメソッド用のスレッドを数を指定して作成
public void makeThreadsGetType(String filename, int threads) throws Exception
{
try
{
// クラス変数を設定
this.threads = threads;
// NiHttpThreadsクラスのインスタンス配列変数
this.nht = new NiHttpThreads[threads];
// NiHttpThreads
for (int i = 0 ; i < threads ; i++)
{
this.nht[i] = new NiHttpThreads(this.host);
this.nht[i].initThreads(filename);
}
}
catch(Exception e)
{
throw e;
}
}
// POSTメソッド用のスレッドを数を指定して作成
public void makeThreadsPostType(String filename, String senddata, int threads) throws Exception
{
try
{
// クラス変数を設定
this.threads = threads;
// NiHttpThreadsクラスのインスタンス配列変数
this.nht = new NiHttpThreads[threads];
// NiHttpThreads
for (int i = 0 ; i < threads ; i++)
{
this.nht[i] = new NiHttpThreads(this.host);
this.nht[i].initThreads(filename, senddata);
}
}
catch(Exception e)
{
throw e;
}
}
}
// 106 NiHttpThreads.java Fri Mar 30 14:38:35 2001
package nilabj;
// NiHttpThreads.java
/********* NiHttpThreadsクラス *********************************
NiHttpを継承し、マルチスレッドで動かす
NiStresserから呼び出すためのクラス
********** コンストラクタ constructor ********************
public NiHttpThreads(String host) throws Exception
ホスト名を指定する
(例) NiHttpThreads("www.goo.ne.jp")
********** メソッド method *******************************
public void initThreads(String filename) throws Exception
GETメソッドを利用した送信の準備をする
アクセス先のファイル名を指定
(例) NiHttpThreads("cgi-bin/j.pl?namae=nilab")
public void initThreads(String filename, String senddata) throws Exception
POSTメソッドを利用した送信の準備をする
アクセス先のファイル名と送信するデータを指定
(例) NiHttpThreads("cgi-bin/j.pl", "namae=nilab")
public void start()
initThreadsで準備したあとスレッドを動かす
public void run()
直接動かしてはいけない
***********************************************************/
import java.net.*;
import java.io.*;
import java.util.*;
import java.rmi.ConnectException;
public class NiHttpThreads extends NiHttp implements Runnable
{
public Thread thread; // スレッド
public String filename; // ファイル名
public String senddata; // POSTで送るデータ
public int modeFlag; // modeFlag = 1:GET 2:POST
// コンストラクタ(最初にNiHttpクラスのコンストラクタを呼び出す)
public NiHttpThreads(String host) throws Exception
{
super(host);
}
// 準備
public void initThreads(String filename) throws Exception
{
this.filename = filename;
this.thread = new Thread(this);
this.modeFlag = 1;
}
// 準備
public void initThreads(String filename, String senddata) throws Exception
{
this.filename = filename;
this.senddata = senddata;
this.thread = new Thread(this);
this.modeFlag = 2;
}
// start
public void start()
{
thread.start();
}
// run
public void run()
{
try
{
switch (this.modeFlag)
{
case 1:
getHttpNo(this.filename);
break;
case 2:
postHttpNo(this.filename, this.senddata);
break;
default:
break;
}
}
catch(Exception e)
{
// throw e;
}
}
}
// 105 NiHttp Fri Mar 30 14:37:18 2001
package nilabj;
// NiHttp.java
/********* NiHttpクラス *********************************
Httpにアクセスする
********** コンストラクタ constructor ********************
public NiHttp(String host) throws Exception
ホスト名を指定する
(例) NiHttp("www.goo.ne.jp")
********** メソッド method *******************************
public void postHttp(Vector v, String filename, String senddata) throws Exception
POSTメソッドを利用してデータを送る
Vectorクラスで返ってくるデータを取得する
(例) postHttp(v, "cgi-bin/j.pl", "author=nilab")
public void getHttp(Vector v, String filename) throws Exception
GETメソッドを利用してデータを送り
Vectorクラスで返ってくるデータを取得する
(例) getHttp(v, "cgi-bin/j.pl?author=nilab")
public void postHttpNo(String filename, String senddata) throws Exception
POSTするがデータを取得しない
public void getHttpNo(String filename) throws Exception
GETするがデータを取得しない
***********************************************************/
import java.net.*;
import java.io.*;
import java.util.*;
import java.rmi.ConnectException;
public class NiHttp
{
String host;
int port;
Socket sock;
InputStreamReader isr;
BufferedReader br;
PrintWriter pw;
// コンストラクタ
public NiHttp()
{
}
// コンストラクタ
public NiHttp(String host) throws Exception
{
this(host, 80);
}
// コンストラクタ
public NiHttp(String host, int port) throws Exception
{
try
{
this.host = host;
this.port = port;
// ソケット
sock = new Socket(host, port);
// ソケットの入力ストリームを取得
this.isr = new InputStreamReader(this.sock.getInputStream());
// 読み込み用
this.br = new BufferedReader(this.isr);
// データちょうだい要求用
this.pw = new PrintWriter(this.sock.getOutputStream());
}
catch(ConnectException e)
{
throw e;
}
catch(Exception e)
{
throw e;
}
}
// ポストする \^^(できたーっ★)
public void postHttp(Vector v, String filename, String senddata) throws Exception
{
try
{
PrintStream ps;
// 接続
URL url = new URL("http://" + this.host + "/" + filename);
URLConnection urlc = url.openConnection();
urlc.setDoOutput(true);
urlc.setDoInput(true);
urlc.setUseCaches(false);
// 送信
ps = new PrintStream( urlc.getOutputStream() );
ps.print(senddata);
ps.flush();
ps.close();
// 受信
// DataInputStream dis;
// dis = new DataInputStream(urlc.getInputStream());
BufferedReader br = new BufferedReader(new InputStreamReader(urlc.getInputStream()));
String s;
// 受信中
while(null != (s = br.readLine()))
{
v.addElement(s);
}
}
catch ( MalformedURLException e )
{
throw e;
}
catch ( IOException e )
{
throw e;
}
}
// ポストする \^^(できたーっ★)
public void postHttps(Vector v, String filename, String senddata) throws Exception
{
try
{
PrintStream ps;
// 接続
URL url = new URL("https://" + this.host + "/" + filename);
URLConnection urlc = url.openConnection();
urlc.setDoOutput(true);
urlc.setDoInput(true);
urlc.setUseCaches(false);
// 送信
ps = new PrintStream( urlc.getOutputStream() );
ps.print(senddata);
ps.flush();
ps.close();
// 受信
// DataInputStream dis;
// dis = new DataInputStream(urlc.getInputStream());
BufferedReader br = new BufferedReader(new InputStreamReader(urlc.getInputStream()));
String s;
// 受信中
while(null != (s = br.readLine()))
{
v.addElement(s);
}
}
catch ( MalformedURLException e )
{
throw e;
}
catch ( IOException e )
{
throw e;
}
}
// GETする
public void getHttp(Vector v, String filename) throws Exception
{
try
{
// データちょうだい要求
this.pw.print("GET /" + filename + "\n\n");
this.pw.flush();
String sline;
// int sline;
while((sline = this.br.readLine()) != null)
{
v.addElement(sline);
}
// while((sline = this.br.read()) != -1)
// {
//System.out.print(sline);
// v.addElement(sline);
// }
}
catch(Exception e)
{
throw e;
}
}
// GETしてデータをちょっとだけ取得
public String getHttpLittle(String filename, int memory) throws Exception
{
try
{
// データちょうだい要求
this.pw.print("GET /" + filename + "\n\n");
this.pw.flush();
char c[] = new char[memory];
// 受信中
this.br.read(c, 0, memory);
String s = new String(c);
return(s);
}
catch(Exception e)
{
throw e;
}
}
// POSTしてデータをちょっとだけ取得
public String postHttpLittle(String filename, String senddata, int memory) throws Exception
{
try
{
PrintStream ps;
// 接続
URL url = new URL("https://" + this.host + "/" + filename);
URLConnection urlc = url.openConnection();
urlc.setDoOutput(true);
urlc.setDoInput(true);
urlc.setUseCaches(false);
// 送信
ps = new PrintStream( urlc.getOutputStream() );
ps.print(senddata);
ps.flush();
ps.close();
// 受信
// DataInputStream dis;
// dis = new DataInputStream(urlc.getInputStream());
BufferedReader br = new BufferedReader(new InputStreamReader(urlc.getInputStream()));
char c[] = new char[memory];
// 受信中
br.read(c, 0, memory);
String s = new String(c);
return(s);
// while(-1 != br.read(c, 0, memory))
// {
// s = new String(c);
// v.addElement(s);
// }
}
catch ( MalformedURLException e )
{
throw e;
}
catch ( IOException e )
{
throw e;
}
}
// POSTするがデータを取得しない
public void postHttpNo(String filename, String senddata) throws Exception
{
try
{
PrintStream ps;
// 接続
URL url = new URL("http://" + this.host + "/" + filename);
URLConnection urlc = url.openConnection();
urlc.setDoOutput(true);
urlc.setDoInput(true);
urlc.setUseCaches(false);
// 送信
ps = new PrintStream( urlc.getOutputStream() );
ps.print(senddata);
ps.flush();
ps.close();
}
catch ( MalformedURLException e )
{
throw e;
}
catch ( IOException e )
{
throw e;
}
}
// GETするがデータを取得しない
public void getHttpNo(String filename) throws Exception
{
try
{
// データちょうだい要求
this.pw.print("GET /" + filename + "\n\n");
this.pw.flush();
}
catch(Exception e)
{
throw e;
}
}
}
// 104 JavaでZIPZIP Fri Mar 30 14:32:13 2001
package nilabj;
// NiZip.java
/********* NiZipクラス ***********************************
Zipファイルを扱う
********** コンストラクタ constructor ********************
public NiZip(String pathname)
Zipファイル名を指定する
********** メソッド method *******************************
public String extract(String entryname)
Zipファイルを解凍する
public String extractAll()
Zipファイル内のファイルを全て解凍する
public String compress()
Zipファイルに圧縮する(予定)
public String entries(Vector v)
Zipファイル内のエントリをVectorへ追加する
***********************************************************/
import java.util.*;
import java.io.*;
import java.lang.*;
import java.util.zip.*;
public class NiZip
{
static String pathname; // Zipファイル名
// コンストラクタ
public NiZip(String pathname)
{
this.pathname = pathname;
}
int aaaaa;
// Zipファイル内のエントリをVectorへ追加する
public String entries(Vector v)
{
try
{
ZipFile zf = new ZipFile(pathname);
Enumeration e = zf.entries();
while(e.hasMoreElements())
{
v.addElement((e.nextElement()).toString());
}
}
catch(Exception e)
{
return("Exception: "+ e);
}
return("");
}
// Zipファイルを解凍する
public String extract(String entryname)
{
byte b;
int i;
try
{
ZipFile zf = new ZipFile(this.pathname);
ZipEntry ze = zf.getEntry(entryname);
InputStream is = zf.getInputStream(ze);
FileOutputStream fos = new FileOutputStream(entryname);
while(-1 != (i = is.read()))
{
fos.write(i);
}
fos.close();
is.close();
}
catch(IOException e)
{
return("Exception: " + e);
}
return("");
}
// Zipファイル内のファイルを全て解凍する
public String extractAll()
{
byte b;
int i;
try
{
ZipFile zf = new ZipFile(this.pathname);
// System.out.println(zf.size());
Enumeration er = zf.entries();
while(er.hasMoreElements())
{
Object obj = er.nextElement();
String s = obj.toString();
// System.out.println(s);
ZipEntry ze = zf.getEntry(s);
InputStream is = zf.getInputStream(ze);
FileOutputStream fos = new FileOutputStream(s);
while(-1 != (i = is.read()))
{
fos.write(i);
}
fos.close();
is.close();
}
}
catch(IOException e)
{
return("Exception: " + e);
}
return("");
}
}
// 103 NTTドコモ,iアプリの開発ツールをようやく公開 Fri Mar 30 14:31:54 2001
http://nikkeibyte.com/home/DevTool/
NTTドコモ,iアプリの開発ツールをようやく公開
http://www.nttdocomo.co.jp/i/java.html
All about i-mode
// 102 NI-Lab. Thu Mar 29 23:29:22 2001
お、なんかいい感じじゃん。
// 101 千 Thu Mar 29 22:31:31 2001
こんなカンジで。まだ途中ですが。チェックよろしゅう。
<html>
<head>
<title>bbs</title>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<style type="text/css">
<!--
a:hover {text-decoration:}
a:link {color:"#000000"; text-decoration:}
a:visited {color:"#000000"; text-decoration:}
a:active {text-decoration:}
body,tr,td { font-size:10pt;}
-->
</style>
</head>
<body bgcolor="#ffffff">
<a href=D:\DRA\index.html><<HOME</a>
<center>
<font size="6" face="Impact" color="#7b68ee">bbs</font><br><br><br>
<table border="2" width="90%">
<tr><td>
<table align="center" border="1" width="80%">
<tr><td align="right">name : </td>
<td><input type="text" name="name" size="20" maxlength="30"></td></tr>
<tr><td align="right">subject : </td>
<td><input type="text" name="sub" size="20" maxlength="30"></td></tr>
<tr><td align="right">e-mail : </td>
<td><input type="text" name="mail" size="30" maxlength="40"></td></tr>
<tr><td align="right">URL : </td>
<td><input type="text" name="URL" value="http://" size="40" maxlength="60"></td></tr>
<tr><td align="right">messege : </td>
<td><textarea name="messege" rows="5" cols="50"></textarea></td></tr>
<tr></tr><tr><td align="right">color : </td>
<td><input type="radio" name="color" value="blue">
<font color="#333399">■</font>
<input type="radio" name="color" value="red">
<font color="#990033">■</font>
<input type="radio" name="color" value="green">
<font color="#336633">■</font>
<input type="radio" name="color" value="yerrow">
<font color="#ff9900">■</font>
<input type="radio" name="color" value="paple">
<font color="#ba55d3">■</font></td></tr>
<tr><td colspan="2" align="center"><input type="submit" value="submit">
<input type="reset" value=" reset"></td></tr>
</table>
</tr></td></table>
nibbs-standard 2.10 produceD bY
NI-Lab.