2017年8月20日日曜日

XSLT XPath + MS 仕様 リファレンス用


XPath 構文
  XPath 式のコンテキスト 演算子および特殊文字 コレクション フィルターおよびフィルター パターン 論理式、比較式、およびセット式 比較 セット操作 位置のパス XPath の例

XPath の例
  ./author author first. name /bookstore //author book[/bookstore/@specialty=@style] author/first-name bookstore//title bookstore/*/title bookstore//book/excerpt//emph .//title author/* book/*/last-name */* *[@specialty] @style price/@exchange price/@exchange/total book[@style] book/@style @* ./first-name first-name author[1] author[first-name][3] my:book my:* @my:*
  x/y[1] x/y[position() = 1] (x/y)[1] x[1]/y[2] book[last()] book/author[last()] (book/author)[last()] book[excerpt] book[excerpt]/title book[excerpt]/author[degree] book[author/degree] author[degree][award] author[degree and award] author[(degree or award) and publication] author[degree and not(publication)] author[not(degree or award) and publication] author[last-name = "Bob"] author[last-name[1] = "Bob"] author[last-name [position()=1]= "Bob"] degree[@from != "Harvard"] author[. = "Matthew Bob"] author[last-name = "Bob" and ../price > 50] book[position() <= 3] author[not(last-name = "Bob")] author[first-name = "Bob"] author[* = "Bob"] author[last-name = "Bob" and first-name = "Joe"] price[@intl = "Canada"] degree[position() < 3] p/text()[2] ancestor::book[1] ancestor::book[author][1] ancestor::author[parent::book][1]


  ancestor:: ancestor-or-self:: attribute:: child:: descendant:: descendant-or-self:: following:: following-sibling:: namespace:: parent:: preceding:: preceding-sibling:: self::

ノード型のテスト
  comment() node() processing-instruction() text()

文字列関数 (XPath)
  concat contains normalize-space starts-with String string-length substring substring-after substring-before translate

XML データ型リファレンス
  string boolean decimal float double duration dateTime time date gYearMonth gYear gMonthDay gDay gMonth hexBinary base64Binary anyURI QName NOTATION normalizedString token language IDREFS ENTITIES NMTOKEN NMTOKENS Name NCName ID IDREF ENTITY integer nonPositiveInteger negativeInteger long int short byte nonNegativeInteger unsignedLong unsignedInt unsignedShort unsignedByte positiveInteger

XsltArgumentList.AddExtensionObject
  .AddExtensionObject("urn:Link", link); xmlns:hxLink="urn:Link" exclude-result-prefixes="hxLink" <xsl:value-of select="concat(hxLink:LookupContentId(@NavigateUrl), '.html')"/>

<xsl:element> 要素
  xsl:apply-imports xsl:apply-templates xsl:call-template xsl:choose xsl:copy xsl:copy-of xsl:element xsl:fallback xsl:for-each xsl:if xsl:message xsl:number xsl:otherwise xsl:param xsl:template xsl:text xsl:value-of xsl:variable xsl:when xsl:with-param

Node-Set 関数
  count id last local-name name namespace-uri position

Microsoft XPath 拡張関数
  ms:type-is ms:type-local-name ([node-set]) ms:type-namespace-uri ([node-set]) ms:schema-info-available ms:string-compare ms:utc ms:namespace-uri ms:local-name ms:number ms:format-date ms:format-time

$ は変数


{} は属性値テンプレート



2017年6月30日金曜日

WinPE 起動用 ISO イメージ作成メモ

mkisofs ... mkisofs は cdrecord_fe_0902_all のものを使用

mkisofs -udf -o cd.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table cd

フォルダー構成

boot/
  bcd
  boot.sdi
  BootFix.bin
  bootsect.exe
  en-us
  etfsboot.com
  fonts
  grldr
  grub
  IMG
  ja-JP
  memdisk
  memtest.exe
  fonts/
    chs_boot.ttf
    cht_boot.ttf
    jpn_boot.ttf
    kor_boot.ttf
    wgl4_boot.ttf
  grub/
    grldr
    menu.lst
  ja-JP/
    bootmgr.exe.mui
    bootsect.exe.mui
isolinux/
  boot.cat 
  chain.c32
  isolinux.bin 
  isolinux.cfg
sources/
  2008R2.wim
BOOTMGR

isolinux.cfg

DEFAULT winpe

LABEL winpe
MENU LABEL ^WinPE BOOTMGR
COM32 chain.c32
APPEND fs ntldr=/BOOTMGR


2017年6月14日水曜日

Access レポート「指定した式には値がありません。」




---
実行時エラー '2427':

指定した式には値がありません。
---

対策例:
Private Sub 詳細_Format(Cancel As Integer, FormatCount As Integer)
    If CurrentRecord = 0 Then
        ' レコードなし
    Else
        ' レコードあり
        Debug.Print [ID]
    End If
End Sub


2017年5月26日金曜日

PowerEdge T130 で、Windows Server 2008 R2 セットアップのキーボード・マウスが操作できない!

簡単な解決方法(未確認)
  • BIOS に入ります。
  • System BIOS Settings → Integrated Devices → USB 3.0 Setting → Disabled

難しい解決方法
  • Windows インストールディスクの boot.wim に USB 3.0 ドライバーを注入します。
  • 更新した boot.wim を含む DVD を作成し、それを使ってインストールを実施します。


参考:
How to inject USB 3.0 drivers into Windows Server 2008 R2SP1 for use on Dell PowerEdge R230, R330, T130, T330 and T30
http://en.community.dell.com/techcenter/b/techcenter/archive/2016/05/15/how-to-inject-usb-3-0-drivers-into-windows-server-2008-r2sp1-for-use-on-dell-r230-r330-t130-t330

syslinux 6 で WinPE を起動したい

用意するファイル

VistaPE などで作成した boot.wim から、7-zip などを使ってこれらのファイルを取り出してください:

\BOOTMGR
\Boot\bcd
\Boot\boot.sdi
\Boot\en-us\*
\Boot\fonts\*
\Boot\ja-JP\*

cfg ファイルの書き方

LABEL -
MENU LABEL ^WinPE BOOTMGR
COM32 /boot/syslinux/chain.c32
APPEND fs ntldr=/BOOTMGR

bcdedit で \boot\bcd ファイルを修正

bcdedit は使う OS のバージョンには特に影響しないようです。




C:\A>bcdedit /store bcd /copy {default} /d "MyPE_x86"
エントリは {5841949e-415a-11e7-bff0-d43d7e05f256} に正常にコピーされました。

C:\A>bcdedit /store bcd /set {5841949e-415a-11e7-bff0-d43d7e05f256} device ramdisk=[boot]\sources\MyPE_x86.wim,{7619dcc8-fafe-11d9-b411-000476eba25f}
この操作を正しく終了しました。

C:\A>bcdedit /store bcd /set {5841949e-415a-11e7-bff0-d43d7e05f256} osdevice ramdisk=[boot]\sources\MyPE_x86.wim,{7619dcc8-fafe-11d9-b411-000476eba25f}
この操作を正しく終了しました。

C:\A>bcdedit /store bcd /displayorder {5841949e-415a-11e7-bff0-d43d7e05f256} /addlast
この操作を正しく終了しました。

C:\A>bcdedit /store bcd

Windows ブート マネージャー
--------------------------------
identifier              {bootmgr}
description             Windows Boot Manager
locale                  ja-jp
inherit                 {globalsettings}
default                 {default}
displayorder            {default}
                        {5841949e-415a-11e7-bff0-d43d7e05f256}
toolsdisplayorder       {memdiag}
timeout                 30

Windows ブート ローダー
--------------------------------
identifier              {default}
device                  ramdisk=[boot]\sources\boot.wim,{7619dcc8-fafe-11d9-b411-000476eba25f}
path                    \windows\system32\boot\winload.exe
description             Windows Setup
locale                  ja-jp
inherit                 {bootloadersettings}
osdevice                ramdisk=[boot]\sources\boot.wim,{7619dcc8-fafe-11d9-b411-000476eba25f}
systemroot              \windows
detecthal               Yes
winpe                   Yes
ems                     Yes

Windows ブート ローダー
--------------------------------
identifier              {5841949e-415a-11e7-bff0-d43d7e05f256}
device                  ramdisk=[boot]\sources\MyPE_x86.wim,{7619dcc8-fafe-11d9-b411-000476eba25f}
path                    \windows\system32\boot\winload.exe
description             MyPE_x86
locale                  ja-jp
inherit                 {bootloadersettings}
osdevice                ramdisk=[boot]\sources\MyPE_x86.wim,{7619dcc8-fafe-11d9-b411-000476eba25f}
systemroot              \windows
detecthal               Yes
winpe                   Yes
ems                     Yes

C:\A>




2017年5月2日火曜日

palloc で access violation … Visual Studio 2005 で作った PostgreSQL 8.2 の C 関数にて

BUILDING_DLL を定義したらダメみたいです。

参考: Re: Access violation from palloc, Visual Studio 2005, C-language function

include/server/utils/palloc.h に定義があります。

/*
 * Type MemoryContextData is declared in nodes/memnodes.h. Most users
 * of memory allocation should just treat it as an abstract type, so we
 * do not provide the struct contents here.
 */
typedef struct MemoryContextData *MemoryContext;

/*
 * CurrentMemoryContext is the default allocation context for palloc().
 * We declare it here so that palloc() can be a macro. Avoid accessing it
 * directly!  Instead, use MemoryContextSwitchTo() to change the setting.
 */
extern DLLIMPORT MemoryContext CurrentMemoryContext;

/*
 * Fundamental memory-allocation operations (more are in utils/memutils.h)
 */
extern void *MemoryContextAlloc(MemoryContext context, Size size);
extern void *MemoryContextAllocZero(MemoryContext context, Size size);
extern void *MemoryContextAllocZeroAligned(MemoryContext context, Size size);

#define palloc(sz) MemoryContextAlloc(CurrentMemoryContext, (sz))

#define palloc0(sz) MemoryContextAllocZero(CurrentMemoryContext, (sz))

MemoryContextAlloc や CurrentMemoryContext は、インポートライブラリを利用して postgres.exe プロセスからインポートします。

---
結論から申しますと、つぎのようにあるべきが、

extern __declspec (dllimport) MemoryContext CurrentMemoryContext;

BUILDING_DLL を定義することで、つぎのように変化することが問題でした。

extern __declspec (dllexport) MemoryContext CurrentMemoryContext;

---
それでは納得できないこともあろうかと、アセンブラレベルで解析もしました。

palloc するだけの C 関数:
PG_FUNCTION_INFO_V1(ddtest);
Datum ddtest(PG_FUNCTION_ARGS) {
 palloc(0x123456);
 PG_RETURN_NULL();
}

まず、
extern __declspec (dllimport) MemoryContext CurrentMemoryContext; となる場合。


緑下線を引いた部分 100470F8 が CurrentMemoryContext の実体のアドレスです。そこに意味のあるコードはありませんが一応。88 87 04 00 の部分が MemoryContextSwitchTo を呼び出すことで、本来の値に書き換えられるわけです。


つぎに、
extern __declspec (dllexport) MemoryContext CurrentMemoryContext; となる場合。


緑下線を引いた部分が <CurrentMemoryContext> になっています。一見これが正解じゃないかと思いますが、参照先は jmp dword ptr [0x100470f8] の命令コードです。



0x70f825ff に 4 を足した 0x70f82603 にアクセスしようとして、access violation が発生することが冒頭のエラーにつながります。

『postgres.exe の 0x005fbb4a で初回の例外が発生しました: 0xC0000005: 場所 0x70f82603 を読み込み中にアクセス違反が発生しました。』

外部の exe/dll からインポートする変数は、__declspec (dllimport) を使いましょう。

2017年4月26日水曜日

Interoperability 相互運用性 を最大限にする! とは

どういうことでしょうか…?

つまり、再利用可能な要素を多分に含む、ということです!

HTML に対する XML と同じ考え方です。

つまり、画面表示の要素と、データを分離する、ということです。

そうするとデータの機械処理や流用が楽になります。

要検討事項:
  • 詳細なデータを確認したい場合。
  • 検証可能性を明らかしたい場合。