Entries from 2017-01-01 to 1 year
Context In PowerShell, you can format a string with -F operator like: Get-Content foo.csv | ConvertFrom-Csv -Header Name,Code,Address | ` ForEach-Object { "{0} `n {1} {2}" -F $_.Name,$_.Code,$_.Address } Problem -F operator returns error l…
ポエムです。 背景 年賀状の宛名なんて、筆まめやら何やらで印刷すればいいとも思うんですよ。特に、私はコンピュータ・ソフトウェア・エンジニアなので、自動化はまさに自分の存在意義に関わる訳です。 でも、そういう訳にもいかない事情があるわけです。主…
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…
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.…
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 …
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…
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…
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…
Problem: In PowerShell, by using XML DOM API in .NET, you can access to a child element in XML as a ordinary property. PS > $xml = New-Object System.Xml.XmlDocument PS > $xml.LoadXml('<a><b id="1">foo</b></a>') PS > $xml.SelectNodes('//a').b id #text -- ----- …
Background: In PowerShell (even in C# or VB.NET?), you can get a body of the tag (text content) with '#text#' property. > $xml = New-Object System.Xml.XmlDocument > $xml.LoadXml('<a><b id="1">foo</b></a>') > $xml.SelectNodes('//a').b.'#text' foo Problem: If a …
In Japan, so many companies have their own security policy like "When you send email with attachments, you must zip all the attachments with password, and send the password in another email". Some say this policy is pointless, but on the o…
Purpose of account lockout These are some purpose for account lockout, such as: Detect login attempts 1 Example: Logging 2 Slow down login attempts Example: Duration-based lockout, scrypt, Argon2 Interrupt login attempts Example: Requires …
日本における貧困率のカウントには、相対的貧困が用いられる。日本における貧困率にカウントされるのは、2017年の国民生活基礎調査の場合、年間の等価処分所得が122万円未満の世帯。 世界における貧困率のカウントには、絶対的貧困が用いられる。世界単位で…
iOS 10.3では、リマインダーに保存したツイートのURLはTwitterのアイコンで表示される。また、TwitterのアイコンをタップするとTwitterのアプリが起動し、対応するツイートが表示される。 iOS 11.0では、リマインダーに保存したツイートのURLはアイコンなし…
JCache cannot save the order of insertion. You should use LinkedHashMap for that purposes. JCache cannot update whole entries in a cache atomically. You should use AtomicReference or some locking mechanisms for that purpose. (Ofcourse you …
I think the word "cache" has so many different meanings in different contexts like below. Note: In this list, the word "invalidated" means the source of cached value might be changed. Something like the cache in web browsers. The cache sto…
Format of Personal Access Tokens In GitHub, personal access tokens are hex string, like e72e16c7e42f292c6912e7710c838347ae178b4a. In GitLab, personal access tokens are like Base62 string, like 9koXpg98eAheJpvBs5tK. Personal Access Tokens a…
Context: You are using Alfresco Community v5.2.0. You are using Chrome with Adblock Plus. Problem: “New Topic” button on the discussion forum disappear. Reason: Adblock Plus added “display: none” to the area that has the “New Topic” button…
Context: You are developing a web application that has anti-CSRF function (transaction tokens). You are using Chrome to test and debug the application. Problem: Once you had viewed the HTML source with “View page source” on the context men…
三重県のサイトに「三重県は中部地方?近畿地方?」という面白い情報があった。 同様の話は静岡県などにも言える(警察庁としては関東管区警察局の管轄区域だが、国土交通省としては中部地方整備局の管轄区域)。 他にも、Chakuwikiには「もし道州制の境界線…
I scanned a B4-size monochrome paper document with Epson EP-805A through Epson iPrint iOS app, and resulted a 1.9MB jpeg file (It’s too big, isn’t it?). You can reduce the size of monochrome almost-binary image with Imagemagick convert com…
For example, in PushOperation.java in EGit, PushOperationSpecification contains LinkedHashMap<URIish, Collection<RemoteRefUpdate>>. So you can join all remote name with Stream API like: String specs = this.specification.getURIs().stream() .map(uri -> this.specification.getRe</uriish,>…
Context You can use lambda as lazy evaluation syntax in Java. Problem You can wrap RuntimeException with lambda like (it shows "omit exception"): import java.util.function.Supplier; public class OmitRuntimeException { public static void ma…
Problem: You can use runas command to run a command with specific user privilege. (Note: You have to type password into command prompt): C:\>runas /user:domain\username cmd Enter the password for domain\username: Attempting to start cmd as…
Problem: “Fork” button in GitHub forks a repository into your account. You cannot rename the repository when you fork it. You cannot have two repositories with identical name. So, you cannot have two forks from one repository simultaneousl…
(In English: What can you do for ISO/IEC 12207 (JIS X 0160:2012) Software Configuration Management Process with VCSs, GitHub/GitLab/etc, and git-flow/GitHub Flow) ISO/IEC 12207 (JIS X 0160:2012)では、ソフトウェア開発におけるソフトウェア構…
tl;dr Java: Floor in type casting. Round half up for Math.round(). You can choose rouding strategy for BigDecimal. JavaScript: Round half up for Math.round(). Round half away from zero for toFixed(). PowerShell (.NET CLR): Round half to ev…
Problem: PowerShell rounds 0.5 to 0 (banker’s rounding) in type casting to int. PS > @(-3.5,-2.5,-1.5,-0.5,0.5,1.5,2.5,3.5) | ForEach-Object { "{0} -> {1}" -F $_, [int]$_ } -3.5 -> -4 -2.5 -> -2 -1.5 -> -2 -0.5 -> 0 0.5 -> 0 1.5 -> 2 2.5 -…
Tested in Windows 7 (Japanese). Import-Csv does not have -Encoding option in PowerShell 2.0. There are no option for UTF-32BE in PowerShell 2.0. (note: PowerShell ISE can handle UTF-32BE Files) Import-Csv does not support Unknown and Strin…
Who recommends changeing password periodically Some say you should change password periodically. PCI DSS version 3.2 8.2.4 Change user passwords/passphrases at least once every 90 days. プライバシーマーク制度 (JIPDEC)(In Japanese) based on…