投稿者の投稿
Eclipse のデフォルト文字コードを全部UTF-8にする
ASCII S-JIS EUC UTF-16 UTF-8 EBICDIC IBM漢字 富士通JEF NEC漢字といろいろあるけれど、これからの新規開発はすべて、UTF-8でやる!
そのためのEclipseの設定は、下記のとおり
eclipse.exeと同フォルダにあるeclipse.iniに、
-Dfile.encoding=utf-8
をいれるだけでよい。
デフォルトは、MS932になっているようだ。
TAB(\9)を空白にする関数
誰か、TABをスペースに置き換えてくれる関数を知らないですか~~~
とGoogle BING に叫んでも教えてくれないので、ちょこっと作ってみました。
/** タブを空白にする関数。
* @param string $str 変換する元
* @param Array $タブ数
* @return string
*/
function tab2space($str,$n)
{
$ret = ”;
$str = preg_replace(“/(\r\n|\n|\r)/”, “\n”, $str);
$array = split(“\n”,$str);
foreach($array as $v)
{
$s = 0;
$l = ”;
$a = explode(“\t”,$v,strlen($v));
foreach($a as $s)
{
$l.=$s;
$c=strlen($l)%$n;
if($c==0) $l .= fillspace($n);
else $l .= fillspace($n – $c);
}
$l = rtrim($l);
$ret .= $l . “\n”;
}
return $ret;
}
function fillspace($count)
{
$s=”;
for($i=0;$i<$count;$i++)
{
$s.=’ ‘;
}
return $s;
}
情報処理試験対策用の良いサイトを見つけた!!
「相手が誰でも関係ない!!!ガンガンメールしてもただ♪♪♪」
なんて歌にはまっている私ですが、ふとネットサーフィンをやっていると、こんなサイトを見かけた。
むかしむかしあるところに、入門C言語 実習C言語 応用C言語 という本があったそうな・・・・
あの時代にインターネットがあって、こんなサイトがあったら、大枚をはたかなくてもよかったのに。
OpenIDにびっくり
20年以上も開発屋をやっているといろんなことがあるが、自分が考えていることはみんな考えているし、なかなか新しいアイデアなんてものは見つからない。
そろそろ年もくってきたことだし、後進の輩に何か残してやりたいと思い、あれやこれやポンコツの頭をひねっていた。
そういえば、私もいろんなサイトでユーザ登録を行っているのだが、ユーザIDとパスワードの数の多さにはげんなりしている。
何とか、もっと簡単な方法でログインできないものだろうかと考え、「そうだ!、そういうシステムを作ってしまえばいいのだ」なんて思い、久しぶりに興奮していた。
「いや?!まてよ・・・・」 こういういいことを思いついても、また、きっと誰かが先に考えているかもしれない、そう思い、おそるおそるGoogleを検索してみた。
やっぱり・・・・
その興奮もわずか数秒でボルテージ200%から一気に0%にたたきおとされた。
そりゃそうだ・・・ ということで、以下のサイトを見れば一目瞭然、大手のサイトは既に行っているようです。
http://www.openid.ne.jp/
http://openid.net/
http://www.sixapart.jp/about/openid/
実に残念であるが、考えてみればラッキーでもある。
世にあるものは、すべて使ってしまおうとプラス思考で考え続けた20数年はだてじゃない、これを利用して新たなシステム作りを考えることにした。
えっ!!?
「この記事は単なる決意表明なんですか?」 って・・
その通りです。
後日(う~んと後日)には、当社のシステムをこれに対応させたいと思います。
webFXTreeを使って、TREE表示をする
webFXTreeを使うと、エクスプローラのようなTree表示のウェブサイトが簡単にできます。
http://webfx.eae.net/dhtml/xtree/index.html
これは、javascript のクラスになっています。
これと、WebFXLoadTree を使うとサーバとの連携で、これまた簡単にTree表示が簡単になります。
http://webfx.eae.net/dhtml/xloadtree/xloadtree.html
両方使うと、ウェブアプリケーションがリッチなクライアントになります。
phpMyAdminやphpPgAdminは、これを改造して使っているようです。
使い方は、私に聞いてください。
Windows 7 でデフォルト共有を使えるようにする
regedit を起動して
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System
の下に、以下の値をDWORD8(32)で追加し、値を1にする
LocalAccountTokenFilterPolicy
これで、c$ やらが使える。
Windows7には、ファイアウォールという壁があるので、それらを乗り越えてください。
何もかもをOKにしてはだめですよ。
Windows 7 64ビット版での32ビットODBCの設定
Windows7の64ビット版では、コントロール パネル\すべてのコントロール パネル項目\管理ツール\データ ソース (ODBC)で、32ビットのODBCドライバーが設定できない。
32ビット版のドライバを使う場合は、
%systemdrive%\Windows\SysWoW64\Odbcad32.exe
を使う。
一般には、c:\Windows\SysWoW64\Odbcad32.exe
phpPgAdminの画面が見ずらいので、テーマを変更
themes/default/global.css を変更した
環境はphpPgAdmin 4.2.2 (PHP 5.2.12)
/**
* Default style sheet
*
* $Id: global.css,v 1.45 2007/10/22 15:54:46 ioguix Exp $
*/
/** ELEMENTS */
body, td
{
background-color: #FFFFFF;
margin: 4px;
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
padding: 0px;
font-size: 10pt
/* font-size: smaller; */ /*0.8em;*/
}
img { border: none; }
div.logo
{
background-color: #CECF9C;
margin: 0px;
padding: 0px;
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
font-size: smaller; /* 1em; */
border: none;
border-bottom: 2px solid #000000;
margin-bottom: 2px;
}
body.browser
{
height: 100%;
background-color: #efefef;
margin: 0px;
padding: 0px;
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
font-size: smaller; /*1em;*/
border-right: 1px dashed #c0c0c0;
text-align: left;
}
body.bottombar {
background-color: #CECF9C;
margin: 0px;
padding: 0px;
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
font-size: smaller; /*1em;*/
text-align: left;
}
p.message {
color: blue;
}
p.comment {
font-style: italic;
}
h2
{
color: #666633;
font-size: medium; /*1.3em;*/
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
font-weight: bold;
border: 2px solid #E6E6CC;
background-color: #F3F3E9;
padding: 2px 1em;
margin: 0 0 1ex 0;
}
h3
{
color: #666633;
font-size: small;
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
font-weight: bold;
}
table.error
{
background-color: #E6E6CC;
}
table.error td {
background-color: #E6E6CC;
}
table.navbar
{
background-color: #E6E6CC;
}
table.navbar td
{
height: 25px;
color: #000000;
background-color: #F3F3E9;
text-align: center;
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
font-size: smaller; /* 0.9em */
font-weight: bold;
}
table.navbar td.active
{
background-color: #E6E6CC;
}
th.data
{
color: #000000;
background-color: #E6E6CC;
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
font-size: smaller; /* 0.9em */
}
th.data a:active, th.data a:link, th.data a:visited, th.data a:hover
{
font-weight: bold;
}
.left
{
text-align: left;
}
td.dat
{
color: #ff0;
text-align: center;
}
th.required
{
text-decoration: underline;
}
td.topbar
{
background-color: #CECF9C;
margin: 0px 0px;
padding: 0px;
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
font-size: smaller; /*0.8em;*/
text-align: left;
}
ul.toplink,ul.navlink
{
list-style: none;
margin:0;padding:0;
}
ul.navlink{margin:20px 0}
ul.toplink li, ul.navlink li
{
display:inline;
border-left:1px solid #000000;
margin:0;padding: 0 2px 0 5px;
}
ul.toplink li:first-child, ul.navlink li:first-child {
border: none;
padding-left:0;
}
td.data1
{
color: #000000;
background-color: #F3F3E9;
text-align: left;
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
font-size: 10pt;
/* font-size: smaller; */ /*0.8em;*/
}
td.data2
{
color: #000000;
background-color: #E6E6CC;
text-align: left;
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
font-size: 10pt;
/* font-size: smaller; */ /*0.8em;*/
}
td.data3
{
color: #000000;
background-color: #F3F3E9;
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
font-size: 10pt;
/* font-size: smaller; */ /*0.8em;*/
}
td.opbutton1
{
color: #000000;
background-color: #F3F3E9;
border-top: 1px solid #FFFFFF;
border-right: 1px solid #706D41;
border-bottom: 1px solid #706D41;
border-left: 1px solid #FFFFFF;
cursor: pointer;
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
font-size: 10pt;
/* font-size: smaller; */ /*0.8em;*/
padding-left: 6px;
padding-right: 6px;
text-align: center;
}
td.opbutton2
{
color: #000000;
background-color: #E6E6CC;
border-top: 1px solid #FFFFFF;
border-right: 1px solid #706D41;
border-bottom: 1px solid #706D41;
border-left: 1px solid #FFFFFF;
cursor: pointer;
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
font-size: 10pt;
/* font-size: smaller; */ /*0.8em;*/
padding-left: 6px;
padding-right: 6px;
text-align: center;
}
.topbar {
border: 2px solid #CECF9C;
}
.topbar, .topbar * {
background-color: #CECF9C;
}
.topbar .platform, .topbar .host, .topbar .username {
font-weight: bold;
}
.topbar, .trail {
margin-bottom: 2px;
}
.topbar, .trail, .tab {
padding: 2px 1ex;
}
.trail, .tab {
border: 2px solid #E6E6CC;
background-color: #F3F3E9;
}
.trail .crumb {
background-color: #F3F3E9;
}
.crumb, .tab {
vertical-align: top;
}
.crumb .icon {
vertical-align: middle;
margin: 0 2px;
}
table.tabs {
width: 100%;
border-collapse: collapse;
margin-bottom: 1ex;
}
.tab {
text-align: center;
}
.tabs .active {
background-color: #E6E6CC;
}
.tab .icon {
display: block;
}
a:active
{
color: #989973;
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
font-weight: normal;
text-decoration: underline;
}
a,a:link
{
color: #336699;
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
text-decoration: none;
}
a:visited
{
color: #336699;
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
text-decoration: none;
}
a:hover
{
color: #cc0000;
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
text-decoration: none;
}
a.navlink:link, a.toplink:link, ul.navlink li a, ul.toplink li a
{
color: #336699;
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
font-weight: bold;
text-decoration: none;
}
a.navlink:visited, a.toplink:visited, ul.navlink li a:visited, ul.toplink li a:visited
{
color: #336699;
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
font-weight: bold;
text-decoration: none;
}
a.navlink:hover, a.toplink:hover, ul.navlink li a:hover, ul.toplink li a:hover
{
color: #cc0000;
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
font-weight: bold;
text-decoration: none;
}
a.navlink:active, a.toplink:active, ul.navlink li a:active, ul.toplink li a:active
{
color: #cc0000;
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
font-weight: bold;
text-decoration: none;
}
.active a
{
font-weight: bold;
}
a.help
{
color: #E68800;
font-size: smaller;
vertical-align: super;
text-decoration: none;
}
pre
{
font-size: 110%;
}
pre.data
{
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
font-size: 100%;
}
.intro li
{
font-weight: bold;
}
/* Syntax highlighting */
.comment {color: #008080}
.keyword {color: #FF8000}
.literal {color: #808080}
/* Browser Tree using XLoadTree 2 */
.refreshTree {
float:right;
text-align:right;
padding: 0 3px;
}
.webfx-tree-row {
white-space: nowrap;
font-family: “MS Pゴシック”, sans-serif, arial, tahoma, verdana, helvetica, serif;
}
.webfx-tree-children {
background-repeat: repeat-y;
background-position-y: 1px !important; /* IE only */
}
.webfx-tree-row img {
vertical-align: middle;
}
.webfx-tree-item-label {
margin-left: 0.5ex;
}
.webfx-tree-icon {
margin-left: 1px;
}
.webfx-tree-hide-root {
display: none;
}
.arg_icon {
padding-right:5pt;
padding-left:5pt;
}
.arg_tr_pc {
}
.ac_field {
border:1px solid #D9D95F;
}
.normal_field {
}
PHP5 XMLファイルと配列を相互に受け渡しをするクラス
<?php
/**
* クラスの説明
* XMLファイルと配列を相互に受け渡しをするクラス
*
* @author k.t
* @since PHP 5.0
*/
class com_xml_array
{
/**
* Arrayに入っている内容を、XMLファイルに書き込む。値はキー値が’text’に格納する。
* @param string $file 書き込むファイル名
* @param Array $array 内容が入ったArray
* @return string
*/
public static function save_array2xml($file,$array,$xml_root_name=’xml_root’)
{
$dom = new DomDocument(‘1.0′,’UTF-8′);
$dom->preserveWhiteSpace = false;
$dom->formatOutput = true;
$parent = new domElement($xml_root_name);
$dom->appendChild($parent);
self::array2xml_recursive($array,$parent,$dom);
$dom->save($file);
}
/**
* 再帰的にarrayの内容をxmlにする.
* @param Array $array
* @param DOMNode $parentarray
* @return
*/
private static function array2xml_recursive($array,&$parent,&$dom)
{
foreach($array as $key => $value)
{
if(is_array($value))
{
$node = $dom->createElement($key);
$parent->appendChild($node);
self::array2xml_recursive($value,$node,$dom);
}
else if(is_string($value))
{
if($key==’text’)
{
$node = $dom->createTextNode($value);
$parent->appendChild($node);
}
else
{
$node = $dom->createElement($key,$value);
$parent->appendChild($node);
}
}
else
{
$node = $dom->createElement($key,$value);
$parent->appendChild($node);
}
}
}
/**
* XMLファイルを読み込んで、Arrayに格納する。ノード中に子ノードを作る場合で、そのタグの値を設定する場合は、キー値が’text’に値を格納する。
* @param string $file ファイル名
* @return Array 読み込んだ結果が入った配列
*/
public static function load_xml2array($file)
{
$dom = new DomDocument(‘1.0′,’UTF-8’);
$dom->preserveWhiteSpace = false;
$dom->formatOutput = true;
try
{
$ret=$dom->load($file);
if(!$ret) return null;
}
catch(Exceptuin $ex)
{
throw new Exception($ex->getMessage());
}
$array = null;
$root = $dom->childNodes->item(0)->childNodes;
foreach($root as $node)
{
$node_type = $node->nodeType;
if($node_type==XML_TEXT_NODE)
{
$array[‘text’] = $node->nodeValue;
}
else
{
self::xml2array_recursive($node,$array[$node->nodeName]);
}
}
return $array;
}
/**
* 再帰的にXMLの構造をArrayに格納する.
* @param DOMNode $pnode
* @param Array $array
*/
private static function xml2array_recursive($pnode,&$array)
{
if(!$pnode->hasChildNodes()) return;
$child_nodes = $pnode->childNodes;
if($child_nodes->length == 0) return;
foreach($child_nodes as $node)
{
$node_type = $node->nodeType;
if($node_type==XML_TEXT_NODE)
{
$array[‘text’] = $node->nodeValue;
}
else
{
self::xml2array_recursive($node,$array[$node->nodeName]);
}
}
}
}
?>