Lazy Diary @ Hatena Blog

PowerShell / Java / miscellaneous things about software development, Tips & Gochas. CC BY-SA 4.0/Apache License 2.0

Entries from 2017-11-01 to 1 month

There are no properties for ordinary characters in PropList.txt

Problem When run the script in next URL with PropList.txt on unicode.org, result file did not contain character properties for ordinary characters like 'x', 'y', or 'z'. http://satob.hatenablog.com/entry/2017/11/21/002957 Reason PropList.t…

Get CodePoint-Property Pair from Scripts.txt on Unicode.org

Context You want to make a list of pair of unicode codepoint and its character property, like below: 00009,Cc 00020,Zs 00021,Po 00024,Sc ... Solution with PowerShell You can make the list from ftp://ftp.unicode.org/Public/UNIDATA/PropList.…

Ordinaly SELECT clause returns ORA-00904 error on Oracle in SQL Fiddle

SQL

Context The "Text to DDL" feature on SQL Fiddle generates DDL like below for Oracle 11g R2. CREATE TABLE Table1 ("value1" int) ; INSERT ALL INTO Table1 ("value1") VALUES (1) SELECT * FROM dual ; Problem This ordinal SELECT clasuse returns …

Return value of comparison operator in SELECT clause

SQL

Background Some RDBMS can contain the result of comparison operator in SELECT clause. However, the returned values are different between RDBMS. Result MySQL I used MySQL 5.6 on SQL Fiddle. DDL (MySQL) CREATE TABLE Table1 (`value1` int, `va…

Convert deeply nested hash or array to JSON with ConvertTo-Json

Context You can read a JSON file like below with ConvertFrom-Json, and write with ConvertTo-Json properly. PS > Get-Content ./foo.json { "outerHash": { "innerHash": { "key": "value" } } } PS > Get-Content ./foo.json | ConvertFrom-Json | Co…

Convert an array to CSV with PowerShell

Problem You cannot convert an array with just pipeline the array to ConvertTo-Csv. PS > $array = ("a", "b", "c", "a", "d") PS > $array | ConvertTo-Csv "Length" "1" "1" "1" "1" "1" ... or just passing the array to ConvertTo-Csv. PS > Conver…