ときどきの雑記帖 RE* (新南口)
不立文字
渋谷駅工事
【京浜東北線 上下線 快速運転中止】
— とれいんふぉ 首都圏エリア 非公式運行情報など (@Trainfo) November 18, 2023
京浜東北線は、山手線内でのホーム嵩上げ工事による線路切換工事の影響で、田端~浜松町の上下線で快速運転を終日中止し、全列車各駅停車の臨時ダイヤで運転します。 pic.twitter.com/tPmInV7P6u
そう言えば水曜日辺りから JR東の車内での運行案内にこれ (京浜東北線)の情報が流れていたんだけど、 日本語版には日付が入っているのに 英語版にはなくて??な状態に。
最初に英語版で気がついて、「Major repairment」とかあったので 京浜東北線でなんかあったのか? と思ってしばらく見てたら日本語版が流れてきて 「Major repairment」が渋谷駅の工事のことだったと初めて分かった。
パスワード
有効期限つけることの是非はおいといて。
期限が6ヶ月とか1年とか「切りの良い」ものなので、 期限切れ前に余裕をみて変更していると だんだん日にちが前の方に移動してくるのにモヤモヤを感じる。
たとえば
- n年 4/1
- n年 9/25(10/1 or 9/30よりちょっと前)
- n+1年 3/20(以下同様)
- n+2年 9/10
- n+3年 3/3
みたいになるってことね (あんまりギリギリを狙うとちょっとした危険がある)。
Ruby
Regexp.last_match(1)の地雷のような挙動を踏み抜いてしまった話 #Ruby - Qiita
公式ドキュメントに嘘が書いてあった。
ありゃま。
ACM ByteCast
なんか日本人ぽい名前と思ったら
Noriko Arai - Episode 46 | ACM ByteCast
In this episode of ACM ByteCast, our special guest host Scott Hanselman (of The Hanselminutes Podcast) welcomes Noriko Arai, a professor in the Information and Society Research Division of the National Institute of Informatics in Tokyo, Japan. She is a researcher in mathematical logic and artificial intelligence and is known for her work on a project to develop robots that can pass the entrance examinations for the University of Tokyo.
新井先生?
マイコン博物館
青梅にあるマイコン博物館の拡張・移転へのご支援をお願いします(吉崎武(一般財団法人 科学技術継承財団 館長) 2023/11/09 公開) - クラウドファンディング READYFOR
すでに目標額には達しているようだけど 自分も申し込むかな
word boundary
who | grep -q ‘^guest\>‘の\>とはなんなのか?
\<と\>はGNU word boundaryを表す特殊文字。
確かにこれはPOSIXにはなくてGNU grepなどにはあるものなんだけど、 GNU(による)拡張じゃないはずなんだが…と思いつつリンク Regular Expressions Reference: Word Boundaries をたどると
Regex Tutorial - \b Word Boundaries
The GNU extensions to POSIX regular expressions add support for the \b and \B word boundaries, as described above. GNU also uses its own syntax for start-of-word and end-of-word boundaries. \< matches at the start of a word, like Tcl’s \m. \> matches at the end of a word, like Tcl’s \M.
Boost also treats \< and \> as word boundaries when using the ECMAScript, extended, egrep, or awk grammar.
あー、参考にしたここからこういう記述なのね。ふむ。
一応 GNU Grep 3.11 も見ておくと、GNU拡張とは書かれてはいない。 実際のところどうなのか明確にしておきたいけど古い文献あさるのめんどくせー😓
詳説正規表現になんかあったかもしれない(がすぐには出てこない)
v7のgrep、sedには…ないっぽいな。
- v7unix/v7/usr/src/cmd/grep.c at master · v7unix/v7unix
- v7unix/v7/usr/src/cmd/sed/sed0.c at master · v7unix/v7unix
新刊近刊
最近よくPragProgの本のお知らせが流れてくるんだけど 面白そうなものが結構あるな。
Programming Ecto by Darin Wilson @darinwilson and Eric Meadows-Jönsson @emjii
— PragmaticProgrammers (@pragprog) November 9, 2023
Languages come and go, but the relational db endures. Learn how to use Ecto, the premier database library for Elixir, to connect your Elixir and Phoenix apps to databases.https://t.co/uRDuo6wYXu
オライリー(の新刊情報)はもうよくわからん😓
Get our latest book, Data Science: The Hard Parts by @dvaughanc—The lessons in this book make the difference between an average data scientist candidate and a qualified data scientist working in the field. https://t.co/ogMS1kzC5n pic.twitter.com/n7t4mjujXh
— O'Reilly Media (@OReillyMedia) November 9, 2023
awk
gawk
gawkで整数から微妙にずれた浮動小数点数を配列添字にしたときの挙動 #AWK - Qiita
3.1.8で出力結果が違っていた件をちょっと追いかけてみた。
数値が整数(で表せるもの)かどうかのチェックは
node.cにあるので、まずはその修正履歴
gawk.git - gawk
を見たのだけど、関係ない部分の修正もたくさんあるので探すのが面倒タイヘンそうなので
ChangeLogから
ChageLog.0
Fri Jan 26 20:01:38 2007 Andrew J. Schorr
* node.c (format_val): Test whether a numeric value is integral
simply by converting it to long and then back again, and checking
if the value matches. That's more robust than trying to test
whether the floating-point value is representable as a long.
* builtin.c (format_tree): Fix buffer overflow bug, off-by-one errors
in checking snprintf return codes, and use "%.0f" to implement "%d"
formatting. For octal or hex formatting, test whether the value
is integral by trying to convert back to floating point and seeing
if the value matches. This is more robust than trying to test
whether the floating-point value is representable as an integer.
この辺が時期的にもアヤシイ。が修正がどういったものかはこれだけではわからない (まあ直接自分で問題の関数の差分をとればいいだけなんだけど)
ところで色々眺めていたら
2.15.6 buitln.c
#ifdef _CRAY
/* Work around a problem in conversion of doubles to exact integers. */
#include <float.h>
#define Floor(n) floor((n) * (1.0 + DBL_EPSILON))
#define Ceil(n) ceil((n) * (1.0 + DBL_EPSILON))
あー、クレイってなんか「クセ」があったとかきいてたよなあ ということを思い出させる条件コンパイルがあった。
んで
2.15.6
/* not an integral value, or out of range */
if ((val = double_to_int(s->numbr)) != s->numbr
|| val < LONG_MIN || val > LONG_MAX) {
と
5.3.0
if (out_of_range(s)) {
const char *result = format_nan_inf(s, 'g');
return make_string(result, strlen(result));
} else if ((val = double_to_int(s->numbr)) != s->numbr
|| val <= LONG_MIN || val >= LONG_MAX
) {
でポイントとなるところは変わっていない(ように見える)ので ここではないどこかの修正が影響してるってことですかね。 ただスクリプトの出力結果からすれば 意図的に今のようにしたんじゃないかと思うんだけど。
前述のChangeLogにあったものの日付とは違うんだけど
- o 2011-10-12 Add a test file, cleanup code and update doc.
- o 2011-10-12 Speed/memory performance improvements.
- o 2011-09-21 Make no mbs support work everywhere.
- x 2011-06-08 Sync dfa with GNU grep.
- x 2011-04-29 Remove VAXCRTL and GFMT_WORKAROUND. Yay!
- x 2011-04-27 Code cleanups in array.c and side effects in other files.
どうもこの辺の修正で動作が変わっているようなんだけど、 肝心かなめの修正差分が入ったコミットが見当たらなんだよねえ…
つづく?
ついでにほかのawk処理系での整数かどうかの判定をどう行っているかの紹介。
mawk
mawk/array.c:array_find
Int ival = d_to_I(d) ;
if ((double)ival == d) {
mawk1.9.6/cast.c: cast1_to_s(CELL* cp)
if (is_int_double(d)) {
#if LONG64
sprintf(buffer,"%ld", (int64_t) d) ;
#else
sprintf(buffer,"%lld", (int64_t) d) ;
#endif
cp->ptr = new_STRING(buffer) ;
}
else {
OTA
tra.c
#define update_str_val(vp) \
else if (modf(vp->fval, &dtemp) == 0) /* it's integral */ \
snprintf(s, sizeof (s), "%.30g", vp->fval); \
ところでOTAはちょっと動きがあった。 UTF-8対応で入り込んだバグがちょろちょろある模様。
- build assumes C compiler is gcc · Issue #176 · onetrueawk/awk
- Consolidate sub and gsub in dosub by mpinjr · Pull Request #209 · onetrueawk/awk
- Fix two incorrect test cases. by arnoldrobbins · Pull Request #210 · onetrueawk/awk
- Extraneous output when RS is a regex · Issue #212 · onetrueawk/awk
- fnematch: fix out-of-bounds access on EOF by millert · Pull Request #211 · onetrueawk/awk
- Fix fnematch utf8 support by mpinjr · Pull Request #214 · onetrueawk/awk
- Fix fnematch. by arnoldrobbins · Pull Request #213 · onetrueawk/awk
FORTRAN Compiler on IBM 704
under 512
x86 のブートセクタ(512バイト)に収まる,世界最小(自称)の C コンパイラ.C のサブセットながらそれなりのコードが書ける機能を備えてる.「構文定義より小さい」という謎のアピールポイント | 'xorvoid/sectorc' https://t.co/tPoa7errHW
— ドッグ (@Linda_pp) November 9, 2023
xorvoid/sectorc: A C Compiler that fits in the 512 byte boot sector of an x86 machine
What is this useful for?
Probably Nothing.
😄
x86 のブートセクタに収まる処理系シリーズ
— ドッグ (@Linda_pp) November 9, 2023
- Forth: https://t.co/tGdkCeeOrh
- Lisp: https://t.co/EZKNj3WrkD
Lisp は Cosmopolitan の作者だった
そう言えばこのLispのソースコード読みも途中で止まってる(512バイト以下なのに)な😓
MANDEL command
そんなコマンドがこれにはあったのか😄
Very early versions of BBC BASIC for the Acorn Archimedes included the MANDEL command to help with Mandelbrot set calculations. Here's a demo of it in action on a 33MHz ARM3 processor - 256 colour video mode. This hardware was available in 1993 ( A5000A ). pic.twitter.com/pMVIaYkwOc
— Kevin Edwards ( Retro Videogame development ) (@KevEdwardsRetro) November 17, 2023
Here's the same code running on an early Acorn Archimedes with an 8MHz ARM2 CPU. It also uses an 8 colour mode. Typical Acorn hardware for 1987. pic.twitter.com/tHa3Xs6n2N
— Kevin Edwards ( Retro Videogame development ) (@KevEdwardsRetro) November 17, 2023
プラモデルのパーツを飛ばして探しまくって、
— やまだたかひろ (@YamadaxTakahiro) October 11, 2023
後に発見された個人的事例トップ3
①胸ポケットの中から
②ズボンの裾の折り返しの中から
③頭髪の中から(洗髪中に発見)
ご参考になりましたら嬉しいです(笑) https://t.co/aXfUl08UNt
汎用のプログラミング言語が組み込んであり、セルの値は式として評価され、値と表示形式が分離していてUIは全部キーボードで操作できるタイプの表計算ソフトウェア(欲しい)
— ((🐑#)) (@Sheeeeepla) October 13, 2023
ジェラルド・R・フォードは世界初の『リニアカタパルト』で艦載機を打ち出す空母。
— MASA(航空宇宙・軍事) (@masa_0083) October 13, 2023
あのトップガンのようなモクモクした景色は見れません。 https://t.co/v9egO49AGW
燃えろよ燃えろ〜よ〜
— 𝙉𝙋𝙊𝙎 (@npostring) November 10, 2023
脂肪よ燃えろ〜