メモ代わり。てきとーに。 いや、ですからてきとーですって。 2年前ぐらいにPythonあたりでメールくれた方、ごめんなさい。メール紛失してしまい無視した形になってしまいました。。。

ラベル work の投稿を表示しています。 すべての投稿を表示
ラベル work の投稿を表示しています。 すべての投稿を表示

2009年6月11日木曜日

[work] ガジェット?

Apache Shindigのサンプルとして、

http://localhost:8080/gadgets/ifr?url=http://www.labpixies.com/campaigns/minesweeper/minesweeper.xml

をやったら、無駄に時間を消費した。

おもしろいねー
.

[work] ガジェット?

Apache Shindigって、元々iGoogleなんすねー。

ほっほー。

iGoogle?
.

[work] ガジェット?

ガジェットって何ってところからスタート。

XのWidgetとは違う?

SNS?

OpenSocial?

Apache Shindig?

よくわからないけど、とりあえず、Apache Shindigインストール。
で、動かしてみた。

で?
.

2009年3月7日土曜日

[work] おちついてきた?

やっと落ち着いてきた感じ。

OpenOfficeについてはドキュメント読んでる間に、先生に片付けられた・・。

まぁいいや。

.

2009年2月18日水曜日

[work][PostgreSQL] MySQLのSHOW PROCESSLISTみたいなもの

メモ。


select * from pg_stat_activity;
 


メモ。

.

2009年2月14日土曜日

[work][PostgreSQL][MySQL] MySQLのバグ?

MySQL5.0.45とMySQL5.1.30で

レスポンスを受け取るまで大体15分ぐらいかかるものがあった。

データ数は数万件。

15分かかるのも問題だけど、結果が変・・・。

1ビットも変更していないのに、ある日ある時突然Order byが効かなくなり、
指定もしていないOrder by idが有効になる。。(idはプライマリーキー)
MySQLを再起動すると、最初の数十回のリクエストはOrder byが正しく効くようだ。
が、いずれOrder byが効かなくなり、さらには、結果が抜け落ちる。

はまった。

困った挙句にPostgreSQL8.3.5に変更してみた。

15分かかっていたSQLも一瞬でレスポンスが得られるようになった。
そして、Order byも完璧。
結果が抜け落ちることもない。

・・・。
MySQLって速くて軽いという触れ込みだった気がするけど
それは昔の話かな?

MySQLの作者とSunがうまくいっていないように見えるし。。

なんだろー。
.

2009年1月23日金曜日

[work] 1っこ片付いた

1つ片付いた。

次、あと1つ!

.

2009年1月4日日曜日

[work][OpenOffice][SDK][java]Spreadsheet Documents読み中(17)

http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Merging_Cell_Ranges_into_a_Single_Cell
を読む。



Merging Cell Ranges into a Single Cell
Cell rangeのインタフェース、com.sun.star.util.XMergeableは、cell rangeをマージしたりマージを取り消したりする。

merge()メソッドは全体のcell rangeをマージしたり、マージを取り消したりする。
getIsMerged()メソッドはcell rangeはマージされているかどうか決定する。

で、マージのサンプルだそうで。


com.sun.star.util.XMergeable xMerge = (com.sun.star.util.XMergeable)
UnoRuntime.queryInterface(com.sun.star.util.XMergeable.class, xCellRange);
xMerge.merge(true);
 


--
そもそもここで言うマージとはセルの結合でよいのかどうか。

.

[work][OpenOffice][SDK][java]Spreadsheet Documents読み中(16)

http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Cell_and_Cell_Range_Access
を読む。


Cell and Cell Range Access
com.sun.star.sheet.XSheetCellRangeはcom.sun.star.table.XCellRangeから派生。

rangeのcellへのアクセス、sub rangeのcellへのアクセスを提供する。
rangeのcellへのアクセスは、スプレッドシート、スプレッドシートのsub rangeによってサポートされる。


でもって、com.sun.star.sheet.XSheetCellRangeのメソッド。


com::sun::star::table::XCell getCellByPosition( [in] long nColumn, [in] long nRow)
com::sun::star::table::XCellRange getCellRangeByPosition( [in] long nLeft, [in] long nTop,
[in] long nRight, [in] long nBottom)
com::sun::star::table::XCellRange getCellRangeByName ( [in] string aRange)
com::sun::star::sheet::XSpreadsheet getSpreadsheet()
 


インタフェース com.sun.star.table.XCellRangeは、cell range中のcellへのアクセスするための
メソッドを提供する。

Cellは位置によって取得される。Cellのアドレスは行インデックスと列インデックスからなる。
インデックスは0基準。要するにインデックス0は最初の要素。



Cell Rangeは

  1. 位置による取得
  2. 名前による取得


の2通りの方法で取得できる。

「名前による取得」は、「A1:B2」といった表記による指定を可能にする。

さらに、XCellRangeはgetSpreadsheet()というメソッドを含む。
そいつはスプレッドシートのcell rangeを含んでいるcom.sun.star.sheet.XSpreadsheetインタフェースを返す。

cell rangeのすべてのcellのコンテンツを変更するメソッドはない。がびーん。


.

[work][OpenOffice][SDK][java]Spreadsheet Documents読み中(15)

http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Properties_of_Cell_Ranges
を読む。


Properties of Cell Ranges
Cell Rangeのプロパティは、以下のものを扱う。


  1. 位置

  2. rangeのサイズ

  3. フォーマット

  4. 入力規則



com.sun.star.sheet.SheetCellRangeのプロパティ
Position
Size
ConditionalFormat
ConditionalFormatLocal
Validation
ValidationLocal

おしまい
.

[work][OpenOffice][SDK][java]Spreadsheet Documents読み中(14) Cell Ranges

http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Cell_Ranges
を読む。

Cell Ranges


Cell RangeというのはCellの矩形領域。
com.sun.star.sheet.SheetCellRangeというサービスで表現される。

.

2009年1月2日金曜日

[work][OpenOffice][SDK][java]Spreadsheet Documents読み中(13) Spreadsheet

http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Spreadsheet
を読む。

Spreadsheet
Spreadsheetっつーのは、インタフェースがくっついたcell rangeだよ。
com.sun.star.sheet.Spreadsheetサービスであらわされるよ。

Properties of Spreadsheet
spreadsheetのプロパティは自身のvisibilityとかpage styleとかを扱うよ。

プロパティ名説明
IsVisible真偽値 - GUIで見えるかどうか決めちゃう
PageStylepage styleの名前を含む



Naming
com.sun.star.container.XNamedインタフェースでスプレッドシートの名前をつけたり変えたりするらしいよ。 spreadsheetコレクションからspreadsheetを取り出したりするときなんかに使うよ。


Inserting Cells, Moving and Copying Cell Ranges
Spreadsheetサービスのcom.sun.star.sheet.XCellRangeMovementインタフェースは
cellの挿入やspreadsheetからcellの削除をサポートするよ。
cellの内容のコピーや移動もサポートするよ。
cellがコピー、移動されたとき、全式の関連するリファレンスは自動的に更新されるよ。

com.sun.star.sheet.XCellRangeMovementには以下のようなメソッドがあるよ。

  1. insertCells()

  2. removeRange()

  3. copyRange()

  4. moveRange()


詳しくはWikiへ。

Page Breaks
とりあえず必要なさそうなので、パス。




.

[work][OpenOffice][SDK][java]Spreadsheet Documents読み中(12) Capabilities of Columns and Rows

http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Capabilities_of_Columns_and_Rows
を読む。


Capabilities of Columns and Rows
すべてのCell Rangeは列と行からなる。だもんで、列と行のコンテナはスプレッドシートからとれるよ。
スプレッドシートのsub-rangeからも、com.sun.star.table.XColumnRowRangeを使ってとれるよ。

で、列とか行とかのコンテナっつーのは、com.sun.star.table.TableColumnsとcom.sun.star.table.TableRowsだよ。

列、行のコンテナは両方ともindexやenumによるアクセスをサポートしてるよ。
TableColumnというのだけ、SheetCellRangeの単一の列、行へ名前によってアクセスすることを
サポートしてるかもよ。


テーブルの行、列サービスは、テーブルの構造、cell rangeのグリッドサイズなるものをコントロールするよ。

列とか行とかのコンテナはinsertとかremoveとかのメソッドを持ってるよ。インタフェースはcom.sun.star.table.XTableRowsとcom.sun.star.table.XTableColumnsね。

TableColumnとTableRowサービスは列の幅とか行の高さとかを調節するためのプロパティやvisibleしたり、page breakしたりするためのプロパティなんぞを持ってたりするかもよ。



.

2009年1月1日木曜日

[work][OpenOffice][SDK][java]Spreadsheet Documents読み中(11) Capabilities of SheetCellRanges Container

http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Capabilities_of_SheetCellRanges_Container
を読む。

Capabilities of SheetCellRanges Container
SheetCellRangeのコンテナは、いくらかのCell Rangeを一括で扱わなければならないような
ところで使われるらしい。

SheetCellRangeサービスはセル、段落、文字プロパティサービスを含み、
queryオプションを提供する。

com.sun.star.sheet.SheetCellRangeのインタフェースは
SheetCellRangeコンテナにアクセスするための要素であるそうで。

SheetCellRangeコンテナは以下の能力がある。
キャラクタ、段落、セルのプロパティサービスを使って整形できる。
com.sun.star.container.XIndexAccess、com.sun.star.container.XNameAccess、com.sun.star.container.XEnumerationAccessへアクセスすることによってCell Rangeの独立をもたらす?
com.sun.star.container.XNameContainerで、名前によってrangeへアクセス、置き換え、追加、削除ができる。
SheetCellRangeに、Index指定によって、新しいrangeを追加でき、またrange中のcellを取得できる。
com.sun.star.container.XEnumerationAccessを使うことでrangeを列挙できる?
式のセルとか空のセルとかみたいな、あるCellの内容のRangeを問い合わせることができる?



.

2008年12月31日水曜日

[work][OpenOffice][SDK][java]Spreadsheet Documents読み中(10) Capabilities of SheetCell

http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Capabilities_of_SheetCell
を読む。

Capabilities of SheetCell
SheetCellというのはOpenOffice.orgにおけるテーブルの基本パーツ。

SheetCellには以下の能力があるそうな。


  1. セルの内容にアクセスできる。

  2. インタフェースであるcom.sun.star.table.XCellはcellにおける式、値を操作できる。

  3. SheetCellはSheetCellRangeの特別なケース。

  4. 一意なセルへのアドレスを提供可能。(com.sun.star.table.CellAddress)

  5. 一時的にロック可能(com.sun.star.document.XActionLockable)


な感じか。





.

2008年12月30日火曜日

[work][OpenOffice][SDK][java]Spreadsheet Documents読み中(9) Capabilities of SheetCellRange

http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Capabilities_of_SheetCellRange
を読む。

SheetCellRangeの能力
SheetCellRangeは矩形領域をあらわす。

SheetCellRangeは以下の能力がある。
com.sun.star.sheet.XSheetCellRangeで、cell、sub-rangeなcellを提供する。
com.sun.star.table.XColumnRowRangeで、列、行を提供する。
com.sun.star.sheet.XSheetOperationで、計算を提供する。
com.sun.star.table.XAutoFormattableやらcom.sun.star.util.XIndentやらcom.sun.star.sheet.XCellFormatRangesSupplierやらcom.sun.star.sheet.XUniqueCellFormatRangesSupplierやらでフォーマットを提供する。
com.sun.star.sheet.XCellRangeDataでcellやcell-rangeのデータを扱える。
一連のデータをcellやcell-rangeに埋めるにはcom.sun.star.sheet.XCellSeriesを使う。
データベースからのデータのインポートにはcom.sun.star.util.XImportableを使う。
Cellの値を検索したり置き換えたりするのに、com.sun.star.util.XSearchableを使う。
Cellをクエリーするにはcom.sun.star.sheet.XCellRangesQueryを使う。
1つのCellに複数のCellをマージするにはcom.sun.star.util.XMergeableを使う。
ソートしたりフィルターしたりすにはcom.sun.star.util.XSortable,、com.sun.star.sheet.XSheetFilterable,
com.sun.star.sheet.XSheetFilterableEx、などを使う。
セルの一意なアドレスを取得したりするには、com.sun.star.sheet.XCellRangeAddressable:getRangeAddressを使う。これはcom.sun.star.table.CellRangeAddressというstructを返す。
com.sun.star.chart.XChartDataArrayをサポートしているのでSheetCellRangeに基づくチャートを作成できる。


って感じ?
.

[work][OpenOffice][SDK][java]Spreadsheet Documents読み中(8) Capabilities of Spreadsheet

http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Capabilities_of_Spreadsheet
を読む。

スプレッドシートの能力
スプレッドシートはcom.sun.star.sheet.SheetCellRangeを含んだcom.sun.star.sheet.Spreadsheetサービスである。

で、スプレッドシートは、com.sun.star.container.XNamedを使うことで名前によるアクセスが可能。
com.sun.star.sheet.XCellRangeMovementを使うことでcellは挿入可能で、全てのcellは削除可能、移動、コピーも可能。
印刷関連はcom.sun.star.sheet.XPrintAreasやcom.sun.star.sheet.XSheetPageBreakを使えばよいらしい。
チャートも扱えるよ。
com.sun.star.util.XProtectableというのを使えば永久に変更から守ることもできるよ?

.

[work][OpenOffice][SDK][java]Spreadsheet Documents読み中(7) Spreadsheet Services - Overview

http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Spreadsheet_Services_-_Overview
を読む。

スプレッドシートサービス概観
スレッドシートサービスを構成する主要素

  1. com.sun.star.sheet.Spreadsheet
  2. com.sun.star.sheet.SheetCellRange
  3. com.sun.star.sheet.SheetCell
  4. com.sun.star.sheet.SheetCellRanges
  5. com.sun.star.table.TableColumn
  6. com.sun.star.table.TableRow

だそうで。

.



.

[work][OpenOffice][SDK][java]Spreadsheet Documents読み中(6) Working with Spreadsheet Documents

http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Working_With_Spreadsheet_Documents
を読む。

Spreadsheet Document
スプレッドシートドキュメントはcom.sun.star.sheet.SpreadsheetDocumentで表現される。

SpreadsheetDocumentは少なくとも1つの要素を持つSpreadsheetオブジェクトのコレクションからなる。
com.sun.star.sheet.XSpreadsheetDocumentのgetSheets()メソッドを呼べば、
com.sun.star.sheet.XSpreadsheetsを取得できる。

getSheets()メソッドでXSpreadsheetsを取得すれば、3つの異なる方法でシートにアクセスすることを可能にする。

  1. インデックスによる方法
  2. Enumによる方法
  3. 名前による方法

の3つ。


インデックスによる方法
com.sun.star.container.XIndexAccessというインタフェースが提供されているので、
このインタフェースを使用し、シートにアクセスする。

public com.sun.star.sheet.XSpreadsheet getSpreadsheet(
com.sun.star.sheet.XSpreadsheetDocument xDocument, int nIndex) {

// Collection of sheets
com.sun.star.sheet.XSpreadsheets xSheets = xDocument.getSheets();
com.sun.star.sheet.XSpreadsheet xSheet = null;

try {
com.sun.star.container.XIndexAccess xSheetsIA = (com.sun.star.container.XIndexAccess)
UnoRuntime.queryInterface(com.sun.star.container.XIndexAccess.class, xSheets);
xSheet = (com.sun.star.sheet.XSpreadsheet) xSheetsIA.getByIndex(nIndex);
} catch (Exception ex) {
}

return xSheet;
}
 


Enumによる方法
com.sun.star.sheet.SpreadsheetsEnumerationというサービスが提供されているので、
このサービスを使用してシートにアクセスする。

名前による方法
com.sun.star.container.XNameContainerを派生してcom.sun.star.sheet.XSpreadsheetsが提供されているので、XNameContainerのメソッドを使用して、名前による指定でシートにアクセスする。

public com.sun.star.sheet.XSpreadsheet getSpreadsheet(
com.sun.star.sheet.XSpreadsheetDocument xDocument,
String aName) {

// Collection of sheets
com.sun.star.sheet.XSpreadsheets xSheets = xDocument.getSheets();
com.sun.star.sheet.XSpreadsheet xSheet = null;

try {
com.sun.star.container.XNameAccess xSheetsNA = (com.sun.star.container.XNameAccess)
UnoRuntime.queryInterface(com.sun.star.container.XNameAccess.class, xSheets);
xSheet = (com.sun.star.sheet.XSpreadsheet) xSheetsNA.getByName(aName);
} catch (Exception ex) {
}

return xSheet;
}
 



さらに、XSpreadsheetには以下のようなメソッドも存在する。
  1. insertNewByName() - 新しい空のシートを指定した名前で指定した位置に追加する。
  2. moveByName() - シートを指定した名前で指定した位置に移動する。
  3. copyByName() - コピーする。




.

[work][OpenOffice][SDK][java]Spreadsheet Documents読み中(5) スプレッドシートの保存

http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Saving_Spreadsheet_Documents
を読む。


Saving Spreadsheet Documents
ドキュメントは、com.sun.star.frame.XStorableというインタフェースを通して保存することができる。

XStorable.storeAsURL()は、「名前をつけて保存」と似た感じ。
XStorable.storeToUrl()は、現在読み込んでいるドキュメントはそのままで、指定されたURLにコピーとして保存する。


Exporting
他のフォーマットで保存する場合、プロパティFilterNameを指定する。
FilterNameにはフォーマットの名前を指定する。
指定できるフォーマットの名前は、


<OfficePath>/share/config/registry/instance/org/openoffice/Office/TypeDetection.xml
 

に記述されているらしい。
Debian-Etchだと、

/usr/lib/openoffice/share/registry/res/en-US/org/openoffice/TypeDetection/Filter.xcu
 

あたりかな??
MS Excel 2003 XMLで出力したかったら、

XStorable xStorable = (XStorable)UnoRuntime.queryInterface(XStorable.class, xDoc);
PropertyValue[] storeProps = new PropertyValue[1];
storeProps[0] = new PropertyValue();
storeProps[0].Name = "FilterName";
storeProps[0].Value = "MS Excel 2003 XML";
xStorable.storeAsURL(storeUrl, storeProps);
 

などと指定すればよいっぽい。



.