ときどきの雑記帖 RE* (新南口)
歳月人を待たないぜ
スーパーマーケットでの支払い
商品のバーコードの読み込みは店員がやるけど、 支払いそのものはそれ用の機械で(店員を介さず)行う 「セルフレジ」が結構増えてきていると思うのだけどそれはそれとして。
とある系列のスーパーマーケットの何店かにそれなりの頻度で行くのだけど、 お店によってこの「セルフレジ」の「仕様」が微妙に違ったいて困る (というほど大ごとではないがまあ改良はしてほしい)。
具体的にはSUICAなどの扱い。ある店では現金などと同様に支払い用の機械を使って自分で すべてやり、別の店では店員がキャッシャーを操作して近くのリーダーで読み込ませる といった具合。
で、レジ待ちの順番が回ってきたときに 「はて、この店ではどっちのスタイルでやるのっだったっけか」 となるのですな。
そういや「レジ袋」も店員にお任せじゃなくて、自分で必要な枚数を所定の枚数とっておいて それをほかの商品とまとめて会計というのにも最近遭遇して ちょっと面食らった(悪くはないと思う)。
ZDNet
最近のこの記事 オライリー調査で明らかに–Go、Rust、Ruby、Dartに関心高まる - ZDNet Japan なんかがそうなんだけど
(続きはTechRepublic Japanでお読みいただけます)
というのが結構多い気がする>ZDNet
それはまあいいんだけど、続きが読めるというその TechRepublic Japan に行ったら行ったで会員登録が必要とか言われる始末。 で、ZDNetで見たその記事の大元はちょっと前(どころか数年前とかいうのも以前見かけた) の記事というのはなんとも納得しがたいものがある。
上記の記事なら Where Programming, Ops, AI, and the Cloud are Headed in 2021 – O’Reilly で、これは
By Mike Loukides
January 25, 2021
The Story of Mel
The Cursed Computer Iceberg Meme に興味深いもののリスト(と言ってもいいんじゃない?)がある。
ページ先頭の記述によれば
this is not a hall of shame.
the intent is to awaken you to many of the peculiarities and weirdness of computers.
hopefully, after reading these articles, you will have learned a lot and will embrace chaos.
だそう。どんなものがあるのか眺めていると
void *alloca(size_t size);
や The Infamous Japanese Postal CSV
というものがあり、あーという感じに。
The ‘Story of Mel’ もあるのだけど、これは ハッカーズ大辞典 (Ascii books) にも(翻訳されたものが)収録されている。
とても好きなエピソードだったりする(どういったお話なのかはあえて書かない)ので、 用語集としてはいささか(だいぶ?)古びてしまっているけど 無理かなあ復刊(できれば電書で)>「ハッカーズ大辞典」。
grep of FreeBSD
前回書いたFreeBSD 13.0のgrep の話の続き。
ソースコードはどれだろうと探してみたが多分これだろう grep « usr.bin - src - FreeBSD source tree
で、どういった素性のものか知るべくファイルの先頭部分にあるライセンス記述などを見ると
grep.c « grep « usr.bin - src - FreeBSD source tree
/* $NetBSD: grep.c,v 1.6 2011/04/18 03:48:23 joerg Exp $ */
/* $FreeBSD$ */
/* $OpenBSD: grep.c,v 1.42 2010/07/02 22:18:03 tedu Exp $ */
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav
* Copyright (C) 2008-2009 Gabor Kovesdan <gabor@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
copyrightの年の記述の最初が1999年とあるから結構以前からあったものですな。
James Howard and Dag-Erling Coidan Smorgrav
で検索すると
二人のそれらしい人物のページが見つかった。
dag-erling (Dag-Erling Smørgrav) と Software | James Howard で、後者のページには
One of the most interesting software projects I have here is FreeGrep, a BSD-licensed implementation of the grep pattern matching suite.
という記述があった、さらにそこからリンクをたどると
FreeGrep was developed primarily over the summer of 1999 as a BSD-licensed alternative to GNU Grep provided with FreeBSD. This edition of grep relies on the local regular express (regex) facilities and provides services for searching compressed archives.
During the summer of 2003, the OpenBSD Project replaced the GNU Grep shipping with OpenBSD with a heavily modified version of FreeGrep.
This is the version of grep shipped with OpenBSD 3.4 and later. During the spring of 2004, the NetBSD project replaced GNU Grep with a modified version of OpenBSD’s FreeGrep and ships will NetBSD 2.0 and later. Since then, it has shipped with Haiku, Minix, FreeBSD, and many other operating systems.
ふむ。
ソースコードはここに置かれているものがオリジナルということなのかな? howardjp/freegrep: FreeGrep is a BSD-licensed implementation of grep(1)
ブラケット式の中のエスケープ
以前 正規表現の文字クラスで]を置くには で文字クラス中のメタ文字の扱いについて書いたのだけど、最新(5.1.0)の gawkのドキュメントを読んでいたらこんな記述があるのに気がついた。
3.4 Using Bracket Expressions
(略)
To include one of the characters ‘\’, ‘]’, ‘-’, or ‘^’ in a bracket expression, put a ‘\’ in front of it. For example:
[d\]]
matches either ‘d’ or ‘]’. Additionally, if you place ‘]’ right after the opening ‘[’, the closing bracket is treated as one of the characters to be matched.
The treatment of ‘\’ in bracket expressions is compatible with other awk implementations and is also mandated by POSIX. The regular expressions in awk are a superset of the POSIX specification for Extended Regular Expressions (EREs). POSIX EREs are based on the regular expressions accepted by the traditional egrep utility.
ここを読むと、ブラケット式(文字クラス)中で \
によるエスケープが有効になるのは
POSIXでも要求されているとあるようなんだけど、opengroupのサイトにはみあたらなかったような…
ついでにawkにおける正規表現のメタ文字としての{
と }
について
3.3.2 Some Notes On Interval Expressions
Interval expressions were not traditionally available in awk. They were added as part of the POSIX standard to make awk and egrep consistent with each other.
Initially, because old programs may use ‘{’ and ‘}’ in regexp constants, gawk did not match interval expressions in regexps.
However, beginning with version 4.0, gawk does match interval expressions by default. This is because compatibility with POSIX has become more important to most gawk users than compatibility with old programs.
For programs that use ‘{’ and ‘}’ in regexp constants, it is good practice to always escape them with a backslash.
Then the regexp constants are valid and work the way you want them to, using any version of awk.17Finally, when ‘{’ and ‘}’ appear in regexp constants in a way that cannot be interpreted as an interval expression (such as /q{a}/), then they stand for themselves.
As mentioned, interval expressions were not traditionally available in awk. In March of 2019, BWK awk (finally) acquired them.
Nonetheless, because they were not available for so many decades, gawk continues to not supply them when in compatibility mode (see section Command-Line Options).
いつの間にか One True Awk でも interval expression を実装していたのね。知らなかった。
ソースコードを読んだ感じではOne True Awk では泣き別れの ‘{’ や ‘}’をエラーにしていないようだったけど、 実装の都合なのか(なんか面倒くさい方法でハンドリングしてた) 過去との互換性のためなのかな。
in-place editing
別件で、過去の perldeltaを読んでいたら 5.28.0で次のような変更があったのに気づいた。
perldelta - what is new for perl v5.28.0 - metacpan.org
In-place editing with perl -i is now safer
Previously in-place editing (perl -i) would delete or rename the input file as soon as you started working on a new file.
Without backups this would result in loss of data if there was an error, such as a full disk, when writing to the output file.
This has changed so that the input file isn’t replaced until the output file has been completely written and successfully closed.
This works by creating a work file in the same directory, which is renamed over the input file once the output file is complete.
Incompatibilities:
Since this renaming needs to only happen once, if you create a thread or child process, that renaming will only happen in the original thread or process.
If you change directories while processing a file, and your operating system doesn’t provide the unlinkat(), renameat() and fchmodat() functions, the final rename step may fail.
[perl #127663]
あー、この元の操作(オープンしてからそのファイルを削除しちゃう)はWindowsでは動かなくて、自分で書き換えた記憶が。 ってActive PerlやCygwinのPerlを自分でビルドしたことあったっけか? 🤔
Hugo メモ
疑問
月別のindexページを作るにはどうやるのがいいのだろう?
refの引数
{{< ref “xxxx.md#id” >}} を使ったページ途中へのリンクについて。
以前見出し部分の空白は’-‘に置き換えられるようだというのを書いたけど、
その他にいくつかの記号(.
と ]
は確認した)は
取り除かれるようだ。