Lazy Diary @ Hatena Blog

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

ISO/IEC 12207 (JIS X 0160:2012) ソフトウェア構成管理プロセスのうちバージョン管理システム、GitHub/GitLab/etc、git-flow/GitHub Flowでカバーできる内容

(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)では、ソフトウェア開発におけるソフトウェア構成管理プロセスが規定されている。その中の作業には、バージョン管理システムを使えばカバーできるもの、GitHub/GitLab/etcを使っていればカバーできるもの、git-flow/GitHub Flowでカバーできるものがある。 ISO/IEC 12207 (JIS X 0160:2012)のソフトウェア構成管理の各項目に対する、各技術要素のカバー範囲を表にまとめてみた。

見出し バージョン管理システムでできること GitHab/GitLab/etcでできること git-flow/GitHub Flowでできること git-flowではできないこと 備考
7.2.2 - - - - -
7.2.2.1 ソフトウェア品目の利用
ソフトウェア品目の完全性の維持
ソフトウェア品目の完全性の確立
7.2.2.2 - - - - -
7.2.2.2 a) ソフトウェア構成管理戦略の作成 git-flowをそのままソフトウェア構成管理戦略と規定する想定
7.2.2.2 b) 生成される品目のベースライン化 生成される品目の識別
生成される品目の定義
ベースライン化に必要なレビュー等が作業フローに含まれるものとする
7.2.2.2 c) 品目の修正の制御
品目のリリースの制御
7.2.2.2 d) 修正の利用
リリースの利用
7.2.2.2 e) 品目及び修正の状態の記録 品目及び修正の状態の報告
7.2.2.2 f) 品目の完全性の確保
品目の一貫性の確保
7.2.2.2 g) 品目の保管の制御 品目の取り扱いの制御 品目の納入の制御
7.2.2.3 - - - - -
7.2.2.3.1 - - - - -
7.2.2.3.1.1 構成管理アクティビティの文書化
構成管理アクティビティを遂行するための手順の文書化
構成管理アクティビティを遂行するためのスケジュールの文書化
構成管理アクティビティを遂行する責任を負う組織の文書化
ソフトウェア開発,保守などの他の組織との関係の文書化
git-flowをそのまま文書として使用する想定
7.2.2.3.2 - - - - -
7.2.2.3.2.1 版の参照番号の識別 ベースラインを確立する文書の識別
その他の識別の詳細
7.2.2.3.3 - - - - -
7.2.3.3.1 変更依頼の識別及び記録
修正されたソフトウェア品目の実装,検証及びリリース各修正の追跡用監査証跡
修正されたソフトウェア品目の修正の承認の追跡用監査証跡
構成制御されたソフトウェア品目に対するアクセスの制御
変更の分析及び評価
変更依頼の承認又は不承認
修正されたソフトウェア品目の修正理由の追跡用監査証跡
構成制御されたソフトウェア品目に対するアクセスの監査
7.2.2.3.4 - - - - -
7.2.2.3.4.1 ソフトウェア品目の状態及び履歴を示す管理記録
プロジェクトにおける変更回数の記録
リリースの識別子の生成
リリースの回数の記録
リリース間の比較
最新のソフトウェア品目の版 状態報告書の準備
ベースラインの準備
7.2.2.3.5 - - - - -
7.2.2.3.5.1 要求事項に対するソフトウェア品目の機能的な完全さ及びソフトウェア品目の物理的な完全さの決定と保証
7.2.2.3.6 - - - - -
7.2.2.3.6.1 ソフトウェア製品及び文書のリリース及び納入の管理 コード及び文書の原本の保守
安全性又はセキュリティの重大な機能を含んだコード及び文書の関係する組織の方針に従った保管と納入

Rounding strategy in Java/JavaScript/PowerShell

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 even (bankers' rounding) in type casting, and [math]::Round(). You can choose rouding strategy in [math]::Round() with optional argument.

Java

java> double [] arr = {-3.5,-2.5,-1.5,-0.5,0.5,1.5,2.5,3.5};
java> for (int i=0; i<arr.length; i++) { System.out.println((int)arr[i]); }
-3
-2
-1
0
0
1
2
3
java> for (int i=0; i<arr.length; i++) { System.out.println(Math.round(arr[i])); }
-3
-2
-1
0
1
2
3
4
java> for (int i=0; i<arr.length; i++) { System.out.println(BigDecimal.valueOf(arr[i]).setScale(0,BigDecimal.ROUND_HALF_UP)); }
-4
-3
-2
-1
1
2
3
4
java> for (int i=0; i<arr.length; i++) { System.out.println(BigDecimal.valueOf(arr[i]).setScale(0,BigDecimal.ROUND_HALF_DOWN)); }
-3
-2
-1
0
0
1
2
3
java> for (int i=0; i<arr.length; i++) { System.out.println(BigDecimal.valueOf(arr[i]).setScale(0,BigDecimal.ROUND_HALF_EVEN)); }
-4
-2
-2
0
0
2
2
4

JavaScript

var arr = [-3.5,-2.5,-1.5,-0.5,0.5,1.5,2.5,3.5];
for (i in arr) { console.log(Math.round(arr[i])); }
-3
-2
-1
-0
1
2
3
4
undefined
for (i in arr) { console.log((arr[i]).toFixed()); }
-4
-3
-2
-1
1
2
3
4

PowerShell

see http://satob.hatenablog.com/entry/2017/06/01/234802 .

PowerShell does banker's rounding in type casting to int

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 -> 2
3.5 -> 4

Hey, Scripting Guy! Blog says use [math]::Round() to round numbers, but [math]::Round() does also banker’s rounding in default.

PS > @(-3.5,-2.5,-1.5,-0.5,0.5,1.5,2.5,3.5) | ForEach-Object { "{0} -> {1}" -F $_, [math]::Round($_) }       -3.5 -> -4                                                                                                              
-2.5 -> -2
-1.5 -> -2
-0.5 -> 0
0.5 -> 0
1.5 -> 2
2.5 -> 2
3.5 -> 4

Solution:

Use [math]::Round() with option "AwayFromZero" when you want to round 0.5 to 1.

PS > @(-3.5,-2.5,-1.5,-0.5,0.5,1.5,2.5,3.5) | ForEach-Object { "{0} -> {1}" -F $_, [math]::Round($_,0,"AwayFromZero") }
-3.5 -> -4
-2.5 -> -3
-1.5 -> -2
-0.5 -> -1
0.5 -> 1
1.5 -> 2
2.5 -> 3
3.5 -> 4

Supported character encodings in Get-Content and Import-Csv (in PowerShell 2.0/4.0)

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 String Encoding.
  • String, Default, OEM, and without -Encoding option are the same.
  • File in UTF-16 with BOM can be read even if -Encoding option is wrong
  • UTF-32BE with BOM could be misdetermined to UTF-16BE (because starting bytes are FEFF)

f:id:satob:20170601231527p:plain

Who does recommend changeing password periodically and who doesn't

Who recommends changeing password periodically

Some say you should change password periodically.

I think IPA should have another report that denies the effect of periodic password changing, but I cannot found a such information.

また、破られにくいパスワードを使っていても、長期間変更せずにいると漏えいする危険性が高まります。パスワードは、定期的に(例えば月毎)変更するようにしましょう。

Who doesn't recommend changeing password periodically

Some say you don't have to (or should not) change password periodically.

Who neither recommends nor denies changeing password periodically

Conclusion:

You can choose either one of them according to what your customer said!

2017-07-07

Add 教育情報セキュリティポリシーに関するガイドライン案 (MEXT)

2017-08-12

Add コンピュータウイルス・不正アクセスの届出状況[2010年2月分]について(IPA) and JIS Q 27001:2014

2018-01-05

2019-01-29

  • Move プライバシーマーク制度 (JIPDEC) JIS Q 15001:2006をベースにした個人情報保護マネジメントシステム実施のためのガイドライン 第2版 from who recommends to who neither recommends nor denies

2019-02-22

  • Move 医療情報システムの安全管理に関するガイドライン from who recommends to who doesn't recommend