しかし、残念ながら私の環境では動作しませんでした。
以下のように、CreateShortcutメソッドへ渡すパラメータを$_から$_.FullNameへ変更することで動作させることができました。
filter Get-Shortcut()
{
$shell = New-Object -ComObject WScript.Shell
return $shell.CreateShortcut($_.FullName)
}
filter Get-Shortcut()
{
$shell = New-Object -ComObject WScript.Shell
return $shell.CreateShortcut($_.FullName)
}
Public Sub Msxml()
Dim namespaces As String
Dim xml As Object
Dim ret As Boolean
Dim nodeList As Object
Dim item As Object
namespaces = "xmlns:rss='http://purl.org/rss/1.0/'"
namespaces = namespaces + " xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'"
Set xml = CreateObject("MSXML2.DOMDocument.6.0")
Call xml.setProperty("ServerHTTPRequest", True)
Call xml.setProperty("SelectionNamespaces", namespaces)
xml.async = False
ret = xml.Load("http://b.hatena.ne.jp/sample/rss")
If ret Then
Set nodeList = xml.SelectNodes("/rdf:RDF/rss:item/rss:title")
For i = 0 To nodeList.Length - 1
ActiveSheet.Cells(i + 1, 1).Value = nodeList.item(i).Text
Next
End If
End Sub
svn export http://svn.apache.org/repos/asf/xmlbeans/trunk/ xmlbeans
private boolean isBadChar ( char ch )
{
if (Character.isHighSurrogate(ch) ||
Character.isLowSurrogate(ch))
return false;
return ! (
(ch >= 0x20 && ch <= 0xD7FF ) ||
(ch >= 0xE000 && ch <= 0xFFFD) ||
(ch >= 0x10000 && ch <= 0x10FFFF) ||
(ch == 0x9) || (ch == 0xA) || (ch == 0xD)
);
}
<cc1:FileDownloadButton ID="FileDownloadButton1" runat="server"
Text="Download"
OnDownloading="FileDownloadButton1_Downloading"
OnDownloaded="FileDownloadButton1_Downloaded"/>
protected void FileDownloadButton1_Downloading(object sender, EventArgs e)
{
// Tempファイルを作成する
var path = Path.GetTempFileName();
var file = new FileInfo(path);
// Tempファイルへデータを出力する
using (var s = file.OpenWrite())
using (var w = new StreamWriter(s))
{
w.WriteLine("Hello");
w.Flush();
}
// FileDownloadButtonのFileプロパティへTempファイルをセットする
FileDownloadButton1.File = file;
}
protected void FileDownloadButton1_Downloaded(object sender, EventArgs e)
{
// Tempファイルを削除する
FileDownloadButton1.File.Delete();
}
namespace HttpHandlerSample
{
// 動的にPNG画像を生成するクラス
public class PngHandler : IHttpHandler
{
// このオブジェクトが再利用可能かを返すプロパティ
public bool IsReusable
{
get
{
return true;
}
}
// ...略...
// HTTPリクエストを処理するメソッド
public void ProcessRequest(HttpContext context)
{
// 画像を生成する
using (var image = GenerateImage())
{
// PNG形式でHTTPレスポンスへ出力する
var output = context.Response.OutputStream;
image.Save(output, ImageFormat.Png);
output.Flush();
}
// Content-TypeヘッダをPNG形式に設定する
context.Response.ContentType = "image/png";
}
// ...略...
}
}
<configuration>
<system.webServer>
<handlers>
<add name="PngHandler" path="*.png" verb="GET" type="HttpHandlerSample.PngHandler"/>
</handlers>
</system.webServer>
</configuration>
ちなみにString regex = "\\[([0-9]+)\\]";
String src = "[1] [2] [3] [4] [5]";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(src);
String result1 = matcher.replaceAll("($1)");
System.out.println(result1);
// => (1) (2) (3) (4) (5)
String regex = "\\[([0-9]+)\\]";
String src = "[1] [2] [3] [4] [5]";
String[] kan = {"一", "ニ", "三", "四", "五"};
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(src);
StringBuilder result2 = new StringBuilder();
int lastEnd = 0;
String outOfMatch = "";
while(matcher.find()) {
outOfMatch = src.substring(lastEnd, matcher.start());
String group = matcher.group(1);
int n = Integer.parseInt(group);
String kanN = kan[n-1];
result2.append(outOfMatch);
result2.append("(" + kanN + ")");
lastEnd = matcher.end();
}
outOfMatch = src.substring(lastEnd);
result2.append(outOfMatch);
System.out.println(result2);
// => (一) (ニ) (三) (四) (五)