diff options
158 files changed, 9403 insertions, 11299 deletions
diff --git a/vhosts/blog/.editorconfig b/vhosts/blog/.editorconfig index f6e2ae3e..a036f907 100644 --- a/vhosts/blog/.editorconfig +++ b/vhosts/blog/.editorconfig @@ -5,6 +5,6 @@ charset = utf-8 end_of_line = lf insert_final_newline = true -[*.ndoc] +[*.dj] indent_style = space indent_size = 2 diff --git a/vhosts/blog/content/posts/2021-03-05/my-first-post.dj b/vhosts/blog/content/posts/2021-03-05/my-first-post.dj new file mode 100644 index 00000000..a84dbd93 --- /dev/null +++ b/vhosts/blog/content/posts/2021-03-05/my-first-post.dj @@ -0,0 +1,21 @@ +--- +[article] +uuid = "6e9c71fd-bc8d-43ce-99c5-13d9f5b87ed2" +title = "My First Post" +description = "ããã¯ãã¹ãæçš¿ã§ããããã¯ãã¹ãæçš¿ã§ããããã¯ãã¹ãæçš¿ã§ãã" +tags = [] + +[[article.revisions]] +date = "2021-03-05" +remark = "å
¬é" +--- +{#test} +# Test + +Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod +tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim +veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea +commodo consequat. Duis aute irure dolor in reprehenderit in voluptate +velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint +occaecat cupidatat non proident, sunt in culpa qui officia deserunt +mollit anim id est laborum. diff --git a/vhosts/blog/content/posts/2021-03-05/my-first-post.ndoc b/vhosts/blog/content/posts/2021-03-05/my-first-post.ndoc deleted file mode 100644 index ee23da14..00000000 --- a/vhosts/blog/content/posts/2021-03-05/my-first-post.ndoc +++ /dev/null @@ -1,25 +0,0 @@ ---- -[article] -uuid = "6e9c71fd-bc8d-43ce-99c5-13d9f5b87ed2" -title = "My First Post" -description = "ããã¯ãã¹ãæçš¿ã§ããããã¯ãã¹ãæçš¿ã§ããããã¯ãã¹ãæçš¿ã§ãã" -tags = [] - -[[article.revisions]] -date = "2021-03-05" -remark = "å
¬é" ---- -<article> - <section id="test"> - <h>Test</h> - <p> - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod - tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim - veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea - commodo consequat. Duis aute irure dolor in reprehenderit in voluptate - velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint - occaecat cupidatat non proident, sunt in culpa qui officia deserunt - mollit anim id est laborum. - </p> - </section> -</article> diff --git a/vhosts/blog/content/posts/2021-03-30/phperkaigi-2021.dj b/vhosts/blog/content/posts/2021-03-30/phperkaigi-2021.dj new file mode 100644 index 00000000..fac9f1ed --- /dev/null +++ b/vhosts/blog/content/posts/2021-03-30/phperkaigi-2021.dj @@ -0,0 +1,177 @@ +--- +[article] +uuid = "3fbe0b8c-216e-48f6-b905-c0d361b94542" +title = "PHPerKaigi 2021" +description = "2021-03-26 ãã 2021-03-28 ã«ãããŠéå¬ããããPHPerKaigi 2021 ã«åå ããã" +tags = [ + "conference", + "php", + "phperkaigi", +] + +[[article.revisions]] +date = "2021-03-30" +remark = "å
¬é" + +[[article.revisions]] +date = "2025-04-09" +remark = "ããããã®çºè¡šã«é¢ããã¡ã¢éšåãåé€ããææ³ã®ã¿ã«" +--- +{#report} +# PHPerKaigi 2021 åå ã¬ã + +2021-03-26 ãã 2021-03-28 +ã«ãããŠéå¬ãããã[PHPerKaigi 2021](https://phperkaigi.jp/2021/) +ã«äžè¬åå è
ãšããŠåå ããã +åŒç€Ÿ[ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ](https://www.dgcircus.com/) +(ä»å¹Ž1æããå€å) +ã¯ãã€ã€ã¢ã³ãã¹ãã³ãµãŒãšãªã£ãŠãããã¹ãã³ãµãŒæ ã®ãã±ããã䜿ãããŠããã ããã + +ãã®ãããªã«ã³ãã¡ã¬ã³ã¹ã«ã¯åããŠåå ããã®ã§ãããŠããå¿åŸ
ã¡ã«ããŠããã®ã ããçæ2æ¥ç®ããäœèª¿ã厩ããŠããŸãããã®èšäºãéäžãŸã§ãšãªã£ãŠããããŸã èŠãŠããªãã»ãã·ã§ã³ãå€ãããã²ãšãŸãçŸæç¹ã§ã®åå ã¬ããæžããŠããã + +çºè¡šã¯ãã©ã㯠AãB ã«åãããŠããã®ã ããä»åã¯ãã¹ãŠ A +ãã©ãã¯ãèŠèŽããŠãã (åãæ¿ããã®ãé¢åã ã£ãã ã)ã + +{#day-0} +## Day 0 åå€ç¥ (2021/03/27) + +{#1730-a} +### 17:30 [A] LAMPããããããŠãµãŒããŒã¬ã¹ã«ä¹ãé
ããPHPerãLambdaã«å
¥éããŠã¿ã + +AWS Lambda ã®ãã㪠Function as a Service +ã¯ãã€ã¯ããµãŒãã¹åã«ãããäžã€ã®å°éç¹ã«æããã®ã ããããã䜿ã£ãŠå®éã« +web ãµãŒãã¹ãäœãå
·äœçãªã€ã¡ãŒãžããŸã èŠããªã (泚: ãã¹ãŠ for me +ãšããŠæžããŠãã)ã + +PHP on AWS Lambda ãããã ãç°¡åã«åãããã®ã«ã¯é©ããã + +åæã« AWS Lambda ã ãšãããããªã³ãã®è»œããæ±ããããã (= PHP + +Laravel ãªã©ã§ã¯åããªããã) +ã ãšããå
å
¥èгãæã£ãŠããã®ã ãããã®çºè¡šã®ãã¢ã«ããã°ããã§ããªããããã + +{#1810-a} +### 18:10 [A] å€§èŠæš¡ãµã€ãã«ãããSEO芳ç¹ã§ã®URLèšèš + +SEO (Search Engine Optimization) +ã¯å€§ããŠç¥ããªãã®ã§æ°é®®ãªè©±ãå€ãã£ãããã®åèªããããšãå°ãªãâŠâŠã + +{#1850-a} +### 18:50 [A] PHPerã§ããããïŒå®è·µWebã¢ã¯ã»ã·ããªã㣠+ +ã€ãæè¿ WAI-ARIA +ã«ã€ããŠã®èšäºãèªãã ã°ããã ã£ãã®ã§å人çã«ã¿ã€ã ãªãŒãªè©±é¡ã ã£ãã(ããŸããã®èšèã䜿ããããªãã®ã ã) +ãããããå¥åžžè
ãã«ãšã£ãŠãããããåé¡ãæ®æ®µã®ç掻ã®äžã§æèããã®ã¯é£ãããã ããããæ
å ±ãžã®ã¢ã³ããã¯åŒµã£ãŠããããã«ãããã + +{#1930-a} +### 19:30 [A] PHP ã§ãã¡ã€ã«ã·ã¹ãã ãäœãã + +PHP ã§ FUSE + +å人çã«æ¥œãã¿ã ã£ãçºè¡šã + +æåŸ
éãã®è峿·±ãçºè¡šã ã£ããFUSE +èªäœãä»åã®çºè¡šã§ç¥ã£ãã®ã ããããæ¬äœã®å®è£
ãèŠãã®ãé¢çœããã ã +ãã®çºè¡šãèããªãããã¡ã€ã«ã·ã¹ãã ã«ããŠã³ãã§ããããªãã®ãèããŠããã®ã ãããããæšæ§é ãããŠãããã®ãã¹ãŠãšèšãããã +(ãã³ããŒããæã£ãŠããªããšäºã
)ãäœãã§ãããã ããªããªãæãã€ããªãã + +{#day-1} +## Day 1 (2021/03/27) + +{#1050-a} +### 10:50 [A] å®è·µATDD ãTDDããæŽã«æ©ã¿ãé²ãããœãããŠã§ã¢éçºãžã + +User Acceptance Test (UAT) +ãããã®èŠæš¡ã«ãªããšå人éçºã»è¶£å³éçºã§ã¯è§Šããªãé åãªã®ã§ã倧ãã«å匷ã«ãªã£ããã¹ã©ã€ãã«æ·»ä»ãããŠããè³æãçžåœã«å
å®ããŠããã®ã§ããããèªãã®ãæ¬çªãšãã£ãæ§çžããæããã +é«ã¬ãã«ãã¹ãã®èªååã¯çŸåšã®ãããžã§ã¯ãã§ãæããŠãããèªååã®ãã£ã³ã¹ã¯äŒºã£ãŠããããšã¯ããã»ãã·ã§ã³ã§ãææãããŠããããã«èªååããããšã«ã³ã¹ããããããããé åãããã®ãäºå®ã§ããã®ãã©ã³ã¹ãé£ããã + +{#1150-a} +### 11:50 [A] éçåè§£æãçšããå€§èŠæš¡ã¬ã¬ã·ãŒã³ãŒãã®ãªãã¡ã¯ã¿ãªã³ã°èšç» + +åã®ããäžçã§çããŠãã身ãšããŠå€§ãã«æ¥œãã¿ã«ããŠããçºè¡šã + +æšä»ãåçåä»ãèšèªã§ã®å宣èšã»åã¢ãããŒã·ã§ã³ã»åãã³ãã®å°å
¥ãçžæ¬¡ãã§ãããé·ããéçåä»ãèšèªãæžããŠããç§ãããããšãããããæ°ã¥ããããšãã£ããšããã ãããšãããåãå°å
¥ããèšèªãå¢ããŠããã +ä»ã®ãããžã§ã¯ãã§ãæ°ãã远å ããã³ãŒãã«ã¯åãã€ããããåªããŠããããã©ãããŠãå€ãã³ãŒãã«ã¯åãã€ããŠããªããå人çã«ã¯åã®ãªãã³ãŒãã«å¯ŸããŠã©ãåãèªåçã«ä»ããããšããç¹ã«èå³ãããããã®ç¹ã§ +Ruby ã® typeprof ã«ã¯æ³šç®ããŠããã + +{#1310-a} +### 13:10 [A] ç®çã«æ²¿ã£ãDocumentation as Codeãããã«ããŠå®çŸããŠããã + +ãã®çºè¡šã以åããéåžžã«æ¥œãã¿ã«ããŠããã + +ããã¥ã¡ã³ãã®ç®¡çã¯çŸãããžã§ã¯ãã§ã課é¡ãšæããŠãããäœãããåœåã¯æ£ãããŠãã宿
ãšä¹é¢ããŠããã®ãæ¢ããã®ã¯å°é£ã極ãããå
šäœçã«è峿·±ãçºè¡šã ã£ãããç¹ã«ã¹ã¿ãã¯ãã¬ãŒã¹ããã®ããã¥ã¡ã³ãçæãšããã¢ã€ãã¢ã«æ¹ããããã®ãæãããã¹ã¿ãã¯ãã¬ãŒã¹ãšãã宿
ãšäžå¯å㪠+(ä¹é¢ããªã) +æ
å ±ãèµ·ç¹ã«ããã®ã¯çã«ããªã£ãŠãããåé¡ã¯ãã¬ãŒã¹ããã€ãã©ãåããã ãããããããèªååããªããã°ã宿
ãšã®ä¹é¢ãé¿ããããªãã ããã + +{#1410-a} +### 14:10 [A] PHPã§åŠã¶ãã»ãã·ã§ã³ã®åºæ¬ãšå¿çš + +å
šäœçã«åºæ¬çãªè©±ã ã£ãã®ã§ç¹ã«è§ŠããªããCookie +ãã»ãã·ã§ã³ã®è©±ãšããŠã¯éåžžã«åããããããŸãšããããŠããã®ã§ãç¥ããªã人ãåŠã¶ã«ã¯ããææã ããã + +{#1450-a} +### 14:50 [A] PHP8ã«ãªã£ãä»ã®æä»£ã«ãPHPã®ããšã©ãŒããäŸå€ããããŠãErrorããããããããŠããã + +PHP ãåŠãã§ããéäžã®ç§ãšããŠã¯ãä»ãŸãã«èãããçºè¡šã ã£ã (çŸæç¹ã§ +PHP ãæžãå§ããŠãã 4ã¶æã»ã©ã«ãªã)ã + +å人çã«äŸå€ããšã©ãŒãæãããŸãæ±ã£ãŠããã®ã¯ GoãSwiftãRustãHaskell +ãªã©ã®ãšã©ãŒããå€ãšããŠãæ±ãèšèªã ãšæã£ãŠãããtry-catch +ã¯éåžžã®åŠçãããŒãå®å
šã«å£ããŠããŸãäžãæ§æãšããŠãéããããå€ãšããŠã®ãšã©ãŒéç¥ã¯ +Cèšèªæä»£ãžã®ååž°ãšãããããããã®é ãšç°ãªãã®ã¯ãšã©ãŒãæé»ã®ãã¡ã«æ¡ã朰ãããšããªããšããããšã ããããã®èšèªã¯åãæã£ãŠãããéçã«æ€èšŒãã§ãã +(C ã®ããã¯ãŸãšããªåä»ãã§ã¯ãªãã念ã®ãã)ã + +PHP +ã®ããã«ããã§ã«äŸå€ãèšèªã·ã¹ãã ã«æ ¹ãããŠããèšèªã§ã¯ã©ãããã°ãããããã®å Žåãåããéçæ€èšŒã®åãåããããšã«ãªãã ããã + +{#1530-a} +### 15:30 [A] Laravel ã®ã¡ãŒã«èªèšŒã®å
éšå®è£
ãæãäžãã + +Laravel +ã®ç¥èããªãç§ã«ã¯ãŸã£ããã€ããŠãããªãã£ãããŸããå人çã«ã¿ã€ãã«ããããã¹ãªãŒãã£ã³ã°ã«æããã + +{#1610-a} +### 16:10 [A] ãã©ãŠã¶ããå§ããgRPC ã gRPC-Webã«PHPãæ·»ã㊠+ +(çºè¡šã®äžã§ããŸãã«åãããšããã£ããã£ãŠããã) PHP +以å€ã®æ¹ãåããŠããã ããããšããã®ã第äžã®ææ³ã§ãããgRPC +ã¯ããèªäœãšããããã Protobuf +ãšãããšã³ã·ã¹ãã ã«ä¹ããããšã®ã¡ãªããã倧ãããšæããããã®ãšã³ã·ã¹ãã ã«ããŸãä¹ããªãæç¹ã§ãããŒããšããæãã + +{#day-2} +## Day 2 (2021/03/28) + +åé ã«æžããéãã2æ¥ç®ããäœèª¿ãæªããŸãšãã«èŽããŠããªããéäžãŸã§ã¯é çãææ
¢ãã€ã€èŠãŠããã®ã ãããŸãšãã«å
¥ã£ãŠããªãã£ãã + +æ®å¿µã§ã¯ãããããããã«ããèŠãããŠããªãçºè¡šã¯ä»ã«ãããã®ã§ãä»é±æ«ã«ã§ããŸãšããŠèŠãããšæãã + +{#comments} +## å
šäœã®ææ³ + +Day 2 +ã«ã»ãšãã©åå ã§ããªãã£ãã®ã¯æ®å¿µã ããã€ãã³ãèªäœã¯å€§å€æ¥œããããŸãè峿·±ããã®ã§ãã£ããèªåããŸã£ããç¥ããªãé åã®è©±ãèããã®ã¯ããããã€ãã³ããªãã§ã¯ã ãšæããããªã³ã©ã€ã³éå¬ããçŸå°ã«è¡ãå¿
èŠããªããæ°è»œã«åå ã§ããã®ã +(ç¹ã«ååå è
ãšããŠ) å¬ãããã€ã³ãã ã£ãã + +ä»åãéè«/ç»å£è
ãžã®è³ªåçåãã« Discord +ãµãŒãããã£ãã®ã ãããã¡ãã¯åå ãããããã®ã® ROM +ã®ãŸãŸã«ãªã£ãŠããŸã£ããçºè¡šã«1ãŠã£ã³ããŠãã¡ã¢ãæžãã®ã«1ãŠã£ã³ããŠãDiscord +衚瀺㫠+1ãŠã£ã³ããŠã§ç§ã«ã¯ããè³ã®ãªãœãŒã¹ãšãã£ã¹ãã¬ã€ã®ã¹ããŒã¹ã远ãã€ããªãã£ã +(ããã«ãããš Zoom +ã§ã¢ã³ã«ã³ãã¡ã¬ã³ã¹ããã£ãŠããããã ããã¡ãã¯ãŸã£ããåå ããŠããªã)ã + +1ã€å人çãªåçç¹ãšããŠã¯ãäžã€äžã€ã®ã»ãã·ã§ã³ãçå£ã«èãéãããšãããã®ãããããã£ãšé©åœã«èããŠããã°ããã£ããããã ãã ãšå€§å€èªåŒãããã®ã ããèšãæ¹ãå€ãããšãDiscord +ãããã¢ã³ã«ã³ãã¡ã¬ã³ã¹ãããããã®ã€ãã³ãã®ãã®ç¬éã«ãããªãã³ã³ãã³ããã«è§Šããã«ãåŸããèŠè¿ããçºè¡šãã¹ã©ã€ãã«æ³šåããŠããŸã£ãããšããããšã ãçºè¡šã®è©³çްãªèŠçŽãã¯ããšããã§ããã®ã ãããä»ããã§ããªãããšãèããã¹ãã ã£ãã +ãŸãåã«ã³ãã¡ã¬ã³ã¹ã ãããšãè¶ãæ¿ããŠãããã + +ããŠãã«ã³ãã¡ã¬ã³ã¹ã§äžã€æ°ã«ãªã£ãããšããããããã¯ãDiscord +ãšããæžã蟌ã¿å Žæãå¢ããããšã§ãã³çã®ã³ã¡ã³ãã®æµéãåžãåãããŠããŸã£ãã®ã§ã¯ãªããããšããç¹ã ããã³ãã³ã ãèŠãŠãããšéçã£ãŠãããã®ããã«èŠããçºè¡šããDiscord +ã®æ¹ã§ã¯çãäžãã£ãŠããããšããã®ãäœåºŠãèŠãããããã³ãã³ã®ã³ã¡ã³ãæ¹åŒã¯çãäžãããåŠå®ã«åæ ããããéããŸãããããDiscord +ããã£ãããšèªäœã¯ãã©ã¹ã ã£ããšæããããã®ç¹ã¯ãã€ãã¹ã ã£ãã®ã§ã¯ãªãããšæããã + +---------------- + +æåŸã«ãªããŸããããæ¯å¹Žã® PHPerKaigi +éå¬ã«ãå°œåãããŠããçæ§ãã¹ããŒã«ãŒã®çæ§ã楜ãã3æ¥éã§ãããããããšãããããŸããïŒ +(ãã£ãšåžžäœã§æžããŠããŸã£ãã®ã§ãããªãä»é é¢ããç¬é¡ã«ãªã£ãããã§æ°æã¡æªã) + +ã§ã¯ãŸãæ¥å¹Žã diff --git a/vhosts/blog/content/posts/2021-03-30/phperkaigi-2021.ndoc b/vhosts/blog/content/posts/2021-03-30/phperkaigi-2021.ndoc deleted file mode 100644 index b9a1f67e..00000000 --- a/vhosts/blog/content/posts/2021-03-30/phperkaigi-2021.ndoc +++ /dev/null @@ -1,209 +0,0 @@ ---- -[article] -uuid = "3fbe0b8c-216e-48f6-b905-c0d361b94542" -title = "PHPerKaigi 2021" -description = "2021-03-26 ãã 2021-03-28 ã«ãããŠéå¬ããããPHPerKaigi 2021 ã«åå ããã" -tags = [ - "conference", - "php", - "phperkaigi", -] - -[[article.revisions]] -date = "2021-03-30" -remark = "å
¬é" - -[[article.revisions]] -date = "2025-04-09" -remark = "ããããã®çºè¡šã«é¢ããã¡ã¢éšåãåé€ããææ³ã®ã¿ã«" ---- -<article> - <section id="report"> - <h>PHPerKaigi 2021 åå ã¬ã</h> - <p> - 2021-03-26 ãã 2021-03-28 - ã«ãããŠéå¬ãããã <a href="https://phperkaigi.jp/2021/">PHPerKaigi 2021</a> - ã«äžè¬åå è
ãšããŠåå ããã - åŒç€Ÿ <a href="https://www.dgcircus.com/">ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ</a> - (ä»å¹Ž1æããå€å) - ã¯ãã€ã€ã¢ã³ãã¹ãã³ãµãŒãšãªã£ãŠãããã¹ãã³ãµãŒæ ã®ãã±ããã䜿ãããŠããã ããã - </p> - <p> - ãã®ãããªã«ã³ãã¡ã¬ã³ã¹ã«ã¯åããŠåå ããã®ã§ãããŠããå¿åŸ
ã¡ã«ããŠããã®ã ããçæ2æ¥ç®ããäœèª¿ã厩ããŠããŸãããã®èšäºãéäžãŸã§ãšãªã£ãŠããããŸã èŠãŠããªãã»ãã·ã§ã³ãå€ãããã²ãšãŸãçŸæç¹ã§ã®åå ã¬ããæžããŠããã - </p> - <p> - çºè¡šã¯ãã©ã㯠AãB ã«åãããŠããã®ã ããä»åã¯ãã¹ãŠ A - ãã©ãã¯ãèŠèŽããŠãã (åãæ¿ããã®ãé¢åã ã£ãã ã)ã - </p> - <section id="day-0"> - <h>Day 0 åå€ç¥ (2021/03/27)</h> - <section id="1730-a"> - <h>17:30 [A] LAMPããããããŠãµãŒããŒã¬ã¹ã«ä¹ãé
ããPHPerãLambdaã«å
¥éããŠã¿ã</h> - <p> - AWS Lambda ã®ãã㪠Function as a Service - ã¯ãã€ã¯ããµãŒãã¹åã«ãããäžã€ã®å°éç¹ã«æããã®ã ããããã䜿ã£ãŠå®éã« - web ãµãŒãã¹ãäœãå
·äœçãªã€ã¡ãŒãžããŸã èŠããªã (泚: ãã¹ãŠ for me - ãšããŠæžããŠãã)ã - </p> - <p> - PHP on AWS Lambda ãããã ãç°¡åã«åãããã®ã«ã¯é©ããã - </p> - <p> - åæã« AWS Lambda ã ãšãããããªã³ãã®è»œããæ±ããããã (= PHP + - Laravel ãªã©ã§ã¯åããªããã) - ã ãšããå
å
¥èгãæã£ãŠããã®ã ãããã®çºè¡šã®ãã¢ã«ããã°ããã§ããªããããã - </p> - </section> - <section id="1810-a"> - <h>18:10 [A] å€§èŠæš¡ãµã€ãã«ãããSEO芳ç¹ã§ã®URLèšèš</h> - <p> - SEO (Search Engine Optimization) - ã¯å€§ããŠç¥ããªãã®ã§æ°é®®ãªè©±ãå€ãã£ãããã®åèªããããšãå°ãªãâŠâŠã - </p> - </section> - <section id="1850-a"> - <h>18:50 [A] PHPerã§ããããïŒå®è·µWebã¢ã¯ã»ã·ããªãã£</h> - <p> - ã€ãæè¿ WAI-ARIA - ã«ã€ããŠã®èšäºãèªãã ã°ããã ã£ãã®ã§å人çã«ã¿ã€ã ãªãŒãªè©±é¡ã ã£ãã(ããŸããã®èšèã䜿ããããªãã®ã ã) - ãããããå¥åžžè
ãã«ãšã£ãŠãããããåé¡ãæ®æ®µã®ç掻ã®äžã§æèããã®ã¯é£ãããã ããããæ
å ±ãžã®ã¢ã³ããã¯åŒµã£ãŠããããã«ãããã - </p> - </section> - <section id="1930-a"> - <h>19:30 [A] PHP ã§ãã¡ã€ã«ã·ã¹ãã ãäœãã</h> - <p> - PHP ã§ FUSE - </p> - <p> - å人çã«æ¥œãã¿ã ã£ãçºè¡šã - </p> - <p> - æåŸ
éãã®è峿·±ãçºè¡šã ã£ããFUSE - èªäœãä»åã®çºè¡šã§ç¥ã£ãã®ã ããããæ¬äœã®å®è£
ãèŠãã®ãé¢çœããã ã - ãã®çºè¡šãèããªãããã¡ã€ã«ã·ã¹ãã ã«ããŠã³ãã§ããããªãã®ãèããŠããã®ã ãããããæšæ§é ãããŠãããã®ãã¹ãŠãšèšãããã - (ãã³ããŒããæã£ãŠããªããšäºã
)ãäœãã§ãããã ããªããªãæãã€ããªãã - </p> - </section> - </section> - <section id="day-1"> - <h>Day 1 (2021/03/27)</h> - <section id="1050-a"> - <h>10:50 [A] å®è·µATDD ãTDDããæŽã«æ©ã¿ãé²ãããœãããŠã§ã¢éçºãžã</h> - <p> - User Acceptance Test (UAT) - ãããã®èŠæš¡ã«ãªããšå人éçºã»è¶£å³éçºã§ã¯è§Šããªãé åãªã®ã§ã倧ãã«å匷ã«ãªã£ããã¹ã©ã€ãã«æ·»ä»ãããŠããè³æãçžåœã«å
å®ããŠããã®ã§ããããèªãã®ãæ¬çªãšãã£ãæ§çžããæããã - é«ã¬ãã«ãã¹ãã®èªååã¯çŸåšã®ãããžã§ã¯ãã§ãæããŠãããèªååã®ãã£ã³ã¹ã¯äŒºã£ãŠããããšã¯ããã»ãã·ã§ã³ã§ãææãããŠããããã«èªååããããšã«ã³ã¹ããããããããé åãããã®ãäºå®ã§ããã®ãã©ã³ã¹ãé£ããã - </p> - </section> - <section id="1150-a"> - <h>11:50 [A] éçåè§£æãçšããå€§èŠæš¡ã¬ã¬ã·ãŒã³ãŒãã®ãªãã¡ã¯ã¿ãªã³ã°èšç»</h> - <p> - åã®ããäžçã§çããŠãã身ãšããŠå€§ãã«æ¥œãã¿ã«ããŠããçºè¡šã - </p> - <p> - æšä»ãåçåä»ãèšèªã§ã®å宣èšã»åã¢ãããŒã·ã§ã³ã»åãã³ãã®å°å
¥ãçžæ¬¡ãã§ãããé·ããéçåä»ãèšèªãæžããŠããç§ãããããšãããããæ°ã¥ããããšãã£ããšããã ãããšãããåãå°å
¥ããèšèªãå¢ããŠããã - ä»ã®ãããžã§ã¯ãã§ãæ°ãã远å ããã³ãŒãã«ã¯åãã€ããããåªããŠããããã©ãããŠãå€ãã³ãŒãã«ã¯åãã€ããŠããªããå人çã«ã¯åã®ãªãã³ãŒãã«å¯ŸããŠã©ãåãèªåçã«ä»ããããšããç¹ã«èå³ãããããã®ç¹ã§ - Ruby ã® typeprof ã«ã¯æ³šç®ããŠããã - </p> - </section> - <section id="1310-a"> - <h>13:10 [A] ç®çã«æ²¿ã£ãDocumentation as Codeãããã«ããŠå®çŸããŠããã</h> - <p> - ãã®çºè¡šã以åããéåžžã«æ¥œãã¿ã«ããŠããã - </p> - <p> - ããã¥ã¡ã³ãã®ç®¡çã¯çŸãããžã§ã¯ãã§ã課é¡ãšæããŠãããäœãããåœåã¯æ£ãããŠãã宿
ãšä¹é¢ããŠããã®ãæ¢ããã®ã¯å°é£ã極ãããå
šäœçã«è峿·±ãçºè¡šã ã£ãããç¹ã«ã¹ã¿ãã¯ãã¬ãŒã¹ããã®ããã¥ã¡ã³ãçæãšããã¢ã€ãã¢ã«æ¹ããããã®ãæãããã¹ã¿ãã¯ãã¬ãŒã¹ãšãã宿
ãšäžå¯å㪠- (ä¹é¢ããªã) - æ
å ±ãèµ·ç¹ã«ããã®ã¯çã«ããªã£ãŠãããåé¡ã¯ãã¬ãŒã¹ããã€ãã©ãåããã ãããããããèªååããªããã°ã宿
ãšã®ä¹é¢ãé¿ããããªãã ããã - </p> - </section> - <section id="1410-a"> - <h>14:10 [A] PHPã§åŠã¶ãã»ãã·ã§ã³ã®åºæ¬ãšå¿çš</h> - <p> - å
šäœçã«åºæ¬çãªè©±ã ã£ãã®ã§ç¹ã«è§ŠããªããCookie - ãã»ãã·ã§ã³ã®è©±ãšããŠã¯éåžžã«åããããããŸãšããããŠããã®ã§ãç¥ããªã人ãåŠã¶ã«ã¯ããææã ããã - </p> - </section> - <section id="1450-a"> - <h>14:50 [A] PHP8ã«ãªã£ãä»ã®æä»£ã«ãPHPã®ããšã©ãŒããäŸå€ããããŠãErrorããããããããŠããã</h> - <p> - PHP ãåŠãã§ããéäžã®ç§ãšããŠã¯ãä»ãŸãã«èãããçºè¡šã ã£ã (çŸæç¹ã§ - PHP ãæžãå§ããŠãã 4ã¶æã»ã©ã«ãªã)ã - </p> - <p> - å人çã«äŸå€ããšã©ãŒãæãããŸãæ±ã£ãŠããã®ã¯ GoãSwiftãRustãHaskell - ãªã©ã®ãšã©ãŒããå€ãšããŠãæ±ãèšèªã ãšæã£ãŠãããtry-catch - ã¯éåžžã®åŠçãããŒãå®å
šã«å£ããŠããŸãäžãæ§æãšããŠãéããããå€ãšããŠã®ãšã©ãŒéç¥ã¯ - Cèšèªæä»£ãžã®ååž°ãšãããããããã®é ãšç°ãªãã®ã¯ãšã©ãŒãæé»ã®ãã¡ã«æ¡ã朰ãããšããªããšããããšã ããããã®èšèªã¯åãæã£ãŠãããéçã«æ€èšŒãã§ãã - (C ã®ããã¯ãŸãšããªåä»ãã§ã¯ãªãã念ã®ãã)ã - </p> - <p> - PHP - ã®ããã«ããã§ã«äŸå€ãèšèªã·ã¹ãã ã«æ ¹ãããŠããèšèªã§ã¯ã©ãããã°ãããããã®å Žåãåããéçæ€èšŒã®åãåããããšã«ãªãã ããã - </p> - </section> - <section id="1530-a"> - <h>15:30 [A] Laravel ã®ã¡ãŒã«èªèšŒã®å
éšå®è£
ãæãäžãã</h> - <p> - Laravel - ã®ç¥èããªãç§ã«ã¯ãŸã£ããã€ããŠãããªãã£ãããŸããå人çã«ã¿ã€ãã«ããããã¹ãªãŒãã£ã³ã°ã«æããã - </p> - </section> - <section id="1610-a"> - <h>16:10 [A] ãã©ãŠã¶ããå§ããgRPC ã gRPC-Webã«PHPãæ·»ããŠ</h> - <p> - (çºè¡šã®äžã§ããŸãã«åãããšããã£ããã£ãŠããã) PHP - 以å€ã®æ¹ãåããŠããã ããããšããã®ã第äžã®ææ³ã§ãããgRPC - ã¯ããèªäœãšããããã Protobuf - ãšãããšã³ã·ã¹ãã ã«ä¹ããããšã®ã¡ãªããã倧ãããšæããããã®ãšã³ã·ã¹ãã ã«ããŸãä¹ããªãæç¹ã§ãããŒããšããæãã - </p> - </section> - </section> - <section id="day-2"> - <h>Day 2 (2021/03/28)</h> - <p> - åé ã«æžããéãã2æ¥ç®ããäœèª¿ãæªããŸãšãã«èŽããŠããªããéäžãŸã§ã¯é çãææ
¢ãã€ã€èŠãŠããã®ã ãããŸãšãã«å
¥ã£ãŠããªãã£ãã - </p> - <p> - æ®å¿µã§ã¯ãããããããã«ããèŠãããŠããªãçºè¡šã¯ä»ã«ãããã®ã§ãä»é±æ«ã«ã§ããŸãšããŠèŠãããšæãã - </p> - </section> - <section id="comments"> - <h>å
šäœã®ææ³</h> - <p> - Day 2 - ã«ã»ãšãã©åå ã§ããªãã£ãã®ã¯æ®å¿µã ããã€ãã³ãèªäœã¯å€§å€æ¥œããããŸãè峿·±ããã®ã§ãã£ããèªåããŸã£ããç¥ããªãé åã®è©±ãèããã®ã¯ããããã€ãã³ããªãã§ã¯ã ãšæããããªã³ã©ã€ã³éå¬ããçŸå°ã«è¡ãå¿
èŠããªããæ°è»œã«åå ã§ããã®ã - (ç¹ã«ååå è
ãšããŠ) å¬ãããã€ã³ãã ã£ãã - </p> - <p> - ä»åãéè«/ç»å£è
ãžã®è³ªåçåãã« Discord - ãµãŒãããã£ãã®ã ãããã¡ãã¯åå ãããããã®ã® ROM - ã®ãŸãŸã«ãªã£ãŠããŸã£ããçºè¡šã«1ãŠã£ã³ããŠãã¡ã¢ãæžãã®ã«1ãŠã£ã³ããŠãDiscord - 衚瀺㫠- 1ãŠã£ã³ããŠã§ç§ã«ã¯ããè³ã®ãªãœãŒã¹ãšãã£ã¹ãã¬ã€ã®ã¹ããŒã¹ã远ãã€ããªãã£ã - (ããã«ãããš Zoom - ã§ã¢ã³ã«ã³ãã¡ã¬ã³ã¹ããã£ãŠããããã ããã¡ãã¯ãŸã£ããåå ããŠããªã)ã - </p> - <p> - 1ã€å人çãªåçç¹ãšããŠã¯ãäžã€äžã€ã®ã»ãã·ã§ã³ãçå£ã«èãéãããšãããã®ãããããã£ãšé©åœã«èããŠããã°ããã£ããããã ãã ãšå€§å€èªåŒãããã®ã ããèšãæ¹ãå€ãããšãDiscord - ãããã¢ã³ã«ã³ãã¡ã¬ã³ã¹ãããããã®ã€ãã³ãã®ãã®ç¬éã«ãããªãã³ã³ãã³ããã«è§Šããã«ãåŸããèŠè¿ããçºè¡šãã¹ã©ã€ãã«æ³šåããŠããŸã£ãããšããããšã ãçºè¡šã®è©³çްãªèŠçŽãã¯ããšããã§ããã®ã ãããä»ããã§ããªãããšãèããã¹ãã ã£ãã - ãŸãåã«ã³ãã¡ã¬ã³ã¹ã ãããšãè¶ãæ¿ããŠãããã - </p> - <p> - ããŠãã«ã³ãã¡ã¬ã³ã¹ã§äžã€æ°ã«ãªã£ãããšããããããã¯ãDiscord - ãšããæžã蟌ã¿å Žæãå¢ããããšã§ãã³çã®ã³ã¡ã³ãã®æµéãåžãåãããŠããŸã£ãã®ã§ã¯ãªããããšããç¹ã ããã³ãã³ã ãèŠãŠãããšéçã£ãŠãããã®ããã«èŠããçºè¡šããDiscord - ã®æ¹ã§ã¯çãäžãã£ãŠããããšããã®ãäœåºŠãèŠãããããã³ãã³ã®ã³ã¡ã³ãæ¹åŒã¯çãäžãããåŠå®ã«åæ ããããéããŸãããããDiscord - ããã£ãããšèªäœã¯ãã©ã¹ã ã£ããšæããããã®ç¹ã¯ãã€ãã¹ã ã£ãã®ã§ã¯ãªãããšæããã - </p> - <hr/> - <p> - æåŸã«ãªããŸããããæ¯å¹Žã® PHPerKaigi - éå¬ã«ãå°œåãããŠããçæ§ãã¹ããŒã«ãŒã®çæ§ã楜ãã3æ¥éã§ãããããããšãããããŸããïŒ - (ãã£ãšåžžäœã§æžããŠããŸã£ãã®ã§ãããªãä»é é¢ããç¬é¡ã«ãªã£ãããã§æ°æã¡æªã) - </p> - <p> - ã§ã¯ãŸãæ¥å¹Žã - </p> - </section> - </section> -</article> diff --git a/vhosts/blog/content/posts/2021-10-02/cpp-you-can-use-keywords-in-attributes.dj b/vhosts/blog/content/posts/2021-10-02/cpp-you-can-use-keywords-in-attributes.dj new file mode 100644 index 00000000..94690092 --- /dev/null +++ b/vhosts/blog/content/posts/2021-10-02/cpp-you-can-use-keywords-in-attributes.dj @@ -0,0 +1,113 @@ +--- +[article] +uuid = "69863d75-ef21-42db-b743-5958f7c86827" +title = "ãC++ã 屿§æ§æã®å±æ§åã«ã¯ããŒã¯ãŒãã䜿ãã" +description = "C++ ã®å±æ§æ§æã®å±æ§åã«ã¯ãããŒã¯ãŒãã䜿ããããã¿èšäºã" +tags = [ + "cpp", + "cpp17", +] + +[[article.revisions]] +date = "2021-10-02" +remark = "Qiita ããç§»æ€" +--- +::: note +ãã®èšäºã¯ Qiita ããç§»æ€ããŠãããã®ã§ãã +å
URL: https://qiita.com/nsfisis/items/94090937bcf860cfa93b +::: + +ã¿ã€ãã«èœã¡ããŸãã¯ãã®ã³ãŒããèŠãŠæ¬²ããã + +```cpp +#include <iostream> + +[[alignas]] [[alignof]] [[and]] [[and_eq]] [[asm]] [[auto]] [[bitand]] +[[bitor]] [[bool]] [[break]] [[case]] [[catch]] [[char]] [[char16_t]] +[[char32_t]] [[class]] [[compl]] [[const]] [[const_cast]] [[constexpr]] +[[continue]] [[decltype]] [[default]] [[delete]] [[do]] [[double]] +[[dynamic_cast]] [[else]] [[enum]] [[explicit]] [[export]] [[extern]] [[false]] +[[final]] [[float]] [[for]] [[friend]] [[goto]] [[if]] [[inline]] [[int]] +[[long]] [[mutable]] [[namespace]] [[new]] [[noexcept]] [[not]] [[not_eq]] +[[nullptr]] [[operator]] [[or]] [[or_eq]] [[override]] [[private]] +[[protected]] [[public]] [[register]] [[reinterpret_cast]] [[return]] [[short]] +[[signed]] [[sizeof]] [[static]] [[static_assert]] [[static_cast]] [[struct]] +[[switch]] [[template]] [[this]] [[thread_local]] [[throw]] [[true]] [[try]] +[[typedef]] [[typeid]] [[typename]] [[union]] [[unsigned]] +[[virtual]] [[void]] [[volatile]] [[wchar_t]] [[while]] [[xor]] [[xor_eq]] +// [[using]] +int main() { + std::cout << "Hello, World!" << std::endl; +} +``` + +ã³ã³ãã€ã©ã®ããŒãžã§ã³ + +``` +$ clang++ âversion Apple clang version 11.0.0 +(clang-1100.0.33.8) Target: x86_64-apple-darwin19.6.0 Thread model: +posix InstalledDir: +/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin +``` + +ã³ã³ãã€ã«ã³ãã³ã (C17æå®) + +``` +$ clang âstd=c++17 hoge.cpp +``` + +ãã®èšäºããåŸããããã®ã¯ãã以äžãªãã®ã§ä»¥äžã¯èè¶³ã«ãªãã + +å¥ä»¶ã§ [cppreference.com ã® identifier ã®ããŒãž](https://en.cppreference.com/w/cpp/language/identifiers)ãèªãã§ããæãæ¬¡ã®æãç®ã«æ¢ãŸã£ãã + +> * the identifiers that are keywords cannot be used for other purposes; +> +> * The only place they can be used as non-keywords is in an attribute-token. (e.g. [[private]] is a valid attribute) (since C++11) + +ããŒã¯ãŒãã§ã屿§ãšããŠæå®ããå Žåã¯éããŒã¯ãŒããšããŠäœ¿ãããããã +å®éã«ãã£ãŠã¿ãã + +åãµã€ãã® [keywords ã®ããŒãž](https://en.cppreference.com/w/cpp/keyword) +ããäžèЧãæåããäžã®ã³ãŒããåºæ¥äžãã£ã (C++17 +ã«ãããŠããŒã¯ãŒãã§ãªããã®ãªã©ãäžéšçããŠãã)ã 倧éã®èŠå (unknown +attribute \`ãã' ignored) +ãã³ã³ãã€ã©ããåºåãããããã³ã³ãã€ã«ã§ããã + +äžã®ã³ãŒãã§ã¯ `[[using]]` ãã³ã¡ã³ãã¢ãŠãããŠãããããã㯠`using` +ããŒã¯ãŒãã®ã¿å±æ§æ§æã®äžã§æå³ãæã€ããã§ããããã®ã³ã¡ã³ãã¢ãŠããå€ããšã³ã³ãã€ã«ã«å€±æããã + +```cpp +// using ã®äŸ +[[using foo: attr1, attr2]] int x; // [[foo::attr1, foo::attr2]] ã®ç³è¡£æ§æ +``` + +C++17 ã®ä»æ§ãèŠãŠã¿ã (æ£ç¢ºã«ã¯æšæºååã®ãã©ãã)ã + +åŒçšå
: https://timsong-cpp.github.io/cppwp/n4659/dcl.attr#grammar-4 + +> If a keyword or an alternative token that satisfies the syntactic +> requirements of an identifier is contained in an attribute-token, it is +> considered an identifier. + +ã`identifier` ã®æ§æäžã®èŠä»¶ãæºããããŒã¯ãŒããŸãã¯ä»£æ¿ããŒã¯ã³ã +`attribute-token` ã«å«ãŸããŠããå Žåã`identifier` +ãšã¿ãªãããããšãããã©ãããééããªãããã ã + +ãšããã§ã代æ¿ããŒã¯ã³ (alternative token) ãšã¯ `and` (`&`) ã `bitor` +(`|`) ãªã©ã®ããšã ãã`identifier` +ã®æ§æäžã®èŠä»¶ãæºãããªããããªä»£æ¿ããŒã¯ã³ãªã©ããã®ãïŒ +çåã«æã£ãŠèª¿ã¹ããšããã代æ¿ããŒã¯ã³ãšããèªã«ã¯ãã€ã°ã©ããå«ãŸããããã +(åè: +[åãã©ãã](https://timsong-cpp.github.io/cppwp/n4659/lex.digraph) ) + +* `<%` â `{` +* `%>` â `}` +* `<:` â `[` +* `:>` â `]` +* `%:` â `#` +* `%:%:` â `##` + +ã`identifier` +ã®æ§æäžã®èŠä»¶ãæºãããªããããªä»£æ¿ããŒã¯ã³ãã¯ããããåœãŠã¯ãŸããšæãããã + +調ã¹ãææ³: åå¥è§£æåšãæ§æè§£æåšãèŸãã diff --git a/vhosts/blog/content/posts/2021-10-02/cpp-you-can-use-keywords-in-attributes.ndoc b/vhosts/blog/content/posts/2021-10-02/cpp-you-can-use-keywords-in-attributes.ndoc deleted file mode 100644 index 244786dd..00000000 --- a/vhosts/blog/content/posts/2021-10-02/cpp-you-can-use-keywords-in-attributes.ndoc +++ /dev/null @@ -1,140 +0,0 @@ ---- -[article] -uuid = "69863d75-ef21-42db-b743-5958f7c86827" -title = "ãC++ã 屿§æ§æã®å±æ§åã«ã¯ããŒã¯ãŒãã䜿ãã" -description = "C++ ã®å±æ§æ§æã®å±æ§åã«ã¯ãããŒã¯ãŒãã䜿ããããã¿èšäºã" -tags = [ - "cpp", - "cpp17", -] - -[[article.revisions]] -date = "2021-10-02" -remark = "Qiita ããç§»æ€" ---- -<article> - <note> - ãã®èšäºã¯ Qiita ããç§»æ€ããŠãããã®ã§ãã - å
URL: https://qiita.com/nsfisis/items/94090937bcf860cfa93b - </note> - <p> - ã¿ã€ãã«èœã¡ããŸãã¯ãã®ã³ãŒããèŠãŠæ¬²ããã - </p> - <codeblock language="cpp"> - <![CDATA[ - #include <iostream> - - [[alignas]] [[alignof]] [[and]] [[and_eq]] [[asm]] [[auto]] [[bitand]] - [[bitor]] [[bool]] [[break]] [[case]] [[catch]] [[char]] [[char16_t]] - [[char32_t]] [[class]] [[compl]] [[const]] [[const_cast]] [[constexpr]] - [[continue]] [[decltype]] [[default]] [[delete]] [[do]] [[double]] - [[dynamic_cast]] [[else]] [[enum]] [[explicit]] [[export]] [[extern]] [[false]] - [[final]] [[float]] [[for]] [[friend]] [[goto]] [[if]] [[inline]] [[int]] - [[long]] [[mutable]] [[namespace]] [[new]] [[noexcept]] [[not]] [[not_eq]] - [[nullptr]] [[operator]] [[or]] [[or_eq]] [[override]] [[private]] - [[protected]] [[public]] [[register]] [[reinterpret_cast]] [[return]] [[short]] - [[signed]] [[sizeof]] [[static]] [[static_assert]] [[static_cast]] [[struct]] - [[switch]] [[template]] [[this]] [[thread_local]] [[throw]] [[true]] [[try]] - [[typedef]] [[typeid]] [[typename]] [[union]] [[unsigned]] - [[virtual]] [[void]] [[volatile]] [[wchar_t]] [[while]] [[xor]] [[xor_eq]] - // [[using]] - int main() { - std::cout << "Hello, World!" << std::endl; - } - ]]> - </codeblock> - <blockquote> - <p> - ã³ã³ãã€ã©ã®ããŒãžã§ã³ $ clang++ âversion Apple clang version 11.0.0 - (clang-1100.0.33.8) Target: x86_64-apple-darwin19.6.0 Thread model: - posix InstalledDir: - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin - </p> - <p> - ã³ã³ãã€ã«ã³ãã³ã (C17æå®) $ clang âstd=c++17 hoge.cpp - </p> - </blockquote> - <p> - ãã®èšäºããåŸããããã®ã¯ãã以äžãªãã®ã§ä»¥äžã¯èè¶³ã«ãªãã - </p> - <p> - å¥ä»¶ã§ cppreference.com ã® - <a href="https://en.cppreference.com/w/cpp/language/identifiers">identifier - ã®ããŒãž</a> ãèªãã§ããæãæ¬¡ã®æãç®ã«æ¢ãŸã£ãã - </p> - <blockquote> - <ul> - <li> - the identifiers that are keywords cannot be used for other purposes; - <ul> - <li> - The only place they can be used as non-keywords is in an - attribute-token. (e.g. [[private]] is a valid attribute) (since C++11) - </li> - </ul> - </li> - </ul> - </blockquote> - <p> - ããŒã¯ãŒãã§ã屿§ãšããŠæå®ããå Žåã¯éããŒã¯ãŒããšããŠäœ¿ãããããã - å®éã«ãã£ãŠã¿ãã - </p> - <p> - åãµã€ãã® <a href="https://en.cppreference.com/w/cpp/keyword">keywords ã®ããŒãž</a> - ããäžèЧãæåããäžã®ã³ãŒããåºæ¥äžãã£ã (C++17 - ã«ãããŠããŒã¯ãŒãã§ãªããã®ãªã©ãäžéšçããŠãã)ã 倧éã®èŠå (unknown - attribute `ãã' ignored) - ãã³ã³ãã€ã©ããåºåãããããã³ã³ãã€ã«ã§ããã - </p> - <p> - äžã®ã³ãŒãã§ã¯ <code>[[using]]</code> ãã³ã¡ã³ãã¢ãŠãããŠãããããã㯠<code>using</code> - ããŒã¯ãŒãã®ã¿å±æ§æ§æã®äžã§æå³ãæã€ããã§ããããã®ã³ã¡ã³ãã¢ãŠããå€ããšã³ã³ãã€ã«ã«å€±æããã - </p> - <codeblock language="cpp"> - <![CDATA[ - // using ã®äŸ - [[using foo: attr1, attr2]] int x; // [[foo::attr1, foo::attr2]] ã®ç³è¡£æ§æ - ]]> - </codeblock> - <p> - C++17 ã®ä»æ§ãèŠãŠã¿ã (æ£ç¢ºã«ã¯æšæºååã®ãã©ãã)ã - </p> - <p> - åŒçšå
: https://timsong-cpp.github.io/cppwp/n4659/dcl.attr#grammar-4 - </p> - <blockquote> - <p> - If a keyword or an alternative token that satisfies the syntactic - requirements of an identifier is contained in an attribute-token, it is - considered an identifier. - </p> - </blockquote> - <p> - ã<code>identifier</code> ã®æ§æäžã®èŠä»¶ãæºããããŒã¯ãŒããŸãã¯ä»£æ¿ããŒã¯ã³ã - <code>attribute-token</code> ã«å«ãŸããŠããå Žåã<code>identifier</code> - ãšã¿ãªãããããšãããã©ãããééããªãããã ã - </p> - <p> - ãšããã§ã代æ¿ããŒã¯ã³ (alternative token) ãšã¯ <code>and</code> (<code>&</code>) ã <code>bitor</code> - (<code>|</code>) ãªã©ã®ããšã ãã<code>identifier</code> - ã®æ§æäžã®èŠä»¶ãæºãããªããããªä»£æ¿ããŒã¯ã³ãªã©ããã®ãïŒ - çåã«æã£ãŠèª¿ã¹ããšããã代æ¿ããŒã¯ã³ãšããèªã«ã¯ãã€ã°ã©ããå«ãŸããããã - (åè: - <a href="https://timsong-cpp.github.io/cppwp/n4659/lex.digraph">åãã©ãã</a>) - </p> - <ul> - <li><code><%</code> â <code>{</code></li> - <li><code>%></code> â <code>}</code></li> - <li><code><:</code> â <code>[</code></li> - <li><code>:></code> â <code>]</code></li> - <li><code>%:</code> â <code>#</code></li> - <li><code>%:%:</code> â <code>##</code></li> - </ul> - <p> - ã<code>identifier</code> - ã®æ§æäžã®èŠä»¶ãæºãããªããããªä»£æ¿ããŒã¯ã³ãã¯ããããåœãŠã¯ãŸããšæãããã - </p> - <p> - 調ã¹ãææ³: åå¥è§£æåšãæ§æè§£æåšãèŸãã - </p> -</article> diff --git a/vhosts/blog/content/posts/2021-10-02/python-unbound-local-error.dj b/vhosts/blog/content/posts/2021-10-02/python-unbound-local-error.dj new file mode 100644 index 00000000..88d03151 --- /dev/null +++ b/vhosts/blog/content/posts/2021-10-02/python-unbound-local-error.dj @@ -0,0 +1,70 @@ +--- +[article] +uuid = "e1aff84c-d6d4-4dea-bc45-9c41e6445006" +title = "ãPythonã ã¯ããŒãžã£ãšUnboundLocalError: local variable 'x' referenced before assignment" +description = "Python ã«ããã UnboundLocalError ã®çç±ãšå¯ŸåŠæ³ã" +tags = [ + "python", + "python3", +] + +[[article.revisions]] +date = "2021-10-02" +remark = "Qiita ããç§»æ€" +--- +::: note +ãã®èšäºã¯ Qiita ããç§»æ€ããŠãããã®ã§ãã +å
URL: https://qiita.com/nsfisis/items/5d733703afcb35bbf399 +::: + +æ¬èšäºã¯ Python 3.7.6 ã®åäœçµæãå
ã«ããŠæžãããŠããã + +Python ã§ã¯ããŒãžã£ãäœãããšã次ã®ãããªã³ãŒããæžããã + +```python +def f(): + x = 0 + def g(): + x += 1 + g() + +f() +``` + +颿° `g` ãã 颿° `f` ã®ã¹ã³ãŒãå
ã§å®çŸ©ããã倿° `x` ãåç
§ããããã« +1 ãè¶³ãããšããŠããã ãããå®è¡ãããš `x += 1` +ã®ç®æã§ãšã©ãŒãçºçããã + +> UnboundLocalError: local variable \`x' referenced before assignment + +local倿° `x` ã代å
¥åã«åç
§ãããããšãããããã¯ã`f` ã® `x` +ãåç
§ããã®ã§ã¯ãªããæ°ããå¥ã®å€æ°ã `g` å
ã«äœã£ãŠããŸã£ãŠããããã +åè¿°ã®ã³ãŒãã宣èšãšä»£å
¥ã䟿å®äžåããŠæžãçŽããšæ¬¡ã®ããã«ãªãã`var` +ã倿°å®£èšã®ããã®æ§æãšããŠæ¬äŒŒçã«å©çšããŠããã + +```python +# 泚: var ã¯æ£ãã Python ã®ææ³ã§ã¯ãªããäžèšåç
§ã®ããš +def f(): + var x # f ã® local倿° 'x' ãå®£èš + x = 0 # x ã« 0 ã代å
¥ + def g(): # f ã®å
éšé¢æ° g ãå®çŸ© + var x # g ã® local倿° 'x' ãå®£èš + # ããŸã㟠f ã«ãåãååã®å€æ°ããããããããšã¯å¥ã®å€æ° + x += 1 # x ã« 1 ãå ç® (x = x + 1 ã®ç³è¡£æ§æ) + # å ç®ããåã®å€ãåç
§ããããšãããããŸã 代å
¥ãããŠããªããããšã©ãŒ + g() +``` + +åœåã®æå³ã衚çŸããã«ã¯ã次ã®ããã«æžãã°ããã + +```python +def f(): + x = 0 + def g(): + nonlocal x ## (*) + x += 1 + g() +``` + +`(*)` ã®ããã«ã`nonlocal` ã远å ãããããã«ããäžã€å€åŽã®ã¹ã³ãŒã (`g` +ã®äžã€å€åŽ = `f`) ã§å®çŸ©ãããŠãã `x` ãæ¢ãã«è¡ãããã«ãªãã diff --git a/vhosts/blog/content/posts/2021-10-02/python-unbound-local-error.ndoc b/vhosts/blog/content/posts/2021-10-02/python-unbound-local-error.ndoc deleted file mode 100644 index b771e8c8..00000000 --- a/vhosts/blog/content/posts/2021-10-02/python-unbound-local-error.ndoc +++ /dev/null @@ -1,84 +0,0 @@ ---- -[article] -uuid = "e1aff84c-d6d4-4dea-bc45-9c41e6445006" -title = "ãPythonã ã¯ããŒãžã£ãšUnboundLocalError: local variable 'x' referenced before assignment" -description = "Python ã«ããã UnboundLocalError ã®çç±ãšå¯ŸåŠæ³ã" -tags = [ - "python", - "python3", -] - -[[article.revisions]] -date = "2021-10-02" -remark = "Qiita ããç§»æ€" ---- -<article> - <note> - ãã®èšäºã¯ Qiita ããç§»æ€ããŠãããã®ã§ãã - å
URL: https://qiita.com/nsfisis/items/5d733703afcb35bbf399 - </note> - <p> - æ¬èšäºã¯ Python 3.7.6 ã®åäœçµæãå
ã«ããŠæžãããŠããã - </p> - <p> - Python ã§ã¯ããŒãžã£ãäœãããšã次ã®ãããªã³ãŒããæžããã - </p> - <codeblock language="python"> - <![CDATA[ - def f(): - x = 0 - def g(): - x += 1 - g() - - f() - ]]> - </codeblock> - <p> - 颿° <code>g</code> ãã 颿° <code>f</code> ã®ã¹ã³ãŒãå
ã§å®çŸ©ããã倿° <code>x</code> ãåç
§ããããã« - 1 ãè¶³ãããšããŠããã ãããå®è¡ãããš <code>x += 1</code> - ã®ç®æã§ãšã©ãŒãçºçããã - </p> - <blockquote> - <p> - UnboundLocalError: local variable `x' referenced before assignment - </p> - </blockquote> - <p> - local倿° <code>x</code> ã代å
¥åã«åç
§ãããããšãããããã¯ã<code>f</code> ã® <code>x</code> - ãåç
§ããã®ã§ã¯ãªããæ°ããå¥ã®å€æ°ã <code>g</code> å
ã«äœã£ãŠããŸã£ãŠããããã - åè¿°ã®ã³ãŒãã宣èšãšä»£å
¥ã䟿å®äžåããŠæžãçŽããšæ¬¡ã®ããã«ãªãã<code>var</code> - ã倿°å®£èšã®ããã®æ§æãšããŠæ¬äŒŒçã«å©çšããŠããã - </p> - <codeblock language="python"> - <![CDATA[ - # 泚: var ã¯æ£ãã Python ã®ææ³ã§ã¯ãªããäžèšåç
§ã®ããš - def f(): - var x # f ã® local倿° 'x' ãå®£èš - x = 0 # x ã« 0 ã代å
¥ - def g(): # f ã®å
éšé¢æ° g ãå®çŸ© - var x # g ã® local倿° 'x' ãå®£èš - # ããŸã㟠f ã«ãåãååã®å€æ°ããããããããšã¯å¥ã®å€æ° - x += 1 # x ã« 1 ãå ç® (x = x + 1 ã®ç³è¡£æ§æ) - # å ç®ããåã®å€ãåç
§ããããšãããããŸã 代å
¥ãããŠããªããããšã©ãŒ - g() - ]]> - </codeblock> - <p> - åœåã®æå³ã衚çŸããã«ã¯ã次ã®ããã«æžãã°ããã - </p> - <codeblock language="python"> - <![CDATA[ - def f(): - x = 0 - def g(): - nonlocal x ## (*) - x += 1 - g() - ]]> - </codeblock> - <p> - <code>(*)</code> ã®ããã«ã<code>nonlocal</code> ã远å ãããããã«ããäžã€å€åŽã®ã¹ã³ãŒã (<code>g</code> - ã®äžã€å€åŽ = <code>f</code>) ã§å®çŸ©ãããŠãã <code>x</code> ãæ¢ãã«è¡ãããã«ãªãã - </p> -</article> diff --git a/vhosts/blog/content/posts/2021-10-02/ruby-detect-running-implementation.dj b/vhosts/blog/content/posts/2021-10-02/ruby-detect-running-implementation.dj new file mode 100644 index 00000000..4c73580c --- /dev/null +++ b/vhosts/blog/content/posts/2021-10-02/ruby-detect-running-implementation.dj @@ -0,0 +1,73 @@ +--- +[article] +uuid = "e1456a50-4fc6-42ef-89f3-8be78e01da13" +title = "ãRubyã èªèº«ãå®è¡ããŠããåŠçç³»ã®çš®é¡ãå€å®ãã" +description = "Ruby ã«ã¯è€æ°ã®å®è£
ãããããèªèº«ãå®è¡ããŠããåŠçç³»ã®çš®é¡ãã¹ã¯ãªããäžããã©ã®ããã«å€å®ããã°ããã ãããã" +tags = [ + "ruby", +] + +[[article.revisions]] +date = "2021-10-02" +remark = "Qiita ããç§»æ€" +--- +::: note +ãã®èšäºã¯ Qiita ããç§»æ€ããŠãããã®ã§ãã +å
URL: https://qiita.com/nsfisis/items/74d7ffeeebc51b20d791 +::: + +Ruby +ãšããèšèªã«ã¯è€æ°ã®å®è£
ãããããããããã¹ã¯ãªããäžããã©ã®ããã«ã㊠+programmatically ã«èŠåããã°ããã ãããã + +`Object` ã¯ã©ã¹ã«å®çŸ©ãããŠãã `RUBY_ENGINE` +ãšãã宿°ããã®çšéã«äœ¿ããã + +åè: +[Object::RUBY_ENGINE](https://docs.ruby-lang.org/ja/latest/method/Object/c/RUBY_ENGINE.html) + +äžèšããŒãžã®äŸããåŒçšãã: + +```shell-session +$ ruby-1.9.1 -ve 'p RUBY_ENGINE' +ruby 1.9.1p0 (2009-03-04 revision 22762) [x86_64-linux] +"ruby" +$ jruby -ve 'p RUBY_ENGINE' +jruby 1.2.0 (ruby 1.8.6 patchlevel 287) (2009-03-16 rev 9419) [i386-java] +"jruby" +``` + +ããããã®åŠçç³»ãã©ã®ãããªå€ãè¿ããã ããstack overflow +ã«è¯ã質åãšåçããã£ãã + +[What values for RUBY_ENGINE correspond to which Ruby implementations?](https://stackoverflow.com/a/9894232) ããåŒçš: + +> ``` +> | RUBY_ENGINE | Implementation | +> |:-----------:|:------------------| +> | <undefined> | MRI < 1.9 | +> | 'ruby' | MRI >= 1.9 or REE | +> | 'jruby' | JRuby | +> | 'macruby' | MacRuby | +> | 'rbx' | Rubinius | +> | 'maglev' | MagLev | +> | 'ironruby' | IronRuby | +> | 'cardinal' | Cardinal | +> ``` + +ãªãããã®è³ªåã»åç㯠+2014幎ã«ãªããããã®ã§ãããå€ã¯å€ãã£ãŠããå¯èœæ§ããããMRI (aka +CRuby) ã«ã€ããŠã¯å·çæçŸåš (2020/12/8) ã `'ruby'` +ãè¿ã£ãŠããããšãç¢ºèªæžã¿ã + +ãã®è¡šã«ãªãäž»èŠãªåŠçç³»ãšããŠã [mruby](https://mruby.org) 㯠`'mruby'` +ãè¿ãã + +[mruby 該åœéšåã®ãœãŒã¹](https://github.com/mruby/mruby/blob/ed29d74bfd95362eaeb946fcf7e865d80346b62b/include/mruby/version.h#L32-L35) ããåŒçš: + +```c +/* + * Ruby engine. + */ +#define MRUBY_RUBY_ENGINE "mruby" +``` diff --git a/vhosts/blog/content/posts/2021-10-02/ruby-detect-running-implementation.ndoc b/vhosts/blog/content/posts/2021-10-02/ruby-detect-running-implementation.ndoc deleted file mode 100644 index af02fde4..00000000 --- a/vhosts/blog/content/posts/2021-10-02/ruby-detect-running-implementation.ndoc +++ /dev/null @@ -1,119 +0,0 @@ ---- -[article] -uuid = "e1456a50-4fc6-42ef-89f3-8be78e01da13" -title = "ãRubyã èªèº«ãå®è¡ããŠããåŠçç³»ã®çš®é¡ãå€å®ãã" -description = "Ruby ã«ã¯è€æ°ã®å®è£
ãããããèªèº«ãå®è¡ããŠããåŠçç³»ã®çš®é¡ãã¹ã¯ãªããäžããã©ã®ããã«å€å®ããã°ããã ãããã" -tags = [ - "ruby", -] - -[[article.revisions]] -date = "2021-10-02" -remark = "Qiita ããç§»æ€" ---- -<article> - <note> - ãã®èšäºã¯ Qiita ããç§»æ€ããŠãããã®ã§ãã - å
URL: https://qiita.com/nsfisis/items/74d7ffeeebc51b20d791 - </note> - <p> - Ruby - ãšããèšèªã«ã¯è€æ°ã®å®è£
ãããããããããã¹ã¯ãªããäžããã©ã®ããã«ã㊠- programmatically ã«èŠåããã°ããã ãããã - </p> - <p> - <code>Object</code> ã¯ã©ã¹ã«å®çŸ©ãããŠãã <code>RUBY_ENGINE</code> - ãšãã宿°ããã®çšéã«äœ¿ããã - </p> - <p> - åè: - <a href="https://docs.ruby-lang.org/ja/latest/method/Object/c/RUBY_ENGINE.html">Object::RUBY_ENGINE</a> - </p> - <p> - äžèšããŒãžã®äŸããåŒçšãã: - </p> - <codeblock language="shell-session"> - <![CDATA[ - $ ruby-1.9.1 -ve 'p RUBY_ENGINE' - ruby 1.9.1p0 (2009-03-04 revision 22762) [x86_64-linux] - "ruby" - $ jruby -ve 'p RUBY_ENGINE' - jruby 1.2.0 (ruby 1.8.6 patchlevel 287) (2009-03-16 rev 9419) [i386-java] - "jruby" - ]]> - </codeblock> - <p> - ããããã®åŠçç³»ãã©ã®ãããªå€ãè¿ããã ããstack overflow - ã«è¯ã質åãšåçããã£ãã - </p> - <p> - <a href="https://stackoverflow.com/a/9894232">What values for RUBY_ENGINE - correspond to which Ruby implementations?</a> ããåŒçš: - </p> - <blockquote> - <table> - <thead> - <tr> - <td>RUBY_ENGINE</td> - <td>Implementation</td> - </tr> - </thead> - <tbody> - <tr> - <td><undefined></td> - <td>MRI < 1.9</td> - </tr> - <tr> - <td>`ruby'</td> - <td>MRI >= 1.9 or REE</td> - </tr> - <tr> - <td>`jruby'</td> - <td>JRuby</td> - </tr> - <tr> - <td>`macruby'</td> - <td>MacRuby</td> - </tr> - <tr> - <td>`rbx'</td> - <td>Rubinius</td> - </tr> - <tr> - <td>`maglev'</td> - <td>MagLev</td> - </tr> - <tr> - <td>`ironruby'</td> - <td>IronRuby</td> - </tr> - <tr> - <td>`cardinal'</td> - <td>Cardinal</td> - </tr> - </tbody> - </table> - </blockquote> - <p> - ãªãããã®è³ªåã»åç㯠- 2014幎ã«ãªããããã®ã§ãããå€ã¯å€ãã£ãŠããå¯èœæ§ããããMRI (aka - CRuby) ã«ã€ããŠã¯å·çæçŸåš (2020/12/8) ã <code>'ruby'</code> - ãè¿ã£ãŠããããšãç¢ºèªæžã¿ã - </p> - <p> - ãã®è¡šã«ãªãäž»èŠãªåŠçç³»ãšããŠã<a href="https://mruby.org">mruby</a> 㯠<code>'mruby'</code> - ãè¿ãã - </p> - <p> - <a href="https://github.com/mruby/mruby/blob/ed29d74bfd95362eaeb946fcf7e865d80346b62b/include/mruby/version.h#L32-L35">mruby - 該åœéšåã®ãœãŒã¹</a> ããåŒçš: - </p> - <codeblock language="c"> - <![CDATA[ - /* - * Ruby engine. - */ - #define MRUBY_RUBY_ENGINE "mruby" - ]]> - </codeblock> -</article> diff --git a/vhosts/blog/content/posts/2021-10-02/ruby-then-keyword-and-case-in.dj b/vhosts/blog/content/posts/2021-10-02/ruby-then-keyword-and-case-in.dj new file mode 100644 index 00000000..7d8616fc --- /dev/null +++ b/vhosts/blog/content/posts/2021-10-02/ruby-then-keyword-and-case-in.dj @@ -0,0 +1,232 @@ +--- +[article] +uuid = "87455008-fe5b-49bf-af5a-b875264f8326" +title = "ãRubyã then ããŒã¯ãŒããš case in" +description = "Ruby 3.0 ã§è¿œå ããã case in æ§æãšãthen ããŒã¯ãŒãã«ã€ããŠã" +tags = [ + "ruby", + "ruby3", +] + +[[article.revisions]] +date = "2021-10-02" +remark = "Qiita ããç§»æ€" +--- +::: note +ãã®èšäºã¯ Qiita ããç§»æ€ããŠãããã®ã§ãã +å
URL: https://qiita.com/nsfisis/items/787a8cf888a304497223 +::: + +{#tl-dr} +# TL; DR + +`case` - `in` ã«ãããã¿ãŒã³ãããã³ã°æ§æã§ãã`case` - `when` +ãšåãããã« `then` ã䜿ãã (å Žåã«ãã£ãŠã¯äœ¿ãå¿
èŠããã)ã + +{#what-is-then-keyword} +# `then` ãšã¯ + +䜿ãããããšã¯çšã ããRuby ã§ã¯ `then` +ãããŒã¯ãŒãã«ãªã£ãŠãããæ¬¡ã®ããã«äœ¿ã: + +```ruby +if cond then + puts "Y" +else + puts "N" +end +``` + +ãã®ããŒã¯ãŒããçŸãããå Žæã¯ããã€ãããã`if`ã`unless`ã`rescue`ã`case` +æ§æãããã«åœããã äžèšã®ããã«ãäœãæ¡ä»¶ãæžããåŸ `then` +ã眮ããåŒãããã§çµäºããŠããããšã瀺ãããŒã«ãŒãšããŠæ©èœããã + +```ruby +# Example: + +if x then + a +end + +unless x then + a +end + +begin + a +rescue then + b +end + +case x +when p then + a +end +``` + +{#why-then-is-usually-unnecessary} +# ãªãæ®æ®µã¯æžããªããŠãããã®ã + +æ®é Ruby ã®ã³ãŒãã§ `then` +ãæžãããšã¯ãªãããªãããæ¬¡ã®ã³ãŒããå®è¡ããŠã¿ããšãããã + +```ruby +if true puts 'Hello, World!' end +``` + +次ã®ãããªæ§æãšã©ãŒãåºåãããã + +``` +20:1: syntax error, unexpected local variable or method, expecting `then' or ';' or '\n' +if true puts 'Hello, World!' end + ^~~~ +20:1: syntax error, unexpected `end', expecting end-of-input +...f true puts 'Hello, World!' end +``` + +äºã€ç®ã®ã¡ãã»ãŒãžã¯ç¡èŠããŠäžã€ç®ãèªããšã`then` ã `;` +ãæ¹è¡ãæ¥ãã¯ãã®ãšãã倿°ã ãã¡ãœããã ããçŸããããšã«ãããšã©ãŒãšãªã£ãŠããããã ã + +ãã€ã³ãã¯æ¹è¡ã `then` (ã `;`) ã®ä»£ãããšãªãããšã§ããã`true` +ã®åŸã«æ¹è¡ãå
¥ããŠã¿ãã + +```ruby +if true +puts 'Hello, World!' end +``` + +ç¡äº Hello, World! ãšåºåãããããã«ãªã£ãã + +{#why-then-or-linebreak-is-needed} +# ãªã `then` ã `;` ãæ¹è¡ãå¿
èŠã + +ãªã `then` ã `;` ãæ¹è¡ (ä»¥äž ã`then` çã) +ãå¿
èŠãªã®ã ããããæ¬¡ã®äŸãèŠãŠã»ãã: + +```ruby +if a b end +``` + +`then` ã `;` +ãæ¹è¡ããªãã®ã§ãšã©ãŒã«ãªãããããã¯æ¡ä»¶åŒãã©ããŸã§ç¶ããŠããã®ãããããªãããã ã +ãã®äŸã¯äºéãã«è§£éã§ããã + +```ruby +# a ãšãã倿°ãã¡ãœããã®è©äŸ¡çµæã truthy ãªã b ãšãã倿°ãã¡ãœãããè©äŸ¡ +if a then +b +end +``` + +```ruby +# a ãšããã¡ãœããã« b ãšãã倿°ãã¡ãœããã®è©äŸ¡çµæãæž¡ããŠåŒã³åºãã +# ãã®çµæã truthy ãªãäœãããªã +if a(b) then +end +``` + +`then` çã¯ãã®ææ§æ§ãæé€ããããã«ãããæ¡ä»¶åŒã¯ `if` ãã `then` +çãŸã§ã®éã«ããããšããããšãæç¢ºã«ããã C系㮠`if` åŸã«æ¥ã `(`/`)` +ããPython ã® `:`ãRust/Go/Swift ãªã©ã® `{` ãåã圹å²ãæã€ã + +Ruby ã®å Žåãããã°ã©ããŒãæžããããããæ¹è¡ã§ãã£ãŠ `then` +ã代çšã§ããã®ã§ãã»ãšãã©ã®å Žå `then` ã¯å¿
èŠãªãã + +{#then-in-case-in} +# `case` - `in` ã«ããã `then` + +ããããæ¬é¡ã«ãã©ãçãããæ¥ã Ruby 3.0 ã§ã¯ `case` ãš `in` +ããŒã¯ãŒãã䜿ã£ããã¿ãŒã³ãããã³ã°ã®æ§æãå
¥ãäºå®ã§ããããã®æ§æã§ããã¿ãŒã³éšãšã®åºåããšã㊠+`then` çãå¿
èŠã«ãªãã (çŸåšã®) Ruby ã«ã¯ formal +ãªåœ¢åŒã§ã®ææ³ä»æ§ã¯ååšããªãã®ã§ãyacc ã®å®çŸ©ãã¡ã€ã«ãåç
§ãã (yacc +ã®èª¬æã¯çç¥)ã + +https://github.com/ruby/ruby/blob/221ca0f8281d39f0dfdfe13b2448875384bbf735/parse.y#L3961-L3986 + +```yacc +p_case_body : keyword_in +{ + SET_LEX_STATE(EXPR_BEG|EXPR_LABEL); + p->command_start = FALSE; + $<ctxt>1 = p->ctxt; + p->ctxt.in_kwarg = 1; + $<tbl>$ = push_pvtbl(p); +} +{ + $<tbl>$ = push_pktbl(p); +} +p_top_expr then +{ + pop_pktbl(p, $<tbl>3); + pop_pvtbl(p, $<tbl>2); + p->ctxt.in_kwarg = $<ctxt>1.in_kwarg; +} +compstmt +p_cases +{ + /*%%%*/ + $$ = NEW_IN($4, $7, $8, &@$); + /*% %*/ + /*% ripper: in!($4, $7, escape_Qundef($8)) %*/ +} +; +``` + +ç°¡ç¥ç: + +```yacc +p_case_body : keyword_in p_top_expr then compstmt p_cases +; +``` + +ããã§ã`keyword_in` ã¯æåéã `in`ã`p_top_expr` +ã¯ãããããã¿ãŒã³ã`then` 㯠`then` +ããŒã¯ãŒãã®ããšã§ã¯ãªãããã®èšäºã§ `then` çãšåŒãã§ãããã®ãã€ãŸã +`then` ããŒã¯ãŒãã`;`ãæ¹è¡ã®ããããã§ããã + +ããã«ããã`case` - `when` ã«ããåŸæ¥ã®æ§æãšåãããã«ã`then` +çããã¿ãŒã³ã®åŸãã«æ¿å
¥ããã°ããããšãããã£ããã€ãŸã次ã®3éãã®ããããã«ãªã: + +```ruby +case x +in 1 then a +in 2 then b +in 3 then c +end + +case x +in 1 + a +in 2 + b +in 3 + c +end + +case x +in 1; a +in 2; b +in 3; c +end +``` + +ãšããã§ã`p_top_expr` ã«ã¯ `if` ã«ãã guard clause +ãæžããã®ã§ããã®å Žå㯠`if` - `then` ãšäŒŒããããªèŠãç®ã«ãªãã + +```ruby +case x +in 0 then a +in n if n < 0 then b +in n then c +end +``` + +{#outro} +# ãŸãšã + +* `if` ã `case` ã®æ¡ä»¶ã®åŸãã«ã¯ `then`ã`;`ãæ¹è¡ã®ãããããå¿
èŠ + + * éåžžã¯æ¹è¡ããŠããã°ãã + +* 3.0 ã§å
¥ãäºå®ã® `case` - `in` ã§ã `then` çãå¿
èŠã«ãªã +* Ruby ã®æ§æãæ£ç¢ºã«ç¥ãã«ã¯ (çŸç¶) `parse.y` ãçŽæ¥èªãã°ãã diff --git a/vhosts/blog/content/posts/2021-10-02/ruby-then-keyword-and-case-in.ndoc b/vhosts/blog/content/posts/2021-10-02/ruby-then-keyword-and-case-in.ndoc deleted file mode 100644 index ef2534c4..00000000 --- a/vhosts/blog/content/posts/2021-10-02/ruby-then-keyword-and-case-in.ndoc +++ /dev/null @@ -1,267 +0,0 @@ ---- -[article] -uuid = "87455008-fe5b-49bf-af5a-b875264f8326" -title = "ãRubyã then ããŒã¯ãŒããš case in" -description = "Ruby 3.0 ã§è¿œå ããã case in æ§æãšãthen ããŒã¯ãŒãã«ã€ããŠã" -tags = [ - "ruby", - "ruby3", -] - -[[article.revisions]] -date = "2021-10-02" -remark = "Qiita ããç§»æ€" ---- -<article> - <note> - ãã®èšäºã¯ Qiita ããç§»æ€ããŠãããã®ã§ãã - å
URL: https://qiita.com/nsfisis/items/787a8cf888a304497223 - </note> - <section id="tl-dr"> - <h>TL; DR</h> - <p> - <code>case</code> - <code>in</code> ã«ãããã¿ãŒã³ãããã³ã°æ§æã§ãã<code>case</code> - <code>when</code> - ãšåãããã« <code>then</code> ã䜿ãã (å Žåã«ãã£ãŠã¯äœ¿ãå¿
èŠããã)ã - </p> - </section> - <section id="what-is-then-keyword"> - <h><code>then</code> ãšã¯</h> - <p> - 䜿ãããããšã¯çšã ããRuby ã§ã¯ <code>then</code> - ãããŒã¯ãŒãã«ãªã£ãŠãããæ¬¡ã®ããã«äœ¿ã: - </p> - <codeblock language="ruby"> - <![CDATA[ - if cond then - puts "Y" - else - puts "N" - end - ]]> - </codeblock> - <p> - ãã®ããŒã¯ãŒããçŸãããå Žæã¯ããã€ãããã<code>if</code>ã<code>unless</code>ã<code>rescue</code>ã<code>case</code> - æ§æãããã«åœããã äžèšã®ããã«ãäœãæ¡ä»¶ãæžããåŸ <code>then</code> - ã眮ããåŒãããã§çµäºããŠããããšã瀺ãããŒã«ãŒãšããŠæ©èœããã - </p> - <codeblock language="ruby"> - <![CDATA[ - # Example: - - if x then - a - end - - unless x then - a - end - - begin - a - rescue then - b - end - - case x - when p then - a - end - ]]> - </codeblock> - </section> - <section id="why-then-is-usually-unnecessary"> - <h>ãªãæ®æ®µã¯æžããªããŠãããã®ã</h> - <p> - æ®é Ruby ã®ã³ãŒãã§ <code>then</code> - ãæžãããšã¯ãªãããªãããæ¬¡ã®ã³ãŒããå®è¡ããŠã¿ããšãããã - </p> - <codeblock language="ruby"> - <![CDATA[ - if true puts 'Hello, World!' end - ]]> - </codeblock> - <p> - 次ã®ãããªæ§æãšã©ãŒãåºåãããã - </p> - <codeblock> - <![CDATA[ - 20:1: syntax error, unexpected local variable or method, expecting `then' or ';' or '\n' - if true puts 'Hello, World!' end - ^~~~ - 20:1: syntax error, unexpected `end', expecting end-of-input - ...f true puts 'Hello, World!' end - ]]> - </codeblock> - <p> - äºã€ç®ã®ã¡ãã»ãŒãžã¯ç¡èŠããŠäžã€ç®ãèªããšã<code>then</code> ã <code>;</code> - ãæ¹è¡ãæ¥ãã¯ãã®ãšãã倿°ã ãã¡ãœããã ããçŸããããšã«ãããšã©ãŒãšãªã£ãŠããããã ã - </p> - <p> - ãã€ã³ãã¯æ¹è¡ã <code>then</code> (ã <code>;</code>) ã®ä»£ãããšãªãããšã§ããã<code>true</code> - ã®åŸã«æ¹è¡ãå
¥ããŠã¿ãã - </p> - <codeblock language="ruby"> - <![CDATA[ - if true - puts 'Hello, World!' end - ]]> - </codeblock> - <p> - ç¡äº Hello, World! ãšåºåãããããã«ãªã£ãã - </p> - </section> - <section id="why-then-or-linebreak-is-needed"> - <h>ãªã <code>then</code> ã <code>;</code> ãæ¹è¡ãå¿
èŠã</h> - <p> - ãªã <code>then</code> ã <code>;</code> ãæ¹è¡ (ä»¥äž ã<code>then</code> çã) - ãå¿
èŠãªã®ã ããããæ¬¡ã®äŸãèŠãŠã»ãã: - </p> - <codeblock language="ruby"> - <![CDATA[ - if a b end - ]]> - </codeblock> - <p> - <code>then</code> ã <code>;</code> - ãæ¹è¡ããªãã®ã§ãšã©ãŒã«ãªãããããã¯æ¡ä»¶åŒãã©ããŸã§ç¶ããŠããã®ãããããªãããã ã - ãã®äŸã¯äºéãã«è§£éã§ããã - </p> - <codeblock language="ruby"> - <![CDATA[ - # a ãšãã倿°ãã¡ãœããã®è©äŸ¡çµæã truthy ãªã b ãšãã倿°ãã¡ãœãããè©äŸ¡ - if a then - b - end - ]]> - </codeblock> - <codeblock language="ruby"> - <![CDATA[ - # a ãšããã¡ãœããã« b ãšãã倿°ãã¡ãœããã®è©äŸ¡çµæãæž¡ããŠåŒã³åºãã - # ãã®çµæã truthy ãªãäœãããªã - if a(b) then - end - ]]> - </codeblock> - <p> - <code>then</code> çã¯ãã®ææ§æ§ãæé€ããããã«ãããæ¡ä»¶åŒã¯ <code>if</code> ãã <code>then</code> - çãŸã§ã®éã«ããããšããããšãæç¢ºã«ããã C系㮠<code>if</code> åŸã«æ¥ã <code>(</code>/<code>)</code> - ããPython ã® <code>:</code>ãRust/Go/Swift ãªã©ã® <code>{</code> ãåã圹å²ãæã€ã - </p> - <p> - Ruby ã®å Žåãããã°ã©ããŒãæžããããããæ¹è¡ã§ãã£ãŠ <code>then</code> - ã代çšã§ããã®ã§ãã»ãšãã©ã®å Žå <code>then</code> ã¯å¿
èŠãªãã - </p> - </section> - <section id="then-in-case-in"> - <h><code>case</code> - <code>in</code> ã«ããã <code>then</code></h> - <p> - ããããæ¬é¡ã«ãã©ãçãããæ¥ã Ruby 3.0 ã§ã¯ <code>case</code> ãš <code>in</code> - ããŒã¯ãŒãã䜿ã£ããã¿ãŒã³ãããã³ã°ã®æ§æãå
¥ãäºå®ã§ããããã®æ§æã§ããã¿ãŒã³éšãšã®åºåããšã㊠- <code>then</code> çãå¿
èŠã«ãªãã (çŸåšã®) Ruby ã«ã¯ formal - ãªåœ¢åŒã§ã®ææ³ä»æ§ã¯ååšããªãã®ã§ãyacc ã®å®çŸ©ãã¡ã€ã«ãåç
§ãã (yacc - ã®èª¬æã¯çç¥)ã - </p> - <p> - https://github.com/ruby/ruby/blob/221ca0f8281d39f0dfdfe13b2448875384bbf735/parse.y#L3961-L3986 - </p> - <codeblock language="yacc"> - <![CDATA[ - p_case_body : keyword_in - { - SET_LEX_STATE(EXPR_BEG|EXPR_LABEL); - p->command_start = FALSE; - $<ctxt>1 = p->ctxt; - p->ctxt.in_kwarg = 1; - $<tbl>$ = push_pvtbl(p); - } - { - $<tbl>$ = push_pktbl(p); - } - p_top_expr then - { - pop_pktbl(p, $<tbl>3); - pop_pvtbl(p, $<tbl>2); - p->ctxt.in_kwarg = $<ctxt>1.in_kwarg; - } - compstmt - p_cases - { - /*%%%*/ - $$ = NEW_IN($4, $7, $8, &@$); - /*% %*/ - /*% ripper: in!($4, $7, escape_Qundef($8)) %*/ - } - ; - ]]> - </codeblock> - <p> - ç°¡ç¥ç: - </p> - <codeblock language="yacc"> - <![CDATA[ - p_case_body : keyword_in p_top_expr then compstmt p_cases - ; - ]]> - </codeblock> - <p> - ããã§ã<code>keyword_in</code> ã¯æåéã <code>in</code>ã<code>p_top_expr</code> - ã¯ãããããã¿ãŒã³ã<code>then</code> 㯠<code>then</code> - ããŒã¯ãŒãã®ããšã§ã¯ãªãããã®èšäºã§ <code>then</code> çãšåŒãã§ãããã®ãã€ãŸã - <code>then</code> ããŒã¯ãŒãã<code>;</code>ãæ¹è¡ã®ããããã§ããã - </p> - <p> - ããã«ããã<code>case</code> - <code>when</code> ã«ããåŸæ¥ã®æ§æãšåãããã«ã<code>then</code> - çããã¿ãŒã³ã®åŸãã«æ¿å
¥ããã°ããããšãããã£ããã€ãŸã次ã®3éãã®ããããã«ãªã: - </p> - <codeblock language="ruby"> - <![CDATA[ - case x - in 1 then a - in 2 then b - in 3 then c - end - - case x - in 1 - a - in 2 - b - in 3 - c - end - - case x - in 1; a - in 2; b - in 3; c - end - ]]> - </codeblock> - <p> - ãšããã§ã<code>p_top_expr</code> ã«ã¯ <code>if</code> ã«ãã guard clause - ãæžããã®ã§ããã®å Žå㯠<code>if</code> - <code>then</code> ãšäŒŒããããªèŠãç®ã«ãªãã - </p> - <codeblock language="ruby"> - <![CDATA[ - case x - in 0 then a - in n if n < 0 then b - in n then c - end - ]]> - </codeblock> - </section> - <section id="outro"> - <h>ãŸãšã</h> - <ul> - <li> - <code>if</code> ã <code>case</code> ã®æ¡ä»¶ã®åŸãã«ã¯ <code>then</code>ã<code>;</code>ãæ¹è¡ã®ãããããå¿
èŠ - <ul> - <li>éåžžã¯æ¹è¡ããŠããã°ãã</li> - </ul> - </li> - <li>3.0 ã§å
¥ãäºå®ã® <code>case</code> - <code>in</code> ã§ã <code>then</code> çãå¿
èŠã«ãªã</li> - <li>Ruby ã®æ§æãæ£ç¢ºã«ç¥ãã«ã¯ (çŸç¶) <code>parse.y</code> ãçŽæ¥èªãã°ãã</li> - </ul> - </section> -</article> diff --git a/vhosts/blog/content/posts/2021-10-02/rust-where-are-primitive-types-from.dj b/vhosts/blog/content/posts/2021-10-02/rust-where-are-primitive-types-from.dj new file mode 100644 index 00000000..212cd3d6 --- /dev/null +++ b/vhosts/blog/content/posts/2021-10-02/rust-where-are-primitive-types-from.dj @@ -0,0 +1,205 @@ +--- +[article] +uuid = "91c61980-c262-4e8d-89b0-4304e7f6d644" +title = "Rust ã®ããªããã£ãåã¯ã©ããããã£ãŠæ¥ãã" +description = "Rust ã®ããªããã£ãåã¯äºçŽèªã§ã¯ãªãæ®éã®èå¥åã§ãããã©ã®ããã«ãããåå解決ãããã®ãã調ã¹ãã" +tags = [ + "rust", +] + +[[article.revisions]] +date = "2021-10-02" +remark = "Qiita ããç§»æ€" +--- +::: note +ãã®èšäºã¯ Qiita ããç§»æ€ããŠãããã®ã§ãã +å
URL: https://qiita.com/nsfisis/items/9a429432258bbcd6c565 +::: + +{#intro} +# å眮ã + +Rust +ã«ãããŠãããªããã£ãåã®ååã¯äºçŽèªã§ãªãããããã£ãŠã次ã®ã³ãŒãã¯åæ³ã§ããã + +```rust +#![allow(non_camel_case_types)] +#![allow(dead_code)] + +struct bool; +struct char; +struct i8; +struct i16; +struct i32; +struct i64; +struct i128; +struct isize; +struct u8; +struct u16; +struct u32; +struct u64; +struct u128; +struct usize; +struct f32; +struct f64; +struct str; +``` + +ã§ã¯ãæ®æ®µåã« `bool` ãšæžãããšãããã® `bool` +ã¯äžäœã©ãããæ¥ãŠããã®ããrustc ã®ãœãŒã¹ã远ã£ãŠã¿ãã + + åæç¥è: äžè¬çãªã³ã³ãã€ã©ã®æ§é ãçšèªã`rustc` ãã®ãã®ã®ç¥èã¯äžèŠ + (ãšãããããçè
èªèº«ãããç¥ããªã) + +{#code-reading} +# èª¿æ» + +調æ»ã«äœ¿çšãããœãŒã¹ (èª¿æ»æç¹ã§ã®ææ° master) + +https://github.com/rust-lang/rust/tree/511ed9f2356af365ad8affe046b3dd33f7ac3c98 + +ã©ã®ããã«ããŠèª¿ã¹ãããrustc +ã®æ§é ã«ã¯è©³ãããªããããããã«åœãããã€ããã®ã¯é£ããã + +倧éæãªæ§é ãšããŠã¯ã`compiler` ãã©ã«ã以äžã« `rustc_*` +ãšããååã®ã¯ã¬ãŒããæ°ååå
¥ã£ãŠããããããã©ããã `rustc` +ã³ãã³ãã®å®è£
éšã®ããã ã + +`rustc` ã¯ã»ã«ããã¹ããããŠãã (= `rustc` èªèº«ã Rust ã§æžãããŠãã) +ã®ã§ã`bool` ã `char` +ãªã©ã§é©åœã«æ€çŽ¢ããããŠããã€ãºãå€ãããŠè©±ã«ãªããªãã +ãããããèªãåããªããšã« `i128`/`u128` +ãšããã³ã³ãã€ã©èªèº«ã䜿ãããšããªããããªåãååšããã®ã§ããã䜿ã£ãŠ +`git grep` ããŠã¿ãã + +``` +$ git grep "\bi128\b" | wc # i128 +165 1069 15790 + +$ git grep "\bu128\b" | wc # u128 +293 2127 26667 + +$ git grep "\bbool\b" | wc # cf. bool ã®çµæ +3563 23577 294659 +``` + +165 +çšåºŠã§ããã°æ¢ãããšãã§ãããã ãä»åã¯ãã¯ã¬ãŒãåãèŠãŠããããã®åœãããã€ããã + +``` +$ git grep "\bi128\b" +... +rustc_resolve/src/lib.rs: table.insert(sym::i128, Int(IntTy::I128)); +... +``` + +`rustc_resolve` +ãšããã®ã¯ããã«ãåå解決ãæ
ããããªã¯ã¬ãŒãåã§ããã該åœç®æãèŠãŠã¿ãã + +```rust +/// Interns the names of the primitive types. +/// +/// All other types are defined somewhere and possibly imported, but the primitive ones need +/// special handling, since they have no place of origin. +struct PrimitiveTypeTable { + primitive_types: FxHashMap<Symbol, PrimTy>, +} + +impl PrimitiveTypeTable { + fn new() -> PrimitiveTypeTable { + let mut table = FxHashMap::default(); + + table.insert(sym::bool, Bool); + table.insert(sym::char, Char); + table.insert(sym::f32, Float(FloatTy::F32)); + table.insert(sym::f64, Float(FloatTy::F64)); + table.insert(sym::isize, Int(IntTy::Isize)); + table.insert(sym::i8, Int(IntTy::I8)); + table.insert(sym::i16, Int(IntTy::I16)); + table.insert(sym::i32, Int(IntTy::I32)); + table.insert(sym::i64, Int(IntTy::I64)); + table.insert(sym::i128, Int(IntTy::I128)); + table.insert(sym::str, Str); + table.insert(sym::usize, Uint(UintTy::Usize)); + table.insert(sym::u8, Uint(UintTy::U8)); + table.insert(sym::u16, Uint(UintTy::U16)); + table.insert(sym::u32, Uint(UintTy::U32)); + table.insert(sym::u64, Uint(UintTy::U64)); + table.insert(sym::u128, Uint(UintTy::U128)); + Self { primitive_types: table } + } +} +``` + +ããã¯åãã«åæããããªããã£ãåã®äžèЧãšäžèŽããŠãããdoc comment +ã«ãã + +``` +All other types are defined somewhere and possibly imported, but the +primitive ones need special handling, since they have no place of +origin. +``` + +ãšãããæ¬¡ã¯ãã® struct +ã®äœ¿çšç®æã远ãã远ããšèšã£ãŠã䜿ãããŠããç®æã¯æ¬¡ã®äžç®æãããªãããªã説æã«äžèŠãªç®æã¯å€§ããåã£ãŠããã + +```rust +/// This resolves the identifier `ident` in the namespace `ns` in the current lexical scope. +/// (ç¥) +fn resolve_ident_in_lexical_scope( + &mut self, + mut ident: Ident, + ns: Namespace, + // (ç¥) +) -> Option<LexicalScopeBinding<'a>> { + // (ç¥) + + if ns == TypeNS { + if let Some(prim_ty) = self.primitive_type_table.primitive_types.get(&ident.name) { + let binding = + (Res::PrimTy(*prim_ty), ty::Visibility::Public, DUMMY_SP, ExpnId::root()) + .to_name_binding(self.arenas); + return Some(LexicalScopeBinding::Item(binding)); + } + } + + None +} +``` + +颿°åã doc comment ã瀺ããŠããéãããã®é¢æ°ã¯èå¥å (identifier, +ident) ãçŸåšã®ã¬ãã·ã«ã«ã¹ã³ãŒãå
ã§è§£æ±º (resolve) ããã +`if ns == TypeNS` ã®ãããã¯å
ã§ã¯ã`primitive_type_table` (äžèšã® +`PrimitiveTypeTable::new()` ã§äœããã倿°) ã«å«ãŸããŠããèå¥å +(`bool`ã`i32` ãªã©) +ãã©ããå€å®ããããã§ããã°ããã«çŽã¥ããããããªããã£ãåãè¿ããŠããã + +ãªãã`ns` ã¯ãåå空éãã瀺ã倿°ã§ãããRust +ã«ãããåå空éã¯Cèšèªã«ããããããšã»ãšãã©åãã§ã仿¢ããŠããååã颿°å/倿°åãªã®ãåãªã®ããã¯ããªã®ããåºå¥ããŠããããã® +`if` +ã¯ãããªããã£ãåã«è§£æ±ºãããã®ã¯åãæ¢ããŠãããšãã ãã ããšèšã£ãŠããã + +éèŠãªã®ã¯ãããã `resolve_ident_in_lexical_scope()` +ã®æåŸã«æžãããŠããç¹ã§ãããã€ãŸããæåã«æããããªããã£ãåã®èå¥åã¯ããååè§£æ±ºã®æçµæ®µéã§ãããä»ã«ååã®åãèŠã€ãã£ãŠããªããã°ãããªããã£ãåãšããŠè§£æ±ºãããã + +åäœãããã£ããšããã§ãäŸãšããŠæ¬¡ã®ã³ãŒããèããã + +```rust +#![allow(non_camel_case_types)] + +struct bool; + +fn main() { + let _: bool = bool; +} +``` + +ããã§ `main()` ã® `bool` 㯠`struct bool` +ãšããŠè§£æ±ºãããããªããªããããªããã£ãåã®å€å®ãããåã« `bool` +ãšããååã®å¥ã®åãèŠã€ããããã ã + +{#outro} +# ãŸãšã + +Rust +ã®ããªããã£ãåã¯äºçŽèªã§ã¯ãªããååè§£æ±ºã®æçµæ®µéã§ç¹å¥æ±ããããä»ã«ååã®åãèŠã€ãã£ãŠããªããã°å¯Ÿå¿ããããªããã£ãåã«è§£æ±ºãããã diff --git a/vhosts/blog/content/posts/2021-10-02/rust-where-are-primitive-types-from.ndoc b/vhosts/blog/content/posts/2021-10-02/rust-where-are-primitive-types-from.ndoc deleted file mode 100644 index 1ce2607f..00000000 --- a/vhosts/blog/content/posts/2021-10-02/rust-where-are-primitive-types-from.ndoc +++ /dev/null @@ -1,234 +0,0 @@ ---- -[article] -uuid = "91c61980-c262-4e8d-89b0-4304e7f6d644" -title = "Rust ã®ããªããã£ãåã¯ã©ããããã£ãŠæ¥ãã" -description = "Rust ã®ããªããã£ãåã¯äºçŽèªã§ã¯ãªãæ®éã®èå¥åã§ãããã©ã®ããã«ãããåå解決ãããã®ãã調ã¹ãã" -tags = [ - "rust", -] - -[[article.revisions]] -date = "2021-10-02" -remark = "Qiita ããç§»æ€" ---- -<article> - <note> - ãã®èšäºã¯ Qiita ããç§»æ€ããŠãããã®ã§ãã - å
URL: https://qiita.com/nsfisis/items/9a429432258bbcd6c565 - </note> - <section id="intro"> - <h>å眮ã</h> - <p> - Rust - ã«ãããŠãããªããã£ãåã®ååã¯äºçŽèªã§ãªãããããã£ãŠã次ã®ã³ãŒãã¯åæ³ã§ããã - </p> - <codeblock language="rust"> - <![CDATA[ - #![allow(non_camel_case_types)] - #![allow(dead_code)] - - struct bool; - struct char; - struct i8; - struct i16; - struct i32; - struct i64; - struct i128; - struct isize; - struct u8; - struct u16; - struct u32; - struct u64; - struct u128; - struct usize; - struct f32; - struct f64; - struct str; - ]]> - </codeblock> - <p> - ã§ã¯ãæ®æ®µåã« <code>bool</code> ãšæžãããšãããã® <code>bool</code> - ã¯äžäœã©ãããæ¥ãŠããã®ããrustc ã®ãœãŒã¹ã远ã£ãŠã¿ãã - </p> - <blockquote> - <p> - åæç¥è: äžè¬çãªã³ã³ãã€ã©ã®æ§é ãçšèªã<code>rustc</code> ãã®ãã®ã®ç¥èã¯äžèŠ - (ãšãããããçè
èªèº«ãããç¥ããªã) - </p> - </blockquote> - </section> - <section id="code-reading"> - <h>調æ»</h> - <p> - 調æ»ã«äœ¿çšãããœãŒã¹ (èª¿æ»æç¹ã§ã®ææ° master) - </p> - <p> - https://github.com/rust-lang/rust/tree/511ed9f2356af365ad8affe046b3dd33f7ac3c98 - </p> - <p> - ã©ã®ããã«ããŠèª¿ã¹ãããrustc - ã®æ§é ã«ã¯è©³ãããªããããããã«åœãããã€ããã®ã¯é£ããã - </p> - <p> - 倧éæãªæ§é ãšããŠã¯ã<code>compiler</code> ãã©ã«ã以äžã« <code>rustc_*</code> - ãšããååã®ã¯ã¬ãŒããæ°ååå
¥ã£ãŠããããããã©ããã <code>rustc</code> - ã³ãã³ãã®å®è£
éšã®ããã ã - </p> - <p> - <code>rustc</code> ã¯ã»ã«ããã¹ããããŠãã (= <code>rustc</code> èªèº«ã Rust ã§æžãããŠãã) - ã®ã§ã<code>bool</code> ã <code>char</code> - ãªã©ã§é©åœã«æ€çŽ¢ããããŠããã€ãºãå€ãããŠè©±ã«ãªããªãã - ãããããèªãåããªããšã« <code>i128</code>/<code>u128</code> - ãšããã³ã³ãã€ã©èªèº«ã䜿ãããšããªããããªåãååšããã®ã§ããã䜿ã£ãŠ - <code>git grep</code> ããŠã¿ãã - </p> - <codeblock> - <![CDATA[ - $ git grep "\bi128\b" | wc # i128 - 165 1069 15790 - - $ git grep "\bu128\b" | wc # u128 - 293 2127 26667 - - $ git grep "\bbool\b" | wc # cf. bool ã®çµæ - 3563 23577 294659 - ]]> - </codeblock> - <p> - 165 - çšåºŠã§ããã°æ¢ãããšãã§ãããã ãä»åã¯ãã¯ã¬ãŒãåãèŠãŠããããã®åœãããã€ããã - </p> - <codeblock> - <![CDATA[ - $ git grep "\bi128\b" - ... - rustc_resolve/src/lib.rs: table.insert(sym::i128, Int(IntTy::I128)); - ... - ]]> - </codeblock> - <p> - <code>rustc_resolve</code> - ãšããã®ã¯ããã«ãåå解決ãæ
ããããªã¯ã¬ãŒãåã§ããã該åœç®æãèŠãŠã¿ãã - </p> - <codeblock language="rust"> - <![CDATA[ - /// Interns the names of the primitive types. - /// - /// All other types are defined somewhere and possibly imported, but the primitive ones need - /// special handling, since they have no place of origin. - struct PrimitiveTypeTable { - primitive_types: FxHashMap<Symbol, PrimTy>, - } - - impl PrimitiveTypeTable { - fn new() -> PrimitiveTypeTable { - let mut table = FxHashMap::default(); - - table.insert(sym::bool, Bool); - table.insert(sym::char, Char); - table.insert(sym::f32, Float(FloatTy::F32)); - table.insert(sym::f64, Float(FloatTy::F64)); - table.insert(sym::isize, Int(IntTy::Isize)); - table.insert(sym::i8, Int(IntTy::I8)); - table.insert(sym::i16, Int(IntTy::I16)); - table.insert(sym::i32, Int(IntTy::I32)); - table.insert(sym::i64, Int(IntTy::I64)); - table.insert(sym::i128, Int(IntTy::I128)); - table.insert(sym::str, Str); - table.insert(sym::usize, Uint(UintTy::Usize)); - table.insert(sym::u8, Uint(UintTy::U8)); - table.insert(sym::u16, Uint(UintTy::U16)); - table.insert(sym::u32, Uint(UintTy::U32)); - table.insert(sym::u64, Uint(UintTy::U64)); - table.insert(sym::u128, Uint(UintTy::U128)); - Self { primitive_types: table } - } - } - ]]> - </codeblock> - <p> - ããã¯åãã«åæããããªããã£ãåã®äžèЧãšäžèŽããŠãããdoc comment - ã«ãã - </p> - <blockquote> - <p> - All other types are defined somewhere and possibly imported, but the - primitive ones need special handling, since they have no place of - origin. - </p> - </blockquote> - <p> - ãšãããæ¬¡ã¯ãã® struct - ã®äœ¿çšç®æã远ãã远ããšèšã£ãŠã䜿ãããŠããç®æã¯æ¬¡ã®äžç®æãããªãããªã説æã«äžèŠãªç®æã¯å€§ããåã£ãŠããã - </p> - <codeblock language="rust"> - <![CDATA[ - /// This resolves the identifier `ident` in the namespace `ns` in the current lexical scope. - /// (ç¥) - fn resolve_ident_in_lexical_scope( - &mut self, - mut ident: Ident, - ns: Namespace, - // (ç¥) - ) -> Option<LexicalScopeBinding<'a>> { - // (ç¥) - - if ns == TypeNS { - if let Some(prim_ty) = self.primitive_type_table.primitive_types.get(&ident.name) { - let binding = - (Res::PrimTy(*prim_ty), ty::Visibility::Public, DUMMY_SP, ExpnId::root()) - .to_name_binding(self.arenas); - return Some(LexicalScopeBinding::Item(binding)); - } - } - - None - } - ]]> - </codeblock> - <p> - 颿°åã doc comment ã瀺ããŠããéãããã®é¢æ°ã¯èå¥å (identifier, - ident) ãçŸåšã®ã¬ãã·ã«ã«ã¹ã³ãŒãå
ã§è§£æ±º (resolve) ããã - <code>if ns == TypeNS</code> ã®ãããã¯å
ã§ã¯ã<code>primitive_type_table</code> (äžèšã® - <code>PrimitiveTypeTable::new()</code> ã§äœããã倿°) ã«å«ãŸããŠããèå¥å - (<code>bool</code>ã<code>i32</code> ãªã©) - ãã©ããå€å®ããããã§ããã°ããã«çŽã¥ããããããªããã£ãåãè¿ããŠããã - </p> - <p> - ãªãã<code>ns</code> ã¯ãåå空éãã瀺ã倿°ã§ãããRust - ã«ãããåå空éã¯Cèšèªã«ããããããšã»ãšãã©åãã§ã仿¢ããŠããååã颿°å/倿°åãªã®ãåãªã®ããã¯ããªã®ããåºå¥ããŠããããã® - <code>if</code> - ã¯ãããªããã£ãåã«è§£æ±ºãããã®ã¯åãæ¢ããŠãããšãã ãã ããšèšã£ãŠããã - </p> - <p> - éèŠãªã®ã¯ãããã <code>resolve_ident_in_lexical_scope()</code> - ã®æåŸã«æžãããŠããç¹ã§ãããã€ãŸããæåã«æããããªããã£ãåã®èå¥åã¯ããååè§£æ±ºã®æçµæ®µéã§ãããä»ã«ååã®åãèŠã€ãã£ãŠããªããã°ãããªããã£ãåãšããŠè§£æ±ºãããã - </p> - <p> - åäœãããã£ããšããã§ãäŸãšããŠæ¬¡ã®ã³ãŒããèããã - </p> - <codeblock language="rust"> - <![CDATA[ - #![allow(non_camel_case_types)] - - struct bool; - - fn main() { - let _: bool = bool; - } - ]]> - </codeblock> - <p> - ããã§ <code>main()</code> ã® <code>bool</code> 㯠<code>struct bool</code> - ãšããŠè§£æ±ºãããããªããªããããªããã£ãåã®å€å®ãããåã« <code>bool</code> - ãšããååã®å¥ã®åãèŠã€ããããã ã - </p> - </section> - <section id="outro"> - <h>ãŸãšã</h> - <p> - Rust - ã®ããªããã£ãåã¯äºçŽèªã§ã¯ãªããååè§£æ±ºã®æçµæ®µéã§ç¹å¥æ±ããããä»ã«ååã®åãèŠã€ãã£ãŠããªããã°å¯Ÿå¿ããããªããã£ãåã«è§£æ±ºãããã - </p> - </section> -</article> diff --git a/vhosts/blog/content/posts/2021-10-02/vim-difference-between-autocmd-bufwrite-and-bufwritepre.dj b/vhosts/blog/content/posts/2021-10-02/vim-difference-between-autocmd-bufwrite-and-bufwritepre.dj new file mode 100644 index 00000000..37af679a --- /dev/null +++ b/vhosts/blog/content/posts/2021-10-02/vim-difference-between-autocmd-bufwrite-and-bufwritepre.dj @@ -0,0 +1,126 @@ +--- +[article] +uuid = "44171f75-c312-4c92-9927-3d260e162175" +title = "ãVimã autocmd events ã® BufWrite/BufWritePre ã®éã" +description = "Vim ã® autocmd events ã«ããã BufWrite/BufWritePre ãã©ãéãã®ãã調ã¹ãçµæãéãã¯ãªãããšãããã£ãã" +tags = [ + "vim", +] + +[[article.revisions]] +date = "2021-10-02" +remark = "Qiita ããç§»æ€" +--- +::: note +ãã®èšäºã¯ Qiita ããç§»æ€ããŠãããã®ã§ãã +å
URL: https://qiita.com/nsfisis/items/79ab4db8564032de0b25 +::: + +{#tl-dr} +# TL; DR + +éãã¯ãªãããã ã®ãšã€ãªã¢ã¹ã + +{#code-reading} +# 調æ»èšé² + +Vim ã® autocmd events ã«ã¯äŒŒéã£ãååã®ãã®ãããã€ãããã倧æµã¯ +`:help` +ã«èª¬æããããããã®èšäºã®ã¿ã€ãã«ã«ãã2ã€ãå«ãã以äžã®ã€ãã³ãã«ã¯ããã®éãã«ã€ããŠèª¬æããªãã + +* `BufRead`/`BufReadPost` +* `BufWrite`/`BufWritePre` +* `BufAdd`/`BufCreate` + +ãã®ãã¡ã`BufAdd`/`BufCreate` ã«é¢ããŠã¯ã`:help BufCreate` ã« + +> The BufCreate event is for historic reasons. + +ãšããããããã㯠`BufAdd` +ã®ãšã€ãªã¢ã¹ã§ããããšããããšãããããä»ã®2çµãåæ§ã§ã¯ãªãããšäºæ³ããããã確èªã®ãã +vim ãš neovim ã®ãœãŒã¹ã³ãŒãã調æ»ããã + +ãœãŒã¹ã³ãŒããžã®ãªã³ã¯ + +* [vim (èª¿æ»æç¹ã§ã® master branch)](https://github.com/vim/vim/tree/8e6be34338f13a6a625f19bcef82019c9adc65f2) +* [neovim (äžã«åã)](https://github.com/neovim/neovim/tree/71d4f5851f068eeb432af34850dddda8cc1c71e3) + +{#vim} +## vim ã®ãœãŒã¹ã³ãŒã + +以äžã¯ãautocmd events +ã®ååãšå
éšã§äœ¿ãããŠããæŽæ°å€ãšã®ãããã³ã°ãå®çŸ©ããŠããç®æã§ãããèŠãŠã®éããäžã§ãšã€ãªã¢ã¹ã§ã¯ãªãããšè¿°ã¹ã3çµã«ã¯ãããããåãå
éšå€ã䜿ãããŠããã + +https://github.com/vim/vim/blob/8e6be34338f13a6a625f19bcef82019c9adc65f2/src/autocmd.c#L85-L86 + +```c +{"BufAdd", EVENT_BUFADD}, +{"BufCreate", EVENT_BUFADD}, +``` + +https://github.com/vim/vim/blob/8e6be34338f13a6a625f19bcef82019c9adc65f2/src/autocmd.c#L95-L97 + +```c +{"BufRead", EVENT_BUFREADPOST}, +{"BufReadCmd", EVENT_BUFREADCMD}, +{"BufReadPost", EVENT_BUFREADPOST}, +``` + +https://github.com/vim/vim/blob/8e6be34338f13a6a625f19bcef82019c9adc65f2/src/autocmd.c#L103-L105 + +```c +{"BufWrite", EVENT_BUFWRITEPRE}, +{"BufWritePost", EVENT_BUFWRITEPOST}, +{"BufWritePre", EVENT_BUFWRITEPRE}, +``` + +{#neovim} +## neovim ã®ãœãŒã¹ã³ãŒã + +neovim ã®å Žåã§ãåæ§ã®ãããã³ã°ãå®çŸ©ãããŠãããããã¡ãã®å Žå㯠Lua +ã§æžãããŠããã以äžã«ããéããã¯ã£ãã `aliases` ãšæžãããŠããã + +https://github.com/neovim/neovim/blob/71d4f5851f068eeb432af34850dddda8cc1c71e3/src/nvim/auevents.lua#L119-L124 + +```lua +aliases = { + BufCreate = 'BufAdd', + BufRead = 'BufReadPost', + BufWrite = 'BufWritePre', + FileEncoding = 'EncodingChanged', +}, +``` + +ãšããã§ãäžã§ã¯åãäžããªãã£ã `FileEncoding` ã ãããã㯠+`:help FileEncoding` ã«ãã£ãããšæžããŠããã + +``` + *FileEncoding* +FileEncoding Obsolete. It still works and is equivalent + to |EncodingChanged|. +``` + +{#outro} +# ãŸãšã + +èšäºã¿ã€ãã«ã«ã€ããŠèšãã°ãã©ã¡ããå€ãããªãã®ã§å¥œããªæ¹ã䜿ãã°ããããããŠèšãã°ã次ã®ããã«ãªãã ããã + +* `BufAdd`/`BufCreate` + + * â `BufCreate` ã¯æŽå²çãªçç±ã«ãã ("for historic reasons") ååšããŠãããããæ°ããæ¹ (`BufAdd`) ã䜿ã + +* `BufRead`/`BufReadPost` + + * â `BufReadPre` ãšã®å¯Ÿç§°æ§ã®ãããããã㯠`BufWritePost` ãšã®å¯Ÿç§°æ§ã®ãã `BufReadPost` ã䜿ã + +* `BufWrite`/`BufWritePre` + + * â `BufWritePost` ãšã®å¯Ÿç§°æ§ã®ãããããã㯠`BufReadPre` ãšã®å¯Ÿç§°æ§ã®ãã `BufWritePre` ã䜿ã + +* `FileEncoding`/`EncodingChanged` + + * â `FileEncoding` 㯠"Obsolete" ãšæèšãããŠããã®ã§ã`EncodingChanged` ã䜿ã + +ãšããã§ãã®èª¿æ»ã§ç¥ã£ãã®ã ãã`BufRead` ãš `BufWrite` +ã¯äžã«ããéãçºç«ããã¿ã€ãã³ã°ããåŸããšãåãã§å¯Ÿç§°æ§ããªããå¯èœãªã +`Pre`/`Post` ä»ãã®ãã®ã䜿ã£ãæ¹ãåãããããã ããã diff --git a/vhosts/blog/content/posts/2021-10-02/vim-difference-between-autocmd-bufwrite-and-bufwritepre.ndoc b/vhosts/blog/content/posts/2021-10-02/vim-difference-between-autocmd-bufwrite-and-bufwritepre.ndoc deleted file mode 100644 index 705cf6c4..00000000 --- a/vhosts/blog/content/posts/2021-10-02/vim-difference-between-autocmd-bufwrite-and-bufwritepre.ndoc +++ /dev/null @@ -1,162 +0,0 @@ ---- -[article] -uuid = "44171f75-c312-4c92-9927-3d260e162175" -title = "ãVimã autocmd events ã® BufWrite/BufWritePre ã®éã" -description = "Vim ã® autocmd events ã«ããã BufWrite/BufWritePre ãã©ãéãã®ãã調ã¹ãçµæãéãã¯ãªãããšãããã£ãã" -tags = [ - "vim", -] - -[[article.revisions]] -date = "2021-10-02" -remark = "Qiita ããç§»æ€" ---- -<article> - <note> - ãã®èšäºã¯ Qiita ããç§»æ€ããŠãããã®ã§ãã - å
URL: https://qiita.com/nsfisis/items/79ab4db8564032de0b25 - </note> - <section id="tl-dr"> - <h>TL; DR</h> - <p> - éãã¯ãªãããã ã®ãšã€ãªã¢ã¹ã - </p> - </section> - <section id="code-reading"> - <h>調æ»èšé²</h> - <p> - Vim ã® autocmd events ã«ã¯äŒŒéã£ãååã®ãã®ãããã€ãããã倧æµã¯ - <code>:help</code> - ã«èª¬æããããããã®èšäºã®ã¿ã€ãã«ã«ãã2ã€ãå«ãã以äžã®ã€ãã³ãã«ã¯ããã®éãã«ã€ããŠèª¬æããªãã - </p> - <ul> - <li><code>BufRead</code>/<code>BufReadPost</code></li> - <li><code>BufWrite</code>/<code>BufWritePre</code></li> - <li><code>BufAdd</code>/<code>BufCreate</code></li> - </ul> - <p> - ãã®ãã¡ã<code>BufAdd</code>/<code>BufCreate</code> ã«é¢ããŠã¯ã<code>:help BufCreate</code> ã« - </p> - <blockquote> - <p> - The BufCreate event is for historic reasons. - </p> - </blockquote> - <p> - ãšããããããã㯠<code>BufAdd</code> - ã®ãšã€ãªã¢ã¹ã§ããããšããããšãããããä»ã®2çµãåæ§ã§ã¯ãªãããšäºæ³ããããã確èªã®ãã - vim ãš neovim ã®ãœãŒã¹ã³ãŒãã調æ»ããã - </p> - <blockquote> - <p> - ãœãŒã¹ã³ãŒããžã®ãªã³ã¯ - <a href="https://github.com/vim/vim/tree/8e6be34338f13a6a625f19bcef82019c9adc65f2">vim (èª¿æ»æç¹ã§ã® master branch)</a> - <a href="https://github.com/neovim/neovim/tree/71d4f5851f068eeb432af34850dddda8cc1c71e3">neovim (äžã«åã)</a> - </p> - </blockquote> - <section id="vim"> - <h>vim ã®ãœãŒã¹ã³ãŒã</h> - <p> - 以äžã¯ãautocmd events - ã®ååãšå
éšã§äœ¿ãããŠããæŽæ°å€ãšã®ãããã³ã°ãå®çŸ©ããŠããç®æã§ãããèŠãŠã®éããäžã§ãšã€ãªã¢ã¹ã§ã¯ãªãããšè¿°ã¹ã3çµã«ã¯ãããããåãå
éšå€ã䜿ãããŠããã - </p> - <p> - https://github.com/vim/vim/blob/8e6be34338f13a6a625f19bcef82019c9adc65f2/src/autocmd.c#L85-L86 - </p> - <codeblock language="c"> - <![CDATA[ - {"BufAdd", EVENT_BUFADD}, - {"BufCreate", EVENT_BUFADD}, - ]]> - </codeblock> - <p> - https://github.com/vim/vim/blob/8e6be34338f13a6a625f19bcef82019c9adc65f2/src/autocmd.c#L95-L97 - </p> - <codeblock language="c"> - <![CDATA[ - {"BufRead", EVENT_BUFREADPOST}, - {"BufReadCmd", EVENT_BUFREADCMD}, - {"BufReadPost", EVENT_BUFREADPOST}, - ]]> - </codeblock> - <p> - https://github.com/vim/vim/blob/8e6be34338f13a6a625f19bcef82019c9adc65f2/src/autocmd.c#L103-L105 - </p> - <codeblock language="c"> - <![CDATA[ - {"BufWrite", EVENT_BUFWRITEPRE}, - {"BufWritePost", EVENT_BUFWRITEPOST}, - {"BufWritePre", EVENT_BUFWRITEPRE}, - ]]> - </codeblock> - </section> - <section id="neovim"> - <h>neovim ã®ãœãŒã¹ã³ãŒã</h> - <p> - neovim ã®å Žåã§ãåæ§ã®ãããã³ã°ãå®çŸ©ãããŠãããããã¡ãã®å Žå㯠Lua - ã§æžãããŠããã以äžã«ããéããã¯ã£ãã <code>aliases</code> ãšæžãããŠããã - </p> - <p> - https://github.com/neovim/neovim/blob/71d4f5851f068eeb432af34850dddda8cc1c71e3/src/nvim/auevents.lua#L119-L124 - </p> - <codeblock language="lua"> - <![CDATA[ - aliases = { - BufCreate = 'BufAdd', - BufRead = 'BufReadPost', - BufWrite = 'BufWritePre', - FileEncoding = 'EncodingChanged', - }, - ]]> - </codeblock> - <p> - ãšããã§ãäžã§ã¯åãäžããªãã£ã <code>FileEncoding</code> ã ãããã㯠- <code>:help FileEncoding</code> ã«ãã£ãããšæžããŠããã - </p> - <codeblock> - <![CDATA[ - *FileEncoding* - FileEncoding Obsolete. It still works and is equivalent - to |EncodingChanged|. - ]]> - </codeblock> - </section> - </section> - <section id="outro"> - <h>ãŸãšã</h> - <p> - èšäºã¿ã€ãã«ã«ã€ããŠèšãã°ãã©ã¡ããå€ãããªãã®ã§å¥œããªæ¹ã䜿ãã°ããããããŠèšãã°ã次ã®ããã«ãªãã ããã - </p> - <ul> - <li> - <code>BufAdd</code>/<code>BufCreate</code> - <ul> - <li>â <code>BufCreate</code> ã¯æŽå²çãªçç±ã«ãã ("for historic reasons") ååšããŠãããããæ°ããæ¹ (<code>BufAdd</code>) ã䜿ã</li> - </ul> - </li> - <li> - <code>BufRead</code>/<code>BufReadPost</code> - <ul> - <li>â <code>BufReadPre</code> ãšã®å¯Ÿç§°æ§ã®ãããããã㯠<code>BufWritePost</code> ãšã®å¯Ÿç§°æ§ã®ãã <code>BufReadPost</code> ã䜿ã</li> - </ul> - </li> - <li> - <code>BufWrite</code>/<code>BufWritePre</code> - <ul> - <li>â <code>BufWritePost</code> ãšã®å¯Ÿç§°æ§ã®ãããããã㯠<code>BufReadPre</code> ãšã®å¯Ÿç§°æ§ã®ãã <code>BufWritePre</code> ã䜿ã</li> - </ul> - </li> - <li> - <code>FileEncoding</code>/<code>EncodingChanged</code> - <ul> - <li>â <code>FileEncoding</code> 㯠<code>`Obsolete'' ãšæèšãããŠããã®ã§ã`EncodingChanged</code> ã䜿ã</li> - </ul> - </li> - </ul> - <p> - ãšããã§ãã®èª¿æ»ã§ç¥ã£ãã®ã ãã<code>BufRead</code> ãš <code>BufWrite</code> - ã¯äžã«ããéãçºç«ããã¿ã€ãã³ã°ããåŸããšãåãã§å¯Ÿç§°æ§ããªããå¯èœãªã - <code>Pre</code>/<code>Post</code> ä»ãã®ãã®ã䜿ã£ãæ¹ãåãããããã ããã - </p> - </section> -</article> diff --git a/vhosts/blog/content/posts/2021-10-02/vim-swap-order-of-selected-lines.dj b/vhosts/blog/content/posts/2021-10-02/vim-swap-order-of-selected-lines.dj new file mode 100644 index 00000000..5de1075d --- /dev/null +++ b/vhosts/blog/content/posts/2021-10-02/vim-swap-order-of-selected-lines.dj @@ -0,0 +1,161 @@ +--- +[article] +uuid = "665de47e-0ed6-405e-ad30-81c3c4592d45" +title = "Vimã§éžæããè¡ã®é çªãå
¥ãæ¿ãã" +description = "Vim ã§éžæããè¡ã®é çªãå
¥ãæ¿ããæ¹æ³ã" +tags = [ + "vim", +] + +[[article.revisions]] +date = "2021-10-02" +remark = "Qiita ããç§»æ€" +--- +::: note +ãã®èšäºã¯ Qiita ããç§»æ€ããŠãããã®ã§ãã +å
URL: https://qiita.com/nsfisis/items/4fefb361d9a693803520 +::: + +{#tl-dr} +# TL; DR + +```vim +" License: Public Domain + +command! -bar -range=% + \ Reverse + \ keeppatterns <line1>,<line2>g/^/m<line1>-1 +``` + +{#version} +# ããŒãžã§ã³æ
å ± + +`:version` ã®äžéš + +> VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Jan 26 2020 11\:30\:30) macOS +> version Included patches: 1-148 Huge version without GUI. + +{#existing-solution} +# ãã玹ä»ãããŠããææ³ + +{#external-commands} +## `tac` / `tail` + +`tac` ã `tail -r` ãªã©ã®å€éšã³ãã³ãã `!` +ã䜿ã£ãŠåŒã³åºãã眮ãæããã + +> :h v_! + +`tac` ã³ãã³ãã `tail` ã® `-r` +ãªãã·ã§ã³ã¯ç°å¢ã«ãã£ãŠå©çšã§ããªãããšããããè€æ°ã®ç°å¢ãè¡ãæ¥ããå Žåã«æ¡çšãã¥ãã + +{#global-command} +## `:g/^/m0` + +ãã¡ãã¯å€éšã³ãã³ãã«é ŒãããVim ã®æ©èœã®ã¿ã䜿ãã`g` 㯠`:global` +ã³ãã³ãã®ã`m` 㯠`:move` ã³ãã³ãã®ç¥ + +`:global` ã³ãã³ã㯠`:[range]global/{pattern}/[command]` +ã®ããã«äœ¿ãã`[range]` ã§æå®ãããç¯å²ã®è¡ã®ãã¡ã`{pattern}` +ã§æå®ãããæ€çŽ¢ãã¿ãŒã³ã«ãããããè¡ã«å¯ŸããŠãé çªã« `[command]` +ã§æå®ããã Ex ã³ãã³ããåŒã³åºãã + +> :h :global + +`:move` ã³ãã³ã㯠`[range]:move {address}` ã®ããã«äœ¿ãã`[range]` +ã§æå®ãããç¯å²ã®è¡ã `{address}` ã§æå®ãããäœçœ®ã«ç§»åãããã + +> :h :move + +`:g/^/m0` ã®ããã«çµã¿åããããšãããã¹ãŠã®è¡ã1è¡ã〠+0è¡ç®(1è¡ç®ã®äž)ã«åããããšããåãããããããã¯ç¢ºãã«è¡ã®å
¥ãæ¿ãã«ãªã£ãŠããã + +ãªãã`:g/^/m0` ã¯å
šãŠã®è¡ãå
¥ãæ¿ãããã`:N,Mg/^/mN-1` ãšããããšã§ +Nè¡ç®ãã +Mè¡ç®ãåŠçç¯å²ãšããããæ¡åŒµã§ãããæã§ãããå
¥åããããã«ã¯ãããªãã®ã§ã次ã®ãããªã³ãã³ããçšæããã + +```vim +command! -bar -range=% + \ Reverse + \ <line1>,<line2>g/^/m<line1>-1 +``` + +ããã¯æã¿ã®åäœãããããå®éã«å®è¡ããŠã¿ããšå
šè¡ããã€ã©ã€ããããŠããŸããæ¬¡ç¯ã§è©³çްãè¿°ã¹ãã + +{#problem-of-global-command} +# `:g/^/m0` ã®åé¡ç¹ + +`:global` +ã³ãã³ãã¯åè¡ã«å¯ŸããŠãããã³ã°ãè¡ãéãçŸåšã®æ€çŽ¢ãã¿ãŒã³ãäžæžãããŠããŸãã`^` +ã¯è¡ã®å
é ã«ããããããããçµæãšããŠå
šãŠã®è¡ããã€ã©ã€ããããŠããŸãã`'hlsearch'` +ãªãã·ã§ã³ãç¡å¹ã«ããŠããå Žåãã®éãã§ã¯ãªããããã®å Žåã§ãçŽåã®æ€çŽ¢ãã¿ãŒã³ã倱ãããŠããŸããš +`n` ã³ãã³ããªã©ã®éã«äžäŸ¿ã§ããã + +> :h @/ + +{#solution} +# 解決ç + +::: note +[2020/9/28远èš] ããç°¡æœãªæ¹æ³ãèŠã€ããã®ã§æ¬¡ç¯ã«è¿œèšãã +::: + +åè¿°ãã `:Reverse` ã³ãã³ãã®å®çŸ©ãå°ãå€ããŠã次ã®ããã«ãã: + +```vim +function! s:reverse_lines(from, to) abort + execute printf("%d,%dg/^/m%d", a:from, a:to, a:from - 1) +endfunction + +command! -bar -range=% + \ Reverse + \ call <SID>reverse_lines(<line1>, <line2>) +``` + +å®è¡ããŠããã³ãã³ããå€ãã£ãããã§ã¯ãªããã颿°åŒã³åºããçµç±ããããã«ãããããã ãã§åè¿°ã®åé¡ã解決ããã + +ãã®çç±ã¯ããŠãŒã¶ãŒå®çŸ©é¢æ°ãå®è¡ããéã¯æ€çŽ¢ãã¿ãŒã³ãäžåºŠä¿åãããå®è¡ãçµäºããããšåŸ©å
ããããããçµæãšããŠæ€çŽ¢ãã¿ãŒã³ã +`^` ã§äžæžããããããšããªããªãã + +Vim ã®ãã«ããã該åœç®æãåŒçšãã (匷調ã¯çè
ã«ãã)ã + +> :h autocmd-searchpat +> +> *Autocommands do not change the current search patterns.* Vim saves the +> current search patterns before executing autocommands then restores them +> after the autocommands finish. This means that autocommands do not +> affect the strings highlighted with the 'hlsearch' option. + +ãã㯠autocommand +ã®å®è¡ã«é¢ããŠã®èšè¿°ã ãããããšåãããšããŠãŒã¶ãŒå®çŸ©é¢æ°ã®å®è¡æã«ãé©çšãããããã®ããšã¯ +`:nohlsearch` ã®ãã«ãã«ãããåãã該åœç®æãåŒçšãã +(匷調ã¯çè
ã«ãã)ã + +> :h :nohlsearch +> +> (ç¥) This command doesnât work in an autocommand, because the +> highlighting state is saved and restored when executing autocommands +> |autocmd-searchpat|. *Same thing for when invoking a user function.* + +ãã®ä»æ§ã«ããã`:g/^/m0` +ã®åŒã³åºãããŠãŒã¶ãŒå®çŸ©é¢æ°ã«åãåºãããšã§äžè¿°ã®åé¡ã解決ã§ããã + +{#solution-revised} +# 解決ç (æ¹èšç) + +::: note +[2020/9/28远èš] ããç°¡æœãªæ¹æ³ãèŠã€ãããã远èšãã +::: + +```vim +command! -bar -range=% + \ Reverse + \ keeppatterns <line1>,<line2>g/^/m<line1>-1 +``` + +ãŸãã«ãã®ããã® Exã³ãã³ãã`:keeppatterns` +ãååšããã`:keeppatterns {command}` +ã®ããã«äœ¿ããèªãã§åã®åŠããåŸãã«ç¶ã +Exã³ãã³ãããçŸåšã®æ€çŽ¢ãã¿ãŒã³ãä¿ã£ããŸãŸãå®è¡ãããã¯ããã«åãããããæå³ã衚çŸã§ããã + +> :h :keeppatterns diff --git a/vhosts/blog/content/posts/2021-10-02/vim-swap-order-of-selected-lines.ndoc b/vhosts/blog/content/posts/2021-10-02/vim-swap-order-of-selected-lines.ndoc deleted file mode 100644 index 149d038d..00000000 --- a/vhosts/blog/content/posts/2021-10-02/vim-swap-order-of-selected-lines.ndoc +++ /dev/null @@ -1,212 +0,0 @@ ---- -[article] -uuid = "665de47e-0ed6-405e-ad30-81c3c4592d45" -title = "Vimã§éžæããè¡ã®é çªãå
¥ãæ¿ãã" -description = "Vim ã§éžæããè¡ã®é çªãå
¥ãæ¿ããæ¹æ³ã" -tags = [ - "vim", -] - -[[article.revisions]] -date = "2021-10-02" -remark = "Qiita ããç§»æ€" ---- -<article> - <note> - ãã®èšäºã¯ Qiita ããç§»æ€ããŠãããã®ã§ãã - å
URL: https://qiita.com/nsfisis/items/4fefb361d9a693803520 - </note> - <section id="tl-dr"> - <h>TL; DR</h> - <codeblock language="vim"> - <![CDATA[ - " License: Public Domain - - command! -bar -range=% - \ Reverse - \ keeppatterns <line1>,<line2>g/^/m<line1>-1 - ]]> - </codeblock> - </section> - <section id="version"> - <h>ããŒãžã§ã³æ
å ±</h> - <p> - <code>:version</code> ã®äžéš - </p> - <blockquote> - <p> - VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Jan 26 2020 11:30:30) macOS - version Included patches: 1-148 Huge version without GUI. - </p> - </blockquote> - </section> - <section id="existing-solution"> - <h>ãã玹ä»ãããŠããææ³</h> - <section id="external-commands"> - <h><code>tac</code> / <code>tail</code></h> - <p> - <code>tac</code> ã <code>tail -r</code> ãªã©ã®å€éšã³ãã³ãã <code>!</code> - ã䜿ã£ãŠåŒã³åºãã眮ãæããã - </p> - <blockquote> - <p> - :h v_! - </p> - </blockquote> - <p> - <code>tac</code> ã³ãã³ãã <code>tail</code> ã® <code>-r</code> - ãªãã·ã§ã³ã¯ç°å¢ã«ãã£ãŠå©çšã§ããªãããšããããè€æ°ã®ç°å¢ãè¡ãæ¥ããå Žåã«æ¡çšãã¥ãã - </p> - </section> - <section id="global-command"> - <h><code>:g/^/m0</code></h> - <p> - ãã¡ãã¯å€éšã³ãã³ãã«é ŒãããVim ã®æ©èœã®ã¿ã䜿ãã<code>g</code> 㯠<code>:global</code> - ã³ãã³ãã®ã<code>m</code> 㯠<code>:move</code> ã³ãã³ãã®ç¥ - </p> - <p> - <code>:global</code> ã³ãã³ã㯠<code>:[range]global/{pattern}/[command]</code> - ã®ããã«äœ¿ãã<code>[range]</code> ã§æå®ãããç¯å²ã®è¡ã®ãã¡ã<code>{pattern}</code> - ã§æå®ãããæ€çŽ¢ãã¿ãŒã³ã«ãããããè¡ã«å¯ŸããŠãé çªã« <code>[command]</code> - ã§æå®ããã Ex ã³ãã³ããåŒã³åºãã - </p> - <blockquote> - <p> - :h :global - </p> - </blockquote> - <p> - <code>:move</code> ã³ãã³ã㯠<code>[range]:move {address}</code> ã®ããã«äœ¿ãã<code>[range]</code> - ã§æå®ãããç¯å²ã®è¡ã <code>{address}</code> ã§æå®ãããäœçœ®ã«ç§»åãããã - </p> - <blockquote> - <p> - :h :move - </p> - </blockquote> - <p> - <code>:g/^/m0</code> ã®ããã«çµã¿åããããšãããã¹ãŠã®è¡ã1è¡ã〠- 0è¡ç®(1è¡ç®ã®äž)ã«åããããšããåãããããããã¯ç¢ºãã«è¡ã®å
¥ãæ¿ãã«ãªã£ãŠããã - </p> - <p> - ãªãã<code>:g/^/m0</code> ã¯å
šãŠã®è¡ãå
¥ãæ¿ãããã<code>:N,Mg/^/mN-1</code> ãšããããšã§ - Nè¡ç®ãã - Mè¡ç®ãåŠçç¯å²ãšããããæ¡åŒµã§ãããæã§ãããå
¥åããããã«ã¯ãããªãã®ã§ã次ã®ãããªã³ãã³ããçšæããã - </p> - <codeblock language="vim"> - <![CDATA[ - command! -bar -range=% - \ Reverse - \ <line1>,<line2>g/^/m<line1>-1 - ]]> - </codeblock> - <p> - ããã¯æã¿ã®åäœãããããå®éã«å®è¡ããŠã¿ããšå
šè¡ããã€ã©ã€ããããŠããŸããæ¬¡ç¯ã§è©³çްãè¿°ã¹ãã - </p> - </section> - </section> - <section id="problem-of-global-command"> - <h><code>:g/^/m0</code> ã®åé¡ç¹</h> - <p> - <code>:global</code> - ã³ãã³ãã¯åè¡ã«å¯ŸããŠãããã³ã°ãè¡ãéãçŸåšã®æ€çŽ¢ãã¿ãŒã³ãäžæžãããŠããŸãã<code>^</code> - ã¯è¡ã®å
é ã«ããããããããçµæãšããŠå
šãŠã®è¡ããã€ã©ã€ããããŠããŸãã<code>'hlsearch'</code> - ãªãã·ã§ã³ãç¡å¹ã«ããŠããå Žåãã®éãã§ã¯ãªããããã®å Žåã§ãçŽåã®æ€çŽ¢ãã¿ãŒã³ã倱ãããŠããŸããš - <code>n</code> ã³ãã³ããªã©ã®éã«äžäŸ¿ã§ããã - </p> - <blockquote> - <p> - :h @/ - </p> - </blockquote> - </section> - <section id="solution"> - <h>解決ç</h> - <blockquote> - <p> - [2020/9/28远èš] ããç°¡æœãªæ¹æ³ãèŠã€ããã®ã§æ¬¡ç¯ã«è¿œèšãã - </p> - </blockquote> - <p> - åè¿°ãã <code>:Reverse</code> ã³ãã³ãã®å®çŸ©ãå°ãå€ããŠã次ã®ããã«ãã: - </p> - <codeblock language="vim"> - <![CDATA[ - function! s:reverse_lines(from, to) abort - execute printf("%d,%dg/^/m%d", a:from, a:to, a:from - 1) - endfunction - - command! -bar -range=% - \ Reverse - \ call <SID>reverse_lines(<line1>, <line2>) - ]]> - </codeblock> - <p> - å®è¡ããŠããã³ãã³ããå€ãã£ãããã§ã¯ãªããã颿°åŒã³åºããçµç±ããããã«ãããããã ãã§åè¿°ã®åé¡ã解決ããã - </p> - <p> - ãã®çç±ã¯ããŠãŒã¶ãŒå®çŸ©é¢æ°ãå®è¡ããéã¯æ€çŽ¢ãã¿ãŒã³ãäžåºŠä¿åãããå®è¡ãçµäºããããšåŸ©å
ããããããçµæãšããŠæ€çŽ¢ãã¿ãŒã³ã - <code>^</code> ã§äžæžããããããšããªããªãã - </p> - <p> - Vim ã®ãã«ããã該åœç®æãåŒçšãã (匷調ã¯çè
ã«ãã)ã - </p> - <blockquote> - <p> - :h autocmd-searchpat - </p> - <p> - <strong>Autocommands do not change the current search patterns.</strong> Vim saves the - current search patterns before executing autocommands then restores them - after the autocommands finish. This means that autocommands do not - affect the strings highlighted with the `hlsearch' option. - </p> - </blockquote> - <p> - ãã㯠autocommand - ã®å®è¡ã«é¢ããŠã®èšè¿°ã ãããããšåãããšããŠãŒã¶ãŒå®çŸ©é¢æ°ã®å®è¡æã«ãé©çšãããããã®ããšã¯ - <code>:nohlsearch</code> ã®ãã«ãã«ãããåãã該åœç®æãåŒçšãã - (匷調ã¯çè
ã«ãã)ã - </p> - <blockquote> - <p> - :h :nohlsearch - </p> - <p> - (ç¥) This command doesnât work in an autocommand, because the - highlighting state is saved and restored when executing autocommands - |autocmd-searchpat|. <strong>Same thing for when invoking a user function.</strong> - </p> - </blockquote> - <p> - ãã®ä»æ§ã«ããã<code>:g/^/m0</code> - ã®åŒã³åºãããŠãŒã¶ãŒå®çŸ©é¢æ°ã«åãåºãããšã§äžè¿°ã®åé¡ã解決ã§ããã - </p> - </section> - <section id="solution-revised"> - <h>解決ç (æ¹èšç)</h> - <blockquote> - <p> - [2020/9/28远èš] ããç°¡æœãªæ¹æ³ãèŠã€ãããã远èšãã - </p> - </blockquote> - <codeblock language="vim"> - <![CDATA[ - command! -bar -range=% - \ Reverse - \ keeppatterns <line1>,<line2>g/^/m<line1>-1 - ]]> - </codeblock> - <p> - ãŸãã«ãã®ããã® Exã³ãã³ãã<code>:keeppatterns</code> - ãååšããã<code>:keeppatterns {command}</code> - ã®ããã«äœ¿ããèªãã§åã®åŠããåŸãã«ç¶ã - Exã³ãã³ãããçŸåšã®æ€çŽ¢ãã¿ãŒã³ãä¿ã£ããŸãŸãå®è¡ãããã¯ããã«åãããããæå³ã衚çŸã§ããã - </p> - <blockquote> - <p> - :h :keeppatterns - </p> - </blockquote> - </section> -</article> diff --git a/vhosts/blog/content/posts/2022-04-09/phperkaigi-2022-tokens.dj b/vhosts/blog/content/posts/2022-04-09/phperkaigi-2022-tokens.dj new file mode 100644 index 00000000..e0fe0279 --- /dev/null +++ b/vhosts/blog/content/posts/2022-04-09/phperkaigi-2022-tokens.dj @@ -0,0 +1,489 @@ +--- +[article] +uuid = "f4985d54-0907-4449-8101-0fcd382f9e02" +title = "PHPerKaigi 2022 ããŒã¯ã³åé¡ã®è§£èª¬" +description = "PHPerKaigi 2022 ã§ç§ãäœæãã PHPer ãã£ã¬ã³ãžåé¡ã解説ããã" +tags = [ + "conference", + "php", + "phperkaigi", +] + +[[article.revisions]] +date = "2022-04-09" +remark = "å
¬é" + +[[article.revisions]] +date = "2022-04-16" +remark = "2åç®ã3åç®ã®è§£èª¬ã远å ã1åç®ã«å ç" +--- +{#intro} +# ã¯ããã« + +æ¬æ¥éå§ããã [PHPerKaigi 2022](https://phperkaigi.jp/2022/) ã® PHPer +ãã£ã¬ã³ãžã«ãããŠãåŒç€Ÿ +[ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ](https://www.dgcircus.com/) ã®åé¡ã +3åäœæããããã®èšäºã§ã¯ããããã®åé¡ã®è§£èª¬ããããªãã + +ãªããžããªã¯ãã¡ã: https://github.com/nsfisis/PHPerKaigi2022-tokens + +{#q1-brainfuck} +# 第1å brainf_ck.php + +ãœãŒã¹ã³ãŒãã¯ãã¡ããå®è¡ã«ã¯ PHP 8.1 以äžãå¿
èŠãªã®ã§æ³šæã + +```php +<?php + +declare(strict_types=0O1); + +namespace Dgcircus\PHPerKaigi\Y2022; + +/** + * @todo + * Run this program to acquire a PHPer token. + */ + +https://creativecommons.org/publicdomain/zero/1.0/ + +\error_reporting(~+!'We are hiring!'); + +$z = fn($f) => (fn($x) => $f(fn(...$xs) => $x($x)(...$xs)))(fn($x) => $f(fn(...$xs) => $x($x)(...$xs))); +$id = \spl_object_id(...); +$put = fn($c) => \printf('%c', $c); +$mm = fn($p, $n) => new \ArrayObject(\array_fill(+!![], $n, $p)); + +$ð = fn($m, $p, $b, $e, $mp, $pc) => [++$mp, ++$pc]; +$ð = fn($m, $p, $b, $e, $mp, $pc) => [--$mp, ++$pc]; +$ð = fn($m, $p, $b, $e, $mp, $pc) => [$mp, ++$pc, ++$m[$mp]]; +$ð = fn($m, $p, $b, $e, $mp, $pc) => [$mp, ++$pc, --$m[$mp]]; +$ð = fn($m, $p, $b, $e, $mp, $pc) => [$mp, ++$pc, $put($m[$mp])]; +$ð€¡ = fn($m, $p, $b, $e, $mp, $pc) => match ($m[$mp]) { + +!![] => [$mp, $z(fn($loop) => fn($pc, $n) => match ($id($p[$pc])) { + $b => $loop(++$pc, ++$n), + $e => $n === +!![] ? ++$pc : $loop(++$pc, --$n), + default => $loop(++$pc, $n), + })($pc, -![])], + default => [$mp, ++$pc], +}; +$ðª = fn($m, $p, $b, $e, $mp, $pc) => match ($m[$mp]) { + +!![] => [$mp, ++$pc], + default => [$mp, $z(fn($loop) => fn($pc, $n) => match ($id($p[$pc])) { + $e => $loop(--$pc, ++$n), + $b => $n === +!![] ? $pc+![] : $loop(--$pc, --$n), + default => $loop(--$pc, $n), + })($pc, -![])], +}; +$ð = fn($p) => $z(fn($loop) => fn($m, $p, $b, $e, $mp, $pc) => + isset($p[$pc]) && $loop($m, $p, $b, $e, ...($p[$pc]($m, $p, $b, $e, $mp, $pc))) +)($mm(+!![], +(![].![])), $p, $id($ð€¡), $id($ðª), +!![], +!![]); + +$ð([ + $ð, $ð, $ð, $ð, $ð, $ð, $ð, $ð, $ð, $ð, + $ð€¡, + $ð, $ð, $ð, $ð, + $ð, $ð, $ð, $ð, $ð, $ð, + $ð, $ð, $ð, $ð, $ð, $ð, $ð, $ð, $ð, $ð, $ð, $ð, $ð, + $ð, $ð, $ð, $ð, $ð, $ð, $ð, $ð, $ð, $ð, $ð, + $ð, $ð, $ð, $ð, $ð, + $ðª, + $ð, $ð, $ð, $ð, $ð, $ð, $ð, + $ð, $ð, $ð, + $ð, $ð, $ð, $ð, $ð, + $ð, $ð, $ð, $ð, $ð, + $ð, $ð, $ð, + $ð, $ð, + $ð, $ð, + $ð, $ð, $ð, $ð, $ð, + $ð, $ð, $ð, $ð, $ð, $ð, $ð, $ð, + $ð, $ð, $ð, $ð, $ð, $ð, + $ð, $ð, + $ð, $ð, $ð, $ð, + $ð, $ð, $ð, + $ð, $ð, +]); +``` + +ãã®åé¡ã¯ãåã«é©åãªããŒãžã§ã³ã® PHP ã§åããã°ããŒã¯ã³ãåŸãããã + +{#commentary} +## 解説 + +{#emoji} +### çµµæå + +ãŸãç®ã«ã€ãã®ã¯å€§éã®çµµæåã ããã PHP +ã¯èå¥åã«äœ¿çšã§ããæåã®ç¯å²ãåºããçµµæåã䜿ãããšãã§ããã + +{#brainfuck} +### ããã°ã©ã å
šäœ + +Brainf\*ck ã®ã€ã³ã¿ããªã¿ãšããã°ã©ã ã«ãªã£ãŠããã Brainf\*ck +ãšã¯ãé£è§£ããã°ã©ãã³ã°èšèªã®ã²ãšã€ã§ãããããã§èª¬æããããã +Wikipedia ã®è©²åœããŒãžãèªãã æ¹ãããã + +https://ja.wikipedia.org/wiki/Brainfuck + +ãªããbrainf*ck ããã°ã©ã ãæ®éã®æžãæ¹ã§æžããšã次ã®ããã«ãªãã + +``` ++ + + + + + + + + + +[ + > + + + + > + + + + + + > + + + + + + + + + + + + + > + + + + + + + + + + + < < < < - +] +> + + + + + . +- - . +> - - - . +> - - - . +- - . +- . +< . +> > - - . ++ + + + + + + . +< - - - - . +< . +> + + . +> - . +< . +``` + +å®è¡çµæã¯ãã¡ã: https://ideone.com/22VWmb + +ããããã®çµµæåã§è¡šããã颿°ããååœä»€ã«å¯Ÿå¿ããŠããã + +* `$ð`: `>` +* `$ð`: `<` +* `$ð`: `+` +* `$ð`: `-` +* `$ð`: `.` +* `$ð€¡`: `[` +* `$ðª`: `]` + +`,` (å
¥å) ã«å¯Ÿå¿ãã颿°ã¯ãªã +(ãã®ããã°ã©ã ã§ã¯äœ¿ããªãã®ã§çšæããŠããªã)ã + +ãªãã`$ð` ã¯ãããã main 颿°ã§ãããããã°ã©ã ã®å®è¡éšåã§ããã + +{#emoji-selection} +### çµµæåã®éžæ + +ããããæå³ã«åèŽããããéžãã§ãããã`$ð€¡` ãš `$ðª` +ã¯åŒç€Ÿããžã¿ã«ãµãŒã«ã¹ã«ã¡ãªãã§ããã ãŸãã`$ð` 㯠PHP +ã®ãã¹ã³ããã®è±¡ã«ç±æ¥ããã + +{#strict-types} +### strict_types + +`declare` æã® `strict_types` ã«æå®ã§ããã®ã¯ã`0` ã `1` +ã®æ°å€ãªãã©ã«ã ãã `0x0` ã `0b1` ã®ãããªå€ãåãä»ããã ä»åã¯ãPHP +8.1 ãã远å ãããã`0O` ãŸã㯠`0o` ããå§ãŸãå
«é²æ°ãªãã©ã«ã䜿ã£ãã + +{#url} +### URL + +ãœãŒã¹ã³ãŒãã®ã©ã€ã»ã³ã¹ã瀺ãããã®éšåã ãã + +```php +https://creativecommons.org/publicdomain/zero/1.0/ +``` + +å®å
šã«åæ³ãª PHP ã®ã³ãŒãã§ããã `https:` éšåã¯ã©ãã«ã`//` +以éã¯è¡ã³ã¡ã³ãã«ãªã£ãŠããã + +{#numbers} +### ãªãã©ã«ãªãã§æ°å€ãçæãã + +ãœãŒã¹ã³ãŒãäžã«ãã»ãšãã©æ°å€ãªãã©ã«ãæžãããŠããªãããšã«ãæ°ã¥ãã ãããã +PHP ã§ã¯ãå倿ãå©çšããããšã§ä»»æã®æŽæ°ãäœãåºãããšãã§ããã + +```php +assert(0 === +!![]); +assert(1 === +![]); +assert(2 === ![]+![]); +assert(3 === ![]+![]+![]); +assert(10 === +(![].+!![])); +``` + +`[]` ã« `!` ãé©çšãããš `true` ãè¿ã£ãŠãããããã« `+` +ãé©çšãããšã`bool` ãã `int` ãã®å倿ãèµ°ãã`1` ãçæãããã`10` +ã¯ããã«ããªãããŒã ããŸã `1` ãš `0` ãäœãã`.` ã§æååãšããŠçµåãã +(`'10'`)ãããã« `+` ãé©çšãããšã`string` ãã `int` +ãžã®å倿ãèµ°ãã`10` ãçãŸãã (ã³ãŒãéã«é çããªããªãã`1` ã 10 +åè¶³ãåãããŠããã¡ãã 10 ãäœãã)ã + +ãŸãã`error_reporting` ã«æå®ããŠããã®ã¯ `-1` ã§ããã ããã¯ã`!` +ã«ãã£ãŠæååã `false` ã«ãã`+` ã«ãã£ãŠ `false` ã `0` +ã«ããããã«ãããå転ã㊠`-1` ã«ããŠããã + +{#conditionals} +### `if` æãªãã§æ¡ä»¶åå² + +äžé
æŒç®åãªãã `match` åŒã䜿ãããšã§ã`if` +ãäžåæžããã«æ¡ä»¶åå²ãã§ããã ãŸãã`&&` / `||` ã䜿ããããšãããã +é
å»¶è©äŸ¡ãäžèŠãªã±ãŒã¹ã§ã¯ã`[$t, $f][$cond]` +ã®ãããªåœ¢ã§åå²ããããšãã§ããã + +{#loops} +### `while`ã`for` æãªãã§ã«ãŒã + +äžåç¹ã³ã³ãããŒã¿ã䜿ã£ãŠç¡åååž°ãã +(詳ãã説æã¯çç¥ããããããã®åèªã§æ€çŽ¢ããŠã»ãã)ã ããã§ã¯ãäžè¬ã« +Z ã³ã³ãããŒã¿ãšããŠç¥ããããã®ã䜿ã£ã (`$z`)ã + +å®éã®ãšããã`$ð€¡` ã `$ðª`ã`$ð` ã¯ãäžåºŠ Scheme (Lisp ã®äžçš®) +ã§æžããŠãã PHP ã«ç¿»èš³ãã圢ã§èšè¿°ããã + +ãªããPHP ã¯æ«å°Ÿååž°ã®æé©åããããªããªã (å°ãªããšãä»ã®ãšããã¯) +ã®ã§ã ããŸãã«é·ã brainf*ck +ããã°ã©ã ãæžããšã¹ã¿ãã¯ãªãŒããŒãããŒããã + +{#q2-riddle} +# 第2å riddle.php + +ãœãŒã¹ã³ãŒãã¯ãã¡ããå®è¡ã«ã¯ PHP 8.0 以äžãå¿
èŠãªã®ã§æ³šæã + +```php +<?php + +/********************************************************* + * This program displays a PHPer token. * + * Guess 'N'. * + * * + * Hints: * + * - N itself has no special meaning, e.g., 42, 8128, * + * it is selected at random. * + * - Each element of $token represents a single letter. * + * - One letter consists of 5x5 cells. * + * - Remember, the output is a complete PHPer token. * + * * + * License: * + * https://creativecommons.org/publicdomain/zero/1.0/ * + *********************************************************/ +const N = 0 /* Change it to your answer. */; +assert(0 <= N && N <= 0b11111_11111_11111_11111_11111); + +$token = [ + 0x14B499C, + 0x0BE34CC, 0x01C9C69, + 0x0ECA069, 0x01C2449, 0x0FDB166, 0x01C9C69, + 0x01C1C66, 0x0FC1C47, 0x01C1C66, + 0x10C5858, 0x1E4E3B8, 0x1A2F2F8, +]; +foreach ($token as $x) { + $x = $x ^ N; + + $x = sprintf('%025b', $x); + $x = str_replace(search: ['0', '1'], replace: [' ', '#'], subject: $x); + $x = implode("\n", str_split($x, length: 5)); + echo "{$x}\n\n"; +} +``` + +ããŠããã®åé¡ã¯ããã»ã©ã®ããã«åçŽã«å®è¡ããã ãã§ã¯ãè¬ã®ãããã¯ã衚瀺ãããã ãã§ããŒã¯ã³ã¯åŸãããªãã +ããŒã¯ã³ãåŸãããã«ã¯ããœãŒã¹ã³ãŒããèªã¿ã宿° `N` +ãç¹å®ããå¿
èŠãããã + +ããã§ã¯ãç§ã®æ³å®è§£ã解説ããã + +{#code-reading} +## èªè§£ + +ãŸãã¯ãœãŒã¹ã³ãŒããèªãã§ããã + +```php +$token = [ + // ç¥ +]; +``` + +æ°å€ãããªã `$token` ããããåèŠçŽ ãã«ãŒãããŠããã + +```php +$x = $x ^ N; +``` + +ãŸãã¯æä»çè«çå (xor) ãåãã + +```php +$x = sprintf('%025b', $x); +``` + +äºé²æ°ã«å€æããŠã + +```php +$x = str_replace(search: ['0', '1'], replace: [' ', '#'], subject: $x); +``` + +0 ã空çœã«ã1 ã `#` ã«ãã + +```php +$x = implode("\n", str_split($x, length: 5)); +``` + +5æåããšã«åºåã£ãããšãæ¹è¡ã§çµåããŠããã + +{#hint} +## ãã³ã + +次ã«ããœãŒã¹ã³ãŒãã«æžããŠãããã³ããèªãã§ããã + +* `N` ããèªäœã¯ã42 ã 8128 ãšãã£ããããªç¹å¥ãªæå³ãæãããã©ã³ãã ã«æ±ºããããŠãã +* `$token` ã®åèŠçŽ ã¯ã1æåã衚ã +* 1æå㯠5x5 ã®ã»ã«ãããªã +* åºåãããã®ã¯ãå®å
šãª PHPer ããŒã¯ã³ã§ãã + +ããã§ãPHPer ããŒã¯ã³ã¯å¿
ã `#` èšå·ããå§ãŸãããšãæãã ããšã +`$token` ã®æåã®æ°å `0x14B499C` ã¯ã倿ã®çµæ `#` +ã«ãªãã®ã§ã¯ãªãããšäºæ³ããã (ãªãããã®ããšã¯ããªããžããªã® README +ãã¡ã€ã«ã«è¿œå ãã³ããšããŠæžãããŠãã)ã + +{#solve} +## è§£ã + +ãããŸã§ãããã°ãããšäžæ©ã§è§£ãããããªãã¡ã`0x14B499C` ã `#` +ã«å€æããããã㪠`N` ãèŠã€ããã°ããã + +`N` ã¯é«ã
+ +```php +assert(0 <= N && N <= 0b11111_11111_11111_11111_11111); +``` + +ãªã®ã§ãã«ãŒããã©ãŒã¹ããŠãããããããã§ã¯ãã«ãŒããã©ãŒã¹ããªãæ¹æ³ã玹ä»ããã + +```php +<?php + +$x = 0x14B499C; + +$x = $x ^ N; + +$x = sprintf('%025b', $x); +$x = str_replace(search: ['0', '1'], replace: [' ', '#'], subject: $x); +$x = implode("\n", str_split($x, length: 5)); + +assert($x === +" # # \n" . +"#####\n" . +" # # \n" . +"#####\n" . +" # # "); +``` + +ãã®äžé£ã®å€æã«å¯Ÿããé倿ãèãããšã次ã®ããã«ãªãã + +```php +<?php + +$x = +" # # \n" . +"#####\n" . +" # # \n" . +"#####\n" . +" # # "; + +$x = implode('', explode("\n", $x)); +$x = str_replace(search: [' ', '#'], replace: ['0', '1'], subject: $x); +$x = bindec($x); + +$n = $x ^ 0x14B499C; + +echo "N = $n\n"; +``` + +ãããå®è¡ãããšã`N` ãåŸãããã + +{#q3-toquine} +# 第3å toquine.php + +ãœãŒã¹ã³ãŒãã¯ãã¡ãã + +```php +<?php + +// License: https://creativecommons.org/publicdomain/zero/1.0/ +// This is a quine-like program to generate a PHPer token. +// Execute it like this: php toquine.php | php | php | php | ... + +$s = <<<'Q' +<?cuc +// Yvprafr: uggcf://perngvirpbzzbaf.bet/choyvpqbznva/mreb/1.0/ +// Guvf vf n dhvar-yvxr cebtenz gb trarengr n CUCre gbxra. +// Rkrphgr vg yvxr guvf: cuc gbdhvar.cuc | cuc | cuc | cuc | ... +%f$f = %f; +$f = fge_ebg13($f); $kf = [ +%f, +]; +$g = ahyy.snyfr; sbe ($v = 0; $v <= vagqvi(__YVAR__-035,6); ++$v) vs (!vffrg($kf[$v])) oernx; ryfr +$g .= vzcybqr("\a", fge_fcyvg(fge_ercynpr(['0','1'], [' ','##'], fcevags(pue(37) . '025o', $kf[$v])), 012)) . "\a\a"; +$jf = neenl_znc(sa($j) => vzcybqr(', ', $j), neenl_puhax(neenl_znc(sa($k) => fcevags('0k' . pue(37) . '07K', $k), $kf), 10)); +cevags($f, $g, fge_ebg13("<<<'Q'\a{$f}\aQ"), vzcybqr(",\a", $jf)); +Q; +$s = str_rot13($s); $xs = [ +0x0AFABEA, 0x1F294A7, 0x1F2109F, 0x1F294A7, 0x0002800, 0x1F2109F, 0x0117041, 0x1F294A7, 0x1FAD6B5, 0x1F295B7, +0x010FC21, 0x1FAD6B5, 0x1151151, 0x010FC21, 0x1F294A7, 0x1F295B7, 0x1FAD6B5, 0x1F294A7, 0x1F295B7, 0x1F8C63F, +0x1F8C631, 0x1FAD6B5, 0x17AD6BD, 0x17AD6BD, 0x1F8C63F, 0x1F295B7, +]; +$t = null.false; for ($i = 0; $i <= intdiv(__LINE__-035,6); ++$i) if (!isset($xs[$i])) break; else +$t .= implode("\n", str_split(str_replace(['0','1'], [' ','##'], sprintf(chr(37) . '025b', $xs[$i])), 012)) . "\n\n"; +$ws = array_map(fn($w) => implode(', ', $w), array_chunk(array_map(fn($x) => sprintf('0x' . chr(37) . '07X', $x), $xs), 10)); +printf($s, $t, str_rot13("<<<'D'\n{$s}\nD"), implode(",\n", $ws)); +``` + +ã³ã¡ã³ãã«ããããšãããæ¬¡ã®ããã«ããŠå®è¡ããã°çããã§ãŠããã + +```shell-session +$ php toquine.php | php | php | php | ... +``` + +å®éã«ã¯ããå°ããã€ãã§ç¹ããªããã°ãªããªãã + +{#commentary} +## 解説 + +{#quine} +### ããã°ã©ã å
šäœ + +ã³ã¡ã³ãã«ããããšããããã㯠quine (颚) ã®ããã°ã©ã ã«ãªã£ãŠããã +Quine +ãšã¯ãèªåã®ãœãŒã¹ã³ãŒãããã£ãããã®ãŸãŸåºåãããããªããã°ã©ã ã®ããšã§ããã + +ãã®ããã°ã©ã ã¯ãå®è¡ãããšèªèº«ãšã»ãšãã©åãããã°ã©ã ãåºåããã +ç°ãªãã®ã¯ããŒã¯ã³ã«ãªã£ãŠããéšåã®ã¿ã§ããã + +{#tokens} +### ããŒã¯ã³ + +`$xs` ãããŒã¯ã³ã«å¯Ÿå¿ããŠããã倿ã®ããžãã¯ã¯ `riddle.php` +ãšã»ãŒåããªã®ã§çç¥ããã + +{#states} +### ç¶æ
ä¿æ + +ããŒã¯ã³ã®äœæåç®ãŸã§åºåããããããœãŒã¹ã³ãŒããå€ããã« (quine +ãªã®ã§) èŠããŠããå¿
èŠãããã +ãã®ããã°ã©ã ã§ã¯ãããŒã¯ã³ãåºåããããšãœãŒã¹ã³ãŒããã ãã ããšé·ããªã£ãŠããã®ãå©çšããŠã`__LINE__` +ããæ
å ±ãååŸããŠããã + +{#rot-13} +### ROT 13 + +Quine ã¯ãçŽ æŽã«æžããšããã°ã©ã ã®äžéšã 2åèšè¿°ãããŠããŸãã +ãããããŸãçŸãããªãã®ã§ã`toquine.php` ã§ã¯ãROT 13 +倿ã䜿ã£ãŠé£èªåããã + +ããã«ããŠããªããããªãã®ãæšæºã©ã€ãã©ãªã«âŠâŠã + +{#outro} +# ãããã« + +è§£ããŠããã ããã¿ãªããããŸããé£æåºŠèª¿æŽã«ã€ããã£ãŠããã ãã瀟å
ã®ã¿ãªãããããããšãããããŸããã + +ä»åã¯çŽåã«äœãã¯ãããã®ãããã3åã ããã€äœ¿ãå€ããããã¿ã°ããã«ãªã£ãŠããŸããŸãããã +æ¥å¹Žã¯ 5åãããé¢çœãåé¡ãæã£ãŠãããŸãã + +å®ã¯ããäœãã¯ãããŠããã®ã§ãã©ããæ¥å¹ŽããããŸãããã«âŠâŠã diff --git a/vhosts/blog/content/posts/2022-04-09/phperkaigi-2022-tokens.ndoc b/vhosts/blog/content/posts/2022-04-09/phperkaigi-2022-tokens.ndoc deleted file mode 100644 index c0540482..00000000 --- a/vhosts/blog/content/posts/2022-04-09/phperkaigi-2022-tokens.ndoc +++ /dev/null @@ -1,560 +0,0 @@ ---- -[article] -uuid = "f4985d54-0907-4449-8101-0fcd382f9e02" -title = "PHPerKaigi 2022 ããŒã¯ã³åé¡ã®è§£èª¬" -description = "PHPerKaigi 2022 ã§ç§ãäœæãã PHPer ãã£ã¬ã³ãžåé¡ã解説ããã" -tags = [ - "conference", - "php", - "phperkaigi", -] - -[[article.revisions]] -date = "2022-04-09" -remark = "å
¬é" - -[[article.revisions]] -date = "2022-04-16" -remark = "2åç®ã3åç®ã®è§£èª¬ã远å ã1åç®ã«å ç" ---- -<article> - <section id="intro"> - <h>ã¯ããã«</h> - <p> - æ¬æ¥éå§ããã <a href="https://phperkaigi.jp/2022/">PHPerKaigi 2022</a> ã® PHPer - ãã£ã¬ã³ãžã«ãããŠãåŒç€Ÿ - <a href="https://www.dgcircus.com/">ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ</a> ã®åé¡ã - 3åäœæããããã®èšäºã§ã¯ããããã®åé¡ã®è§£èª¬ããããªãã - </p> - <p> - ãªããžããªã¯ãã¡ã: https://github.com/nsfisis/PHPerKaigi2022-tokens - </p> - </section> - <section id="q1-brainfuck"> - <h>第1å brainf_ck.php</h> - <p> - ãœãŒã¹ã³ãŒãã¯ãã¡ããå®è¡ã«ã¯ PHP 8.1 以äžãå¿
èŠãªã®ã§æ³šæã - </p> - <codeblock language="php"> - <![CDATA[ - <?php - - declare(strict_types=0O1); - - namespace Dgcircus\PHPerKaigi\Y2022; - - /** - * @todo - * Run this program to acquire a PHPer token. - */ - - https://creativecommons.org/publicdomain/zero/1.0/ - - \error_reporting(~+!'We are hiring!'); - - $z = fn($f) => (fn($x) => $f(fn(...$xs) => $x($x)(...$xs)))(fn($x) => $f(fn(...$xs) => $x($x)(...$xs))); - $id = \spl_object_id(...); - $put = fn($c) => \printf('%c', $c); - $mm = fn($p, $n) => new \ArrayObject(\array_fill(+!![], $n, $p)); - - $ð = fn($m, $p, $b, $e, $mp, $pc) => [++$mp, ++$pc]; - $ð = fn($m, $p, $b, $e, $mp, $pc) => [--$mp, ++$pc]; - $ð = fn($m, $p, $b, $e, $mp, $pc) => [$mp, ++$pc, ++$m[$mp]]; - $ð = fn($m, $p, $b, $e, $mp, $pc) => [$mp, ++$pc, --$m[$mp]]; - $ð = fn($m, $p, $b, $e, $mp, $pc) => [$mp, ++$pc, $put($m[$mp])]; - $ð€¡ = fn($m, $p, $b, $e, $mp, $pc) => match ($m[$mp]) { - +!![] => [$mp, $z(fn($loop) => fn($pc, $n) => match ($id($p[$pc])) { - $b => $loop(++$pc, ++$n), - $e => $n === +!![] ? ++$pc : $loop(++$pc, --$n), - default => $loop(++$pc, $n), - })($pc, -![])], - default => [$mp, ++$pc], - }; - $ðª = fn($m, $p, $b, $e, $mp, $pc) => match ($m[$mp]) { - +!![] => [$mp, ++$pc], - default => [$mp, $z(fn($loop) => fn($pc, $n) => match ($id($p[$pc])) { - $e => $loop(--$pc, ++$n), - $b => $n === +!![] ? $pc+![] : $loop(--$pc, --$n), - default => $loop(--$pc, $n), - })($pc, -![])], - }; - $ð = fn($p) => $z(fn($loop) => fn($m, $p, $b, $e, $mp, $pc) => - isset($p[$pc]) && $loop($m, $p, $b, $e, ...($p[$pc]($m, $p, $b, $e, $mp, $pc))) - )($mm(+!![], +(![].![])), $p, $id($ð€¡), $id($ðª), +!![], +!![]); - - $ð([ - $ð, $ð, $ð, $ð, $ð, $ð, $ð, $ð, $ð, $ð, - $ð€¡, - $ð, $ð, $ð, $ð, - $ð, $ð, $ð, $ð, $ð, $ð, - $ð, $ð, $ð, $ð, $ð, $ð, $ð, $ð, $ð, $ð, $ð, $ð, $ð, - $ð, $ð, $ð, $ð, $ð, $ð, $ð, $ð, $ð, $ð, $ð, - $ð, $ð, $ð, $ð, $ð, - $ðª, - $ð, $ð, $ð, $ð, $ð, $ð, $ð, - $ð, $ð, $ð, - $ð, $ð, $ð, $ð, $ð, - $ð, $ð, $ð, $ð, $ð, - $ð, $ð, $ð, - $ð, $ð, - $ð, $ð, - $ð, $ð, $ð, $ð, $ð, - $ð, $ð, $ð, $ð, $ð, $ð, $ð, $ð, - $ð, $ð, $ð, $ð, $ð, $ð, - $ð, $ð, - $ð, $ð, $ð, $ð, - $ð, $ð, $ð, - $ð, $ð, - ]); - ]]> - </codeblock> - <p> - ãã®åé¡ã¯ãåã«é©åãªããŒãžã§ã³ã® PHP ã§åããã°ããŒã¯ã³ãåŸãããã - </p> - <section id="commentary"> - <h>解説</h> - <section id="emoji"> - <h>çµµæå</h> - <p> - ãŸãç®ã«ã€ãã®ã¯å€§éã®çµµæåã ããã PHP - ã¯èå¥åã«äœ¿çšã§ããæåã®ç¯å²ãåºããçµµæåã䜿ãããšãã§ããã - </p> - </section> - <section id="brainfuck"> - <h>ããã°ã©ã å
šäœ</h> - <p> - Brainf*ck ã®ã€ã³ã¿ããªã¿ãšããã°ã©ã ã«ãªã£ãŠããã Brainf*ck - ãšã¯ãé£è§£ããã°ã©ãã³ã°èšèªã®ã²ãšã€ã§ãããããã§èª¬æããããã - Wikipedia ã®è©²åœããŒãžãèªãã æ¹ãããã - </p> - <p> - https://ja.wikipedia.org/wiki/Brainfuck - </p> - <p> - ãªããbrainf*ck ããã°ã©ã ãæ®éã®æžãæ¹ã§æžããšã次ã®ããã«ãªãã - </p> - <codeblock> - <![CDATA[ - + + + + + + + + + + - [ - > + + + - > + + + + + - > + + + + + + + + + + + + - > + + + + + + + + + + - < < < < - - ] - > + + + + + . - - - . - > - - - . - > - - - . - - - . - - . - < . - > > - - . - + + + + + + + . - < - - - - . - < . - > + + . - > - . - < . - ]]> - </codeblock> - <p> - å®è¡çµæã¯ãã¡ã: https://ideone.com/22VWmb - </p> - <p> - ããããã®çµµæåã§è¡šããã颿°ããååœä»€ã«å¯Ÿå¿ããŠããã - </p> - <ul> - <li><code>$ð</code>: <code>></code></li> - <li><code>$ð</code>: <code><</code></li> - <li><code>$ð</code>: <code>+</code></li> - <li><code>$ð</code>: <code>-</code></li> - <li><code>$ð</code>: <code>.</code></li> - <li><code>$ð€¡</code>: <code>[</code></li> - <li><code>$ðª</code>: <code>]</code></li> - </ul> - <p> - <code>,</code> (å
¥å) ã«å¯Ÿå¿ãã颿°ã¯ãªã - (ãã®ããã°ã©ã ã§ã¯äœ¿ããªãã®ã§çšæããŠããªã)ã - </p> - <p> - ãªãã<code>$ð</code> ã¯ãããã main 颿°ã§ãããããã°ã©ã ã®å®è¡éšåã§ããã - </p> - </section> - <section id="emoji-selection"> - <h>çµµæåã®éžæ</h> - <p> - ããããæå³ã«åèŽããããéžãã§ãããã<code>$ð€¡</code> ãš <code>$ðª</code> - ã¯åŒç€Ÿããžã¿ã«ãµãŒã«ã¹ã«ã¡ãªãã§ããã ãŸãã<code>$ð</code> 㯠PHP - ã®ãã¹ã³ããã®è±¡ã«ç±æ¥ããã - </p> - </section> - <section id="strict-types"> - <h>strict_types</h> - <p> - <code>declare</code> æã® <code>strict_types</code> ã«æå®ã§ããã®ã¯ã<code>0</code> ã <code>1</code> - ã®æ°å€ãªãã©ã«ã ãã <code>0x0</code> ã <code>0b1</code> ã®ãããªå€ãåãä»ããã ä»åã¯ãPHP - 8.1 ãã远å ãããã<code>0O</code> ãŸã㯠<code>0o</code> ããå§ãŸãå
«é²æ°ãªãã©ã«ã䜿ã£ãã - </p> - </section> - <section id="url"> - <h>URL</h> - <p> - ãœãŒã¹ã³ãŒãã®ã©ã€ã»ã³ã¹ã瀺ãããã®éšåã ãã - </p> - <codeblock language="php"> - <![CDATA[ - https://creativecommons.org/publicdomain/zero/1.0/ - ]]> - </codeblock> - <p> - å®å
šã«åæ³ãª PHP ã®ã³ãŒãã§ããã <code>https:</code> éšåã¯ã©ãã«ã<code>//</code> - 以éã¯è¡ã³ã¡ã³ãã«ãªã£ãŠããã - </p> - </section> - <section id="numbers"> - <h>ãªãã©ã«ãªãã§æ°å€ãçæãã</h> - <p> - ãœãŒã¹ã³ãŒãäžã«ãã»ãšãã©æ°å€ãªãã©ã«ãæžãããŠããªãããšã«ãæ°ã¥ãã ãããã - PHP ã§ã¯ãå倿ãå©çšããããšã§ä»»æã®æŽæ°ãäœãåºãããšãã§ããã - </p> - <codeblock language="php"> - <![CDATA[ - assert(0 === +!![]); - assert(1 === +![]); - assert(2 === ![]+![]); - assert(3 === ![]+![]+![]); - assert(10 === +(![].+!![])); - ]]> - </codeblock> - <p> - <code>[]</code> ã« <code>!</code> ãé©çšãããš <code>true</code> ãè¿ã£ãŠãããããã« <code>+</code> - ãé©çšãããšã<code>bool</code> ãã <code>int</code> ãã®å倿ãèµ°ãã<code>1</code> ãçæãããã<code>10</code> - ã¯ããã«ããªãããŒã ããŸã <code>1</code> ãš <code>0</code> ãäœãã<code>.</code> ã§æååãšããŠçµåãã - (<code>'10'</code>)ãããã« <code>+</code> ãé©çšãããšã<code>string</code> ãã <code>int</code> - ãžã®å倿ãèµ°ãã<code>10</code> ãçãŸãã (ã³ãŒãéã«é çããªããªãã<code>1</code> ã 10 - åè¶³ãåãããŠããã¡ãã 10 ãäœãã)ã - </p> - <p> - ãŸãã<code>error_reporting</code> ã«æå®ããŠããã®ã¯ <code>-1</code> ã§ããã ããã¯ã<code>!</code> - ã«ãã£ãŠæååã <code>false</code> ã«ãã<code>+</code> ã«ãã£ãŠ <code>false</code> ã <code>0</code> - ã«ããããã«ãããå転ã㊠<code>-1</code> ã«ããŠããã - </p> - </section> - <section id="conditionals"> - <h><code>if</code> æãªãã§æ¡ä»¶åå²</h> - <p> - äžé
æŒç®åãªãã <code>match</code> åŒã䜿ãããšã§ã<code>if</code> - ãäžåæžããã«æ¡ä»¶åå²ãã§ããã ãŸãã<code>&&</code> / <code>||</code> ã䜿ããããšãããã - é
å»¶è©äŸ¡ãäžèŠãªã±ãŒã¹ã§ã¯ã<code>[$t, $f][$cond]</code> - ã®ãããªåœ¢ã§åå²ããããšãã§ããã - </p> - </section> - <section id="loops"> - <h><code>while</code>ã<code>for</code> æãªãã§ã«ãŒã</h> - <p> - äžåç¹ã³ã³ãããŒã¿ã䜿ã£ãŠç¡åååž°ãã - (詳ãã説æã¯çç¥ããããããã®åèªã§æ€çŽ¢ããŠã»ãã)ã ããã§ã¯ãäžè¬ã« - Z ã³ã³ãããŒã¿ãšããŠç¥ããããã®ã䜿ã£ã (<code>$z</code>)ã - </p> - <p> - å®éã®ãšããã<code>$ð€¡</code> ã <code>$ðª</code>ã<code>$ð</code> ã¯ãäžåºŠ Scheme (Lisp ã®äžçš®) - ã§æžããŠãã PHP ã«ç¿»èš³ãã圢ã§èšè¿°ããã - </p> - <p> - ãªããPHP ã¯æ«å°Ÿååž°ã®æé©åããããªããªã (å°ãªããšãä»ã®ãšããã¯) - ã®ã§ã ããŸãã«é·ã brainf*ck - ããã°ã©ã ãæžããšã¹ã¿ãã¯ãªãŒããŒãããŒããã - </p> - </section> - </section> - </section> - <section id="q2-riddle"> - <h>第2å riddle.php</h> - <p> - ãœãŒã¹ã³ãŒãã¯ãã¡ããå®è¡ã«ã¯ PHP 8.0 以äžãå¿
èŠãªã®ã§æ³šæã - </p> - <codeblock language="php"> - <![CDATA[ - <?php - - /********************************************************* - * This program displays a PHPer token. * - * Guess 'N'. * - * * - * Hints: * - * - N itself has no special meaning, e.g., 42, 8128, * - * it is selected at random. * - * - Each element of $token represents a single letter. * - * - One letter consists of 5x5 cells. * - * - Remember, the output is a complete PHPer token. * - * * - * License: * - * https://creativecommons.org/publicdomain/zero/1.0/ * - *********************************************************/ - const N = 0 /* Change it to your answer. */; - assert(0 <= N && N <= 0b11111_11111_11111_11111_11111); - - $token = [ - 0x14B499C, - 0x0BE34CC, 0x01C9C69, - 0x0ECA069, 0x01C2449, 0x0FDB166, 0x01C9C69, - 0x01C1C66, 0x0FC1C47, 0x01C1C66, - 0x10C5858, 0x1E4E3B8, 0x1A2F2F8, - ]; - foreach ($token as $x) { - $x = $x ^ N; - - $x = sprintf('%025b', $x); - $x = str_replace(search: ['0', '1'], replace: [' ', '#'], subject: $x); - $x = implode("\n", str_split($x, length: 5)); - echo "{$x}\n\n"; - } - ]]> - </codeblock> - <p> - ããŠããã®åé¡ã¯ããã»ã©ã®ããã«åçŽã«å®è¡ããã ãã§ã¯ãè¬ã®ãããã¯ã衚瀺ãããã ãã§ããŒã¯ã³ã¯åŸãããªãã - ããŒã¯ã³ãåŸãããã«ã¯ããœãŒã¹ã³ãŒããèªã¿ã宿° <code>N</code> - ãç¹å®ããå¿
èŠãããã - </p> - <p> - ããã§ã¯ãç§ã®æ³å®è§£ã解説ããã - </p> - <section id="code-reading"> - <h>èªè§£</h> - <p> - ãŸãã¯ãœãŒã¹ã³ãŒããèªãã§ããã - </p> - <codeblock language="php"> - <![CDATA[ - $token = [ - // ç¥ - ]; - ]]> - </codeblock> - <p> - æ°å€ãããªã <code>$token</code> ããããåèŠçŽ ãã«ãŒãããŠããã - </p> - <codeblock language="php"> - <![CDATA[ - $x = $x ^ N; - ]]> - </codeblock> - <p> - ãŸãã¯æä»çè«çå (xor) ãåãã - </p> - <codeblock language="php"> - <![CDATA[ - $x = sprintf('%025b', $x); - ]]> - </codeblock> - <p> - äºé²æ°ã«å€æããŠã - </p> - <codeblock language="php"> - <![CDATA[ - $x = str_replace(search: ['0', '1'], replace: [' ', '#'], subject: $x); - ]]> - </codeblock> - <p> - 0 ã空çœã«ã1 ã <code>#</code> ã«ãã - </p> - <codeblock language="php"> - <![CDATA[ - $x = implode("\n", str_split($x, length: 5)); - ]]> - </codeblock> - <p> - 5æåããšã«åºåã£ãããšãæ¹è¡ã§çµåããŠããã - </p> - </section> - <section id="hint"> - <h>ãã³ã</h> - <p> - 次ã«ããœãŒã¹ã³ãŒãã«æžããŠãããã³ããèªãã§ããã - </p> - <ul> - <li><code>N</code> ããèªäœã¯ã42 ã 8128 ãšãã£ããããªç¹å¥ãªæå³ãæãããã©ã³ãã ã«æ±ºããããŠãã</li> - <li><code>$token</code> ã®åèŠçŽ ã¯ã1æåã衚ã</li> - <li>1æå㯠5x5 ã®ã»ã«ãããªã</li> - <li>åºåãããã®ã¯ãå®å
šãª PHPer ããŒã¯ã³ã§ãã</li> - </ul> - <p> - ããã§ãPHPer ããŒã¯ã³ã¯å¿
ã <code>#</code> èšå·ããå§ãŸãããšãæãã ããšã - <code>$token</code> ã®æåã®æ°å <code>0x14B499C</code> ã¯ã倿ã®çµæ <code>#</code> - ã«ãªãã®ã§ã¯ãªãããšäºæ³ããã (ãªãããã®ããšã¯ããªããžããªã® README - ãã¡ã€ã«ã«è¿œå ãã³ããšããŠæžãããŠãã)ã - </p> - </section> - <section id="solve"> - <h>è§£ã</h> - <p> - ãããŸã§ãããã°ãããšäžæ©ã§è§£ãããããªãã¡ã<code>0x14B499C</code> ã <code>#</code> - ã«å€æããããã㪠<code>N</code> ãèŠã€ããã°ããã - </p> - <p> - <code>N</code> ã¯é«ã
- </p> - <codeblock language="php"> - <![CDATA[ - assert(0 <= N && N <= 0b11111_11111_11111_11111_11111); - ]]> - </codeblock> - <p> - ãªã®ã§ãã«ãŒããã©ãŒã¹ããŠãããããããã§ã¯ãã«ãŒããã©ãŒã¹ããªãæ¹æ³ã玹ä»ããã - </p> - <codeblock language="php"> - <![CDATA[ - <?php - - $x = 0x14B499C; - - $x = $x ^ N; - - $x = sprintf('%025b', $x); - $x = str_replace(search: ['0', '1'], replace: [' ', '#'], subject: $x); - $x = implode("\n", str_split($x, length: 5)); - - assert($x === - " # # \n" . - "#####\n" . - " # # \n" . - "#####\n" . - " # # "); - ]]> - </codeblock> - <p> - ãã®äžé£ã®å€æã«å¯Ÿããé倿ãèãããšã次ã®ããã«ãªãã - </p> - <codeblock language="php"> - <![CDATA[ - <?php - - $x = - " # # \n" . - "#####\n" . - " # # \n" . - "#####\n" . - " # # "; - - $x = implode('', explode("\n", $x)); - $x = str_replace(search: [' ', '#'], replace: ['0', '1'], subject: $x); - $x = bindec($x); - - $n = $x ^ 0x14B499C; - - echo "N = $n\n"; - ]]> - </codeblock> - <p> - ãããå®è¡ãããšã<code>N</code> ãåŸãããã - </p> - </section> - </section> - <section id="q3-toquine"> - <h>第3å toquine.php</h> - <p> - ãœãŒã¹ã³ãŒãã¯ãã¡ãã - </p> - <codeblock language="php"> - <![CDATA[ - <?php - - // License: https://creativecommons.org/publicdomain/zero/1.0/ - // This is a quine-like program to generate a PHPer token. - // Execute it like this: php toquine.php | php | php | php | ... - - $s = <<<'Q' - <?cuc - // Yvprafr: uggcf://perngvirpbzzbaf.bet/choyvpqbznva/mreb/1.0/ - // Guvf vf n dhvar-yvxr cebtenz gb trarengr n CUCre gbxra. - // Rkrphgr vg yvxr guvf: cuc gbdhvar.cuc | cuc | cuc | cuc | ... - %f$f = %f; - $f = fge_ebg13($f); $kf = [ - %f, - ]; - $g = ahyy.snyfr; sbe ($v = 0; $v <= vagqvi(__YVAR__-035,6); ++$v) vs (!vffrg($kf[$v])) oernx; ryfr - $g .= vzcybqr("\a", fge_fcyvg(fge_ercynpr(['0','1'], [' ','##'], fcevags(pue(37) . '025o', $kf[$v])), 012)) . "\a\a"; - $jf = neenl_znc(sa($j) => vzcybqr(', ', $j), neenl_puhax(neenl_znc(sa($k) => fcevags('0k' . pue(37) . '07K', $k), $kf), 10)); - cevags($f, $g, fge_ebg13("<<<'Q'\a{$f}\aQ"), vzcybqr(",\a", $jf)); - Q; - $s = str_rot13($s); $xs = [ - 0x0AFABEA, 0x1F294A7, 0x1F2109F, 0x1F294A7, 0x0002800, 0x1F2109F, 0x0117041, 0x1F294A7, 0x1FAD6B5, 0x1F295B7, - 0x010FC21, 0x1FAD6B5, 0x1151151, 0x010FC21, 0x1F294A7, 0x1F295B7, 0x1FAD6B5, 0x1F294A7, 0x1F295B7, 0x1F8C63F, - 0x1F8C631, 0x1FAD6B5, 0x17AD6BD, 0x17AD6BD, 0x1F8C63F, 0x1F295B7, - ]; - $t = null.false; for ($i = 0; $i <= intdiv(__LINE__-035,6); ++$i) if (!isset($xs[$i])) break; else - $t .= implode("\n", str_split(str_replace(['0','1'], [' ','##'], sprintf(chr(37) . '025b', $xs[$i])), 012)) . "\n\n"; - $ws = array_map(fn($w) => implode(', ', $w), array_chunk(array_map(fn($x) => sprintf('0x' . chr(37) . '07X', $x), $xs), 10)); - printf($s, $t, str_rot13("<<<'D'\n{$s}\nD"), implode(",\n", $ws)); - ]]> - </codeblock> - <p> - ã³ã¡ã³ãã«ããããšãããæ¬¡ã®ããã«ããŠå®è¡ããã°çããã§ãŠããã - </p> - <codeblock language="shell-session"> - <![CDATA[ - $ php toquine.php | php | php | php | ... - ]]> - </codeblock> - <p> - å®éã«ã¯ããå°ããã€ãã§ç¹ããªããã°ãªããªãã - </p> - <section id="commentary"> - <h>解説</h> - <section id="quine"> - <h>ããã°ã©ã å
šäœ</h> - <p> - ã³ã¡ã³ãã«ããããšããããã㯠quine (颚) ã®ããã°ã©ã ã«ãªã£ãŠããã - Quine - ãšã¯ãèªåã®ãœãŒã¹ã³ãŒãããã£ãããã®ãŸãŸåºåãããããªããã°ã©ã ã®ããšã§ããã - </p> - <p> - ãã®ããã°ã©ã ã¯ãå®è¡ãããšèªèº«ãšã»ãšãã©åãããã°ã©ã ãåºåããã - ç°ãªãã®ã¯ããŒã¯ã³ã«ãªã£ãŠããéšåã®ã¿ã§ããã - </p> - </section> - <section id="tokens"> - <h>ããŒã¯ã³</h> - <p> - <code>$xs</code> ãããŒã¯ã³ã«å¯Ÿå¿ããŠããã倿ã®ããžãã¯ã¯ <code>riddle.php</code> - ãšã»ãŒåããªã®ã§çç¥ããã - </p> - </section> - <section id="states"> - <h>ç¶æ
ä¿æ</h> - <p> - ããŒã¯ã³ã®äœæåç®ãŸã§åºåããããããœãŒã¹ã³ãŒããå€ããã« (quine - ãªã®ã§) èŠããŠããå¿
èŠãããã - ãã®ããã°ã©ã ã§ã¯ãããŒã¯ã³ãåºåããããšãœãŒã¹ã³ãŒããã ãã ããšé·ããªã£ãŠããã®ãå©çšããŠã<code>__LINE__</code> - ããæ
å ±ãååŸããŠããã - </p> - </section> - <section id="rot-13"> - <h>ROT 13</h> - <p> - Quine ã¯ãçŽ æŽã«æžããšããã°ã©ã ã®äžéšã 2åèšè¿°ãããŠããŸãã - ãããããŸãçŸãããªãã®ã§ã<code>toquine.php</code> ã§ã¯ãROT 13 - 倿ã䜿ã£ãŠé£èªåããã - </p> - <p> - ããã«ããŠããªããããªãã®ãæšæºã©ã€ãã©ãªã«âŠâŠã - </p> - </section> - </section> - </section> - <section id="outro"> - <h>ãããã«</h> - <p> - è§£ããŠããã ããã¿ãªããããŸããé£æåºŠèª¿æŽã«ã€ããã£ãŠããã ãã瀟å
ã®ã¿ãªãããããããšãããããŸããã - </p> - <p> - ä»åã¯çŽåã«äœãã¯ãããã®ãããã3åã ããã€äœ¿ãå€ããããã¿ã°ããã«ãªã£ãŠããŸããŸãããã - æ¥å¹Žã¯ 5åãããé¢çœãåé¡ãæã£ãŠãããŸãã - </p> - <p> - å®ã¯ããäœãã¯ãããŠããã®ã§ãã©ããæ¥å¹ŽããããŸãããã«âŠâŠã - </p> - </section> -</article> diff --git a/vhosts/blog/content/posts/2022-04-24/term-banner-write-tool-showing-banner-in-terminal.dj b/vhosts/blog/content/posts/2022-04-24/term-banner-write-tool-showing-banner-in-terminal.dj new file mode 100644 index 00000000..433ad383 --- /dev/null +++ b/vhosts/blog/content/posts/2022-04-24/term-banner-write-tool-showing-banner-in-terminal.dj @@ -0,0 +1,97 @@ +--- +[article] +uuid = "42cf2829-b897-4748-bc22-80dd734a3c09" +title = "term-banner: ã¿ãŒããã«ã«ãããŒã衚瀺ããããŒã«ãæžãã" +description = "ã¿ãŒããã«ã«ä»»æã®æåã®ãããŒã衚瀺ããããã®ããŒã«ã Go ã§æžããã" +tags = [] + +[[article.revisions]] +date = "2022-04-24" +remark = "å
¬é" + +[[article.revisions]] +date = "2022-04-27" +remark = "-f ãªãã·ã§ã³ã«ã€ããŠè¿œèš" +--- +{#intro} +# ã¯ããã« + +ãããªãã®ãäœã£ãã + +``` +$ term-banner 'Hello, World!' 'ããã«ã¡ã¯ã' 'äžçïŒ' +``` + + + +ã³ãã³ãã©ã€ã³åŒæ°ãšããŠæž¡ããæååãã¿ãŒããã«ã«å€§ãã衚瀺ããã + +ãªããžããªã¯ãã¡ã: https://github.com/nsfisis/term-banner + +{#motivation} +# Motivation + +以åã[`big-clock-mode`](https://github.com/nsfisis/big-clock-mode) +ãšãã䌌ããããªããã°ã©ã ãæžããã ãã㯠tmux ã® `:clock-mode` +ã³ãã³ãã«çæ³ãåŸããã®ã§ã`:clock-mode` +ããã倧ããçŸåšæå»ã衚瀺ããã + +`big-clock-mode` +ãéçºããã®ã¯ã次ã®ãããªã·ãã¥ãšãŒã·ã§ã³ã§äœ¿ãããã§ããã +åŒç€Ÿã§ã¯çŸåšãªã¢ãŒãã¯ãŒã¯ãåºæ¬ã ããweb +äŒè°ãªã©ã§ç»é¢å
±æããŠãããšãã«ãäŒæ©ãæãã§ç¹å®ã®æå»ããåéããããšããããšãããã +ãããã£ãã±ãŒã¹ã§ãç»é¢äžã«çŸåšã®æå»ã倧ããã«è¡šç€ºããŠãããšãã¢ãã¿ããé¢ããŠãé ãããæå»ããããã®ã§äŸ¿å©ã§ããã + +ããããã¿ã€ãã¢ããªãäœãã䜿ãã°ããã®ã ããã¿ãŒããã«ã«æ£²ããããã®ãšããŠã¯ãäœåŠããé¢ããããªãããã ã + +ãã°ãã䟿å©ã«äœ¿ã£ãŠããã®ã ããã²ãšã€äžæºç¹ãåºãŠãããããã¯ãåéããæå»ããã€ã ã£ãããèŠããŠãããªããã°ãªããªããšããããšã ã +ã©ããã«ã¡ã¢ããŠãããŠããããããã£ãããªãçŸåšæå»ãšãšãã«è¡šç€ºãããŠããããã + +ãããªããã§ããä»»æã®æååãã¿ãŒããã«ã«è¡šç€ºãããããã°ã©ã ãæžãéã³ãšãªã£ãã +ãŸããäœããªããŠãæ¢ãã°ãããšæãããäœããããã®ã¯äœãããã®ã§ç¥ã£ãããšã§ã¯ãªãã + +{#program} +# ããã°ã©ã + +å
šäœã®æµãã¯æ¬¡ã®ããã«ãªã£ãŠããã + +1. ãã©ã³ããã¡ã€ã«ãèªã¿èŸŒã +1. ã³ãã³ãã©ã€ã³åŒæ°ã Shift-JIS ã«å€æãã (ãã©ã³ãã Shift-JIS åºæºã§äžŠãã§ãããã) +1. 1æåãã€ã¬ã³ããªã³ã°ããŠãã + +`big-clock-mode` ã Go 補ãªã®ã§ãä»åã Go ã§æžããã PNG +ãæšæºã©ã€ãã©ãªã«ãã£ãããShift-JIS +ã®ãšã³ã³ãŒãã£ã³ã°ãæºæšæºã©ã€ãã©ãªã«ãã£ããããã®ã¯å©ãã£ãã + +ãã©ã³ããã¡ã€ã«ã¯ `go:embed` +ã§å®è¡ãã¡ã€ã«ã«åã蟌ãã§ããã®ã§ããã«ãåŸã¯ã¯ã³ãã€ããªã§åãã +ä»äºã§ã¯ã¹ã¯ãªããèšèªã°ããæžããŠãããããã¯ãã³ã³ãã€ã«èšèªã¯ããã + +{#font} +# ãã©ã³ã + +ããªãŒã® 8x8 +ãããããããã©ã³ãã§ããã [çŸå²ãã©ã³ã 2021-05-05a ç](https://littlelimit.net/misaki.htm) ã䜿ãããŠããã ããã + +ã¯ããã¯èªåã§ããããæã£ãŠããã®ã ãããããããããŸã§ãã£ãŠæ«æããã +åãã 8x8 +ã§äœã£ãŠããã®ã ãã平仮åã§ãããããã®å°ããªãã£ã³ãã¹ã«ã¯ãšãŠãåããããªãã + +çŸå²ãã©ã³ãã¯ã平仮åã»çä»®åã«çãŸãããJIS +第äžã»ç¬¬äºæ°Žæºã®æŒ¢åãŸã§ãµããŒãããŠããã +ç¬¬äºæ°Žæºãšããªããšäžçãç®ã«ãããããšã®ãªãåã®æ¹ãå€ããããã ããããããã®å€§ããã§æžããšããã®ã¯ããã¯ãèžè¡ã®åã§ããã + +ããã«èšããšãå®ã®ãšããçŸå²ãã©ã³ãã¯å®ãµã€ãº 7x7 +ã§äœãããŠãããäœçœãèšããããŠããã +ããã¯ãåçŽã«ãã®ãŸãŸäžŠã¹ãŠãåéã»è¡éã確ä¿ã§ããããã«ãšããé
æ
®ã§ããã +ãããã§ã³ãŒãã£ã³ã°ãŸã§æ¥œã«ãªã£ãã + +ãŽã·ãã¯äœãšææäœããã£ãããç§ã®å¥œã¿ã§ææäœã®æ¹ã«ããã +ãã ããŽã·ãã¯äœã®æ¹ãèŠãããæ°ãããã®ã§ããã©ã³ããéžã¹ãããã«åŸã»ã©æ¡åŒµãããããããªãã + +2022-04-27 远èš: `-f` ãªãã·ã§ã³ã§éžã¹ãããã«ããã + +{#outro} +# ãããã« + +ããªããã¿ãŒããã«ã«äœãã§ã¿ãŸãããïŒ diff --git a/vhosts/blog/content/posts/2022-04-24/term-banner-write-tool-showing-banner-in-terminal.ndoc b/vhosts/blog/content/posts/2022-04-24/term-banner-write-tool-showing-banner-in-terminal.ndoc deleted file mode 100644 index 1369a265..00000000 --- a/vhosts/blog/content/posts/2022-04-24/term-banner-write-tool-showing-banner-in-terminal.ndoc +++ /dev/null @@ -1,119 +0,0 @@ ---- -[article] -uuid = "42cf2829-b897-4748-bc22-80dd734a3c09" -title = "term-banner: ã¿ãŒããã«ã«ãããŒã衚瀺ããããŒã«ãæžãã" -description = "ã¿ãŒããã«ã«ä»»æã®æåã®ãããŒã衚瀺ããããã®ããŒã«ã Go ã§æžããã" -tags = [] - -[[article.revisions]] -date = "2022-04-24" -remark = "å
¬é" - -[[article.revisions]] -date = "2022-04-27" -remark = "-f ãªãã·ã§ã³ã«ã€ããŠè¿œèš" ---- -<article> - <section id="intro"> - <h>ã¯ããã«</h> - <p> - ãããªãã®ãäœã£ãã - </p> - <codeblock> - <![CDATA[ - $ term-banner 'Hello, World!' 'ããã«ã¡ã¯ã' 'äžçïŒ' - ]]> - </codeblock> - <img src="/posts/2022-04-24/term-banner-write-tool-showing-banner-in-terminal/screenshot.png" alt="term-banner ãåäœããŠããæ§åã®ã¹ã¯ãªãŒã³ã·ã§ãã"></img> - <p> - ã³ãã³ãã©ã€ã³åŒæ°ãšããŠæž¡ããæååãã¿ãŒããã«ã«å€§ãã衚瀺ããã - </p> - <p> - ãªããžããªã¯ãã¡ã: https://github.com/nsfisis/term-banner - </p> - </section> - <section id="motivation"> - <h>Motivation</h> - <p> - 以åã<a href="https://github.com/nsfisis/big-clock-mode"><code>big-clock-mode</code></a> - ãšãã䌌ããããªããã°ã©ã ãæžããã ãã㯠tmux ã® <code>:clock-mode</code> - ã³ãã³ãã«çæ³ãåŸããã®ã§ã<code>:clock-mode</code> - ããã倧ããçŸåšæå»ã衚瀺ããã - </p> - <p> - <code>big-clock-mode</code> - ãéçºããã®ã¯ã次ã®ãããªã·ãã¥ãšãŒã·ã§ã³ã§äœ¿ãããã§ããã - åŒç€Ÿã§ã¯çŸåšãªã¢ãŒãã¯ãŒã¯ãåºæ¬ã ããweb - äŒè°ãªã©ã§ç»é¢å
±æããŠãããšãã«ãäŒæ©ãæãã§ç¹å®ã®æå»ããåéããããšããããšãããã - ãããã£ãã±ãŒã¹ã§ãç»é¢äžã«çŸåšã®æå»ã倧ããã«è¡šç€ºããŠãããšãã¢ãã¿ããé¢ããŠãé ãããæå»ããããã®ã§äŸ¿å©ã§ããã - </p> - <p> - ããããã¿ã€ãã¢ããªãäœãã䜿ãã°ããã®ã ããã¿ãŒããã«ã«æ£²ããããã®ãšããŠã¯ãäœåŠããé¢ããããªãããã ã - </p> - <p> - ãã°ãã䟿å©ã«äœ¿ã£ãŠããã®ã ããã²ãšã€äžæºç¹ãåºãŠãããããã¯ãåéããæå»ããã€ã ã£ãããèŠããŠãããªããã°ãªããªããšããããšã ã - ã©ããã«ã¡ã¢ããŠãããŠããããããã£ãããªãçŸåšæå»ãšãšãã«è¡šç€ºãããŠããããã - </p> - <p> - ãããªããã§ããä»»æã®æååãã¿ãŒããã«ã«è¡šç€ºãããããã°ã©ã ãæžãéã³ãšãªã£ãã - ãŸããäœããªããŠãæ¢ãã°ãããšæãããäœããããã®ã¯äœãããã®ã§ç¥ã£ãããšã§ã¯ãªãã - </p> - </section> - <section id="program"> - <h>ããã°ã©ã </h> - <p> - å
šäœã®æµãã¯æ¬¡ã®ããã«ãªã£ãŠããã - </p> - <ol numeration="arabic"> - <li>ãã©ã³ããã¡ã€ã«ãèªã¿èŸŒã</li> - <li>ã³ãã³ãã©ã€ã³åŒæ°ã Shift-JIS ã«å€æãã (ãã©ã³ãã Shift-JIS åºæºã§äžŠãã§ãããã)</li> - <li>1æåãã€ã¬ã³ããªã³ã°ããŠãã</li> - </ol> - <p> - <code>big-clock-mode</code> ã Go 補ãªã®ã§ãä»åã Go ã§æžããã PNG - ãæšæºã©ã€ãã©ãªã«ãã£ãããShift-JIS - ã®ãšã³ã³ãŒãã£ã³ã°ãæºæšæºã©ã€ãã©ãªã«ãã£ããããã®ã¯å©ãã£ãã - </p> - <p> - ãã©ã³ããã¡ã€ã«ã¯ <code>go:embed</code> - ã§å®è¡ãã¡ã€ã«ã«åã蟌ãã§ããã®ã§ããã«ãåŸã¯ã¯ã³ãã€ããªã§åãã - ä»äºã§ã¯ã¹ã¯ãªããèšèªã°ããæžããŠãããããã¯ãã³ã³ãã€ã«èšèªã¯ããã - </p> - </section> - <section id="font"> - <h>ãã©ã³ã</h> - <p> - ããªãŒã® 8x8 - ãããããããã©ã³ãã§ããã<a href="https://littlelimit.net/misaki.htm">çŸå²ãã©ã³ã 2021-05-05a ç</a> ã䜿ãããŠããã ããã - </p> - <p> - ã¯ããã¯èªåã§ããããæã£ãŠããã®ã ãããããããããŸã§ãã£ãŠæ«æããã - åãã 8x8 - ã§äœã£ãŠããã®ã ãã平仮åã§ãããããã®å°ããªãã£ã³ãã¹ã«ã¯ãšãŠãåããããªãã - </p> - <p> - çŸå²ãã©ã³ãã¯ã平仮åã»çä»®åã«çãŸãããJIS - 第äžã»ç¬¬äºæ°Žæºã®æŒ¢åãŸã§ãµããŒãããŠããã - ç¬¬äºæ°Žæºãšããªããšäžçãç®ã«ãããããšã®ãªãåã®æ¹ãå€ããããã ããããããã®å€§ããã§æžããšããã®ã¯ããã¯ãèžè¡ã®åã§ããã - </p> - <p> - ããã«èšããšãå®ã®ãšããçŸå²ãã©ã³ãã¯å®ãµã€ãº 7x7 - ã§äœãããŠãããäœçœãèšããããŠããã - ããã¯ãåçŽã«ãã®ãŸãŸäžŠã¹ãŠãåéã»è¡éã確ä¿ã§ããããã«ãšããé
æ
®ã§ããã - ãããã§ã³ãŒãã£ã³ã°ãŸã§æ¥œã«ãªã£ãã - </p> - <p> - ãŽã·ãã¯äœãšææäœããã£ãããç§ã®å¥œã¿ã§ææäœã®æ¹ã«ããã - ãã ããŽã·ãã¯äœã®æ¹ãèŠãããæ°ãããã®ã§ããã©ã³ããéžã¹ãããã«åŸã»ã©æ¡åŒµãããããããªãã - </p> - <p> - 2022-04-27 远èš: <code>-f</code> ãªãã·ã§ã³ã§éžã¹ãããã«ããã - </p> - </section> - <section id="outro"> - <h>ãããã«</h> - <p> - ããªããã¿ãŒããã«ã«äœãã§ã¿ãŸãããïŒ - </p> - </section> -</article> diff --git a/vhosts/blog/content/posts/2022-05-01/phperkaigi-2022.dj b/vhosts/blog/content/posts/2022-05-01/phperkaigi-2022.dj new file mode 100644 index 00000000..6758f265 --- /dev/null +++ b/vhosts/blog/content/posts/2022-05-01/phperkaigi-2022.dj @@ -0,0 +1,132 @@ +--- +[article] +uuid = "9211e1fe-bca3-43c4-ba4e-c67d62f3fed0" +title = "PHPerKaigi 2022" +description = "2022-04-09 ãã 2022-04-11 ã«ãããŠéå¬ããããPHPerKaigi 2022 ã«åå ããã" +tags = [ + "conference", + "php", + "phperkaigi", +] + +[[article.revisions]] +date = "2022-05-01" +remark = "å
¬é" +--- +{#intro} +# ã¯ããã« + +2022-04-09 ãã 2022-04-11 ã«ãããŠéå¬ãããã [PHPerKaigi 2022](https://phperkaigi.jp/2022/) ã«ã +äžè¬åå è
ãšããŠåå ããã +åŒç€Ÿ [ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ](https://www.dgcircus.com/) ã¯ãã€ã€ã¢ã³ãã¹ãã³ãµãŒãšãªã£ãŠããã +ã¹ãã³ãµãŒæ ã®ãã±ããã䜿ãããŠããã ããã + +æšå¹Žã®ã¬ããŒã㯠[ãã¡ã](/posts/2021-03-30/phperkaigi-2021) ã + +{#comments} +# ææ³ + +{#great-sessions} +## å³éžããããããŒã¯ + +å€ãã®çŽ æŽãããããŒã¯ã®äžãããç¹ã«ããããã®ãã®ã 5ã€éžãã ã +æ¯éèããŠã»ãããåŒçšéšåã¯ããªã³ã¯å
ããããŒã¶ã«ããåŒçšããŠããã + +[äºé²ã«åãé²åŸ¡ãªã - å
ç¢ãªã³ãŒããå°ãæ§ã
ãªèšèšã®ãã³ã](https://fortee.jp/phperkaigi-2022/proposal/ef8cf4ed-63fe-42f8-8145-b3e70054458b) + +> PHP ã¯ããŒãžã§ã³ãè¿œãæ¯ã«å宣èšãäŸå€ã衚æãåæåãªã©ã®æ©èœã倧å¹
ã«åŒ·åãããå
ç¢ãªã³ãŒããæžãããã®æ©èœãå
å®ããŠããŸããããããã®æ©èœã¯ã©ã䜿ããšå¹æçãªã®ã§ããããã +> +> æ¬è¬æŒã§ã¯ PHP 8.1 ãããŒã¹ã«ããŠã誀ããæ³å®ããŠãã§ãã¯ããã®ã§ã¯ãªãããããã誀ãã«ããèšèšãšã¯ã©ã®ãããªãã®ããã€ãŸããäºé²ãã®èгç¹ã軞足ã«ãå
ç¢ãªã³ãŒããå°ãããã®æ§ã
ãªèšèšã®ãã³ããã玹ä»ããŸãã + +[PHPã®ãšã©ãŒãçè§£ããŠé©åãªãšã©ãŒãã³ããªã³ã°ãåŠãŒã](https://fortee.jp/phperkaigi-2022/proposal/db00d49e-0dd6-453f-b54b-f731d112f10e) + +> PHPã䜿ã£ãŠããšããééãã Fatal error / Parse error / Warning / Notice çè§£ããŠããŸããïŒ +> +> ãããã®ãšã©ãŒæãçè§£ããããšã§ãããã«ãšã©ãŒã®åå ã«æ°ä»ãé©åã«å¯Ÿè±¡ã§ããæ§ã«ãªããŸãïŒ +> +> ãŸãããããçè§£ããäžã§ã®ãšã©ãŒãã³ããªã³ã°ãåŠã³ãŸãããã + +[ãšã©ãŒç£èŠãšãã¹ãäœå¶ãžã®æ¹åäœæŠ](https://fortee.jp/phperkaigi-2022/proposal/4a7e3ded-9134-4919-955c-ec7bf4491c0d) + +> æ¯æ¥æµããŠãããšã©ãŒã«çããã¯ã©ãåãåã£ãŠãŸããïŒ +> +> ãšã©ãŒãåºããªãäºãäžçªã§ãããå®å
šã«å¡ãäºã¯é£ãããšèããŸãã +> +> ãµãŒãã¹éçšã®äžã§æ¬çªç°å¢ããçºçãããšã©ãŒïŒãµãŒããŒã»ã¯ã©ã€ã¢ã³ããµã€ãã»ãµãŒãããŒãã£èµ·å ã®ãšã©ãŒïŒãžã®ç£èŠäœå¶ãšã +> +> ãšã©ãŒã»ãã°é²åŸ¡ã®ããããŒã ã§è¡ã£ãŠãããã¹ãã³ãŒãæåã¥ããã®è©±ãããŸãã + +[ISUCON11ã®PHPå®è£
ã¯ãäœãèããã©ã®ããã«ããŠäœãããŠããã®ã](https://fortee.jp/phperkaigi-2022/proposal/6f47daf8-c78f-4fb1-9b99-e9656e6fe7f7) + +> æšå¹Žéå¬ãããISUCON11ã«ãŠåé¡ïŒåèå®è£
ïŒã®PHPãžã®ç§»æ€ãæ
åœãããŠããã ããŸããã +> +> æçµçãªãœãŒã¹ã³ãŒãããã·ã³ãã«ãªWebã¢ããªã±ãŒã·ã§ã³ã§ã¯ãããŸããããã®è£ã«ã¯ +> +> * ãïŒç§ã®æãïŒè¯ãèšèšããå®çŸããããã®æææ±ºå® +> * ãISUCONã®åé¡ããšããäœçœ®ä»ãã«ç±æ¥ããåæšéžæ +> * ç§»æ€äžã«ééãããã©ãã«ãšãã®è§£æ±ºç +> +> ãšãã£ãæèãèè€ãååšããŠããŸãã +> +> æ¬çºè¡šã¯ããããå
±æããããšã§ +> +> * PHPã¢ããªã±ãŒã·ã§ã³ã®èšèšãå®è£
äºäŸãšããŠåœ¹ç«ãŠãŠããã +> * ISUCONã®èšèªç§»æ€ã«èå³ãæã£ãŠããã +> * ISUCONåé¡ç§»æ€ã®ãå®è£
ãèšèšã®ç·Žç¿ãããææããšããŠã®å¯èœæ§ãç¥ã£ãŠããã +> +> ããšãç®çãšããŸãã + +[ããŒã ã®ä»äºã¯ãŸãã£ãŠãããã©ãã¡ã³ããŒã¯ããããã¢ã€ã¢ã€ãæ±ããŠãã話ââ40åã®å€§èŠæš¡éçºããŒã ã§1on1ãã°ãå
¬éããŠã¿ã](https://fortee.jp/phperkaigi-2022/proposal/5a260e4e-542d-4d82-849d-ef3d6cb7c854) + +> ãµã€ããŠãºã®å€§äŒæ¥åãã°ã«ãŒããŠã§ã¢ã®GaroonïŒã¬ã«ãŒã³ïŒã¯ãPHPã§éçºãããŠãã20幎ç®ã®è£œåã§ããã¬ã«ãŒã³éçºããŒã ã¯æ¥æ¬ã§40åããããã ã§50åã®èš90åã»ã©ã®ããŒã ã«ãªã£ãŠããŸãããŸããã³ããçŠã§ãã«ãªã¢ãŒãã§ã®æŽ»åããã®2幎ã»ã©ç¶ç¶ããŠããŸããã +> +> ãã«ãªã¢ãŒãã«ãªã£ãŠãä»äºã¯ãŸãã£ãŠãããç¶ç¶çã«ãªãªãŒã¹ã¯ããŠããŸããããäžæ¹ã§ãäºãã®èããŠããããšãæããŠããå顿èãèŠãã¥ãããªããã¢ã€ã¢ã€ãæ±ããŠããã¡ã³ããŒãå¢ããŠããŸããã +> +> ãã®ã»ãã·ã§ã³ã§ã¯ãããããç¶æ³ã§ç§ãããŒã å€ãããžã§ã€ã³ããèŽã圹ã«åŸ¹ããªããèŠããåããããšã§ç¶æ³ãæ¹åããŠãã£ãåãçµã¿ã玹ä»ããŸããåãããã«å€§ããªããŒã ããªã¢ãŒãã¯ãŒã¯ã§é£ãããæããŠãã人ã«ãé£ããã®åå ãžã®æ°ã¥ããåãçµã¿ãžã®ãã³ããããã°å¹žãã§ãã + +{#token-quizzes} +## ããŒã¯ã³åé¡ã®äœæ + +ä»åã¯ãPHPer ãã£ã¬ã³ãžçšã«åŒç€Ÿã®ããŒã¯ã³åé¡ã 3é¡äœæããã +ãã¡ãã«ã€ããŠã¯ [å¥éèšäºã«ããŠãã](/posts/2022-04-09/phperkaigi-2022-tokens) ã®ã§ããã¡ããåç
§ããããã + +{#phper-challenge} +## PHPer ãã£ã¬ã³ãž + +[1äœ](https://fortee.jp/phperkaigi-2022/challenge) ã«ãªã£ãã +ãŸããè³åãšã㊠[Echo Show 15](https://www.amazon.co.jp/dp/B08MQNJC9Z) ãããã ããã + +{#conference} +## ã«ã³ãã¡ã¬ã³ã¹å
šäœãžã®ææ³ + +[å»å¹Žã®åå ã¬ã](/posts/2021-03-30/phperkaigi-2021) ã§ã¯ããããªããšãæžããã + +> 1ã€å人çãªåçç¹ãšããŠã¯ã(äžç¥) Discord ãããã¢ã³ã«ã³ãã¡ã¬ã³ã¹ãããããã®ã€ãã³ãã®ãã®ç¬éã«ãããªãã³ã³ãã³ããã«è§Šããã«ã +> åŸããèŠè¿ããçºè¡šãã¹ã©ã€ãã«æ³šåããŠããŸã£ãããšããããšã ã +> çºè¡šã®è©³çްãªèŠçŽãã¯ããšããã§ããã®ã ãããä»ããã§ããªãããšãèããã¹ãã ã£ãã +> ãŸãåã«ã³ãã¡ã¬ã³ã¹ã ãããšãè¶ãæ¿ããŠãããã + +ãã®åçãèžãŸããä»å¹Žã¯ç©æ¥µçã«ã»ãã®å Ž (å
¬åŒã® Discord ãµãŒãããã¢ã³ã«ã³ãã¡ã¬ã³ã¹) ã«ãåå ããã +ããã«ãããåå äœéšã®è³ªãã¯ããã«åäžãããç¹ã« Discord ã«é¢ããŠã¯ãç»å£è
ãæ¬äººã«ããè£è¶³ãã +質åãžã®åçãªã©ããããªããã (ããšãå€ã) ãããç¹å¥ãªçç±ã®ãªãéããçºèšã¯ããªããŸã§ãåå ã¯ããŠãããã»ããè¯ããšæãããã + +ãªããã¢ã³ã«ã³ãã¡ã¬ã³ã¹ã«ã€ããŠã¯ã1æ¥ç®ã®çµããã« [ããŒã¯ã³åé¡ã®è§£èª¬æŸé](https://fortee.jp/phperkaigi-2022/unconference/view/d332797a-8921-4706-a7e2-ee72640c9b5e) ããããªã£ãã + +ãŸããä»å¹Žã¯ãªãã©ã€ã³ãšãªã³ã©ã€ã³ã®ãã€ããªããéå¬ã§ãã£ãããå»å¹Žã®å
šãªã³ã©ã€ã³ãšæ¯ã¹ãŠããªã³ã©ã€ã³åå ã®äœéšãèœã¡ãŠããªãã£ãã®ã¯ãç¹çãã¹ãã§ãããã +ä»å¹Žã¯ 3åç®ã®ã¯ã¯ãã³æ¥çš®ãéã«åããªãã£ãããšãããçŸå°åå ã¯èŠéã£ãã®ã ããæ¥å¹Žã¯æ¯éãªãã©ã€ã³ã§åå ãããã + +{#next-year} +# ãããŠæ¥å¹ŽãžâŠâŠ? + +PHPerKaigi 2023 ããããã©ããåãäžããªããããããšããã°ã次㮠4ã€ãç®æšãšãããã + +* ããããŒã¶ã«ãåºã +* PHPer ãã£ã¬ã³ãžã®ããŒã¯ã³åé¡ã 5é¡äœæãã +* çŸå°ã«è¡ã +* PHPer ãã£ã¬ã³ãžã§å§åãã + +---------------- + +æåŸã«ãªããŸããããPHPerKaigi ã®ã¹ã¿ãããã¹ãã³ãµãŒãã¹ããŒã«ãŒã®ã¿ãªãããçŽ æµãªæéãããããšãããããŸããã + +ã§ã¯ãŸãæ¥å¹Žã diff --git a/vhosts/blog/content/posts/2022-05-01/phperkaigi-2022.ndoc b/vhosts/blog/content/posts/2022-05-01/phperkaigi-2022.ndoc deleted file mode 100644 index 0e1a6bc8..00000000 --- a/vhosts/blog/content/posts/2022-05-01/phperkaigi-2022.ndoc +++ /dev/null @@ -1,166 +0,0 @@ ---- -[article] -uuid = "9211e1fe-bca3-43c4-ba4e-c67d62f3fed0" -title = "PHPerKaigi 2022" -description = "2022-04-09 ãã 2022-04-11 ã«ãããŠéå¬ããããPHPerKaigi 2022 ã«åå ããã" -tags = [ - "conference", - "php", - "phperkaigi", -] - -[[article.revisions]] -date = "2022-05-01" -remark = "å
¬é" ---- -<article> - <section id="intro"> - <h>ã¯ããã«</h> - <p> - 2022-04-09 ãã 2022-04-11 ã«ãããŠéå¬ãããã<a href="https://phperkaigi.jp/2022/">PHPerKaigi 2022</a> ã«ã - äžè¬åå è
ãšããŠåå ããã - åŒç€Ÿ<a href="https://www.dgcircus.com/">ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ</a>ã¯ãã€ã€ã¢ã³ãã¹ãã³ãµãŒãšãªã£ãŠããã - ã¹ãã³ãµãŒæ ã®ãã±ããã䜿ãããŠããã ããã - </p> - <p> - æšå¹Žã®ã¬ããŒãã¯<a href="/posts/2021-03-30/phperkaigi-2021">ãã¡ã</a>ã - </p> - </section> - <section id="comments"> - <h>ææ³</h> - <section id="great-sessions"> - <h>å³éžããããããŒã¯</h> - <p> - å€ãã®çŽ æŽãããããŒã¯ã®äžãããç¹ã«ããããã®ãã®ã 5ã€éžãã ã - æ¯éèããŠã»ãããåŒçšéšåã¯ããªã³ã¯å
ããããŒã¶ã«ããåŒçšããŠããã - </p> - <p> - <a href="https://fortee.jp/phperkaigi-2022/proposal/ef8cf4ed-63fe-42f8-8145-b3e70054458b">äºé²ã«åãé²åŸ¡ãªã - å
ç¢ãªã³ãŒããå°ãæ§ã
ãªèšèšã®ãã³ã</a> - </p> - <blockquote> - <p> - PHP ã¯ããŒãžã§ã³ãè¿œãæ¯ã«å宣èšãäŸå€ã衚æãåæåãªã©ã®æ©èœã倧å¹
ã«åŒ·åãããå
ç¢ãªã³ãŒããæžãããã®æ©èœãå
å®ããŠããŸããããããã®æ©èœã¯ã©ã䜿ããšå¹æçãªã®ã§ããããã - </p> - <p> - æ¬è¬æŒã§ã¯ PHP 8.1 ãããŒã¹ã«ããŠã誀ããæ³å®ããŠãã§ãã¯ããã®ã§ã¯ãªãããããã誀ãã«ããèšèšãšã¯ã©ã®ãããªãã®ããã€ãŸããäºé²ãã®èгç¹ã軞足ã«ãå
ç¢ãªã³ãŒããå°ãããã®æ§ã
ãªèšèšã®ãã³ããã玹ä»ããŸãã - </p> - </blockquote> - <p> - <a href="https://fortee.jp/phperkaigi-2022/proposal/db00d49e-0dd6-453f-b54b-f731d112f10e">PHPã®ãšã©ãŒãçè§£ããŠé©åãªãšã©ãŒãã³ããªã³ã°ãåŠãŒã</a> - </p> - <blockquote> - <p> - PHPã䜿ã£ãŠããšããééãã Fatal error / Parse error / Warning / Notice çè§£ããŠããŸããïŒ<br/> - ãããã®ãšã©ãŒæãçè§£ããããšã§ãããã«ãšã©ãŒã®åå ã«æ°ä»ãé©åã«å¯Ÿè±¡ã§ããæ§ã«ãªããŸãïŒ<br/> - ãŸãããããçè§£ããäžã§ã®ãšã©ãŒãã³ããªã³ã°ãåŠã³ãŸãããã - </p> - </blockquote> - <p> - <a href="https://fortee.jp/phperkaigi-2022/proposal/4a7e3ded-9134-4919-955c-ec7bf4491c0d">ãšã©ãŒç£èŠãšãã¹ãäœå¶ãžã®æ¹åäœæŠ</a> - </p> - <blockquote> - <p> - æ¯æ¥æµããŠãããšã©ãŒã«çããã¯ã©ãåãåã£ãŠãŸããïŒ<br/> - ãšã©ãŒãåºããªãäºãäžçªã§ãããå®å
šã«å¡ãäºã¯é£ãããšèããŸãã<br/> - ãµãŒãã¹éçšã®äžã§æ¬çªç°å¢ããçºçãããšã©ãŒïŒãµãŒããŒã»ã¯ã©ã€ã¢ã³ããµã€ãã»ãµãŒãããŒãã£èµ·å ã®ãšã©ãŒïŒãžã®ç£èŠäœå¶ãšã<br/> - ãšã©ãŒã»ãã°é²åŸ¡ã®ããããŒã ã§è¡ã£ãŠãããã¹ãã³ãŒãæåã¥ããã®è©±ãããŸãã - </p> - </blockquote> - <p> - <a href="https://fortee.jp/phperkaigi-2022/proposal/6f47daf8-c78f-4fb1-9b99-e9656e6fe7f7">ISUCON11ã®PHPå®è£
ã¯ãäœãèããã©ã®ããã«ããŠäœãããŠããã®ã</a> - </p> - <blockquote> - <p> - æšå¹Žéå¬ãããISUCON11ã«ãŠåé¡ïŒåèå®è£
ïŒã®PHPãžã®ç§»æ€ãæ
åœãããŠããã ããŸããã - </p> - <p> - æçµçãªãœãŒã¹ã³ãŒãããã·ã³ãã«ãªWebã¢ããªã±ãŒã·ã§ã³ã§ã¯ãããŸããããã®è£ã«ã¯<br/> - ã»ãïŒç§ã®æãïŒè¯ãèšèšããå®çŸããããã®æææ±ºå®<br/> - ã»ãISUCONã®åé¡ããšããäœçœ®ä»ãã«ç±æ¥ããåæšéžæ<br/> - ã»ç§»æ€äžã«ééãããã©ãã«ãšãã®è§£æ±ºç<br/> - ãšãã£ãæèãèè€ãååšããŠããŸãã - </p> - <p> - æ¬çºè¡šã¯ããããå
±æããããšã§<br/> - ã»PHPã¢ããªã±ãŒã·ã§ã³ã®èšèšãå®è£
äºäŸãšããŠåœ¹ç«ãŠãŠããã<br/> - ã»ISUCONã®èšèªç§»æ€ã«èå³ãæã£ãŠããã<br/> - ã»ISUCONåé¡ç§»æ€ã®ãå®è£
ãèšèšã®ç·Žç¿ãããææããšããŠã®å¯èœæ§ãç¥ã£ãŠããã<br/> - ããšãç®çãšããŸãã - </p> - </blockquote> - <p> - <a href="https://fortee.jp/phperkaigi-2022/proposal/5a260e4e-542d-4d82-849d-ef3d6cb7c854">ããŒã ã®ä»äºã¯ãŸãã£ãŠãããã©ãã¡ã³ããŒã¯ããããã¢ã€ã¢ã€ãæ±ããŠãã話ââ40åã®å€§èŠæš¡éçºããŒã ã§1on1ãã°ãå
¬éããŠã¿ã</a> - </p> - <blockquote> - <p> - ãµã€ããŠãºã®å€§äŒæ¥åãã°ã«ãŒããŠã§ã¢ã®GaroonïŒã¬ã«ãŒã³ïŒã¯ãPHPã§éçºãããŠãã20幎ç®ã®è£œåã§ããã¬ã«ãŒã³éçºããŒã ã¯æ¥æ¬ã§40åããããã ã§50åã®èš90åã»ã©ã®ããŒã ã«ãªã£ãŠããŸãããŸããã³ããçŠã§ãã«ãªã¢ãŒãã§ã®æŽ»åããã®2幎ã»ã©ç¶ç¶ããŠããŸããã - </p> - <p> - ãã«ãªã¢ãŒãã«ãªã£ãŠãä»äºã¯ãŸãã£ãŠãããç¶ç¶çã«ãªãªãŒã¹ã¯ããŠããŸããããäžæ¹ã§ãäºãã®èããŠããããšãæããŠããå顿èãèŠãã¥ãããªããã¢ã€ã¢ã€ãæ±ããŠããã¡ã³ããŒãå¢ããŠããŸããã - </p> - <p> - ãã®ã»ãã·ã§ã³ã§ã¯ãããããç¶æ³ã§ç§ãããŒã å€ãããžã§ã€ã³ããèŽã圹ã«åŸ¹ããªããèŠããåããããšã§ç¶æ³ãæ¹åããŠãã£ãåãçµã¿ã玹ä»ããŸããåãããã«å€§ããªããŒã ããªã¢ãŒãã¯ãŒã¯ã§é£ãããæããŠãã人ã«ãé£ããã®åå ãžã®æ°ã¥ããåãçµã¿ãžã®ãã³ããããã°å¹žãã§ãã - </p> - </blockquote> - </section> - <section id="token-quizzes"> - <h>ããŒã¯ã³åé¡ã®äœæ</h> - <p> - ä»åã¯ãPHPer ãã£ã¬ã³ãžçšã«åŒç€Ÿã®ããŒã¯ã³åé¡ã 3é¡äœæããã - ãã¡ãã«ã€ããŠã¯<a href="/posts/2022-04-09/phperkaigi-2022-tokens">å¥éèšäºã«ããŠãã</a>ã®ã§ããã¡ããåç
§ããããã - </p> - </section> - <section id="phper-challenge"> - <h>PHPer ãã£ã¬ã³ãž</h> - <p> - <a href="https://fortee.jp/phperkaigi-2022/challenge">1äœ</a>ã«ãªã£ãã<br/> - ãŸããè³åãšã㊠<a href="https://www.amazon.co.jp/dp/B08MQNJC9Z">Echo Show 15</a> ãããã ããã - </p> - </section> - <section id="conference"> - <h>ã«ã³ãã¡ã¬ã³ã¹å
šäœãžã®ææ³</h> - <p> - <a href="/posts/2021-03-30/phperkaigi-2021">å»å¹Žã®åå ã¬ã</a> ã§ã¯ããããªããšãæžããã - </p> - <blockquote> - <p> - 1ã€å人çãªåçç¹ãšããŠã¯ã(äžç¥) Discord ãããã¢ã³ã«ã³ãã¡ã¬ã³ã¹ãããããã®ã€ãã³ãã®ãã®ç¬éã«ãããªãã³ã³ãã³ããã«è§Šããã«ã - åŸããèŠè¿ããçºè¡šãã¹ã©ã€ãã«æ³šåããŠããŸã£ãããšããããšã ã - çºè¡šã®è©³çްãªèŠçŽãã¯ããšããã§ããã®ã ãããä»ããã§ããªãããšãèããã¹ãã ã£ãã<br/> - ãŸãåã«ã³ãã¡ã¬ã³ã¹ã ãããšãè¶ãæ¿ããŠãããã - </p> - </blockquote> - <p> - ãã®åçãèžãŸããä»å¹Žã¯ç©æ¥µçã«ã»ãã®å Ž (å
¬åŒã® Discord ãµãŒãããã¢ã³ã«ã³ãã¡ã¬ã³ã¹) ã«ãåå ããã<br/> - ããã«ãããåå äœéšã®è³ªãã¯ããã«åäžãããç¹ã« Discord ã«é¢ããŠã¯ãç»å£è
ãæ¬äººã«ããè£è¶³ãã - 質åãžã®åçãªã©ããããªããã (ããšãå€ã) ãããç¹å¥ãªçç±ã®ãªãéããçºèšã¯ããªããŸã§ãåå ã¯ããŠãããã»ããè¯ããšæãããã - </p> - <p> - ãªããã¢ã³ã«ã³ãã¡ã¬ã³ã¹ã«ã€ããŠã¯ã1æ¥ç®ã®çµããã«<a href="https://fortee.jp/phperkaigi-2022/unconference/view/d332797a-8921-4706-a7e2-ee72640c9b5e">ããŒã¯ã³åé¡ã®è§£èª¬æŸé</a>ããããªã£ãã - </p> - <p> - ãŸããä»å¹Žã¯ãªãã©ã€ã³ãšãªã³ã©ã€ã³ã®ãã€ããªããéå¬ã§ãã£ãããå»å¹Žã®å
šãªã³ã©ã€ã³ãšæ¯ã¹ãŠããªã³ã©ã€ã³åå ã®äœéšãèœã¡ãŠããªãã£ãã®ã¯ãç¹çãã¹ãã§ãããã - ä»å¹Žã¯ 3åç®ã®ã¯ã¯ãã³æ¥çš®ãéã«åããªãã£ãããšãããçŸå°åå ã¯èŠéã£ãã®ã ããæ¥å¹Žã¯æ¯éãªãã©ã€ã³ã§åå ãããã - </p> - </section> -</section> -<section id="next-year"> - <h>ãããŠæ¥å¹ŽãžâŠâŠ?</h> - <p> - PHPerKaigi 2023 ããããã©ããåãäžããªããããããšããã°ã次㮠4ã€ãç®æšãšãããã - </p> - <ul> - <li>ããããŒã¶ã«ãåºã</li> - <li>PHPer ãã£ã¬ã³ãžã®ããŒã¯ã³åé¡ã 5é¡äœæãã</li> - <li>çŸå°ã«è¡ã</li> - <li>PHPer ãã£ã¬ã³ãžã§å§åãã</li> - </ul> - <hr/> - <p> - æåŸã«ãªããŸããããPHPerKaigi ã®ã¹ã¿ãããã¹ãã³ãµãŒãã¹ããŒã«ãŒã®ã¿ãªãããçŽ æµãªæéãããããšãããããŸããã - </p> - <p> - ã§ã¯ãŸãæ¥å¹Žã - </p> -</section> -</article> diff --git a/vhosts/blog/content/posts/2022-08-27/php-conference-okinawa-code-golf.dj b/vhosts/blog/content/posts/2022-08-27/php-conference-okinawa-code-golf.dj new file mode 100644 index 00000000..5701fe4d --- /dev/null +++ b/vhosts/blog/content/posts/2022-08-27/php-conference-okinawa-code-golf.dj @@ -0,0 +1,99 @@ +--- +[article] +uuid = "bb71bb5d-361b-44cb-9753-81d14583d860" +title = "PHP ã«ã³ãã¡ã¬ã³ã¹æ²çžã§åºé¡ãããã³ãŒããŽã«ãã®åé¡ãè§£ããŠã¿ã" +description = "PHP ã«ã³ãã¡ã¬ã³ã¹æ²çžã®æèŠªäŒ LT ã§åºé¡ãããã³ãŒããŽã«ãã®åé¡ãè§£ããŠã¿ãã" +tags = [ + "conference", + "php", + "phpconokinawa", +] + +[[article.revisions]] +date = "2022-08-27" +remark = "å
¬é" +--- +{#intro} +# ã¯ããã« + +æ¬æ¥ [PHP ã«ã³ãã¡ã¬ã³ã¹æ²çž 2022](https://phpcon.okinawa.jp/) ãéå¬ããã (ããã)ã + +ã«ã³ãã¡ã¬ã³ã¹ã«ã¯åå ã§ããªãã£ããã®ã®ãæèŠªäŒã® LT ã§åºé¡ãããã³ãŒããŽã«ãã®åé¡ã Twitter ã«æµããŠããã®ã§ãè§£ããŠã¿ãã + +* ãã€ãŒã: https://twitter.com/m3m0r7/status/1563397620231712772 +* ã¹ã©ã€ã: https://speakerdeck.com/memory1994/php-conference-okinawa-2022-extra?slide=3 + +{#solution} +# è§£ + +现ããã¬ã®ã¥ã¬ãŒã·ã§ã³ã¯äžæã ã£ãã®ã§ãåæã«å®ããã + +* ã³ãã³ãã©ã€ã³åŒæ°ã®ç¬¬1åŒæ°ã§åããšã +* çµæã¯æšæºåºåã«åºã +* ã³ã³ãã®çŽåŸã«ã¯ã¹ããŒã¹ã1ã€çœ®ã +* æ«å°Ÿã³ã³ãã¯çŠæ¢ +* æ°åã§ãªããã®ã¯å
¥ã£ãŠããªããã®ãšãã +* è² æ°ã¯å
¥ã£ãŠããªããã®ãšãã + +æžãããã®ããã¡ã: + +```php +[<?php $n=$argv[1];foreach([1e4,5e3,2e3,1e3,500,100,50,10,5,1]as$x)for(;$n>=$x;$n-=$x)$r[]=$x;echo implode(', ',$r??[]);?>] +``` + +ãã㊠123 ãã€ããšãªã£ã (æ«å°Ÿæ¹è¡ãå«ããã«ã«ãŠã³ã)ã + +ãã¡ãã¯æ¹è¡ãšã¹ããŒã¹ã远å ããããŒãžã§ã³: + +```php +[<?php + +$n = $argv[1]; +foreach ([1e4, 5e3, 2e3, 1e3, 500, 100, 50, 10, 5, 1] as $x) + for (; $n >= $x; $n -= $x) + $r[] = $x; +echo implode(', ', $r ?? []); + +?>] +``` + +{#techniques} +# 䜿çšãããã¯ãã㯠+ +{#exponential-notation} +## ææ°è¡šèš + +å²ãšå€ãã®èšèªã®ãŽã«ãã§äœ¿ãããã¯ããã¯ã +`e` ãçšããææ°è¡šèšã§ã倧ããªæ°ãçã衚ãã +ãã®ã³ãŒãã§ã¯ `10000`ã`5000`ã`2000`ã`1000` ãææ°è¡šèšããŠããã + +{#shorten-loop} +## foreach ã for ã®äžèº«ã1ã€ã®æã« + +`foreach`ã`for`ã`if` ãªã©ã®åŸãã«ã¯ã +éåžž `{` ãç¶ããŠè€æ°ã®æãé£ããããäžèº«ã®æã1ã€ã«ããŠããŸãã°ã`{` ãš `}` ãçç¥ã§ããã +Cèšèªãªã©ã§ã䜿ããã + +{#omit-initialization} +## $r ã«åæå€ãå
¥ããªã + +PHP ã§ã¯ã`$r[] = ......` ã®ãããªé
åã®æ«å°Ÿã«è¿œå ããåŒãå®è¡ãããšãã +`$r` ãæªå®çŸ©ã ã£ãå Žå㯠`$r` ãåæã«å®çŸ©ããŠç©ºã®é
åã§åæåããŠãããã +ãããå©çšãããšã`$r = [];` ã®ãããªåæåãäžèŠã«ãªãã + +ãã ããããã°ã©ã ã« 0 ãæž¡ããããšã«ãŒããäžåºŠãåããªãã®ã§ã`$r` ãæªå®çŸ©ã«ãªã£ãŠããŸãã +`implode()` ã«æž¡ããšããã§ãšã©ãŒã«ãªãã +ãããé²ãããã« `$r ?? []` ã䜿ã£ãŠããã + +ãã 0 ãæž¡ãããã±ãŒã¹ãç¡èŠãããªãããããäžèŠã«ãªãã®ã§ 4 ãã€ãçž®ãã + +{#put-text-outside-php-tag} +## PHP ã¿ã°ã®å€ã«æååã眮ã + +PHP ã§ã¯ã`<?php` `?>` ã§å²ãããéšåã®å€åŽã«ããæååã¯ããã®ãŸãŸåºåãããã +ä»åã®ã±ãŒã¹ã§ã¯ãå
é ãšæ«å°Ÿã«å¿
ã `[` ãš `]` ãåºåããã®ã§ããã®ãŸãŸæžããŠããã°ããã + +{#outro} +# ãããã« + +æåŸã«ãªããŸãããã [ããããŒ](https://twitter.com/m3m0r7) ãããæ¥œããåé¡ãããããšãããããŸããã diff --git a/vhosts/blog/content/posts/2022-08-27/php-conference-okinawa-code-golf.ndoc b/vhosts/blog/content/posts/2022-08-27/php-conference-okinawa-code-golf.ndoc deleted file mode 100644 index 056ac438..00000000 --- a/vhosts/blog/content/posts/2022-08-27/php-conference-okinawa-code-golf.ndoc +++ /dev/null @@ -1,119 +0,0 @@ ---- -[article] -uuid = "bb71bb5d-361b-44cb-9753-81d14583d860" -title = "PHP ã«ã³ãã¡ã¬ã³ã¹æ²çžã§åºé¡ãããã³ãŒããŽã«ãã®åé¡ãè§£ããŠã¿ã" -description = "PHP ã«ã³ãã¡ã¬ã³ã¹æ²çžã®æèŠªäŒ LT ã§åºé¡ãããã³ãŒããŽã«ãã®åé¡ãè§£ããŠã¿ãã" -tags = [ - "conference", - "php", - "phpconokinawa", -] - -[[article.revisions]] -date = "2022-08-27" -remark = "å
¬é" ---- -<article> - <section id="intro"> - <h>ã¯ããã«</h> - <p> - æ¬æ¥ <a href="https://phpcon.okinawa.jp/">PHP ã«ã³ãã¡ã¬ã³ã¹æ²çž 2022</a> ãéå¬ããã (ããã)ã - </p> - <p> - ã«ã³ãã¡ã¬ã³ã¹ã«ã¯åå ã§ããªãã£ããã®ã®ãæèŠªäŒã® LT ã§åºé¡ãããã³ãŒããŽã«ãã®åé¡ã Twitter ã«æµããŠããã®ã§ãè§£ããŠã¿ãã - </p> - <ul> - <li>ãã€ãŒã: https://twitter.com/m3m0r7/status/1563397620231712772</li> - <li>ã¹ã©ã€ã: https://speakerdeck.com/memory1994/php-conference-okinawa-2022-extra?slide=3</li> - </ul> - </section> - <section id="solution"> - <h>è§£</h> - <p> - 现ããã¬ã®ã¥ã¬ãŒã·ã§ã³ã¯äžæã ã£ãã®ã§ãåæã«å®ããã - </p> - <ul> - <li>ã³ãã³ãã©ã€ã³åŒæ°ã®ç¬¬1åŒæ°ã§åããšã</li> - <li>çµæã¯æšæºåºåã«åºã</li> - <li>ã³ã³ãã®çŽåŸã«ã¯ã¹ããŒã¹ã1ã€çœ®ã</li> - <li>æ«å°Ÿã³ã³ãã¯çŠæ¢</li> - <li>æ°åã§ãªããã®ã¯å
¥ã£ãŠããªããã®ãšãã</li> - <li>è² æ°ã¯å
¥ã£ãŠããªããã®ãšãã</li> - </ul> - <p> - æžãããã®ããã¡ã: - </p> - <codeblock language="php"> - <![CDATA[ - [<?php $n=$argv[1];foreach([1e4,5e3,2e3,1e3,500,100,50,10,5,1]as$x)for(;$n>=$x;$n-=$x)$r[]=$x;echo implode(', ',$r??[]);?>] - ]]> - </codeblock> - <p> - ãã㊠123 ãã€ããšãªã£ã (æ«å°Ÿæ¹è¡ãå«ããã«ã«ãŠã³ã)ã - </p> - <p> - ãã¡ãã¯æ¹è¡ãšã¹ããŒã¹ã远å ããããŒãžã§ã³: - </p> - <codeblock language="php"> - <![CDATA[ - [<?php - - $n = $argv[1]; - foreach ([1e4, 5e3, 2e3, 1e3, 500, 100, 50, 10, 5, 1] as $x) - for (; $n >= $x; $n -= $x) - $r[] = $x; - echo implode(', ', $r ?? []); - - ?>] - ]]> - </codeblock> - </section> - <section id="techniques"> - <h>䜿çšãããã¯ããã¯</h> - <section id="exponential-notation"> - <h>ææ°è¡šèš</h> - <p> - å²ãšå€ãã®èšèªã®ãŽã«ãã§äœ¿ãããã¯ããã¯ã - <code>e</code> ãçšããææ°è¡šèšã§ã倧ããªæ°ãçã衚ãã - ãã®ã³ãŒãã§ã¯ <code>10000</code>ã<code>5000</code>ã<code>2000</code>ã<code>1000</code> ãææ°è¡šèšããŠããã - </p> - </section> - <section id="shorten-loop"> - <h>foreach ã for ã®äžèº«ã1ã€ã®æã«</h> - <p> - <code>foreach</code>ã<code>for</code>ã<code>if</code> ãªã©ã®åŸãã«ã¯ã - éåžž <code>{</code> ãç¶ããŠè€æ°ã®æãé£ããããäžèº«ã®æã1ã€ã«ããŠããŸãã°ã<code>{</code> ãš <code>}</code> ãçç¥ã§ããã - Cèšèªãªã©ã§ã䜿ããã - </p> - </section> - <section id="omit-initialization"> - <h>$r ã«åæå€ãå
¥ããªã</h> - <p> - PHP ã§ã¯ã<code>$r[] = ......</code> ã®ãããªé
åã®æ«å°Ÿã«è¿œå ããåŒãå®è¡ãããšãã - <code>$r</code> ãæªå®çŸ©ã ã£ãå Žå㯠<code>$r</code> ãåæã«å®çŸ©ããŠç©ºã®é
åã§åæåããŠãããã - ãããå©çšãããšã<code>$r = [];</code> ã®ãããªåæåãäžèŠã«ãªãã - </p> - <p> - ãã ããããã°ã©ã ã« 0 ãæž¡ããããšã«ãŒããäžåºŠãåããªãã®ã§ã<code>$r</code> ãæªå®çŸ©ã«ãªã£ãŠããŸãã - <code>implode()</code> ã«æž¡ããšããã§ãšã©ãŒã«ãªãã - ãããé²ãããã« <code>$r ?? []</code> ã䜿ã£ãŠããã - </p> - <p> - ãã 0 ãæž¡ãããã±ãŒã¹ãç¡èŠãããªãããããäžèŠã«ãªãã®ã§ 4 ãã€ãçž®ãã - </p> - </section> - <section id="put-text-outside-php-tag"> - <h>PHP ã¿ã°ã®å€ã«æååã眮ã</h> - <p> - PHP ã§ã¯ã<code><?php</code> <code>?></code> ã§å²ãããéšåã®å€åŽã«ããæååã¯ããã®ãŸãŸåºåãããã - ä»åã®ã±ãŒã¹ã§ã¯ãå
é ãšæ«å°Ÿã«å¿
ã <code>[</code> ãš <code>]</code> ãåºåããã®ã§ããã®ãŸãŸæžããŠããã°ããã - </p> - </section> - </section> - <section id="outro"> - <h>ãããã«</h> - <p> - æåŸã«ãªããŸãããã<a href="https://twitter.com/m3m0r7">ããããŒ</a>ãããæ¥œããåé¡ãããããšãããããŸããã - </p> - </section> -</article> diff --git a/vhosts/blog/content/posts/2022-08-31/support-for-communty-is-employee-benefits.dj b/vhosts/blog/content/posts/2022-08-31/support-for-communty-is-employee-benefits.dj new file mode 100644 index 00000000..1ba5891b --- /dev/null +++ b/vhosts/blog/content/posts/2022-08-31/support-for-communty-is-employee-benefits.dj @@ -0,0 +1,52 @@ +--- +[article] +uuid = "cd16debe-8077-4edf-aec0-b1d45955a0e2" +title = "åŒç€Ÿã® PHP Foundation ãžã®å¯ä»ã«å¯ããŠ" +description = "å
æ¥ãç§ã®å€ããããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€ŸããPHP Foundation ãžå¯ä»ããããªããŸãããæ¬ä»¶ã瀟å
ã§ãã€ããæšé²ãã1人ãšããŠãæšé²ã®çç±çãæžãæ®ããŠãããŸãã" +tags = [] + +[[article.revisions]] +date = "2022-08-31" +remark = "å
¬é" +--- +{#intro} +# ã¯ããã« + +*泚: ããã¯ç§åäººã®æèŠã§ãããæå±ããçµç¹ã代衚ãããã®ã§ã¯ãããŸããã* + +å
æ¥ãç§ã®å€ãã [ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ](https://www.dgcircus.com/) ã +[PHP Foundation](https://opencollective.com/phpfoundation) ãž $2,000 ã®å¯ä»ããããªããŸããã + +èšäº: https://www.dgcircus.com/news/581 + +æ¬ä»¶ã瀟å
ã§ãã€ããæšé²ãã1人ãšããŠãæšé²ã®çç±çãæžãæ®ããŠãããŸãã + +{#why} +# ãªãïŒ + +çµç¹ãšããŠã®å¯ä»çç±ã¯åæ²ããèšäºã«è²ããšããŠãããã§ã¯ãç§ã瀟å
ã§ãã®ä»¶ãæšé²ããçç±ã«ã€ããŠæžãããšã«ããŸãã + +åœæã®èãã端çã«ãŸãšãã瀟å
ãã£ããã®æçš¿ããã£ãã®ã§ããããåŒçšããŸã: + +> çµå±ãããéããã (ç§ã®äžã§ã®) æå€§ã®çç±ãããèªåã®å€ããäŒç€ŸãããããããäŒç€Ÿã§ãã£ãŠã»ããããšããã®ãããã +> âã«ããŠããææ
ããŒã¹ã®çç±ããåºããŠããªããšããã®ã説åŸåã«æ¬ ããŠããçç±ãªã®ã ãšæããŸããã +> å¯ä»ã®å ±åãæµããŠããããOSS ã®ããªãŒã©ã€ãã®è©±ãæµããŠããããããã³ã«ãèªå°å¿ãæ¯æãããããšããã +> (ããã¯å€§è¢è£ããã衚çŸã§ãå®éã«ã¯ãããŸã§æç¢ºã«å·ã€ããŠããããã§ã¯ãããŸããã)ã +> +> 远èš: ãè©èº«ãçããªãããšããã®ãããé©åã§ããã + +â»æäžã®ãâã«ããŠããã¯ãããã«èŒããŠããªãå¥ã®æçš¿ãæããŠããŸãã + +OSS ãééçã«æ¯æŽããããæè¡ã«ã³ãã¡ã¬ã³ã¹ãžåè³ããã +(ããã㯠[CTO](https://twitter.com/tomzoh) ãã«ã³ãã¡ã¬ã³ã¹ã幎2ã§äž»å¬ããã: +[iOSDC](https://iosdc.jp) [PHPerKaigi](https://phperkaigi.jp) ) +ãšãã£ãè¡çºã¯ãã³ãã¥ããã£ãžã®è²¢ç®ã§ãããšåæã«ã瀟å¡ã«å¯Ÿãã粟ç¥ççŠå©åçã§ããããšèšããã§ããã (ç¥ãããã©)ã +ãããã¯ãæè¡ãæè¡è
ã倧åã«ããçµç¹ã§ããããšããããšã®ã察å€çã«ã察å
çã«ã匷åãªã¡ãã»ãŒãžãªã®ã§ãã + +以äžããç§ã瀟å
ã§å¯ä»ã®ä»¶ãé²ãã (ããªãç§çãª) çç±ã§ãã + +{#outro} +# ãããã« + +æçµçã«ç€ŸãšããŠã®å¯ä»ãŸã§æŒãçããããã®ã¯ããã¡ããç§ã®åã§ã¯ãªã圹å¡ã®æ¹ã
ã®æ±ºå®ã«ãããã®ã§ãã +ãã®å ŽãåããŠæè¬ç³ãäžããŸãã diff --git a/vhosts/blog/content/posts/2022-08-31/support-for-communty-is-employee-benefits.ndoc b/vhosts/blog/content/posts/2022-08-31/support-for-communty-is-employee-benefits.ndoc deleted file mode 100644 index cbc99969..00000000 --- a/vhosts/blog/content/posts/2022-08-31/support-for-communty-is-employee-benefits.ndoc +++ /dev/null @@ -1,69 +0,0 @@ ---- -[article] -uuid = "cd16debe-8077-4edf-aec0-b1d45955a0e2" -title = "åŒç€Ÿã® PHP Foundation ãžã®å¯ä»ã«å¯ããŠ" -description = "å
æ¥ãç§ã®å€ããããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€ŸããPHP Foundation ãžå¯ä»ããããªããŸãããæ¬ä»¶ã瀟å
ã§ãã€ããæšé²ãã1人ãšããŠãæšé²ã®çç±çãæžãæ®ããŠãããŸãã" -tags = [] - -[[article.revisions]] -date = "2022-08-31" -remark = "å
¬é" ---- -<article> - <section id="intro"> - <h>ã¯ããã«</h> - <p> - <strong>泚: ããã¯ç§åäººã®æèŠã§ãããæå±ããçµç¹ã代衚ãããã®ã§ã¯ãããŸããã</strong> - </p> - <p> - å
æ¥ãç§ã®å€ãã <a href="https://www.dgcircus.com/">ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ</a> ã - <a href="https://opencollective.com/phpfoundation">PHP Foundation</a> ãž $2,000 ã®å¯ä»ããããªããŸããã - </p> - <p> - èšäº: https://www.dgcircus.com/news/581 - </p> - <p> - æ¬ä»¶ã瀟å
ã§ãã€ããæšé²ãã1人ãšããŠãæšé²ã®çç±çãæžãæ®ããŠãããŸãã - </p> - </section> - <section id="why"> - <h>ãªãïŒ</h> - <p> - çµç¹ãšããŠã®å¯ä»çç±ã¯åæ²ããèšäºã«è²ããšããŠãããã§ã¯ãç§ã瀟å
ã§ãã®ä»¶ãæšé²ããçç±ã«ã€ããŠæžãããšã«ããŸãã - </p> - <p> - åœæã®èãã端çã«ãŸãšãã瀟å
ãã£ããã®æçš¿ããã£ãã®ã§ããããåŒçšããŸã: - </p> - <blockquote> - <p> - çµå±ãããéããã (ç§ã®äžã§ã®) æå€§ã®çç±ãããèªåã®å€ããäŒç€ŸãããããããäŒç€Ÿã§ãã£ãŠã»ããããšããã®ãããã - âã«ããŠããææ
ããŒã¹ã®çç±ããåºããŠããªããšããã®ã説åŸåã«æ¬ ããŠããçç±ãªã®ã ãšæããŸããã - å¯ä»ã®å ±åãæµããŠããããOSS ã®ããªãŒã©ã€ãã®è©±ãæµããŠããããããã³ã«ãèªå°å¿ãæ¯æãããããšããã - (ããã¯å€§è¢è£ããã衚çŸã§ãå®éã«ã¯ãããŸã§æç¢ºã«å·ã€ããŠããããã§ã¯ãããŸããã)ã - </p> - <p> - 远èš: ãè©èº«ãçããªãããšããã®ãããé©åã§ããã - </p> - </blockquote> - <p> - â»æäžã®ãâã«ããŠããã¯ãããã«èŒããŠããªãå¥ã®æçš¿ãæããŠããŸãã - </p> - <p> - OSS ãééçã«æ¯æŽããããæè¡ã«ã³ãã¡ã¬ã³ã¹ãžåè³ããã - (ããã㯠<a href="https://twitter.com/tomzoh">CTO</a> ãã«ã³ãã¡ã¬ã³ã¹ã幎2ã§äž»å¬ããã: - <a href="https://iosdc.jp">iOSDC</a> <a href="https://phperkaigi.jp">PHPerKaigi</a>) - ãšãã£ãè¡çºã¯ãã³ãã¥ããã£ãžã®è²¢ç®ã§ãããšåæã«ã瀟å¡ã«å¯Ÿãã粟ç¥ççŠå©åçã§ããããšèšããã§ããã (ç¥ãããã©)ã - ãããã¯ãæè¡ãæè¡è
ã倧åã«ããçµç¹ã§ããããšããããšã®ã察å€çã«ã察å
çã«ã匷åãªã¡ãã»ãŒãžãªã®ã§ãã - </p> - <p> - 以äžããç§ã瀟å
ã§å¯ä»ã®ä»¶ãé²ãã (ããªãç§çãª) çç±ã§ãã - </p> - </section> - <section id="outro"> - <h>ãããã«</h> - <p> - æçµçã«ç€ŸãšããŠã®å¯ä»ãŸã§æŒãçããããã®ã¯ããã¡ããç§ã®åã§ã¯ãªã圹å¡ã®æ¹ã
ã®æ±ºå®ã«ãããã®ã§ãã - ãã®å ŽãåããŠæè¬ç³ãäžããŸãã - </p> - </section> -</article> diff --git a/vhosts/blog/content/posts/2022-09-29/write-fizzbuzz-in-php-2-letters-per-line.dj b/vhosts/blog/content/posts/2022-09-29/write-fizzbuzz-in-php-2-letters-per-line.dj new file mode 100644 index 00000000..c23341dc --- /dev/null +++ b/vhosts/blog/content/posts/2022-09-29/write-fizzbuzz-in-php-2-letters-per-line.dj @@ -0,0 +1,617 @@ +--- +[article] +uuid = "42f0b29b-1e44-4dbe-9864-69abe3bb1e6e" +title = "ãPHPã fizzbuzz ãæžãã1è¡ããã2æåã§ã" +description = "PHP ã§ fizzbuzz ãæžããããã ãã1è¡ãããã«äœ¿ããæåæ°ã¯2æåãŸã§ã" +tags = [ + "php", +] + +[[article.revisions]] +date = "2022-09-28" +remark = "å
¬é" + +[[article.revisions]] +date = "2022-09-29" +remark = "å°ããªæèšã®ä¿®æ£ã»å€æŽ" +--- +{#intro} +# èšäºã®æ§æã«ã€ã㊠+ +ãã®èšäºã¯ãæ®éã® fizzbuzz ãåŸã
ã«å€åœ¢ããŠæçµåœ¢ã«ããŠããããšããæ§æã§æžãããŠããã +æçµåœ¢ãèŠãŠã©ã®ãããªä»çµã¿ã§åããŠããã®ãè§£èªããŠãã解説ãèªã¿ããããšãããããããã°ã +[ãã®ããŒãž](https://gist.github.com/nsfisis/04c227d5a419867472a0b23a83ad2919#file-fizzbuzz-php-2-letters-per-line-and-supports-php-8-x-without-warnings) +ã«ãœãŒã¹ã³ãŒããããã®ã§ããã¡ããå
ã«èŠãŠã»ããã + +{#regulations} +# ã¬ã®ã¥ã¬ãŒã·ã§ã³ + +PHP ã§ã次ã®ãããªå¶çŽã®äžã« fizzbuzz ãæžããã + +* 1è¡ãããã®æåæ°ã¯2æåãŸã§ã«åããããš (ãã ã `<?php` ã¿ã°ã¯é€ã) + + * å³å¯ãªå®çŸ©: `<?php` ã¿ã°ä»¥éã®ãœãŒã¹ã³ãŒããã2 byte ããšã«ã©ã€ã³ãã£ãŒã (LF) ã§åºåãããããš + +* ã¹ããŒã¹ãã¿ãã䜿çšããªãããš +* ã«ãŒãã®ã¢ã³ããŒã«ãããªãããš + + * 100 åã«ãŒãã®ä»£ããã« 100 åã³ãŒããã³ããããšããã®ã¯çŠæ¢ + +* PHP 7.4ã8.1 ã§åäœããããš +* å®è¡æã« Notice ã Warning ãåºãªãããš +* æšæºçãªã€ã³ã¹ããŒã«æ§æã® PHP ã§å®çŸã§ããããš (ããã©ã«ãã§æå¹ã«ãªã£ãŠããªãæ¡åŒµçã䜿ããªãããš) + +åè: PHP ã«ã¯ `short_open_tag` ãšãããªãã·ã§ã³ãããã +ãããæå¹ã«ãããšãã¡ã€ã«åé ã® `<?php` ã®ä»£ããã« `<?` +ã䜿ãããšãã§ããæåã©ãã1è¡2æåã§æžããã +ãã ããã®ãªãã·ã§ã³ã¯ããã©ã«ã off ã«ãªã£ãŠããç°å¢ãå€ããããªã®ã§ãä»åã¯äœ¿ããªãããšã«ããã + +{#problems} +# äž»ãªé害 + +1è¡ãããã®æåæ°ãªã©ãé©åœã«æ¹è¡ãæãã°ããã ãã§ã¯ãªãã®ãïŒ + +ç¹ã«ãCèšèªã§ãã®ãããªè©Šã¿ããããªã£ãããšããããããªãããæãã ãããäºå®ãCã§ã®ãã®å¶çŽã¯ã»ãšãã©ç¡æå³ã«çããã + +```c +#\ +i\ +n\ +c\ +l\ +u\ +d\ +e\ +<\ +s\ +t\ +d\ +i\ +o\ +.\ +h\ +>\ +/* +*/ +i\ +n\ +t\ +/* +*/ +m\ +a\ +i\ +n( +){ +f\ +o\ +r( +i\ +n\ +t\ +/* +*/ +i= +1; +i< +1\ +0\ +0; +i\ ++\ ++) +if +(i +%\ +15 +== +0) +p\ +r\ +i\ +n\ +t\ +f( +"\ +F\ +i\ +z\ +z\ +B\ +u\ +z\ +z\ +%\ +c\ +", +10 +); + +/* ããšã¯åãããã«æ®éã®ããã°ã©ã ãå€åœ¢ããã ããªã®ã§çç¥ */ +``` + +ããã¯ã¹ã©ãã·ã¥ã䜿ã£ãè¡ç¶ç¶ãããŒã¯ã³ãåºåããªãããšããã®ããã€ã³ãã ã + +ããŠãPHP ã§ã¯ããããããã¯ã¹ã©ãã·ã¥ãè¡ç¶ç¶ã«äœ¿ãããšãã§ããªãã +ããã«ãããã3æå以äžãããªãããŒã¯ã³ãäžå䜿ããªãããšããå¶çŽã課ãããã +äŸãã°ã`echo` ã§åºåããããšãã`for` ã§ã«ãŒãããããšã +`new` ã§ã€ã³ã¹ã¿ã³ã¹ãçæããããšãã§ããªãã +ç¹ã«ãåºå㯠fizzbuzz ãã©ããªã¢ã«ãŽãªãºã ã§å®è£
ããããšãããªããªããã°ãªããªãã®ã§ãã§ããªãã®ã¯èŽåœçã§ããã + +åœç¶ãååã3æå以äžãã颿°ã䜿ããªãããªããæšæº PHP ã®ç¯å²å
ã«ãããŠãååã 2æå以äžã®é¢æ°ã¯ä»¥äžã®ãšããã§ãã: + +* `_`: `gettext` ã®ãšã€ãªã¢ã¹ +* `dl`: æ¡åŒµã¢ãžã¥ãŒã«ãããŒããã +* `pi`: ååšçãè¿ã + +(ç°å¢ã«ãã£ãŠå€å°ã¯å€ãããã) + +2æåã®é¢æ°ãå®çŸ©ããŸãã£ãæ¡åŒµã¢ãžã¥ãŒã«ãçšæããŠãã㊠`dl()` ã§èªã¿èŸŒãè¡çºã¯ãã¬ã®ã¥ã¬ãŒã·ã§ã³ã§å®ãã + +> * æšæºçãªã€ã³ã¹ããŒã«æ§æã® PHP ã§å®çŸã§ããããš (ããã©ã«ãã§æå¹ã«ãªã£ãŠããªãæ¡åŒµçã䜿ããªãããš) + +ã«åãã (ãšããããããããã ãšãããããããªããšããªãã®ã§ããã®ã«ãŒã«ãè¶³ããããšããã®ãæ£ãã)ã + +ãŸãã2æåã ãšæååããŸãšãã«æžããªãã®ãèŸãã`''` ã ãã§2æå䜿ãã®ã§ã +ã1æåã®æååãªãã©ã«ããšãããã®ãæžãããšãã§ããªããPHP ã§ã¯æååãªãã©ã«äžã«çã®æ¹è¡ãæžããã®ã§ + +```php +$a +=' +a' +;; +``` + +ãšãããš `$a` 㯠`"\na"` ã«ãªãã®ã ããäœèšãªæ¹è¡ãå
¥ã£ãŠããŸãã + +ãããã®é害ãã©ã®ããã«ä¹ãè¶ããã®ããæ¬¡ç¯ããèŠãŠããã + +{#commentary} +# 解説 + +{#normal-fizzbuzz} +## æ®éã® (?) fizzbuzz + +ãŸãã¯æ®éã«æžããšãããã + +```php +<?php + +for ($i = 1; $i < 100; $i++) { + echo (($i % 3 ? '' : 'Fizz') . ($i % 5 ? '' : 'Buzz') ?: $i) . "\n"; +} +``` + +çŽ çŽã«æžãã fizzbuzz ãšã¯èšãé£ããããã®ãããã¯æ®éã ãšããããšã«ããŠãããªããšããã®å
ããã£ãŠããããªãã®ã§èš±ããŠã»ããã + +{#remove-keywords} +## `for` ã®æé€ + +`for` ã¯ã3æåãããé·ãããŒã¯ãŒãã§ããã +ãããªãã®ã¯äœ¿ããªãã`array_` ç³»ã®é¢æ°ã䜿ã£ãŠãé©åœã«çœ®ãæãããšãããã + +```php +<?php + +$s = range(1, 100); +array_walk( +$s, +fn($i) => +printf((($i % 3 ? '' : 'Fizz') . ($i % 5 ? '' : 'Buzz') ?: $i) . "\n"), +); +``` + +`array_walk` ã `range`ã`printf` ãšãã£ã +`for` ãããé·ãããŒã¯ã³ãçŸããŠããŸã£ãããããã¯æ¬¡ç¯ã§çŽãããšã«ããã +ãªãã`echo` ã¯æ (statement) ã§ããåŒ (expression) ã§ã¯ãªãã®ã§ãåŒã§ãã `printf` ã«çœ®ãæããã + +{#shorten-function-invocation} +## 颿°åŒã³åºãã®ççž® + +`range`ã`array_walk`ã`printf` ã¯é·ãããã®ã§ã©ãã«ãããã°ãªããªãã +ããã§ãPHP ã®å¯å€é¢æ°ã䜿ããå¯å€é¢æ°ãšã¯ã颿°åãæååãšããŠå
¥ã£ã倿°ãçµç±ããŠã颿°ãåŒã³åºãæ©èœã§ããã + +```php +<?php + +$r = 'range'; +$w = 'array_walk'; +$p = 'printf'; + +$s = $r(1, 100); +$w( +$s, +fn($i) => +$p((($i % 3 ? '' : 'Fizz') . ($i % 5 ? '' : 'Buzz') ?: $i) . "\n"), +); +``` + +ããã§é¢æ°ãåŒã³åºããŠããæã¯çããªã£ãã +ã§ã¯ã`$r` ã `$w` ã `$p`ã +ãŸã `'Fizz'` ã `'Buzz'` ã¯ã©ããã£ãŠ 1 è¡ 2 æåã«åããã®ãã +次ã®ãã¯ããã¯ãžç§»ããã + +{#incompatible-solution} +## äœè«: PHP 8.x ã§åäœããªããŠããããªã + +ä»å䜿ã£ããã¯ããã¯ã説æããåã«ãäœè«ãšããŠãæååãªãã©ã«ã®ççž®æ³ãšããŠä»åæ¡çšããªãã£ããã®ã玹ä»ããã + +> * PHP 7.4ã8.1 ã§åäœããããš + +ãšããã«ãŒã«ããªãå Žåããæªå®çŸ©ã®å®æ°ãè©äŸ¡ãããå Žåããã®å®æ°ã®ååãå€ã«ãªãããšãã PHP 7.x ãŸã§ã®ä»æ§ãå©çšã§ããã +äŸãã°ã `Fizz` ãšããæååãæ¬²ãããã°ã次ã®ããã«ããã + +```php +$f +=F +.i +.z +.z +;; +``` + +ããããŠç°¡åã«æååãäœããã +ãªãããã®ä»æ§ã¯ 7.x æç¹ã§ãèŠåãåããã®ã§ã`@` æŒç®åã䜿ã£ãŠæå¶ããŠãããšããã + +```php +$f +=@ +F. +@i +.# +@z +.# +@z +;; +``` + +ãããããã®ããšãããã£ãŠãããããã PHP 8.x ã§ã®åäœãèŠä»¶ã«èª²ãããšãããããã + +{#shorten-string-literals} +## æååãªãã©ã«ã®ççž® + +å®éã«äœ¿ã£ãææ³ã®èª¬æã«ç§»ãã + +ãã°ããæååå士ã®ãããæŒç®ã䜿ãã +PHP ã§ã¯ãæååå士ã§ãããæŒç® (`&`ã`|`ã`^`) ãããå Žåã +æååã®åãã€ãããšã«æå®ãããããæŒç®ããªããããããçµåãããã®ãæŒç®çµæãšãªãã + +```php +$a = "12345"; +$b = "world"; + +// $a ^ $b ã¯æ¬¡ã®ã³ãŒããšåã +$result = ''; +for ($i = 0; $i < min(strlen($a), strlen($b)); $i++) { +$result .= $a[$i] ^ $b[$i]; +} + +echo $result; +// => F]AXQ +``` + +ãããèžãŸããæ¬¡ã®ã³ãŒããèŠãŠã¿ããã + +```php +$x = "x\nOm\n"; +$y = "\nk!\no"; +$r = $x ^ $y; +echo "$r\n"; +``` + +å®è¡ãããšã`range` ã衚瀺ãããã +ããŠãPHP ã§ã¯æååãªãã©ã«äžã«çã®æ¹è¡ãçŽæ¥æžããŠãããã®ã ã£ã (ãäž»ãªé害ãã®ç¯ãåç
§ã®ããš)ã +æžããããŠã¿ããã + +```php +$x +='x +Om +'; +$y +=' +k! +o' +; + +$r = $x ^ $y; +echo "$r\n"; +``` + +ããã« `#` ã䜿ã£ãŠé©åœã«èª¿æŽãããšã次ã®ããã«ãªãã + +```php +$x +=# +'x +Om +'; +$y +=' +k! +o' +;# +$r +=# +$x +^# +$y +;# + +echo "$r\n"; +``` + +1è¡ããã2æåã§ã`range` ãšããæååãçæããããšã«æåããã +ä»ã®å¿
èŠãªæååã«ããåæ§ã®åŠçãã»ã©ããã + +åè: `Buzz` äžã«ããå°æåã® `u` ã¯ããã®ããžãã¯ã ãš non-printable ãªæåã«ãªã£ãŠããŸãã +ãããŸã§ã®ãã¯ããã¯ãé§äœ¿ããã°åé¿ããã®ã¯ããé£ãããªãã®ã§ãèããŠã¿ãŠã»ããã + +{#stretched-fizzbuzz} +# å®æç³» + +宿ãããã®ããã¡ãã + +```php +<?php + +$x +=# +'i +S' +;; +$y +=' +b! +'; +$c +=# +$x +^# +$y +;# +$x +=# +'x +Om +'; +$y +=' +k! +o' +;# +$r +=# +$x +^# +$y +;# +$x +=# +'k +Sk +~} +Ma +'; +$y +=' +x! +s! +k! +'; +$w +=# +$x +^# +$y +;# +$x +=# +'z +Hd +G' +;# +$y +=' +x! +~! +'; +$p +=# +$x +^# +$y +;# +$x +=# +'L +[p +'; +$y +=' +c! +'; +$f +=# +$x +^# +$y +;# +$x +=# +'H +[p +'; +$y +=' +_! +'; +$b +=# +$x +^# +$y +;# +$b +[1 +]= +$c +(# +13 +*9 +); +$s +=# +$r +(1 +,( +10 +** +2) +); +$w +(# +$s +,# +fn +(# +$i +)# +=> +$p +(( +(# +$i +%3 +?# +'' +:# +$f +). +(# +$i +%5 +?# +'' +:# +$b +)? +:# +$i +)# +.' +') +); +``` + +{#outro} +# ææ³ãªã© + +PHP ã¯ãã¹ã¯ãªããèšèªã®äžã ãšã·ã³ã¿ãã¯ã¹ã·ã¥ã¬ãŒãå°ãªã (äœæ)ã +ãã®ææŠã¯äžå¯èœã«æãããããPHP ããã¥ã¢ã«ãšã«ããã£ãããŠããããªããšããªã£ãã + +ã¿ããªãããã°ã©ã ã现é·ããããã + +{#alternative-solution} +# äœè«2: å¥è§£ + +PHP ã§ã¯ãããã¯ã¯ã©ãŒãã䜿ã£ãŠã·ã§ã«ãåŒã³åºããã +ãã㯠`shell_exec` 颿°ãšç䟡ã§ããã +ããŠãPHP ã§ã¯ããã¯ã¹ã©ãã·ã¥ã«ããè¡ç¶ç¶ã䜿ããªããšæžããããã·ã§ã«ã§ã¯äœ¿ãã +(åœç¶ã ããåŒã³åºãããã·ã§ã«ã«äŸåãããBash ãªã倧äžå€«ã ãããç¥ãããã©)ã + +```php +<?php + +printf(` +e\ +c\ +h\ +o\ +\ +1\ +2\ +3\ +`); +``` + +ãªããããã§ã¯ç°¡åã®ããåºåã« `printf` ããã®ãŸãŸäœ¿ã£ãŠãããã +å®éã«ã¯ `printf` ãšããæååãåæããŠå¯å€é¢æ°ã§åŒã³åºãã + +ãã ããããã§ã¯ + +> * ã¹ããŒã¹ãã¿ãã䜿çšããªãããš + +ã«éåããŠããŸããã¹ããŒã¹ã䜿ããªããšåŒæ°ãšã³ãã³ããåºåããªããããã¯å°ã£ãã + +ãããã以äžã¯äžå¯èœã ãšæã£ãŠããã®ã ãããã®èšäºã®å·çäžã«è§£æ±ºããæ¹æ³ãæãã€ããã®ã§èŒããŠããã + +```php +<?php + +$c = 'chr'; + +${ +'_ +'} +=# +$c +(# +32 +). +$c +(# +92 +); + +printf(` +e\ +c\ +h\ +o\ +${ +'_ +'} +1\ +2\ +3\ +`); +``` + +å
çšãšåããã`chr` ã `printf` ãçæããéšåã¯é·ããªãã®ã§çããã + +``` +${ +'_ +'} +``` + +ã¯å€æ°ã§ãäžã«ã¯ã¹ããŒã¹ãšãšã¹ã±ãŒããå
¥ã£ãŠãã (`chr(32) . chr(92)`)ã +ã·ã§ã«ã«æž¡ãããŠããæååã¯æ¬¡ã®ããã«ãªãã + +``` +e\ +c\ +h\ +o\ +\ +1\ +2\ +3\ +``` + +ããã¯ãåæ²ããã³ãã³ããšåãã ã +ããããŠãã¹ããŒã¹ãéœã«æžããã«ã·ã§ã«ãããããèªç±ã«æ±ããããã«ãªã£ãã +Fizzbuzz ã®ã¯ã³ã©ã€ããŒãããããæžããã ãããããããšã¯ãªããšããªãã ãã (詊ããŠãªããã©)ã + +ãšããããšã§ããã¯å¥è§£ãšããããšã«ããŠããã + +ã¡ãªã¿ã«ãPHP 8.2 ããã¯ããã®èšæ³ã§ Warning ãåºãããã«ãªãããã ã + +``` +${ +'_ +'} +``` + +ææ°çã§èŠåãåºããšããã®ãçŸãããªãã®ã§ãç§ãšããŠã¯æ¬ç·šã®è§£æ³ãæšãã diff --git a/vhosts/blog/content/posts/2022-09-29/write-fizzbuzz-in-php-2-letters-per-line.ndoc b/vhosts/blog/content/posts/2022-09-29/write-fizzbuzz-in-php-2-letters-per-line.ndoc deleted file mode 100644 index f8b0d62e..00000000 --- a/vhosts/blog/content/posts/2022-09-29/write-fizzbuzz-in-php-2-letters-per-line.ndoc +++ /dev/null @@ -1,705 +0,0 @@ ---- -[article] -uuid = "42f0b29b-1e44-4dbe-9864-69abe3bb1e6e" -title = "ãPHPã fizzbuzz ãæžãã1è¡ããã2æåã§ã" -description = "PHP ã§ fizzbuzz ãæžããããã ãã1è¡ãããã«äœ¿ããæåæ°ã¯2æåãŸã§ã" -tags = [ - "php", -] - -[[article.revisions]] -date = "2022-09-28" -remark = "å
¬é" - -[[article.revisions]] -date = "2022-09-29" -remark = "å°ããªæèšã®ä¿®æ£ã»å€æŽ" ---- -<article> - <section id="intro"> - <h>èšäºã®æ§æã«ã€ããŠ</h> - <p> - ãã®èšäºã¯ãæ®éã® fizzbuzz ãåŸã
ã«å€åœ¢ããŠæçµåœ¢ã«ããŠããããšããæ§æã§æžãããŠããã - æçµåœ¢ãèŠãŠã©ã®ãããªä»çµã¿ã§åããŠããã®ãè§£èªããŠãã解説ãèªã¿ããããšãããããããã°ã - <a href="https://gist.github.com/nsfisis/04c227d5a419867472a0b23a83ad2919#file-fizzbuzz-php-2-letters-per-line-and-supports-php-8-x-without-warnings">ãã®ããŒãž</a> - ã«ãœãŒã¹ã³ãŒããããã®ã§ããã¡ããå
ã«èŠãŠã»ããã - </p> - </section> - <section id="regulations"> - <h>ã¬ã®ã¥ã¬ãŒã·ã§ã³</h> - <p> - PHP ã§ã次ã®ãããªå¶çŽã®äžã« fizzbuzz ãæžããã - </p> - <ul> - <li> - 1è¡ãããã®æåæ°ã¯2æåãŸã§ã«åããããš (ãã ã <code><?php</code> ã¿ã°ã¯é€ã) - <ul> - <li> - å³å¯ãªå®çŸ©: <code><?php</code> ã¿ã°ä»¥éã®ãœãŒã¹ã³ãŒããã2 byte ããšã«ã©ã€ã³ãã£ãŒã (LF) ã§åºåãããããš - </li> - </ul> - </li> - <li>ã¹ããŒã¹ãã¿ãã䜿çšããªãããš</li> - <li> - ã«ãŒãã®ã¢ã³ããŒã«ãããªãããš - <ul> - <li>100 åã«ãŒãã®ä»£ããã« 100 åã³ãŒããã³ããããšããã®ã¯çŠæ¢</li> - </ul> - </li> - <li>PHP 7.4ã8.1 ã§åäœããããš</li> - <li>å®è¡æã« Notice ã Warning ãåºãªãããš</li> - <li>æšæºçãªã€ã³ã¹ããŒã«æ§æã® PHP ã§å®çŸã§ããããš (ããã©ã«ãã§æå¹ã«ãªã£ãŠããªãæ¡åŒµçã䜿ããªãããš)</li> - </ul> - <p> - åè: PHP ã«ã¯ <code>short_open_tag</code> ãšãããªãã·ã§ã³ãããã - ãããæå¹ã«ãããšãã¡ã€ã«åé ã® <code><?php</code> ã®ä»£ããã« <code><?</code> - ã䜿ãããšãã§ããæåã©ãã1è¡2æåã§æžããã - ãã ããã®ãªãã·ã§ã³ã¯ããã©ã«ã off ã«ãªã£ãŠããç°å¢ãå€ããããªã®ã§ãä»åã¯äœ¿ããªãããšã«ããã - </p> - </section> - <section id="problems"> - <h>äž»ãªé害</h> - <p> - 1è¡ãããã®æåæ°ãªã©ãé©åœã«æ¹è¡ãæãã°ããã ãã§ã¯ãªãã®ãïŒ - </p> - <p> - ç¹ã«ãCèšèªã§ãã®ãããªè©Šã¿ããããªã£ãããšããããããªãããæãã ãããäºå®ãCã§ã®ãã®å¶çŽã¯ã»ãšãã©ç¡æå³ã«çããã - </p> - <codeblock language="c"> - <![CDATA[ - #\ - i\ - n\ - c\ - l\ - u\ - d\ - e\ - <\ - s\ - t\ - d\ - i\ - o\ - .\ - h\ - >\ - /* - */ - i\ - n\ - t\ - /* - */ - m\ - a\ - i\ - n( - ){ - f\ - o\ - r( - i\ - n\ - t\ - /* - */ - i= - 1; - i< - 1\ - 0\ - 0; - i\ - +\ - +) - if - (i - %\ - 15 - == - 0) - p\ - r\ - i\ - n\ - t\ - f( - "\ - F\ - i\ - z\ - z\ - B\ - u\ - z\ - z\ - %\ - c\ - ", - 10 - ); - - /* ããšã¯åãããã«æ®éã®ããã°ã©ã ãå€åœ¢ããã ããªã®ã§çç¥ */ - ]]> - </codeblock> - <p> - ããã¯ã¹ã©ãã·ã¥ã䜿ã£ãè¡ç¶ç¶ãããŒã¯ã³ãåºåããªãããšããã®ããã€ã³ãã ã - </p> - <p> - ããŠãPHP ã§ã¯ããããããã¯ã¹ã©ãã·ã¥ãè¡ç¶ç¶ã«äœ¿ãããšãã§ããªãã - ããã«ãããã3æå以äžãããªãããŒã¯ã³ãäžå䜿ããªãããšããå¶çŽã課ãããã - äŸãã°ã<code>echo</code> ã§åºåããããšãã<code>for</code> ã§ã«ãŒãããããšã - <code>new</code> ã§ã€ã³ã¹ã¿ã³ã¹ãçæããããšãã§ããªãã - ç¹ã«ãåºå㯠fizzbuzz ãã©ããªã¢ã«ãŽãªãºã ã§å®è£
ããããšãããªããªããã°ãªããªãã®ã§ãã§ããªãã®ã¯èŽåœçã§ããã - </p> - <p> - åœç¶ãååã3æå以äžãã颿°ã䜿ããªãããªããæšæº PHP ã®ç¯å²å
ã«ãããŠãååã 2æå以äžã®é¢æ°ã¯ä»¥äžã®ãšããã§ãã: - </p> - <ul> - <li> - <code>_</code>: <code>gettext</code> ã®ãšã€ãªã¢ã¹ - </li> - <li> - <code>dl</code>: æ¡åŒµã¢ãžã¥ãŒã«ãããŒããã - </li> - <li> - <code>pi</code>: ååšçãè¿ã - </li> - </ul> - <p> - (ç°å¢ã«ãã£ãŠå€å°ã¯å€ãããã) - </p> - <p> - 2æåã®é¢æ°ãå®çŸ©ããŸãã£ãæ¡åŒµã¢ãžã¥ãŒã«ãçšæããŠãã㊠<code>dl()</code> ã§èªã¿èŸŒãè¡çºã¯ãã¬ã®ã¥ã¬ãŒã·ã§ã³ã§å®ãã - </p> - <blockquote> - <ul> - <li>æšæºçãªã€ã³ã¹ããŒã«æ§æã® PHP ã§å®çŸã§ããããš (ããã©ã«ãã§æå¹ã«ãªã£ãŠããªãæ¡åŒµçã䜿ããªãããš)</li> - </ul> - </blockquote> - <p> - ã«åãã (ãšããããããããã ãšãããããããªããšããªãã®ã§ããã®ã«ãŒã«ãè¶³ããããšããã®ãæ£ãã)ã - </p> - <p> - ãŸãã2æåã ãšæååããŸãšãã«æžããªãã®ãèŸãã<code>''</code> ã ãã§2æå䜿ãã®ã§ã - ã1æåã®æååãªãã©ã«ããšãããã®ãæžãããšãã§ããªããPHP ã§ã¯æååãªãã©ã«äžã«çã®æ¹è¡ãæžããã®ã§ - </p> - <codeblock language="php"> - <![CDATA[ - $a - =' - a' - ;; - ]]> - </codeblock> - <p> - ãšãããš <code>$a</code> 㯠<code>"\na"</code> ã«ãªãã®ã ããäœèšãªæ¹è¡ãå
¥ã£ãŠããŸãã - </p> - <p> - ãããã®é害ãã©ã®ããã«ä¹ãè¶ããã®ããæ¬¡ç¯ããèŠãŠããã - </p> - </section> - <section id="commentary"> - <h>解説</h> - <section id="normal-fizzbuzz"> - <h>æ®éã® (?) fizzbuzz</h> - <p> - ãŸãã¯æ®éã«æžããšãããã - </p> - <codeblock language="php"> - <![CDATA[ - <?php - - for ($i = 1; $i < 100; $i++) { - echo (($i % 3 ? '' : 'Fizz') . ($i % 5 ? '' : 'Buzz') ?: $i) . "\n"; - } - ]]> - </codeblock> - <p> - çŽ çŽã«æžãã fizzbuzz ãšã¯èšãé£ããããã®ãããã¯æ®éã ãšããããšã«ããŠãããªããšããã®å
ããã£ãŠããããªãã®ã§èš±ããŠã»ããã - </p> - </section> - <section id="remove-keywords"> - <h><code>for</code> ã®æé€</h> - <p> - <code>for</code> ã¯ã3æåãããé·ãããŒã¯ãŒãã§ããã - ãããªãã®ã¯äœ¿ããªãã<code>array_</code> ç³»ã®é¢æ°ã䜿ã£ãŠãé©åœã«çœ®ãæãããšãããã - </p> - <codeblock language="php"> - <![CDATA[ - <?php - - $s = range(1, 100); - array_walk( - $s, - fn($i) => - printf((($i % 3 ? '' : 'Fizz') . ($i % 5 ? '' : 'Buzz') ?: $i) . "\n"), - ); - ]]> - </codeblock> - <p> - <code>array_walk</code> ã <code>range</code>ã<code>printf</code> ãšãã£ã - <code>for</code> ãããé·ãããŒã¯ã³ãçŸããŠããŸã£ãããããã¯æ¬¡ç¯ã§çŽãããšã«ããã - ãªãã<code>echo</code> ã¯æ (statement) ã§ããåŒ (expression) ã§ã¯ãªãã®ã§ãåŒã§ãã <code>printf</code> ã«çœ®ãæããã - </p> - </section> - <section id="shorten-function-invocation"> - <h>颿°åŒã³åºãã®ççž®</h> - <p> - <code>range</code>ã<code>array_walk</code>ã<code>printf</code> ã¯é·ãããã®ã§ã©ãã«ãããã°ãªããªãã - ããã§ãPHP ã®å¯å€é¢æ°ã䜿ããå¯å€é¢æ°ãšã¯ã颿°åãæååãšããŠå
¥ã£ã倿°ãçµç±ããŠã颿°ãåŒã³åºãæ©èœã§ããã - </p> - <codeblock language="php"> - <![CDATA[ - <?php - - $r = 'range'; - $w = 'array_walk'; - $p = 'printf'; - - $s = $r(1, 100); - $w( - $s, - fn($i) => - $p((($i % 3 ? '' : 'Fizz') . ($i % 5 ? '' : 'Buzz') ?: $i) . "\n"), - ); - ]]> - </codeblock> - <p> - ããã§é¢æ°ãåŒã³åºããŠããæã¯çããªã£ãã - ã§ã¯ã<code>$r</code> ã <code>$w</code> ã <code>$p</code>ã - ãŸã <code>'Fizz'</code> ã <code>'Buzz'</code> ã¯ã©ããã£ãŠ 1 è¡ 2 æåã«åããã®ãã - 次ã®ãã¯ããã¯ãžç§»ããã - </p> - </section> - <section id="incompatible-solution"> - <h>äœè«: PHP 8.x ã§åäœããªããŠããããªã</h> - <p> - ä»å䜿ã£ããã¯ããã¯ã説æããåã«ãäœè«ãšããŠãæååãªãã©ã«ã®ççž®æ³ãšããŠä»åæ¡çšããªãã£ããã®ã玹ä»ããã - </p> - <blockquote> - <ul> - <li>PHP 7.4ã8.1 ã§åäœããããš</li> - </ul> - </blockquote> - <p> - ãšããã«ãŒã«ããªãå Žåããæªå®çŸ©ã®å®æ°ãè©äŸ¡ãããå Žåããã®å®æ°ã®ååãå€ã«ãªãããšãã PHP 7.x ãŸã§ã®ä»æ§ãå©çšã§ããã - äŸãã°ã <code>Fizz</code> ãšããæååãæ¬²ãããã°ã次ã®ããã«ããã - </p> - <codeblock language="php"> - <![CDATA[ - $f - =F - .i - .z - .z - ;; - ]]> - </codeblock> - <p> - ããããŠç°¡åã«æååãäœããã - ãªãããã®ä»æ§ã¯ 7.x æç¹ã§ãèŠåãåããã®ã§ã<code>@</code> æŒç®åã䜿ã£ãŠæå¶ããŠãããšããã - </p> - <codeblock language="php"> - <![CDATA[ - $f - =@ - F. - @i - .# - @z - .# - @z - ;; - ]]> - </codeblock> - <p> - ãããããã®ããšãããã£ãŠãããããã PHP 8.x ã§ã®åäœãèŠä»¶ã«èª²ãããšãããããã - </p> - </section> - <section id="shorten-string-literals"> - <h>æååãªãã©ã«ã®ççž®</h> - <p> - å®éã«äœ¿ã£ãææ³ã®èª¬æã«ç§»ãã - </p> - <p> - ãã°ããæååå士ã®ãããæŒç®ã䜿ãã - PHP ã§ã¯ãæååå士ã§ãããæŒç® (<code>&</code>ã<code>|</code>ã<code>^</code>) ãããå Žåã - æååã®åãã€ãããšã«æå®ãããããæŒç®ããªããããããçµåãããã®ãæŒç®çµæãšãªãã - </p> - <codeblock language="php"> - <![CDATA[ - $a = "12345"; - $b = "world"; - - // $a ^ $b ã¯æ¬¡ã®ã³ãŒããšåã - $result = ''; - for ($i = 0; $i < min(strlen($a), strlen($b)); $i++) { - $result .= $a[$i] ^ $b[$i]; - } - - echo $result; - // => F]AXQ - ]]> - </codeblock> - <p> - ãããèžãŸããæ¬¡ã®ã³ãŒããèŠãŠã¿ããã - </p> - <codeblock language="php"> - <![CDATA[ - $x = "x\nOm\n"; - $y = "\nk!\no"; - $r = $x ^ $y; - echo "$r\n"; - ]]> - </codeblock> - <p> - å®è¡ãããšã<code>range</code> ã衚瀺ãããã - ããŠãPHP ã§ã¯æååãªãã©ã«äžã«çã®æ¹è¡ãçŽæ¥æžããŠãããã®ã ã£ã (ãäž»ãªé害ãã®ç¯ãåç
§ã®ããš)ã - æžããããŠã¿ããã - </p> - <codeblock language="php"> - <![CDATA[ - $x - ='x - Om - '; - $y - =' - k! - o' - ; - - $r = $x ^ $y; - echo "$r\n"; - ]]> - </codeblock> - <p> - ããã« <code>#</code> ã䜿ã£ãŠé©åœã«èª¿æŽãããšã次ã®ããã«ãªãã - </p> - <codeblock language="php"> - <![CDATA[ - $x - =# - 'x - Om - '; - $y - =' - k! - o' - ;# - $r - =# - $x - ^# - $y - ;# - - echo "$r\n"; - ]]> - </codeblock> - <p> - 1è¡ããã2æåã§ã<code>range</code> ãšããæååãçæããããšã«æåããã - ä»ã®å¿
èŠãªæååã«ããåæ§ã®åŠçãã»ã©ããã - </p> - <p> - åè: <code>Buzz</code> äžã«ããå°æåã® <code>u</code> ã¯ããã®ããžãã¯ã ãš non-printable ãªæåã«ãªã£ãŠããŸãã - ãããŸã§ã®ãã¯ããã¯ãé§äœ¿ããã°åé¿ããã®ã¯ããé£ãããªãã®ã§ãèããŠã¿ãŠã»ããã - </p> - </section> - </section> - <section id="stretched-fizzbuzz"> - <h>å®æç³»</h> - <p> - 宿ãããã®ããã¡ãã - </p> - <codeblock language="php"> - <![CDATA[ - <?php - - $x - =# - 'i - S' - ;; - $y - =' - b! - '; - $c - =# - $x - ^# - $y - ;# - $x - =# - 'x - Om - '; - $y - =' - k! - o' - ;# - $r - =# - $x - ^# - $y - ;# - $x - =# - 'k - Sk - ~} - Ma - '; - $y - =' - x! - s! - k! - '; - $w - =# - $x - ^# - $y - ;# - $x - =# - 'z - Hd - G' - ;# - $y - =' - x! - ~! - '; - $p - =# - $x - ^# - $y - ;# - $x - =# - 'L - [p - '; - $y - =' - c! - '; - $f - =# - $x - ^# - $y - ;# - $x - =# - 'H - [p - '; - $y - =' - _! - '; - $b - =# - $x - ^# - $y - ;# - $b - [1 - ]= - $c - (# - 13 - *9 - ); - $s - =# - $r - (1 - ,( - 10 - ** - 2) - ); - $w - (# - $s - ,# - fn - (# - $i - )# - => - $p - (( - (# - $i - %3 - ?# - '' - :# - $f - ). - (# - $i - %5 - ?# - '' - :# - $b - )? - :# - $i - )# - .' - ') - ); - ]]> - </codeblock> - </section> - <section id="outro"> - <h>ææ³ãªã©</h> - <p> - PHP ã¯ãã¹ã¯ãªããèšèªã®äžã ãšã·ã³ã¿ãã¯ã¹ã·ã¥ã¬ãŒãå°ãªã (äœæ)ã - ãã®ææŠã¯äžå¯èœã«æãããããPHP ããã¥ã¢ã«ãšã«ããã£ãããŠããããªããšããªã£ãã - </p> - <p> - ã¿ããªãããã°ã©ã ã现é·ããããã - </p> - </section> - <section id="alternative-solution"> - <h>äœè«2: å¥è§£</h> - <p> - PHP ã§ã¯ãããã¯ã¯ã©ãŒãã䜿ã£ãŠã·ã§ã«ãåŒã³åºããã - ãã㯠<code>shell_exec</code> 颿°ãšç䟡ã§ããã - ããŠãPHP ã§ã¯ããã¯ã¹ã©ãã·ã¥ã«ããè¡ç¶ç¶ã䜿ããªããšæžããããã·ã§ã«ã§ã¯äœ¿ãã - (åœç¶ã ããåŒã³åºãããã·ã§ã«ã«äŸåãããBash ãªã倧äžå€«ã ãããç¥ãããã©)ã - </p> - <codeblock language="php"> - <![CDATA[ - <?php - - printf(` - e\ - c\ - h\ - o\ - \ - 1\ - 2\ - 3\ - `); - ]]> - </codeblock> - <p> - ãªããããã§ã¯ç°¡åã®ããåºåã« <code>printf</code> ããã®ãŸãŸäœ¿ã£ãŠãããã - å®éã«ã¯ <code>printf</code> ãšããæååãåæããŠå¯å€é¢æ°ã§åŒã³åºãã - </p> - <p> - ãã ããããã§ã¯ - </p> - <blockquote> - <ul> - <li>ã¹ããŒã¹ãã¿ãã䜿çšããªãããš</li> - </ul> - </blockquote> - <p> - ã«éåããŠããŸããã¹ããŒã¹ã䜿ããªããšåŒæ°ãšã³ãã³ããåºåããªããããã¯å°ã£ãã - </p> - <p> - ãããã以äžã¯äžå¯èœã ãšæã£ãŠããã®ã ãããã®èšäºã®å·çäžã«è§£æ±ºããæ¹æ³ãæãã€ããã®ã§èŒããŠããã - </p> - <codeblock language="php"> - <![CDATA[ - <?php - - $c = 'chr'; - - ${ - '_ - '} - =# - $c - (# - 32 - ). - $c - (# - 92 - ); - - printf(` - e\ - c\ - h\ - o\ - ${ - '_ - '} - 1\ - 2\ - 3\ - `); - ]]> - </codeblock> - <p> - å
çšãšåããã<code>chr</code> ã <code>printf</code> ãçæããéšåã¯é·ããªãã®ã§çããã - </p> - <codeblock> - <![CDATA[ - ${ - '_ - '} - ]]> - </codeblock> - <p> - ã¯å€æ°ã§ãäžã«ã¯ã¹ããŒã¹ãšãšã¹ã±ãŒããå
¥ã£ãŠãã (<code>chr(32) . chr(92)</code>)ã - ã·ã§ã«ã«æž¡ãããŠããæååã¯æ¬¡ã®ããã«ãªãã - </p> - <codeblock> - <![CDATA[ - e\ - c\ - h\ - o\ - \ - 1\ - 2\ - 3\ - ]]> - </codeblock> - <p> - ããã¯ãåæ²ããã³ãã³ããšåãã ã - ããããŠãã¹ããŒã¹ãéœã«æžããã«ã·ã§ã«ãããããèªç±ã«æ±ããããã«ãªã£ãã - Fizzbuzz ã®ã¯ã³ã©ã€ããŒãããããæžããã ãããããããšã¯ãªããšããªãã ãã (詊ããŠãªããã©)ã - </p> - <p> - ãšããããšã§ããã¯å¥è§£ãšããããšã«ããŠããã - </p> - <p> - ã¡ãªã¿ã«ãPHP 8.2 ããã¯ããã®èšæ³ã§ Warning ãåºãããã«ãªãããã ã - </p> - <codeblock> - <![CDATA[ - ${ - '_ - '} - ]]> - </codeblock> - <p> - ææ°çã§èŠåãåºããšããã®ãçŸãããªãã®ã§ãç§ãšããŠã¯æ¬ç·šã®è§£æ³ãæšãã - </p> - </section> -</article> diff --git a/vhosts/blog/content/posts/2022-10-23/phperkaigi-2023-unused-token-quiz-1.dj b/vhosts/blog/content/posts/2022-10-23/phperkaigi-2023-unused-token-quiz-1.dj new file mode 100644 index 00000000..8567c711 --- /dev/null +++ b/vhosts/blog/content/posts/2022-10-23/phperkaigi-2023-unused-token-quiz-1.dj @@ -0,0 +1,154 @@ +--- +[article] +uuid = "46e0d5db-b17e-464c-a723-8c3e01af7d1d" +title = "PHPerKaigi 2023: ããã«ãªã£ãããŒã¯ã³åé¡ ãã® 1" +description = "æ¥å¹Žã® PHPerKaigi 2023 ã§ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿããåºé¡äºå®ã®ããŒã¯ã³åé¡ã®ãã¡ãããã«ãªã£ãåé¡ãå
¬éãã (ãã® 1)ã" +tags = [ + "php", + "phperkaigi", +] + +[[article.revisions]] +date = "2022-10-23" +remark = "å
¬é" +--- +{#intro} +# ã¯ããã« + +2023 幎 3 æ 23 æ¥ãã 25 æ¥ã«ãããŠéå¬äºå® (èšäºå·çæç¹) ã®ã +[PHPerKaigi 2023](https://phperkaigi.jp/2023/) ã«ãããŠã +æšå¹Žãšåæ§ã«ãåŒç€Ÿ [ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ](https://www.dgcircus.com/) ããã +ããŒã¯ã³åé¡ãåºé¡äºå®ã§ããã + +æšå¹Žã®ããŒã¯ã³åé¡ã®èšäºã¯ãã¡ã: [PHPerKaigi 2022 ããŒã¯ã³åé¡ã®è§£èª¬](/posts/2022-04-09/phperkaigi-2022-tokens) + +ãã§ã« 2023 幎çšã®åé¡ã¯äœææžã¿ã§ãããããã®å¶äœéçšã®äžã§ããã€ãããåãã§ããã +ãã£ãããªã®ã§ãPHPerKaigi éå¬ãåŸ
ã€éã«ç޹ä»ããããšæãã + +10 æãã 2 æãŸã§ãæ¯æ 1 èšäºãã€å
¬éããŠããäºå® (å¿ããŠããªããã°)ã + +{#quiz} +# åé¡ + +泚æ: ããã¯ããåãªã®ã§ãåŸãããããŒã¯ã³ã PHPerKaigi ã§å
¥åããŠããã€ã³ãã«ã¯ãªããªãã + +```php +<?php + +$Ï = $argv[1] ?? null; +if ($Ï === null) { + exit('No input.'); +} +$Ï = trim($Ï); +if (!is_numeric($Ï)) { + exit('Invalid input.'); +} + +$s = implode(array_map(chr(...), str_split($Ï, 2))); + +preg_match('/(\x23.+?) /', $s, $m); +$t = $m[1] ?? ''; + +if (md5($t) === '056e831a4146bf123e8ea16613303d2e') { + echo "Token: {$t}\n"; +} else { + echo "Failed.\n"; +} +``` + +{#how-to-obtain-token} +# ããŒã¯ã³å
¥ææ¹æ³ + +ãœãŒã¹ãèŠããšããããšããã`$argv[1]` ãåç
§ããŠããã +ããã `$Ï` ãªã倿°ã«ä»£å
¥ããŠããã®ã§ãååšçãæž¡ããŠã¿ãã + +```shell-session +$ php Q.php 3.14 +Failed. +``` + +倱æããŠããŸã£ãã粟床ãäžããŠã¿ãã + +```shell-session +$ php Q.php 3.1415 +Failed. +``` + +ã ãã ã£ãããããæåãããŸã§ç¹°ãè¿ãã + +æåã«ããŒã¯ã³ãåŸãããã®ã¯ãå°æ°ç¹ä»¥äž 16 æ¡ç®ãŸã§å
¥åãããšãã§ããããªãã + +```shell-session +$ php Q.php 3.1415926535897932 +Token: #YO +``` + +ãã§ããããŒã¯ã³ã`#YO`ããæã«å
¥ã£ãã + +{#commentary} +# 解説 + +çãã®ã§é ãã远ã£ãŠããã + +```php +$Ï = $argv[1] ?? null; +if ($Ï === null) { + exit('No input.'); +} +$Ï = trim($Ï); +if (!is_numeric($Ï)) { + exit('Invalid input.'); +} +``` + +å
¥åã®ããªããŒã·ã§ã³éšåãæ°å€ã®ã¿åãä»ããã + +```php +$s = implode(array_map(chr(...), str_split($Ï, 2))); +``` + +`$Ï` ã 2 æåããšã«åºåã (`str_split`)ã +æ°å€ã ASCII ã³ãŒããšèŠåããŠæåã«å€æ (`chr`) ããŠçµå (`implode`) ããŠããã + +äŸãã°ã`$Ï` ã `'656667'` ã ã£ããšãããšã +`65`ã`66`ã`67` ã«å¯Ÿå¿ãã +`'A'`ã`'B'`ã`'C'` ãžãšå€æããã`'ABC'` ã«ãªãã + +```php +$Ï = '656667'; +$s = implode(array_map(chr(...), str_split($Ï, 2))); +echo $s; +// => ABC +``` + +```php +preg_match('/(\x23.+?) /', $s, $m); +$t = $m[1] ?? ''; +``` + +æ£èŠè¡šçŸã§ãããã³ã°ããŠããã`\x23` 㯠`#` ãšåãã§ããããšã«çæãããšã +ãã®æ£èŠè¡šçŸã¯ã`#` ããå§ãŸã 2 以äžã®é·ã (å« `#`) ã®æååã§ã +æåã«çŸããã¹ããŒã¹ãŸã§ãã«ããããããã€ãŸãããã¯ãPHPerKaigi ã«ãããããŒã¯ã³ã§ããã + +ãªãã`#` ãçŽæ¥æžããŠããªãã®ã¯ã`/#.+?) /` ãšæžããšã +`#.+?)` ãšããæå³ãã¬ããŒã¯ã³ãç»é²ãããŠããŸãããã§ããã + +```php +if (md5($t) === '056e831a4146bf123e8ea16613303d2e') { + echo "Token: {$t}\n"; +} else { + echo "Failed.\n"; +} +``` + +æåŸã«ããŒã¯ã³ã®ããã·ã¥å€ãèŠãŠãæ³å®è§£ãã©ããã確èªããã + +{#outro} +# ãããã« + +ååšçãäœæ¡ãèšç®ã㊠ASCII ã³ãŒãçµç±ã§æåååããã°ãããŒã¯ã³ã£ãœããã®ãã©ããã§åºãŠããã®ã§ã¯ãªããããšèããŠçãŸããäœåã + +æåã¯çé¢ç®ã«ååšçã®èšç®ããã°ã©ã ãçµãã§ããã®ã ããããåãããŠã¿ããšããã«æµ
ããšããã«ãã£ãã®ã§é©ãã +(ã¡ãªã¿ã«ãããã§ã `M_PI` ã `pi()` ã§ã¯ç²ŸåºŠãè¶³ããªã)ã +èŠã€ãããšãã¯çåãããã®ã®ãå·éã«ãªã£ãŠã¿ããšå€§ããŠé¢çœããªãã£ãã®ã§ããã«ãªã£ãã +ãããã100 äžæ¡ç®ãããã«åãŸã£ãŠããŠãããã»ããããã£ããããããªãã diff --git a/vhosts/blog/content/posts/2022-10-23/phperkaigi-2023-unused-token-quiz-1.ndoc b/vhosts/blog/content/posts/2022-10-23/phperkaigi-2023-unused-token-quiz-1.ndoc deleted file mode 100644 index cf6b1e2b..00000000 --- a/vhosts/blog/content/posts/2022-10-23/phperkaigi-2023-unused-token-quiz-1.ndoc +++ /dev/null @@ -1,185 +0,0 @@ ---- -[article] -uuid = "46e0d5db-b17e-464c-a723-8c3e01af7d1d" -title = "PHPerKaigi 2023: ããã«ãªã£ãããŒã¯ã³åé¡ ãã® 1" -description = "æ¥å¹Žã® PHPerKaigi 2023 ã§ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿããåºé¡äºå®ã®ããŒã¯ã³åé¡ã®ãã¡ãããã«ãªã£ãåé¡ãå
¬éãã (ãã® 1)ã" -tags = [ - "php", - "phperkaigi", -] - -[[article.revisions]] -date = "2022-10-23" -remark = "å
¬é" ---- -<article> - <section id="intro"> - <h>ã¯ããã«</h> - <p> - 2023 幎 3 æ 23 æ¥ãã 25 æ¥ã«ãããŠéå¬äºå® (èšäºå·çæç¹) ã®ã - <a href="https://phperkaigi.jp/2023/">PHPerKaigi 2023</a> ã«ãããŠã - æšå¹Žãšåæ§ã«ãåŒç€Ÿ <a href="https://www.dgcircus.com/">ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ</a> ããã - ããŒã¯ã³åé¡ãåºé¡äºå®ã§ããã - </p> - <p> - æšå¹Žã®ããŒã¯ã³åé¡ã®èšäºã¯ãã¡ã: <a href="/posts/2022-04-09/phperkaigi-2022-tokens">PHPerKaigi 2022 ããŒã¯ã³åé¡ã®è§£èª¬</a> - </p> - <p> - ãã§ã« 2023 幎çšã®åé¡ã¯äœææžã¿ã§ãããããã®å¶äœéçšã®äžã§ããã€ãããåãã§ããã - ãã£ãããªã®ã§ãPHPerKaigi éå¬ãåŸ
ã€éã«ç޹ä»ããããšæãã - </p> - <p> - 10 æãã 2 æãŸã§ãæ¯æ 1 èšäºãã€å
¬éããŠããäºå® (å¿ããŠããªããã°)ã - </p> - </section> - <section id="quiz"> - <h>åé¡</h> - <p> - 泚æ: ããã¯ããåãªã®ã§ãåŸãããããŒã¯ã³ã PHPerKaigi ã§å
¥åããŠããã€ã³ãã«ã¯ãªããªãã - </p> - <codeblock language="php"> - <![CDATA[ - <?php - - $Ï = $argv[1] ?? null; - if ($Ï === null) { - exit('No input.'); - } - $Ï = trim($Ï); - if (!is_numeric($Ï)) { - exit('Invalid input.'); - } - - $s = implode(array_map(chr(...), str_split($Ï, 2))); - - preg_match('/(\x23.+?) /', $s, $m); - $t = $m[1] ?? ''; - - if (md5($t) === '056e831a4146bf123e8ea16613303d2e') { - echo "Token: {$t}\n"; - } else { - echo "Failed.\n"; - } - ]]> - </codeblock> - </section> - <section id="how-to-obtain-token"> - <h>ããŒã¯ã³å
¥ææ¹æ³</h> - <p> - ãœãŒã¹ãèŠããšããããšããã<code>$argv[1]</code> ãåç
§ããŠããã - ããã <code>$Ï</code> ãªã倿°ã«ä»£å
¥ããŠããã®ã§ãååšçãæž¡ããŠã¿ãã - </p> - <codeblock language="shell-session"> - <![CDATA[ - $ php Q.php 3.14 - Failed. - ]]> - </codeblock> - <p> - 倱æããŠããŸã£ãã粟床ãäžããŠã¿ãã - </p> - <codeblock language="shell-session"> - <![CDATA[ - $ php Q.php 3.1415 - Failed. - ]]> - </codeblock> - <p> - ã ãã ã£ãããããæåãããŸã§ç¹°ãè¿ãã - </p> - <p> - æåã«ããŒã¯ã³ãåŸãããã®ã¯ãå°æ°ç¹ä»¥äž 16 æ¡ç®ãŸã§å
¥åãããšãã§ããããªãã - </p> - <codeblock language="shell-session"> - <![CDATA[ - $ php Q.php 3.1415926535897932 - Token: #YO - ]]> - </codeblock> - <p> - ãã§ããããŒã¯ã³ã<code>#YO</code>ããæã«å
¥ã£ãã - </p> - </section> - <section id="commentary"> - <h>解説</h> - <p> - çãã®ã§é ãã远ã£ãŠããã - </p> - <codeblock language="php"> - <![CDATA[ - $Ï = $argv[1] ?? null; - if ($Ï === null) { - exit('No input.'); - } - $Ï = trim($Ï); - if (!is_numeric($Ï)) { - exit('Invalid input.'); - } - ]]> - </codeblock> - <p> - å
¥åã®ããªããŒã·ã§ã³éšåãæ°å€ã®ã¿åãä»ããã - </p> - <codeblock language="php"> - <![CDATA[ - $s = implode(array_map(chr(...), str_split($Ï, 2))); - ]]> - </codeblock> - <p> - <code>$Ï</code> ã 2 æåããšã«åºåã (<code>str_split</code>)ã - æ°å€ã ASCII ã³ãŒããšèŠåããŠæåã«å€æ (<code>chr</code>) ããŠçµå (<code>implode</code>) ããŠããã - </p> - <p> - äŸãã°ã<code>$Ï</code> ã <code>'656667'</code> ã ã£ããšãããšã - <code>65</code>ã<code>66</code>ã<code>67</code> ã«å¯Ÿå¿ãã - <code>'A'</code>ã<code>'B'</code>ã<code>'C'</code> ãžãšå€æããã<code>'ABC'</code> ã«ãªãã - </p> - <codeblock language="php"> - <![CDATA[ - $Ï = '656667'; - $s = implode(array_map(chr(...), str_split($Ï, 2))); - echo $s; - // => ABC - ]]> - </codeblock> - <codeblock language="php"> - <![CDATA[ - preg_match('/(\x23.+?) /', $s, $m); - $t = $m[1] ?? ''; - ]]> - </codeblock> - <p> - æ£èŠè¡šçŸã§ãããã³ã°ããŠããã<code>\x23</code> 㯠<code>#</code> ãšåãã§ããããšã«çæãããšã - ãã®æ£èŠè¡šçŸã¯ã<code>#</code> ããå§ãŸã 2 以äžã®é·ã (å« <code>#</code>) ã®æååã§ã - æåã«çŸããã¹ããŒã¹ãŸã§ãã«ããããããã€ãŸãããã¯ãPHPerKaigi ã«ãããããŒã¯ã³ã§ããã - </p> - <p> - ãªãã<code>#</code> ãçŽæ¥æžããŠããªãã®ã¯ã<code>/#.+?) /</code> ãšæžããšã - <code>#.+?)</code> ãšããæå³ãã¬ããŒã¯ã³ãç»é²ãããŠããŸãããã§ããã - </p> - <codeblock language="php"> - <![CDATA[ - if (md5($t) === '056e831a4146bf123e8ea16613303d2e') { - echo "Token: {$t}\n"; - } else { - echo "Failed.\n"; - } - ]]> - </codeblock> - <p> - æåŸã«ããŒã¯ã³ã®ããã·ã¥å€ãèŠãŠãæ³å®è§£ãã©ããã確èªããã - </p> - </section> - <section id="outro"> - <h>ãããã«</h> - <p> - ååšçãäœæ¡ãèšç®ã㊠ASCII ã³ãŒãçµç±ã§æåååããã°ãããŒã¯ã³ã£ãœããã®ãã©ããã§åºãŠããã®ã§ã¯ãªããããšèããŠçãŸããäœåã - </p> - <p> - æåã¯çé¢ç®ã«ååšçã®èšç®ããã°ã©ã ãçµãã§ããã®ã ããããåãããŠã¿ããšããã«æµ
ããšããã«ãã£ãã®ã§é©ãã - (ã¡ãªã¿ã«ãããã§ã <code>M_PI</code> ã <code>pi()</code> ã§ã¯ç²ŸåºŠãè¶³ããªã)ã - èŠã€ãããšãã¯çåãããã®ã®ãå·éã«ãªã£ãŠã¿ããšå€§ããŠé¢çœããªãã£ãã®ã§ããã«ãªã£ãã - ãããã100 äžæ¡ç®ãããã«åãŸã£ãŠããŠãããã»ããããã£ããããããªãã - </p> - </section> -</article> diff --git a/vhosts/blog/content/posts/2022-10-28/setup-server-for-this-site.dj b/vhosts/blog/content/posts/2022-10-28/setup-server-for-this-site.dj new file mode 100644 index 00000000..6fed329d --- /dev/null +++ b/vhosts/blog/content/posts/2022-10-28/setup-server-for-this-site.dj @@ -0,0 +1,264 @@ +--- +[article] +uuid = "673cb872-af2d-41a3-9fb0-60f1afcedb0d" +title = "ãåå¿é²ã ãã®ãµã€ãçšã® VPS ãã»ããã¢ãããããšãã®ã¡ã¢" +description = "GitHub Pages ã§ãã¹ãããŠãããã®ãµã€ãã VPS ãžç§»è¡ããã®ã§ããã®ãšãã«ãã£ãããšã®ã¡ã¢ã99 % èªåçšã" +tags = [ + "note-to-self", +] + +[[article.revisions]] +date = "2022-10-28" +remark = "å
¬é" + +[[article.revisions]] +date = "2023-08-30" +remark = "ssh_config ã« IdentitiesOnly yes ã远å " +--- +{#intro} +# ã¯ããã« + +ãããŸã§ãã® blog 㯠GitHub Pages ã§ãã¹ãããŠããã®ã ããå
æ¥ VPS ã«ç§»è¡ããã +ãã®ãšãã«ãããªã£ããµãŒãã®ã»ããã¢ããäœæ¥ãæžãæ®ããŠããã +99 % èªåçšã®åå¿é²ãå¥ã®ãã³ãã«ç§»ãããããããªã£ããèŠã«æ¥ãã + +æªæ¥ã®èªåãž: ç¹ã«èªååããŠãªãã®ã§ãããããèŠããã§ããã + +{#vps} +# VPS + +[ãããã® VPS](https://vps.sakura.ad.jp/) ã® 2 GB ãã©ã³ã +ãããŸã§çé¢ç®ã«éžå®ããŠããªãã®ã§ãå°ã£ããç§»åããããã + +{#preparation} +# äºåæºå + +{#hostname} +## ãµãŒãã®ãã¹ãåãæ±ºãã + +ã¢ãããŒã·ã§ã³ãäžãããšããå¹èœããããä»åã¯è€åå®å®¶ããåã£ãŠ `teika` ã«ããã +ãããŠããã€ãæºæ°ç©èªã®åžãå°åçŸäººäžéŠã®æäººããéžãã§ããã + +{#ssh-key} +## SSH ã®éµçæ + +ããŒã«ã«ãã·ã³ã§éµãçæããã + +```shell-session +$ ssh-keygen -t ed25519 -b 521 -f ~/.ssh/teika.key +$ ssh-keygen -t ed25519 -b 521 -f ~/.ssh/github2teika.key +``` + +`teika.key` ã¯ããŒã«ã«ãããµãŒããžã®æ¥ç¶çšã`github2teika.key` ã¯ã +GitHub Actions ãããµãŒããžã®ãããã€çšã + +{#ssh-config} +## SSH ã®èšå® + +`.ssh/config` ã«èšå®ããŠããã + +```ssh_config +Host teika + HostName ********** + User ********** + Port ********** + IdentityFile ~/.ssh/teika.key + IdentitiesOnly yes +``` + +{#basic-setup} +# åºæ¬ã®ã»ããã¢ãã + +{#login} +## SSH æ¥ç¶ + +VPS å¥çŽæã«èšå®ãã管çè
ãŠãŒã¶ãšãã¹ã¯ãŒãã䜿ã£ãŠãã°ã€ã³ããã + +{#user} +## ãŠãŒã¶ãäœæãã + +管çè
ãŠãŒã¶ã§äœæ¥ãããšå±ãªãã®ã§ãã¡ã€ã³ã§äœ¿ããŠãŒã¶ãäœæããã +`sudo` ã°ã«ãŒãã«è¿œå ã㊠`sudo` ã§ããããã«ãã`su` ã§åãæ¿ãã + +```shell-session +$ sudo adduser ********** +$ sudo adduser ********** sudo +$ su ********** +$ cd +``` + +{#hostname} +## ãã¹ãåãå€ãã + +```shell-session +$ sudo hostname teika +``` + +{#public-key} +## å
¬ééµã眮ã + +```shell-session +$ mkdir ~/.ssh +$ chmod 700 ~/.ssh +$ vi ~/.ssh/authorized_keys +``` + +`authorized_keys` ã«ã¯ãããŒã«ã«ã§çæãã `~/.ssh/teika.key.pub` ãš +`~/.ssh/github2teika.key.pub` ã®å
容ãã³ããŒããã + +{#ssh-config} +## SSH ã®èšå® + +SSH ã®èšå®ã倿Žããå°ãã§ãå®å
šã«ããŠããã + +```shell-session +$ sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak +$ sudo vi /etc/ssh/sshd_config +``` + +* `Port` ãå€æŽ +* `PermitRootLogin` ã `no` ã« +* `PasswordAuthentication` ã `no` ã« + +ãããŠèšå®ãåæ ã + +```shell-session +$ sudo systemctl restart sshd +$ sudo systemctl status sshd +``` + +{#ssh-connect} +## SSH ã§æ¥ç¶ç¢ºèª + +ä»ã® SSH ã»ãã·ã§ã³ã¯éããã«ãã¿ãŒããã«ãå¥ééããŠçé確èªããã +ã»ãã·ã§ã³ãéããŠããŸããšãSSH ã®èšå®ã«äžåããã£ãå Žåã«ç· ãåºãããããã + +```shell-session +$ ssh teika +``` + +{#close-ports} +## ããŒãã®é®æ + +ããã©ã«ãã® 22 çªãéããèšå®ããããŒãã ã空ããã + +```shell-session +$ sudo ufw deny ssh +$ sudo ufw allow ******* +$ sudo ufw enable +$ sudo ufw reload +$ sudo ufw status +``` + +ããã§ããäžåºŠ SSH ã®æ¥ç¶ç¢ºèªãæãã + +{#ssh-key-for-github} +## GitHub çšã® SSH éµ + +GitHub ã«çœ®ããŠãã private ãªããžããªããµãŒããã clone ãããã®ã§ãSSH éµãçæããŠçœ®ããŠããã + +```shell-session +$ ssh-keygen -t ed25519 -b 521 -f ~/.ssh/github.key +$ cat ~/.ssh/github.key.pub +``` + +[GitHub ã®èšå®ç»é¢](https://github.com/settings/ssh) ããããã®å
¬ééµã远å ããã + +```shell-session +$ vi ~/.ssh/config +``` + +èšå®ã¯ããã + +```ssh_config +Host github.com + HostName github.com + User git + Port 22 + IdentityFile ~/.ssh/github.key + IdentitiesOnly yes +``` + +æåŸã«æ¥ç¶ã§ããã確èªããŠããã + +```shell-session +$ ssh -T github.com +``` + +{#upgrade-packages} +## ããã±ãŒãžã®æŽæ° + +```shell-session +$ sudo apt update +$ sudo apt upgrade +$ sudo apt update +$ sudo apt upgrade +$ sudo apt autoremove +``` + +{#site-hosting-setup} +# ãµã€ããã¹ãã£ã³ã°çšã®ã»ããã¢ãã + +{#dns} +## DNS ã« IP ã¢ãã¬ã¹ãç»é²ãã + +ãã®ãµãŒãã¯åºå®ã® IP ã¢ãã¬ã¹ãããã®ã§ã`A` ã¬ã³ãŒãã«çŽæ¥å
¥ããã ãã§æžãã ã + +{#install-softwares} +## 䜿ããœãããŠã§ã¢ã®ã€ã³ã¹ããŒã« + +```shell-session +$ sudo apt install docker docker-compose git make +``` + +{#docker} +## ã¡ã€ã³ãŠãŒã¶ã Docker ã䜿ããããã« + +```shell-session +$ sudo adduser ********** docker +``` + +{#open-http-ports} +## HTTP/HTTPS ãéã + +80 çªãš 443 çªã空ããã + +```shell-session +$ sudo ufw allow 80/tcp +$ sudo ufw allow 443/tcp +$ sudo ufw reload +$ sudo ufw status +``` + +{#clone-repositories} +## ãªããžããªã®ã¯ããŒã³ + +```shell-session +$ cd +$ git clone git@github.com:nsfisis/nsfisis.dev.git +$ cd nsfisis.dev +$ git submodule update --init +``` + +{#certbot} +## certbot ã§èšŒææžååŸ + +```shell-session +$ docker-compose up -d acme-challenge +$ make setup +``` + +{#run-server} +## ãµãŒãã皌åããã + +```shell-session +$ make serve +``` + +{#outro} +# ææ³ + +(æ¥åã§ãªã) å人ã ãšæ°å¹Žã¶ãã®ãµãŒãã»ããã¢ããã§ãããã ãã§ãå²ãšæéãé£ã£ãŠããŸã£ãã +ãšã¯ããåŒå¹Žé·å®®ã¯æ¥œããã®ã§ãããããã宿çã«ãã£ãŠããããã +ã³ã³ãããããã€ã«ãããæ°æã¡ãããã®ã ããè²ã
å®éšãããé¢ä¿äžãæ¬ç©ã®ãµãŒããæ¬²ããã¯ããã +次ã®åŒå¹Žé·å®®ã§ã¯ãæé ã®äžéšã ãã§ãèªååããããšããã diff --git a/vhosts/blog/content/posts/2022-10-28/setup-server-for-this-site.ndoc b/vhosts/blog/content/posts/2022-10-28/setup-server-for-this-site.ndoc deleted file mode 100644 index c10ad115..00000000 --- a/vhosts/blog/content/posts/2022-10-28/setup-server-for-this-site.ndoc +++ /dev/null @@ -1,310 +0,0 @@ ---- -[article] -uuid = "673cb872-af2d-41a3-9fb0-60f1afcedb0d" -title = "ãåå¿é²ã ãã®ãµã€ãçšã® VPS ãã»ããã¢ãããããšãã®ã¡ã¢" -description = "GitHub Pages ã§ãã¹ãããŠãããã®ãµã€ãã VPS ãžç§»è¡ããã®ã§ããã®ãšãã«ãã£ãããšã®ã¡ã¢ã99 % èªåçšã" -tags = [ - "note-to-self", -] - -[[article.revisions]] -date = "2022-10-28" -remark = "å
¬é" - -[[article.revisions]] -date = "2023-08-30" -remark = "ssh_config ã« IdentitiesOnly yes ã远å " ---- -<article> - <section id="intro"> - <h>ã¯ããã«</h> - <p> - ãããŸã§ãã® blog 㯠GitHub Pages ã§ãã¹ãããŠããã®ã ããå
æ¥ VPS ã«ç§»è¡ããã - ãã®ãšãã«ãããªã£ããµãŒãã®ã»ããã¢ããäœæ¥ãæžãæ®ããŠããã - 99 % èªåçšã®åå¿é²ãå¥ã®ãã³ãã«ç§»ãããããããªã£ããèŠã«æ¥ãã - </p> - <p> - æªæ¥ã®èªåãž: ç¹ã«èªååããŠãªãã®ã§ãããããèŠããã§ããã - </p> - </section> - <section id="vps"> - <h>VPS</h> - <p> - <a href="https://vps.sakura.ad.jp/">ãããã® VPS</a> ã® 2 GB ãã©ã³ã - ãããŸã§çé¢ç®ã«éžå®ããŠããªãã®ã§ãå°ã£ããç§»åããããã - </p> - </section> - <section id="preparation"> - <h>äºåæºå</h> - <section id="hostname"> - <h>ãµãŒãã®ãã¹ãåãæ±ºãã</h> - <p> - ã¢ãããŒã·ã§ã³ãäžãããšããå¹èœããããä»åã¯è€åå®å®¶ããåã£ãŠ <code>teika</code> ã«ããã - ãããŠããã€ãæºæ°ç©èªã®åžãå°åçŸäººäžéŠã®æäººããéžãã§ããã - </p> - </section> - <section id="ssh-key"> - <h>SSH ã®éµçæ</h> - <p> - ããŒã«ã«ãã·ã³ã§éµãçæããã - </p> - <codeblock language="shell-session"> - <![CDATA[ - $ ssh-keygen -t ed25519 -b 521 -f ~/.ssh/teika.key - $ ssh-keygen -t ed25519 -b 521 -f ~/.ssh/github2teika.key - ]]> - </codeblock> - <p> - <code>teika.key</code> ã¯ããŒã«ã«ãããµãŒããžã®æ¥ç¶çšã<code>github2teika.key</code> ã¯ã - GitHub Actions ãããµãŒããžã®ãããã€çšã - </p> - </section> - <section id="ssh-config"> - <h>SSH ã®èšå®</h> - <p> - <code>.ssh/config</code> ã«èšå®ããŠããã - </p> - <codeblock language="ssh_config"> - <![CDATA[ - Host teika - HostName ********** - User ********** - Port ********** - IdentityFile ~/.ssh/teika.key - IdentitiesOnly yes - ]]> - </codeblock> - </section> - </section> - <section id="basic-setup"> - <h>åºæ¬ã®ã»ããã¢ãã</h> - <section id="login"> - <h>SSH æ¥ç¶</h> - <p> - VPS å¥çŽæã«èšå®ãã管çè
ãŠãŒã¶ãšãã¹ã¯ãŒãã䜿ã£ãŠãã°ã€ã³ããã - </p> - </section> - <section id="user"> - <h>ãŠãŒã¶ãäœæãã</h> - <p> - 管çè
ãŠãŒã¶ã§äœæ¥ãããšå±ãªãã®ã§ãã¡ã€ã³ã§äœ¿ããŠãŒã¶ãäœæããã - <code>sudo</code> ã°ã«ãŒãã«è¿œå ã㊠<code>sudo</code> ã§ããããã«ãã<code>su</code> ã§åãæ¿ãã - </p> - <codeblock language="shell-session"> - <![CDATA[ - $ sudo adduser ********** - $ sudo adduser ********** sudo - $ su ********** - $ cd - ]]> - </codeblock> - </section> - <section id="hostname"> - <h>ãã¹ãåãå€ãã</h> - <codeblock language="shell-session"> - <![CDATA[ - $ sudo hostname teika - ]]> - </codeblock> - </section> - <section id="public-key"> - <h>å
¬ééµã眮ã</h> - <codeblock language="shell-session"> - <![CDATA[ - $ mkdir ~/.ssh - $ chmod 700 ~/.ssh - $ vi ~/.ssh/authorized_keys - ]]> - </codeblock> - <p> - <code>authorized_keys</code> ã«ã¯ãããŒã«ã«ã§çæãã <code>~/.ssh/teika.key.pub</code> ãš - <code>~/.ssh/github2teika.key.pub</code> ã®å
容ãã³ããŒããã - </p> - </section> - <section id="ssh-config"> - <h>SSH ã®èšå®</h> - <p> - SSH ã®èšå®ã倿Žããå°ãã§ãå®å
šã«ããŠããã - </p> - <codeblock language="shell-session"> - <![CDATA[ - $ sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak - $ sudo vi /etc/ssh/sshd_config - ]]> - </codeblock> - <ul> - <li><code>Port</code> ã倿Ž</li> - <li><code>PermitRootLogin</code> ã <code>no</code> ã«</li> - <li><code>PasswordAuthentication</code> ã <code>no</code> ã«</li> - </ul> - <p> - ãããŠèšå®ãåæ ã - </p> - <codeblock language="shell-session"> - <![CDATA[ - $ sudo systemctl restart sshd - $ sudo systemctl status sshd - ]]> - </codeblock> - </section> - <section id="ssh-connect"> - <h>SSH ã§æ¥ç¶ç¢ºèª</h> - <p> - ä»ã® SSH ã»ãã·ã§ã³ã¯éããã«ãã¿ãŒããã«ãå¥ééããŠçé確èªããã - ã»ãã·ã§ã³ãéããŠããŸããšãSSH ã®èšå®ã«äžåããã£ãå Žåã«ç· ãåºãããããã - </p> - <codeblock language="shell-session"> - <![CDATA[ - $ ssh teika - ]]> - </codeblock> - </section> - <section id="close-ports"> - <h>ããŒãã®é®æ</h> - <p> - ããã©ã«ãã® 22 çªãéããèšå®ããããŒãã ã空ããã - </p> - <codeblock language="shell-session"> - <![CDATA[ - $ sudo ufw deny ssh - $ sudo ufw allow ******* - $ sudo ufw enable - $ sudo ufw reload - $ sudo ufw status - ]]> - </codeblock> - <p> - ããã§ããäžåºŠ SSH ã®æ¥ç¶ç¢ºèªãæãã - </p> - </section> - <section id="ssh-key-for-github"> - <h>GitHub çšã® SSH éµ</h> - <p> - GitHub ã«çœ®ããŠãã private ãªããžããªããµãŒããã clone ãããã®ã§ãSSH éµãçæããŠçœ®ããŠããã - </p> - <codeblock language="shell-session"> - <![CDATA[ - $ ssh-keygen -t ed25519 -b 521 -f ~/.ssh/github.key - $ cat ~/.ssh/github.key.pub - ]]> - </codeblock> - <p> - <a href="https://github.com/settings/ssh">GitHub ã®èšå®ç»é¢</a> ããããã®å
¬ééµã远å ããã - </p> - <codeblock language="shell-session"> - <![CDATA[ - $ vi ~/.ssh/config - ]]> - </codeblock> - <p> - èšå®ã¯ããã - </p> - <codeblock language="ssh_config"> - <![CDATA[ - Host github.com - HostName github.com - User git - Port 22 - IdentityFile ~/.ssh/github.key - IdentitiesOnly yes - ]]> - </codeblock> - <p> - æåŸã«æ¥ç¶ã§ããã確èªããŠããã - </p> - <codeblock language="shell-session"> - <![CDATA[ - $ ssh -T github.com - ]]> - </codeblock> - </section> - <section id="upgrade-packages"> - <h>ããã±ãŒãžã®æŽæ°</h> - <codeblock language="shell-session"> - <![CDATA[ - $ sudo apt update - $ sudo apt upgrade - $ sudo apt update - $ sudo apt upgrade - $ sudo apt autoremove - ]]> - </codeblock> - </section> - </section> - <section id="site-hosting-setup"> - <h>ãµã€ããã¹ãã£ã³ã°çšã®ã»ããã¢ãã</h> - <section id="dns"> - <h>DNS ã« IP ã¢ãã¬ã¹ãç»é²ãã</h> - <p> - ãã®ãµãŒãã¯åºå®ã® IP ã¢ãã¬ã¹ãããã®ã§ã<code>A</code> ã¬ã³ãŒãã«çŽæ¥å
¥ããã ãã§æžãã ã - </p> - </section> - <section id="install-softwares"> - <h>䜿ããœãããŠã§ã¢ã®ã€ã³ã¹ããŒã«</h> - <codeblock language="shell-session"> - <![CDATA[ - $ sudo apt install docker docker-compose git make - ]]> - </codeblock> - </section> - <section id="docker"> - <h>ã¡ã€ã³ãŠãŒã¶ã Docker ã䜿ããããã«</h> - <codeblock language="shell-session"> - <![CDATA[ - $ sudo adduser ********** docker - ]]> - </codeblock> - </section> - <section id="open-http-ports"> - <h>HTTP/HTTPS ãéã</h> - <p> - 80 çªãš 443 çªã空ããã - </p> - <codeblock language="shell-session"> - <![CDATA[ - $ sudo ufw allow 80/tcp - $ sudo ufw allow 443/tcp - $ sudo ufw reload - $ sudo ufw status - ]]> - </codeblock> - </section> - <section id="clone-repositories"> - <h>ãªããžããªã®ã¯ããŒã³</h> - <codeblock language="shell-session"> - <![CDATA[ - $ cd - $ git clone git@github.com:nsfisis/nsfisis.dev.git - $ cd nsfisis.dev - $ git submodule update --init - ]]> - </codeblock> - </section> - <section id="certbot"> - <h>certbot ã§èšŒææžååŸ</h> - <codeblock language="shell-session"> - <![CDATA[ - $ docker-compose up -d acme-challenge - $ make setup - ]]> - </codeblock> - </section> - <section id="run-server"> - <h>ãµãŒãã皌åããã</h> - <codeblock language="shell-session"> - <![CDATA[ - $ make serve - ]]> - </codeblock> - </section> - </section> - <section id="outro"> - <h>ææ³</h> - <p> - (æ¥åã§ãªã) å人ã ãšæ°å¹Žã¶ãã®ãµãŒãã»ããã¢ããã§ãããã ãã§ãå²ãšæéãé£ã£ãŠããŸã£ãã - ãšã¯ããåŒå¹Žé·å®®ã¯æ¥œããã®ã§ãããããã宿çã«ãã£ãŠããããã - ã³ã³ãããããã€ã«ãããæ°æã¡ãããã®ã ããè²ã
å®éšãããé¢ä¿äžãæ¬ç©ã®ãµãŒããæ¬²ããã¯ããã - 次ã®åŒå¹Žé·å®®ã§ã¯ãæé ã®äžéšã ãã§ãèªååããããšããã - </p> - </section> -</article> diff --git a/vhosts/blog/content/posts/2022-11-19/phperkaigi-2023-unused-token-quiz-2.dj b/vhosts/blog/content/posts/2022-11-19/phperkaigi-2023-unused-token-quiz-2.dj new file mode 100644 index 00000000..bd752c2e --- /dev/null +++ b/vhosts/blog/content/posts/2022-11-19/phperkaigi-2023-unused-token-quiz-2.dj @@ -0,0 +1,139 @@ +--- +[article] +uuid = "10fe9c47-7029-4874-82bd-b4dc50e07809" +title = "PHPerKaigi 2023: ããã«ãªã£ãããŒã¯ã³åé¡ ãã® 2" +description = "æ¥å¹Žã® PHPerKaigi 2023 ã§ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿããåºé¡äºå®ã®ããŒã¯ã³åé¡ã®ãã¡ãããã«ãªã£ãåé¡ãå
¬éãã (ãã® 2)ã" +tags = [ + "php", + "phperkaigi", +] + +[[article.revisions]] +date = "2022-11-19" +remark = "å
¬é" +--- +{#intro} +# ã¯ããã« + +2023 幎 3 æ 23 æ¥ãã 25 æ¥ã«ãããŠéå¬äºå® (èšäºå·çæç¹) ã® [PHPerKaigi 2023](https://phperkaigi.jp/2023/) ã«ãããŠã +æšå¹Žãšåæ§ã«ãåŒç€Ÿ [ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ](https://www.dgcircus.com/) ããããŒã¯ã³åé¡ãåºé¡äºå®ã§ããã + +æšå¹Žã®ããŒã¯ã³åé¡ã®èšäºã¯ãã¡ã: [PHPerKaigi 2022 ããŒã¯ã³åé¡ã®è§£èª¬](/posts/2022-04-09/phperkaigi-2022-tokens/) + +ãã§ã« 2023 幎çšã®åé¡ã¯äœææžã¿ã§ãããããã®å¶äœéçšã®äžã§ããã€ãããåãã§ããããã£ãããªã®ã§ãPHPerKaigi éå¬ãåŸ
ã€éã«ç޹ä»ããããšæãã + +10 æãã 2 æãŸã§ãæ¯æ 1 èšäºãã€å
¬éããŠããäºå® (å¿ããŠããªããã°)ã + +ãã® 1 ã¯ãã¡ã: [PHPerKaigi 2023: ããã«ãªã£ãããŒã¯ã³åé¡ ãã® 1](/posts/2022-10-23/phperkaigi-2023-unused-token-quiz-1/) + +{#quiz} +# åé¡ + +泚æ: ããã¯ããåãªã®ã§ãåŸãããããŒã¯ã³ã PHPerKaigi ã§å
¥åããŠããã€ã³ãã«ã¯ãªããªãã + +```php +<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='â<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> +<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='âââââââââââââââââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> +<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='âââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> +<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='ââââââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> +<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='âââââââââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> +<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='ââââââââââââââââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> +<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='âââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> +<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='ââââââââââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> +<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='ââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> +<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='ââââââââââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> +``` + +"And Then There Were None" (ãããŠèª°ãããªããªã£ã) ãšåä»ããäœåãå€å quine (èªåèªèº«ãšåããœãŒã¹ã³ãŒããåºåããããã°ã©ã ) ã«ãªã£ãŠããã + +{#how-to-obtain-token} +# ããŒã¯ã³å
¥ææ¹æ³ + +å®è¡ããŠã¿ããšã次ã®ãããªåºåãåŸãããã + +```php +# +<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='âââââââââââââââââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> +<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='âââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> +<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='ââââââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> +<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='âââââââââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> +<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='ââââââââââââââââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> +<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='âââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> +<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='ââââââââââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> +<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='ââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> +<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='ââââââââââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> +``` + +1 è¡ç®ãé€ããå
ã»ã©ã®ã³ãŒããšã»ãŒåããã®ãåºãŠãããããäžåºŠå®è¡ããŠã¿ãã + +```php +# +W +<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='âââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> +<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='ââââââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> +<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='âââââââââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> +<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='ââââââââââââââââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> +<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='âââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> +<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='ââââââââââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> +<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='ââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> +<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='ââââââââââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> +``` + +ä»åºŠã¯ 2 è¡ç®ãæžãæããããããã¹ãŠã®è¡ãå€åãããŸã§ç¹°ãè¿ããšæ¬¡ã®ããã«ãªãã + +```php +# +W +E +L +O +V +E +P +H +P +``` + +ããŒã¯ã³ã#WELOVEPHPããæã«å
¥ã£ãã + +{#commentary} +# 解説 + +äžèŠãããšåãè¡ã 10 è¡äžŠãã§ããã ããªã®ã«ãé¢ãããããªãããããã®è¡ã§åºåãå€ããã®ãããœãŒã¹ã³ãŒããã³ããŒããŠãé©åœãªãšãã£ã¿ã«è²Œãä»ãããšããããããã + +Vim ã§éããšæ¬¡ã®ããã«ãªã (1 è¡ç®ãæç²)ã + +```php +<?php printf((isset($s)?fn($s)=>trim($s,"<200b>"):fn($s)=>chr(strlen($s)/3))($s='<200b><?php printf((isset($s)?fn($s)=>trim($s,"<200b>"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> +``` + +`<200b>` ãšè¡šç€ºãããŠããã®ã¯ãUnicode ã® U+200b ã§ããŒãå¹
ã¹ããŒã¹ã§ããã + +::: note +ãšãã£ã¿ã«ãã£ãŠã¯ããŒãå¹
ã¹ããŒã¹ãèŠããªãããšããããVSCode ã§ã¯ãã©ãŠã¶ãšåæ§ã«äžå¯èŠã ã£ãã +::: + +æååãªãã©ã«ã®äžã«ãŒãå¹
ã¹ããŒã¹ãä»èŸŒãããšã§ãèŠãç®ãå€ããã«æ
å ±ããšã³ã³ãŒãããããšãå¯èœãšãªãã + +ç¶ããŠãããŒã¯ã³ãžã®å€æããžãã¯ãè§£æãããæ³šç®ãã¹ãã¯ãã®éšåã ã以äžããŒãå¹
ã¹ããŒã¹ã¯ Vim ã§ã®è¡šç€ºã«åãã㊠`<200b>` ãšèšèŒããã + +```php +fn($s)=>chr(strlen($s)/3) +``` + +PHP ã® `strlen()` ã¯æååã®ãã€ãæ°ãè¿ãã1 è¡ç®ã® `$s` ã¯ä»¥äžã®å
容ãšãªã£ãŠããã + +```php +$s='<200b><?php printf((isset($s)?fn($s)=>trim($s,"<200b>"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>' +``` + +ãã®ãœãŒã¹ã³ãŒã㯠UTF-8 ã§æžãããŠããã®ã§ã105 ãã€ãã«ãªããããã 3 ã§å²ããš 35 ãšãªãããã㯠`#` ã® ASCII ã³ãŒããšäžèŽãããä»ã®è¡ããåæ§ã«ããŠãŒãå¹
ã¹ããŒã¹ãè©°ããããšã§æååé·ã調æŽããããŒã¯ã³ããšã³ã³ãŒãããŠããã + +ãã³ãŒãéšä»¥å€ã®éšåã¯ãquine ã®ããã®èšè¿°ã§ããã + +{#outro} +# ãããã« + +[CVE-2021-42574](https://blog.rust-lang.org/2021/11/01/cve-2021-42574.html) ã«çæ³ãåŸãäœåããã®è匱æ§ã¯ãUnicode ã®å¶åŸ¡æåã§ãã left-to-right mark ãš right-to-left mark ãå©çšãããœãŒã¹ã³ãŒãã®å®éã®å
å®¹ãæ¬ºãããšãããã®ãç°¡åã®ãããŒãå¹
ã¹ããŒã¹ãçšããããšãšããã€ãã§ã« quine ã«ããããšãããªã£ãã + +ããã«ãªã£ãçç±ã¯ããŒãå¹
ã¹ããŒã¹ã衚瀺ããŠãããšãã£ã¿ãæ³å以äžã«å€ãã£ãããããåãè¡ã䞊ãã§ããã ããªã®ã«åºåãç°ãªãããšããã¢ã€ãã¢ã®æ ¹å¹¹ã厩ãããŠããŸãã®ã§ããã®åé¡ã¯äžæ¡çšãšãªã£ãã diff --git a/vhosts/blog/content/posts/2022-11-19/phperkaigi-2023-unused-token-quiz-2.ndoc b/vhosts/blog/content/posts/2022-11-19/phperkaigi-2023-unused-token-quiz-2.ndoc deleted file mode 100644 index e1305179..00000000 --- a/vhosts/blog/content/posts/2022-11-19/phperkaigi-2023-unused-token-quiz-2.ndoc +++ /dev/null @@ -1,171 +0,0 @@ ---- -[article] -uuid = "10fe9c47-7029-4874-82bd-b4dc50e07809" -title = "PHPerKaigi 2023: ããã«ãªã£ãããŒã¯ã³åé¡ ãã® 2" -description = "æ¥å¹Žã® PHPerKaigi 2023 ã§ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿããåºé¡äºå®ã®ããŒã¯ã³åé¡ã®ãã¡ãããã«ãªã£ãåé¡ãå
¬éãã (ãã® 2)ã" -tags = [ - "php", - "phperkaigi", -] - -[[article.revisions]] -date = "2022-11-19" -remark = "å
¬é" ---- -<article> - <section id="intro"> - <h>ã¯ããã«</h> - <p> - 2023 幎 3 æ 23 æ¥ãã 25 æ¥ã«ãããŠéå¬äºå® (èšäºå·çæç¹) ã® <a href="https://phperkaigi.jp/2023/">PHPerKaigi 2023</a> ã«ãããŠã - æšå¹Žãšåæ§ã«ãåŒç€Ÿ <a href="https://www.dgcircus.com/">ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ</a> ããããŒã¯ã³åé¡ãåºé¡äºå®ã§ããã - </p> - <p> - æšå¹Žã®ããŒã¯ã³åé¡ã®èšäºã¯ãã¡ã: <a href="/posts/2022-04-09/phperkaigi-2022-tokens/">PHPerKaigi 2022 ããŒã¯ã³åé¡ã®è§£èª¬</a> - </p> - <p> - ãã§ã« 2023 幎çšã®åé¡ã¯äœææžã¿ã§ãããããã®å¶äœéçšã®äžã§ããã€ãããåãã§ããããã£ãããªã®ã§ãPHPerKaigi éå¬ãåŸ
ã€éã«ç޹ä»ããããšæãã - </p> - <p> - 10 æãã 2 æãŸã§ãæ¯æ 1 èšäºãã€å
¬éããŠããäºå® (å¿ããŠããªããã°)ã - </p> - <p> - ãã® 1 ã¯ãã¡ã: <a href="/posts/2022-10-23/phperkaigi-2023-unused-token-quiz-1/">PHPerKaigi 2023: ããã«ãªã£ãããŒã¯ã³åé¡ ãã® 1</a> - </p> - </section> - <section id="quiz"> - <h>åé¡</h> - <p> - 泚æ: ããã¯ããåãªã®ã§ãåŸãããããŒã¯ã³ã PHPerKaigi ã§å
¥åããŠããã€ã³ãã«ã¯ãªããªãã - </p> - <codeblock language="php"> - <![CDATA[ - <?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='â<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> - <?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='âââââââââââââââââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> - <?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='âââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> - <?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='ââââââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> - <?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='âââââââââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> - <?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='ââââââââââââââââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> - <?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='âââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> - <?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='ââââââââââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> - <?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='ââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> - <?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='ââââââââââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> - ]]> - </codeblock> - <p> - "And Then There Were None" (ãããŠèª°ãããªããªã£ã) ãšåä»ããäœåãå€å quine (èªåèªèº«ãšåããœãŒã¹ã³ãŒããåºåããããã°ã©ã ) ã«ãªã£ãŠããã - </p> - </section> - <section id="how-to-obtain-token"> - <h>ããŒã¯ã³å
¥ææ¹æ³</h> - <p> - å®è¡ããŠã¿ããšã次ã®ãããªåºåãåŸãããã - </p> - <codeblock language="php"> - <![CDATA[ - # - <?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='âââââââââââââââââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> - <?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='âââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> - <?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='ââââââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> - <?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='âââââââââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> - <?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='ââââââââââââââââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> - <?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='âââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> - <?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='ââââââââââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> - <?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='ââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> - <?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='ââââââââââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> - ]]> - </codeblock> - <p> - 1 è¡ç®ãé€ããå
ã»ã©ã®ã³ãŒããšã»ãŒåããã®ãåºãŠãããããäžåºŠå®è¡ããŠã¿ãã - </p> - <codeblock language="php"> - <![CDATA[ - # - W - <?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='âââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> - <?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='ââââââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> - <?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='âââââââââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> - <?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='ââââââââââââââââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> - <?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='âââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> - <?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='ââââââââââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> - <?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='ââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> - <?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s='ââââââââââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> - ]]> - </codeblock> - <p> - ä»åºŠã¯ 2 è¡ç®ãæžãæããããããã¹ãŠã®è¡ãå€åãããŸã§ç¹°ãè¿ããšæ¬¡ã®ããã«ãªãã - </p> - <codeblock language="php"> - <![CDATA[ - # - W - E - L - O - V - E - P - H - P - ]]> - </codeblock> - <p> - ããŒã¯ã³ã#WELOVEPHPããæã«å
¥ã£ãã - </p> - </section> - <section id="commentary"> - <h>解説</h> - <p> - äžèŠãããšåãè¡ã 10 è¡äžŠãã§ããã ããªã®ã«ãé¢ãããããªãããããã®è¡ã§åºåãå€ããã®ãããœãŒã¹ã³ãŒããã³ããŒããŠãé©åœãªãšãã£ã¿ã«è²Œãä»ãããšããããããã - </p> - <p> - Vim ã§éããšæ¬¡ã®ããã«ãªã (1 è¡ç®ãæç²)ã - </p> - <codeblock language="php"> - <![CDATA[ - <?php printf((isset($s)?fn($s)=>trim($s,"<200b>"):fn($s)=>chr(strlen($s)/3))($s='<200b><?php printf((isset($s)?fn($s)=>trim($s,"<200b>"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>')."\n","\x27$s\x27");?> - ]]> - </codeblock> - <p> - <code><200b></code> ãšè¡šç€ºãããŠããã®ã¯ãUnicode ã® U+200b ã§ããŒãå¹
ã¹ããŒã¹ã§ããã - </p> - <note> - <p> - ãšãã£ã¿ã«ãã£ãŠã¯ããŒãå¹
ã¹ããŒã¹ãèŠããªãããšããããVSCode ã§ã¯ãã©ãŠã¶ãšåæ§ã«äžå¯èŠã ã£ãã - </p> - </note> - <p> - æååãªãã©ã«ã®äžã«ãŒãå¹
ã¹ããŒã¹ãä»èŸŒãããšã§ãèŠãç®ãå€ããã«æ
å ±ããšã³ã³ãŒãããããšãå¯èœãšãªãã - </p> - <p> - ç¶ããŠãããŒã¯ã³ãžã®å€æããžãã¯ãè§£æãããæ³šç®ãã¹ãã¯ãã®éšåã ã以äžããŒãå¹
ã¹ããŒã¹ã¯ Vim ã§ã®è¡šç€ºã«åãã㊠<code><200b></code> ãšèšèŒããã - </p> - <codeblock language="php"> - <![CDATA[ - fn($s)=>chr(strlen($s)/3) - ]]> - </codeblock> - <p> - PHP ã® <code>strlen()</code> ã¯æååã®ãã€ãæ°ãè¿ãã1 è¡ç®ã® <code>$s</code> ã¯ä»¥äžã®å
容ãšãªã£ãŠããã - </p> - <codeblock language="php"> - <![CDATA[ - $s='<200b><?php printf((isset($s)?fn($s)=>trim($s,"<200b>"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>' - ]]> - </codeblock> - <p> - ãã®ãœãŒã¹ã³ãŒã㯠UTF-8 ã§æžãããŠããã®ã§ã105 ãã€ãã«ãªããããã 3 ã§å²ããš 35 ãšãªãããã㯠<code>#</code> ã® ASCII ã³ãŒããšäžèŽãããä»ã®è¡ããåæ§ã«ããŠãŒãå¹
ã¹ããŒã¹ãè©°ããããšã§æååé·ã調æŽããããŒã¯ã³ããšã³ã³ãŒãããŠããã - </p> - <p> - ãã³ãŒãéšä»¥å€ã®éšåã¯ãquine ã®ããã®èšè¿°ã§ããã - </p> - </section> - <section id="outro"> - <h>ãããã«</h> - <p> - <a href="https://blog.rust-lang.org/2021/11/01/cve-2021-42574.html">CVE-2021-42574</a> ã«çæ³ãåŸãäœåããã®è匱æ§ã¯ãUnicode ã®å¶åŸ¡æåã§ãã left-to-right mark ãš right-to-left mark ãå©çšãããœãŒã¹ã³ãŒãã®å®éã®å
å®¹ãæ¬ºãããšãããã®ãç°¡åã®ãããŒãå¹
ã¹ããŒã¹ãçšããããšãšããã€ãã§ã« quine ã«ããããšãããªã£ãã - </p> - <p> - ããã«ãªã£ãçç±ã¯ããŒãå¹
ã¹ããŒã¹ã衚瀺ããŠãããšãã£ã¿ãæ³å以äžã«å€ãã£ãããããåãè¡ã䞊ãã§ããã ããªã®ã«åºåãç°ãªãããšããã¢ã€ãã¢ã®æ ¹å¹¹ã厩ãããŠããŸãã®ã§ããã®åé¡ã¯äžæ¡çšãšãªã£ãã - </p> - </section> -</article> diff --git a/vhosts/blog/content/posts/2023-01-10/phperkaigi-2023-unused-token-quiz-3.dj b/vhosts/blog/content/posts/2023-01-10/phperkaigi-2023-unused-token-quiz-3.dj new file mode 100644 index 00000000..dcf7106b --- /dev/null +++ b/vhosts/blog/content/posts/2023-01-10/phperkaigi-2023-unused-token-quiz-3.dj @@ -0,0 +1,289 @@ +--- +[article] +uuid = "89722cfb-7f4b-4e96-80bc-e0096e5eeef6" +title = "PHPerKaigi 2023: ããã«ãªã£ãããŒã¯ã³åé¡ ãã® 3" +description = "æ¥å¹Žã® PHPerKaigi 2023 ã§ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿããåºé¡äºå®ã®ããŒã¯ã³åé¡ã®ãã¡ãããã«ãªã£ãåé¡ãå
¬éãã (ãã® 3)ã" +tags = [ + "php", + "phperkaigi", +] + +[[article.revisions]] +date = "2023-01-10" +remark = "å
¬é" +--- +{#intro} +# ã¯ããã« + +2023 幎 3 æ 23 æ¥ãã 25 æ¥ã«ãããŠéå¬äºå® (èšäºå·çæç¹) ã® [PHPerKaigi 2023](https://phperkaigi.jp/2023/) ã«ãããŠã +æšå¹Žãšåæ§ã«ãåŒç€Ÿ [ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ](https://www.dgcircus.com/) ããããŒã¯ã³åé¡ãåºé¡äºå®ã§ããã + +æšå¹Žã®ããŒã¯ã³åé¡ã®èšäºã¯ãã¡ã: [PHPerKaigi 2022 ããŒã¯ã³åé¡ã®è§£èª¬](/posts/2022-04-09/phperkaigi-2022-tokens/) + +ãã§ã« 2023 幎çšã®åé¡ã¯äœææžã¿ã§ãããããã®å¶äœéçšã®äžã§ããã€ãããåãã§ããã +ãã£ãããªã®ã§ãPHPerKaigi éå¬ãåŸ
ã€éã«ç޹ä»ããããšæãã + +10 æãã 2 æãŸã§ãæ¯æ 1 èšäºãã€å
¬éããŠããäºå® (å¿ããŠããªããã° â å¿ããŠããã®ã§ 12 æå
¬éäºå®ã ã£ãèšäºã仿žããŠãã)ã + +* ãã® 1 ã¯ãã¡ã: [PHPerKaigi 2023: ããã«ãªã£ãããŒã¯ã³åé¡ ãã® 1](/posts/2022-10-23/phperkaigi-2023-unused-token-quiz-1/) +* ãã® 2 ã¯ãã¡ã: [PHPerKaigi 2023: ããã«ãªã£ãããŒã¯ã³åé¡ ãã® 2](/posts/2022-11-19/phperkaigi-2023-unused-token-quiz-2/) + +{#quiz} +# åé¡ + +泚æ: ããã¯ããåãªã®ã§ãåŸãããããŒã¯ã³ã PHPerKaigi ã§å
¥åããŠããã€ã³ãã«ã¯ãªããªãã + +```php +<?php +try { + f(g() / __LINE__); +} catch (Throwable $e) { + while ($e = $e->getPrevious()) printf('%c', $e->getLine() + 23); + echo "\n"; +} +function f(int $i) { + if ($i < 0) f(); + try { + match ($i) { + 0 => 0 / 0, + + + + 15, 36 => 0 / 0, + 14 => 0 / 0, + 37 => 0 / 0, + + + + + + + + + + + 6 => 0 / 0, + + 5 => 0 / 0, + + 22 => 0 / 0, + + + + + 34, 35 => 0 / 0, + + + + + + + + + 25 => 0 / 0, + 17, 21 => 0 / 0, + + 24, 32 => 0 / 0, + + + + + + + + 33 => 0 / 0, + + 16 => 0 / 0, + + + 18 => 0 / 0, + + + + + + + + + 7 => 0 / 0, + + 2 => 0 / 0, + 1, 20 => 0 / 0, + 10, 28 => 0 / 0, + 8, 12, 26 => 0 / 0, + 4, 9, 13 => 0 / 0, + + + + + + 31 => 0 / 0, + + 29 => 0 / 0, + + 11 => 0 / 0, + + + + 3, 19, 23 => 0 / 0, + + + 27 => 0 / 0, + + 30 => 0 / 0, + }; + } finally { + f($i - 1); + } +} + + + + + + + +function g() { + return __LINE__; +} +``` + +"Catchline" ãšåä»ããäœåãå®è¡ãããšããŒã¯ã³ `#base64_decode('SGVsbG8sIFdvcmxkIQ==')` ãåŸãããã + +ããŒã¯ã³ã¯ PHP ã®åŒã«ãªã£ãŠããŠãè©äŸ¡ãããš `Hello, World!` ãšããæååã«ãªããPHPer ãã£ã¬ã³ãžã®ããŒã¯ã³ã«ã¯ç©ºçœãå«ããããªããšããå¶çŽããããããããã£ã圢ã§ããŒã¯ã³ã«ããã°åé¿ã§ããã + +{#commentary} +# 解説 + +{#summary} +## æŠèŠ + +äŸå€ãçºçããè¡æ°ã«ããŒã¿ããšã³ã³ãŒãããããã `catch` ã§æãŸããŠè¡šç€ºããŠããã + +{#chain-of-exceptions} +## äŸå€ãªããžã§ã¯ãã®é£é + +[`Exception`](https://www.php.net/class.Exception) ã [`Error`](https://www.php.net/class.Error) ã«ã¯ `$previous` ãšããããããã£ããããã³ã³ã¹ãã©ã¯ã¿ã®ç¬¬3åŒæ°ããæž¡ãããšãã§ããã䞻㫠2ã€ã®çšæ³ããã: + +* ãšã©ãŒãåŠçããŠããéäžã«èµ·ãã£ãå¥ã®ãšã©ãŒã«ãå
ã®ãšã©ãŒæ
å ±ãå«ãã +* å
éšãšã©ãŒãã©ããããŠäœããããšã©ãŒã«ãå
éšãšã©ãŒã®æ
å ±ãå«ãã + +ãã®ãã¡ 1ã€ç®ã®ã±ãŒã¹ã¯ã `finally` ç¯ã®äžã§ãšã©ãŒãæãããš PHP åŠçç³»ãåæã« `$previous` ãèšå®ããŠãããã + +```php +<?php + +try { + try { + throw new Exception("Error 1"); + } finally { + throw new Exception("Error 2"); + } +} catch (Exception $e) { + echo $e->getMessage() . PHP_EOL; + // => Error 2 + echo $e->getPrevious()->getMessage() . PHP_EOL; + // => Error 1 +} +``` + +ãã®ç¥èãå
ã«ãããŒã¯ã³ã®åºåéšãè§£æããŠã¿ãã + +{#output} +## åºåéšã®è§£æ + +åºåéšãã³ã¡ã³ããæ¹è¡ã远å ããŠåæ²ãã: + +```php +<?php +try { + f(g() / __LINE__); +} catch (Throwable $e) { + while ($e = $e->getPrevious()) { + printf('%c', $e->getLine() + 23); + } + echo "\n"; +} +``` + +åºåããããªã `catch` ç¯ãèŠãŠã¿ããšã `Throwable::getPrevious()` ãåŒã³åºããŠãšã©ãŒãã§ã€ã³ã蟿ãã `Throwable::getLine()` ã§ãšã©ãŒãçºçããè¡æ°ãååŸããŠããããã®è¡æ°ã« `23` ãªãããžãã¯ãã³ããŒãè¶³ãããã©ãŒãããæå®å `%c` ã§åºåããŠããã + +ãã©ãŒãããæå®å `%c` ã¯ãæŽæ°ã ASCII ã³ãŒã[^ras-syndrome] ãšèŠåããŠå°åãããããŒã¯ã³ `#base64_decode('SGVsbG8sIFdvcmxkIQ==')` ã® `b` ã§ããã°ãASCII ã³ãŒã `98` ãªã®ã§ã75 è¡ç®ã§çºçãããšã©ãŒã + +[^ras-syndrome]: RAS syndrome + +```php +1, 20 => 0 / 0, +``` + +ã«ãã£ãŠè¡šçŸãããŠããããšã©ãŒãèµ·ããæ¹æ³ã¯ãããããšèããããããä»åã¯ãŒãé€ç®ã䜿ã£ãã + +ããã§ã¯ããšã©ãŒãã§ã€ã³ãäœãç®æã颿° `f()` ãèŠãŠããã + +{#data-construction} +## ããŒã¿æ§æéšã®è§£æ + +`f()` ã®å®çŸ©ãåæ²ãã (ãšã©ãŒãªããžã§ã¯ãã®è¡æ°ãå©çšããŠããã®ã§ãäžéšåã ãæãåºããšå€ãå€ããããšã«æ³šæ): + +```php +function f(int $i) { + if ($i < 0) f(); + try { + match ($i) { + 0 => 0 / 0, // 12 è¡ç® + + + + 15, 36 => 0 / 0, + 14 => 0 / 0, + 37 => 0 / 0, + + // (ç¥) + + 30 => 0 / 0, // 97 è¡ç® + }; + } finally { + f($i - 1); + } +} +``` + +åè¿°ã®ããã«ã `finally` ç¯ã§ãšã©ãŒãæãããš PHP åŠçç³»ã `$previous` ãèšå®ãããããã§ã¯ããšã©ãŒãç¹ããããã« `f()` ãååž°åŒã³åºãããŠãããæåã« `f()` ãåŒã³åºããŠããç®æã確èªãããšã + +```php +<?php +try { + f(g() / __LINE__); // 3 è¡ç® +``` + +```php +function g() { + return __LINE__; // 111 è¡ç® +} +``` + +`f()` ã«ã¯ `111 / 3` ã§ `37` ãæž¡ãããããšããããããããã 1 ãã€æžãããŠååž°åŒã³åºãããŠããã0 ããå°ãããªã£ãã `f()` ãåŒæ°ãªãã§åŒã³åºããåŒæ°ã®æ°ãè¶³ããªããšåŒã³åºãã«å€±æããã®ã§ãååž°ã¯ããã§æ¢ãŸãã + +ãšã©ãŒãã§ã€ã³ã¯ãæåŸã«çºçãããšã©ãŒãå
é ãšããåæ¹åé£çµãªã¹ãã«ãªã£ãŠããã®ã§ãé ã« + +1. `f()` ã®åŒæ°ãè¶³ããªãããšã«ããåŒã³åºã倱æ +1. `f(0)` ã®åŒã³åºãã§çºçãããŒãé€ç® +1. `f(1)` ã®åŒã³åºãã§çºçãããŒãé€ç® +1. ⊠+1. `f(37)` ã®åŒã³åºãã§çºçãããŒãé€ç® + +ãšãªã£ãŠãããåºåã®é㯠`catch` ãããšã©ãŒã® `getPrevious()` ããåŠçãå§ããã®ã§ã1 çªç®ã® `f()` ã«ãããšã©ãŒã¯ç¡èŠããã `f(0)` ã«ãããšã©ãŒã `f(1)` ã«ãããšã©ãŒã `f(2)` ã«ãããšã©ãŒããšåºåãé²ãã + +`f()` ã« `0` ãæž¡ãããšã㯠12 è¡ç®ã«ãã `match` ã® `0` ã§ãŒãé€ç®ãèµ·ããã®ã§ãè¡æ°ã 12 ãšãªã£ããšã©ãŒãæãããããåºåéšã§ã¯ããã« 23 ãè¶³ããæ°ã ASCII ã³ãŒããšããŠè¡šç€ºããŠããã®ã ã£ãã `12 + 23` 㯠`35`ãASCII ã³ãŒãã§ã¯ `#` ã§ããããããããŒã¯ã³ã® 1æåç®ã«ãããã + +{#outro} +# ãããã« + +ãè¡æ°ããšããã®ã¯ããŒã¯ã³æååããã³ãŒããã察象ãšããŠåªããŠããã + +* ããŒã¯ã³ã®äžéšãå
šéšãéœã«çŸããªã +* `__LINE__` ã§å®¹æã«ååŸã§ãã + +ãããããããã£ããå€ãªãããã°ã©ã ãäœåºŠãèªãã ãæžãããããŠãããšã `__LINE__` ã䜿ãã®ã¯ããŸãã«ãããããã§éå±ã«ãªããã§ã¯ãä»ã«è¡æ°ãååŸããææ®µã¯ãªãããããã㊠`Throwable` ãæãã€ããç¶ããŠãšã©ãŒãªããžã§ã¯ãã«ã¯ `$previous` ãããããšãæãåºããã + +ä»åãšã©ãŒãæããã®ã«ãŒãé€ç®ãçšããã®ã¯ãããããšã©ãŒãæããæãçãã³ãŒãã ãšèããããã§ããããã 3ãã€ãæªæºã§ `Throwable` ãªãªããžã§ã¯ããæããææ®µããåãã®ãããããã£ãããã°ããã²ãæç€ºããã ããããâŠâŠãšç· ããäºå®ã ã£ãã®ã ãã`0/0` ã®ãšãããååšããªã宿°ã«ããã°ãç°¡åã« 1ãã€ããéæã§ããããŒãé€ç®ããŠããç®æã¯ã¡ããã© 26 ç®æããã®ã§ãã¢ã«ãã¡ãããã«ã§ãããŠããã°æå³ãããã§è¯ãã£ããããããªãã diff --git a/vhosts/blog/content/posts/2023-01-10/phperkaigi-2023-unused-token-quiz-3.ndoc b/vhosts/blog/content/posts/2023-01-10/phperkaigi-2023-unused-token-quiz-3.ndoc deleted file mode 100644 index 45259b85..00000000 --- a/vhosts/blog/content/posts/2023-01-10/phperkaigi-2023-unused-token-quiz-3.ndoc +++ /dev/null @@ -1,326 +0,0 @@ ---- -[article] -uuid = "89722cfb-7f4b-4e96-80bc-e0096e5eeef6" -title = "PHPerKaigi 2023: ããã«ãªã£ãããŒã¯ã³åé¡ ãã® 3" -description = "æ¥å¹Žã® PHPerKaigi 2023 ã§ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿããåºé¡äºå®ã®ããŒã¯ã³åé¡ã®ãã¡ãããã«ãªã£ãåé¡ãå
¬éãã (ãã® 3)ã" -tags = [ - "php", - "phperkaigi", -] - -[[article.revisions]] -date = "2023-01-10" -remark = "å
¬é" ---- -<article> - <section id="intro"> - <h>ã¯ããã«</h> - <p> - 2023 幎 3 æ 23 æ¥ãã 25 æ¥ã«ãããŠéå¬äºå® (èšäºå·çæç¹) ã® <a href="https://phperkaigi.jp/2023/">PHPerKaigi 2023</a> ã«ãããŠã - æšå¹Žãšåæ§ã«ãåŒç€Ÿ <a href="https://www.dgcircus.com/">ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ</a> ããããŒã¯ã³åé¡ãåºé¡äºå®ã§ããã - </p> - <p> - æšå¹Žã®ããŒã¯ã³åé¡ã®èšäºã¯ãã¡ã: <a href="/posts/2022-04-09/phperkaigi-2022-tokens/">PHPerKaigi 2022 ããŒã¯ã³åé¡ã®è§£èª¬</a> - </p> - <p> - ãã§ã« 2023 幎çšã®åé¡ã¯äœææžã¿ã§ãããããã®å¶äœéçšã®äžã§ããã€ãããåãã§ããã - ãã£ãããªã®ã§ãPHPerKaigi éå¬ãåŸ
ã€éã«ç޹ä»ããããšæãã - </p> - <p> - 10 æãã 2 æãŸã§ãæ¯æ 1 èšäºãã€å
¬éããŠããäºå® (å¿ããŠããªããã° â å¿ããŠããã®ã§ 12 æå
¬éäºå®ã ã£ãèšäºã仿žããŠãã)ã - </p> - <ul> - <li>ãã® 1 ã¯ãã¡ã: <a href="/posts/2022-10-23/phperkaigi-2023-unused-token-quiz-1/">PHPerKaigi 2023: ããã«ãªã£ãããŒã¯ã³åé¡ ãã® 1</a></li> - <li>ãã® 2 ã¯ãã¡ã: <a href="/posts/2022-11-19/phperkaigi-2023-unused-token-quiz-2/">PHPerKaigi 2023: ããã«ãªã£ãããŒã¯ã³åé¡ ãã® 2</a></li> - </ul> - </section> - <section id="quiz"> - <h>åé¡</h> - <p> - 泚æ: ããã¯ããåãªã®ã§ãåŸãããããŒã¯ã³ã PHPerKaigi ã§å
¥åããŠããã€ã³ãã«ã¯ãªããªãã - </p> - <codeblock language="php"> - <![CDATA[ - <?php - try { - f(g() / __LINE__); - } catch (Throwable $e) { - while ($e = $e->getPrevious()) printf('%c', $e->getLine() + 23); - echo "\n"; - } - function f(int $i) { - if ($i < 0) f(); - try { - match ($i) { - 0 => 0 / 0, - - - - 15, 36 => 0 / 0, - 14 => 0 / 0, - 37 => 0 / 0, - - - - - - - - - - - 6 => 0 / 0, - - 5 => 0 / 0, - - 22 => 0 / 0, - - - - - 34, 35 => 0 / 0, - - - - - - - - - 25 => 0 / 0, - 17, 21 => 0 / 0, - - 24, 32 => 0 / 0, - - - - - - - - 33 => 0 / 0, - - 16 => 0 / 0, - - - 18 => 0 / 0, - - - - - - - - - 7 => 0 / 0, - - 2 => 0 / 0, - 1, 20 => 0 / 0, - 10, 28 => 0 / 0, - 8, 12, 26 => 0 / 0, - 4, 9, 13 => 0 / 0, - - - - - - 31 => 0 / 0, - - 29 => 0 / 0, - - 11 => 0 / 0, - - - - 3, 19, 23 => 0 / 0, - - - 27 => 0 / 0, - - 30 => 0 / 0, - }; - } finally { - f($i - 1); - } - } - - - - - - - - function g() { - return __LINE__; - } - ]]> - </codeblock> - <p> - "Catchline" ãšåä»ããäœåãå®è¡ãããšããŒã¯ã³ <code>#base64_decode('SGVsbG8sIFdvcmxkIQ==')</code> ãåŸãããã - </p> - <p> - ããŒã¯ã³ã¯ PHP ã®åŒã«ãªã£ãŠããŠãè©äŸ¡ãããš <code>Hello, World!</code> ãšããæååã«ãªããPHPer ãã£ã¬ã³ãžã®ããŒã¯ã³ã«ã¯ç©ºçœãå«ããããªããšããå¶çŽããããããããã£ã圢ã§ããŒã¯ã³ã«ããã°åé¿ã§ããã - </p> - </section> - <section id="commentary"> - <h>解説</h> - <section id="summary"> - <h>æŠèŠ</h> - <p> - äŸå€ãçºçããè¡æ°ã«ããŒã¿ããšã³ã³ãŒãããããã <code>catch</code> ã§æãŸããŠè¡šç€ºããŠããã - </p> - </section> - <section id="chain-of-exceptions"> - <h>äŸå€ãªããžã§ã¯ãã®é£é</h> - <p> - <a href="https://www.php.net/class.Exception"><code>Exception</code></a> ã <a href="https://www.php.net/class.Error"><code>Error</code></a> ã«ã¯ <code>$previous</code> ãšããããããã£ããããã³ã³ã¹ãã©ã¯ã¿ã®ç¬¬3åŒæ°ããæž¡ãããšãã§ããã䞻㫠2ã€ã®çšæ³ããã: - </p> - <ul> - <li>ãšã©ãŒãåŠçããŠããéäžã«èµ·ãã£ãå¥ã®ãšã©ãŒã«ãå
ã®ãšã©ãŒæ
å ±ãå«ãã</li> - <li>å
éšãšã©ãŒãã©ããããŠäœããããšã©ãŒã«ãå
éšãšã©ãŒã®æ
å ±ãå«ãã</li> - </ul> - <p> - ãã®ãã¡ 1ã€ç®ã®ã±ãŒã¹ã¯ã <code>finally</code> ç¯ã®äžã§ãšã©ãŒãæãããš PHP åŠçç³»ãåæã« <code>$previous</code> ãèšå®ããŠãããã - </p> - <codeblock language="php"> - <![CDATA[ - <?php - - try { - try { - throw new Exception("Error 1"); - } finally { - throw new Exception("Error 2"); - } - } catch (Exception $e) { - echo $e->getMessage() . PHP_EOL; - // => Error 2 - echo $e->getPrevious()->getMessage() . PHP_EOL; - // => Error 1 - } - ]]> - </codeblock> - <p> - ãã®ç¥èãå
ã«ãããŒã¯ã³ã®åºåéšãè§£æããŠã¿ãã - </p> - </section> - <section id="output"> - <h>åºåéšã®è§£æ</h> - <p> - åºåéšãã³ã¡ã³ããæ¹è¡ã远å ããŠåæ²ãã: - </p> - <codeblock language="php"> - <![CDATA[ - <?php - try { - f(g() / __LINE__); - } catch (Throwable $e) { - while ($e = $e->getPrevious()) { - printf('%c', $e->getLine() + 23); - } - echo "\n"; - } - ]]> - </codeblock> - <p> - åºåããããªã <code>catch</code> ç¯ãèŠãŠã¿ããšã <code>Throwable::getPrevious()</code> ãåŒã³åºããŠãšã©ãŒãã§ã€ã³ã蟿ãã <code>Throwable::getLine()</code> ã§ãšã©ãŒãçºçããè¡æ°ãååŸããŠããããã®è¡æ°ã« <code>23</code> ãªãããžãã¯ãã³ããŒãè¶³ãããã©ãŒãããæå®å <code>%c</code> ã§åºåããŠããã - </p> - <p> - ãã©ãŒãããæå®å <code>%c</code> ã¯ãæŽæ°ã ASCII ã³ãŒã<footnote>RAS syndrome</footnote> ãšèŠåããŠå°åãããããŒã¯ã³ <code>#base64_decode('SGVsbG8sIFdvcmxkIQ==')</code> ã® <code>b</code> ã§ããã°ãASCII ã³ãŒã <code>98</code> ãªã®ã§ã75 è¡ç®ã§çºçãããšã©ãŒã - </p> - <codeblock language="php"> - <![CDATA[ - 1, 20 => 0 / 0, - ]]> - </codeblock> - <p> - ã«ãã£ãŠè¡šçŸãããŠããããšã©ãŒãèµ·ããæ¹æ³ã¯ãããããšèããããããä»åã¯ãŒãé€ç®ã䜿ã£ãã - </p> - <p> - ããã§ã¯ããšã©ãŒãã§ã€ã³ãäœãç®æã颿° <code>f()</code> ãèŠãŠããã - </p> - </section> - <section id="data-construction"> - <h>ããŒã¿æ§æéšã®è§£æ</h> - <p> - <code>f()</code> ã®å®çŸ©ãåæ²ãã (ãšã©ãŒãªããžã§ã¯ãã®è¡æ°ãå©çšããŠããã®ã§ãäžéšåã ãæãåºããšå€ãå€ããããšã«æ³šæ): - </p> - <codeblock language="php"> - <![CDATA[ - function f(int $i) { - if ($i < 0) f(); - try { - match ($i) { - 0 => 0 / 0, // 12 è¡ç® - - - - 15, 36 => 0 / 0, - 14 => 0 / 0, - 37 => 0 / 0, - - // (ç¥) - - 30 => 0 / 0, // 97 è¡ç® - }; - } finally { - f($i - 1); - } - } - ]]> - </codeblock> - <p> - åè¿°ã®ããã«ã <code>finally</code> ç¯ã§ãšã©ãŒãæãããš PHP åŠçç³»ã <code>$previous</code> ãèšå®ãããããã§ã¯ããšã©ãŒãç¹ããããã« <code>f()</code> ãååž°åŒã³åºãããŠãããæåã« <code>f()</code> ãåŒã³åºããŠããç®æã確èªãããšã - </p> - <codeblock language="php"> - <![CDATA[ - <?php - try { - f(g() / __LINE__); // 3 è¡ç® - ]]> - </codeblock> - <codeblock language="php"> - <![CDATA[ - function g() { - return __LINE__; // 111 è¡ç® - } - ]]> - </codeblock> - <p> - <code>f()</code> ã«ã¯ <code>111 / 3</code> ã§ <code>37</code> ãæž¡ãããããšããããããããã 1 ãã€æžãããŠååž°åŒã³åºãããŠããã0 ããå°ãããªã£ãã <code>f()</code> ãåŒæ°ãªãã§åŒã³åºããåŒæ°ã®æ°ãè¶³ããªããšåŒã³åºãã«å€±æããã®ã§ãååž°ã¯ããã§æ¢ãŸãã - </p> - <p> - ãšã©ãŒãã§ã€ã³ã¯ãæåŸã«çºçãããšã©ãŒãå
é ãšããåæ¹åé£çµãªã¹ãã«ãªã£ãŠããã®ã§ãé ã« - </p> - <ol numeration="arabic"> - <li><code>f()</code> ã®åŒæ°ãè¶³ããªãããšã«ããåŒã³åºã倱æ</li> - <li><code>f(0)</code> ã®åŒã³åºãã§çºçãããŒãé€ç®</li> - <li><code>f(1)</code> ã®åŒã³åºãã§çºçãããŒãé€ç®</li> - <li>âŠ</li> - <li><code>f(37)</code> ã®åŒã³åºãã§çºçãããŒãé€ç®</li> - </ol> - <p> - ãšãªã£ãŠãããåºåã®é㯠<code>catch</code> ãããšã©ãŒã® <code>getPrevious()</code> ããåŠçãå§ããã®ã§ã1 çªç®ã® <code>f()</code> ã«ãããšã©ãŒã¯ç¡èŠããã <code>f(0)</code> ã«ãããšã©ãŒã <code>f(1)</code> ã«ãããšã©ãŒã <code>f(2)</code> ã«ãããšã©ãŒããšåºåãé²ãã - </p> - <p> - <code>f()</code> ã« <code>0</code> ãæž¡ãããšã㯠12 è¡ç®ã«ãã <code>match</code> ã® <code>0</code> ã§ãŒãé€ç®ãèµ·ããã®ã§ãè¡æ°ã 12 ãšãªã£ããšã©ãŒãæãããããåºåéšã§ã¯ããã« 23 ãè¶³ããæ°ã ASCII ã³ãŒããšããŠè¡šç€ºããŠããã®ã ã£ãã <code>12 + 23</code> 㯠<code>35</code>ãASCII ã³ãŒãã§ã¯ <code>#</code> ã§ããããããããŒã¯ã³ã® 1æåç®ã«ãããã - </p> - </section> - </section> - <section id="outro"> - <h>ãããã«</h> - <p> - ãè¡æ°ããšããã®ã¯ããŒã¯ã³æååããã³ãŒããã察象ãšããŠåªããŠããã - </p> - <ul> - <li>ããŒã¯ã³ã®äžéšãå
šéšãéœã«çŸããªã</li> - <li><code>__LINE__</code> ã§å®¹æã«ååŸã§ãã</li> - </ul> - <p> - ãããããããã£ããå€ãªãããã°ã©ã ãäœåºŠãèªãã ãæžãããããŠãããšã <code>__LINE__</code> ã䜿ãã®ã¯ããŸãã«ãããããã§éå±ã«ãªããã§ã¯ãä»ã«è¡æ°ãååŸããææ®µã¯ãªãããããã㊠<code>Throwable</code> ãæãã€ããç¶ããŠãšã©ãŒãªããžã§ã¯ãã«ã¯ <code>$previous</code> ãããããšãæãåºããã - </p> - <p> - ä»åãšã©ãŒãæããã®ã«ãŒãé€ç®ãçšããã®ã¯ãããããšã©ãŒãæããæãçãã³ãŒãã ãšèããããã§ããããã 3ãã€ãæªæºã§ <code>Throwable</code> ãªãªããžã§ã¯ããæããææ®µããåãã®ãããããã£ãããã°ããã²ãæç€ºããã ããããâŠâŠãšç· ããäºå®ã ã£ãã®ã ãã<code>0/0</code> ã®ãšãããååšããªã宿°ã«ããã°ãç°¡åã« 1ãã€ããéæã§ããããŒãé€ç®ããŠããç®æã¯ã¡ããã© 26 ç®æããã®ã§ãã¢ã«ãã¡ãããã«ã§ãããŠããã°æå³ãããã§è¯ãã£ããããããªãã - </p> - </section> -</article> diff --git a/vhosts/blog/content/posts/2023-03-10/rewrite-this-blog-generator.dj b/vhosts/blog/content/posts/2023-03-10/rewrite-this-blog-generator.dj new file mode 100644 index 00000000..a4ccf87e --- /dev/null +++ b/vhosts/blog/content/posts/2023-03-10/rewrite-this-blog-generator.dj @@ -0,0 +1,73 @@ +--- +[article] +uuid = "12512894-05d8-42c6-950e-8f5d60f984d8" +title = "ãã®ããã°ã®ãžã§ãã¬ãŒã¿ãæžãçŽãã" +description = "ãã®ããã°ã®ãžã§ãã¬ãŒã¿ãæžãçŽããã®ã§ããã£ãããšãæžãèšããŠããã" +tags = [] + +[[article.revisions]] +date = "2023-03-10" +remark = "å
¬é" +--- +{#intro} +# ã¯ããã« + +ãã®ããã°ãæ§ç¯ããã·ã¹ãã ãæžãçŽããã®ã¯ 2床ç®ã§ããã +å
ã
ç«ã¡äžããåœåã¯ãéçãµã€ããžã§ãã¬ãŒã¿ã§ãã [Hugo](https://gohugo.io/) ã䜿ã£ãŠããã +ããã [Asciidoctor](https://asciidoctor.org/) ã«ããã€ãã®ã«ã¹ã¿ã ãå ããèªåã®ãžã§ãã¬ãŒã¿ã«ç§»è¡ããã®ã 2022幎ã®11æããã ã +ãããŠä»åãã¹ã¯ã©ããããæžãã [Deno](https://deno.land/) 補ã®ãžã§ãã¬ãŒã¿ã«ç§»è¡ããã + +ãã®èšäºã§ã¯ãç§»è¡ã®çç±ãªã©ã (äž»ã«å°æ¥ã®ç§ãžåããŠ) æžãèšããŠããã + +{#from-hugo-to-asciidoctor} +# Hugo ãã Asciidoctor ãž + +æåã«æã£ãŠãããšãHugo ã¯å€§å€ã«åªããéçãµã€ããžã§ãã¬ãŒã¿ã§ãããç§»è¡ã®çç±ã®å€§åã¯ãèªåã§ãžã§ãã¬ãŒã¿ãæžãããã£ãããã«ä»ãªããªãã +å®ã®ãšããããã®èšäºãå·çããŠããçŸåšãèªäœãžã§ãã¬ãŒã¿ã¯ Hugo ãããæ©èœãå£ã£ãŠããã +äŸãã°ãHugo ã䜿ã£ãŠããããã¯ãµããŒãããŠãã RSS ãã£ãŒãã®çæã¯ããŸã å®è£
ã§ããŠããªãã + +ç§»è¡å
ã®ãã©ãŒããããšã㊠AsciiDoc ãéžãã ã®ã¯ãMarkdown ããã衚çŸåã«åªããããã§ãããMarkdown ã¯åºã䜿ãããŠãã軜éããŒã¯ã¢ããèšèªã ãã以äžã®ãããªæ¬ ç¹ãæã€ã + +* CommonMark ã§ã¯æ©èœã貧匱ã§ãã (äŸ: èæ³šã`id` 屿§ã®ä»äž) +* æ¡åŒµèšæ³ã«å®è£
éã§äºææ§ããªã +* ã¡ã¿ããŒã¿ (å
¬éæ¥ãªã©) ãåã蟌ãçµ±äžãããæ¹æ³ããªã + +AsciiDoc 㯠Markdown ã«æ¯ã¹ããšæ®åããŠããªãããäžèšã®æ¬ ç¹ã¯å
æããŠããã + +* ããã°ãæžãã®ã«ååãªè¡šçŸåããã +* ãã©ãŒããããæ¡åŒµãããšãã®èšæ³ããããããå®ããããŠãã +* ã¡ã¿ããŒã¿ãåã蟌ãçµ±äžãããæ¹æ³ããã + +ãªããHugo 㯠AsciiDoc ããµããŒãããŠããã®ã ããAsciiDoc ã䜿ãå Žå Asciidoctor ãå¥éã€ã³ã¹ããŒã«ããå¿
èŠãããããããªãã°æåãã Asciidoctor ã§ãããããšç§»è¡ã決ããã + +{#from-asciidoctor-to-my-own-generator} +# Asciidoctor ããèªåã®ãžã§ãã¬ãŒã¿ãž + +AsciiDoc ã¯è¯ããã©ãŒãããã ããç§ã«ã¯ 1ç¹äžæºããã£ããããã¯ãé«ã衚çŸåãæ
ä¿ããããã«èšå·ã䜿ãåãããŠããããšã¹ã±ãŒããé£ãããšããç¹ã (å
·äœäŸãæãããã®ã ããäœã ã£ããèŠããŠããªã)ãããã¯ãå€çš®å€æ§ãªèšå·é¡ãå
¥åããå¿
èŠã®ããæè¡ããã°ã«ãšã£ãŠã¯èŸãåé¡ã§ããããã®åé¡ã解決ããããã + +* 衚çŸåãé«ãã +* ææ³ãå³å¯ã§ããã +* ç°¡åã«å®è£
ã§ãã + +ãã©ãŒããããæ±ãããããããã«åèŽããã®ããXML ãããŒã¹ãšãã [DocBook](https://docbook.org/) (ä»å䜿ã£ãŠããã®ã¯ããã®ãµãã»ããã§ãã [Simplified DocBook](https://tdg.docbook.org/tdg/sdocbook/5.1/) ) ã§ããã + +å®ã¯ãAsciiDoc ãš DocBook ã¯ããããäºææ§ããããAsciiDoc ã§æžãããææžã¯ (ã»ãŒ) æ
å ±ãã¹ãªãã« DocBook ãžå€æã§ããéããŸããããã§ããã +ãã£ãŠãDocBook ã«ã¯ãAsciiDoc ãšåçã®è¡šçŸåãããã + +XML ã®ææ³ã®å³å¯ãã«ã€ããŠã¯ã説æãããŸã§ããªãã ããããŸããåçŽãªææ³ã§ããããšããå®è£
ã容æã§ãããäºå®äž Asciidoctor ãžããã¯ã€ã³ããã AsciiDoc ãšã¯ç°ãªããããŸããŸãªèšèªã§å€ãã®ã©ã€ãã©ãªãååšããã + +ä»åã¯ãXML ã®ããŒã¹èªäœãèªåã§æžããŠãã (ããã¯äœãšãªãæžãããã£ãããã§ãããåççãªçç±ãããããã§ã¯ãªããå®è£
ã¯ãµãããŸãã£ãŠããã®ã§ XML ã®ã³ã¡ã³ãã䜿ããªããšãã£ãå¶éããã)ã + +XML ãšããæ©æ¢°åŠçãããããã©ãŒããããéžã¶ããšã«ã¯ãæ©æ¢°çãªå€æãæ€æ»ãšãã£ãåŠçããããªãããããªããšãã£ãå©ç¹ãããã +æ¬ ç¹ã¯è»œéããŒã¯ã¢ããèšèªãšæ¯ã¹ãŠåé·ã§ããããšã ããæžãéã¯è£å®ãªã©ãçšããã®ã§ããã»ã©æ°ã«ãªããªãã +çµå±ã®ãšãããæè¡ããã°ã®å·çãåŸéããã®ã¯èª¿æ»ãšæç« ã®èšè¿°ã§ãããããŒã¯ã¢ããã®ææ®µã¯å·çæéã«å€§ãã圱é¿ãäžããªãã + +{#outro} +# ãããã« + +2床ã®ãªã©ã€ããçµãŠãèšäºã®ãã©ãŒããããšãµã€ããžã§ãã¬ãŒã¿ãäžããäžãŸã§ææ¡ããã +ä»åŸãæ¹åã®ã¢ã€ãã¢ã¯å€æ°ããã®ã§ããããããšé²ããŠãããããšããã ã + +æåŸã«ããäžåºŠæžãã®ã ããHugo ã¯å€§å€ã«åªããéçãµã€ããžã§ãã¬ãŒã¿ã§ããã +ç¡é§ãªæãããªããã°ããã䜿ããšããã +ç§ã¯ç¡é§ã«æã£ãã®ã§ãããã°ã®èšäºãæžãæéãæœ°ããŠããã°ã·ã¹ãã ãäœã£ãŠããŸã£ãã diff --git a/vhosts/blog/content/posts/2023-03-10/rewrite-this-blog-generator.ndoc b/vhosts/blog/content/posts/2023-03-10/rewrite-this-blog-generator.ndoc deleted file mode 100644 index 0c36e611..00000000 --- a/vhosts/blog/content/posts/2023-03-10/rewrite-this-blog-generator.ndoc +++ /dev/null @@ -1,95 +0,0 @@ ---- -[article] -uuid = "12512894-05d8-42c6-950e-8f5d60f984d8" -title = "ãã®ããã°ã®ãžã§ãã¬ãŒã¿ãæžãçŽãã" -description = "ãã®ããã°ã®ãžã§ãã¬ãŒã¿ãæžãçŽããã®ã§ããã£ãããšãæžãèšããŠããã" -tags = [] - -[[article.revisions]] -date = "2023-03-10" -remark = "å
¬é" ---- -<article> - <section id="intro"> - <h>ã¯ããã«</h> - <p> - ãã®ããã°ãæ§ç¯ããã·ã¹ãã ãæžãçŽããã®ã¯ 2床ç®ã§ããã - å
ã
ç«ã¡äžããåœåã¯ãéçãµã€ããžã§ãã¬ãŒã¿ã§ãã <a href="https://gohugo.io/">Hugo</a> ã䜿ã£ãŠããã - ããã <a href="https://asciidoctor.org/">Asciidoctor</a> ã«ããã€ãã®ã«ã¹ã¿ã ãå ããèªåã®ãžã§ãã¬ãŒã¿ã«ç§»è¡ããã®ã 2022幎ã®11æããã ã - ãããŠä»åãã¹ã¯ã©ããããæžãã <a href="https://deno.land/">Deno</a> 補ã®ãžã§ãã¬ãŒã¿ã«ç§»è¡ããã - </p> - <p> - ãã®èšäºã§ã¯ãç§»è¡ã®çç±ãªã©ã (äž»ã«å°æ¥ã®ç§ãžåããŠ) æžãèšããŠããã - </p> - </section> - <section id="from-hugo-to-asciidoctor"> - <h>Hugo ãã Asciidoctor ãž</h> - <p> - æåã«æã£ãŠãããšãHugo ã¯å€§å€ã«åªããéçãµã€ããžã§ãã¬ãŒã¿ã§ãããç§»è¡ã®çç±ã®å€§åã¯ãèªåã§ãžã§ãã¬ãŒã¿ãæžãããã£ãããã«ä»ãªããªãã - å®ã®ãšããããã®èšäºãå·çããŠããçŸåšãèªäœãžã§ãã¬ãŒã¿ã¯ Hugo ãããæ©èœãå£ã£ãŠããã - äŸãã°ãHugo ã䜿ã£ãŠããããã¯ãµããŒãããŠãã RSS ãã£ãŒãã®çæã¯ããŸã å®è£
ã§ããŠããªãã - </p> - <p> - ç§»è¡å
ã®ãã©ãŒããããšã㊠AsciiDoc ãéžãã ã®ã¯ãMarkdown ããã衚çŸåã«åªããããã§ãããMarkdown ã¯åºã䜿ãããŠãã軜éããŒã¯ã¢ããèšèªã ãã以äžã®ãããªæ¬ ç¹ãæã€ã - </p> - <p> - <ul> - <li>CommonMark ã§ã¯æ©èœã貧匱ã§ãã (äŸ: èæ³šã<code>id</code> 屿§ã®ä»äž)</li> - <li>æ¡åŒµèšæ³ã«å®è£
éã§äºææ§ããªã</li> - <li>ã¡ã¿ããŒã¿ (å
¬éæ¥ãªã©) ãåã蟌ãçµ±äžãããæ¹æ³ããªã</li> - </ul> - </p> - <p> - AsciiDoc 㯠Markdown ã«æ¯ã¹ããšæ®åããŠããªãããäžèšã®æ¬ ç¹ã¯å
æããŠããã - </p> - <p> - <ul> - <li>ããã°ãæžãã®ã«ååãªè¡šçŸåããã</li> - <li>ãã©ãŒããããæ¡åŒµãããšãã®èšæ³ããããããå®ããããŠãã</li> - <li>ã¡ã¿ããŒã¿ãåã蟌ãçµ±äžãããæ¹æ³ããã</li> - </ul> - </p> - <p> - ãªããHugo 㯠AsciiDoc ããµããŒãããŠããã®ã ããAsciiDoc ã䜿ãå Žå Asciidoctor ãå¥éã€ã³ã¹ããŒã«ããå¿
èŠãããããããªãã°æåãã Asciidoctor ã§ãããããšç§»è¡ã決ããã - </p> - </section> - <section id="from-asciidoctor-to-my-own-generator"> - <h>Asciidoctor ããèªåã®ãžã§ãã¬ãŒã¿ãž</h> - <p> - AsciiDoc ã¯è¯ããã©ãŒãããã ããç§ã«ã¯ 1ç¹äžæºããã£ããããã¯ãé«ã衚çŸåãæ
ä¿ããããã«èšå·ã䜿ãåãããŠããããšã¹ã±ãŒããé£ãããšããç¹ã (å
·äœäŸãæãããã®ã ããäœã ã£ããèŠããŠããªã)ãããã¯ãå€çš®å€æ§ãªèšå·é¡ãå
¥åããå¿
èŠã®ããæè¡ããã°ã«ãšã£ãŠã¯èŸãåé¡ã§ããããã®åé¡ã解決ããããã - <ul> - <li>衚çŸåãé«ãã</li> - <li>ææ³ãå³å¯ã§ããã</li> - <li>ç°¡åã«å®è£
ã§ãã</li> - </ul> - ãã©ãŒããããæ±ãããããããã«åèŽããã®ããXML ãããŒã¹ãšãã <a href="https://docbook.org/">DocBook</a> (ä»å䜿ã£ãŠããã®ã¯ããã®ãµãã»ããã§ãã <a href="https://tdg.docbook.org/tdg/sdocbook/5.1/">Simplified DocBook</a>) ã§ããã - </p> - <p> - å®ã¯ãAsciiDoc ãš DocBook ã¯ããããäºææ§ããããAsciiDoc ã§æžãããææžã¯ (ã»ãŒ) æ
å ±ãã¹ãªãã« DocBook ãžå€æã§ããéããŸããããã§ããã - ãã£ãŠãDocBook ã«ã¯ãAsciiDoc ãšåçã®è¡šçŸåãããã - </p> - <p> - XML ã®ææ³ã®å³å¯ãã«ã€ããŠã¯ã説æãããŸã§ããªãã ããããŸããåçŽãªææ³ã§ããããšããå®è£
ã容æã§ãããäºå®äž Asciidoctor ãžããã¯ã€ã³ããã AsciiDoc ãšã¯ç°ãªããããŸããŸãªèšèªã§å€ãã®ã©ã€ãã©ãªãååšããã - </p> - <p> - ä»åã¯ãXML ã®ããŒã¹èªäœãèªåã§æžããŠãã (ããã¯äœãšãªãæžãããã£ãããã§ãããåççãªçç±ãããããã§ã¯ãªããå®è£
ã¯ãµãããŸãã£ãŠããã®ã§ XML ã®ã³ã¡ã³ãã䜿ããªããšãã£ãå¶éããã)ã - </p> - <p> - XML ãšããæ©æ¢°åŠçãããããã©ãŒããããéžã¶ããšã«ã¯ãæ©æ¢°çãªå€æãæ€æ»ãšãã£ãåŠçããããªãããããªããšãã£ãå©ç¹ãããã - æ¬ ç¹ã¯è»œéããŒã¯ã¢ããèšèªãšæ¯ã¹ãŠåé·ã§ããããšã ããæžãéã¯è£å®ãªã©ãçšããã®ã§ããã»ã©æ°ã«ãªããªãã - çµå±ã®ãšãããæè¡ããã°ã®å·çãåŸéããã®ã¯èª¿æ»ãšæç« ã®èšè¿°ã§ãããããŒã¯ã¢ããã®ææ®µã¯å·çæéã«å€§ãã圱é¿ãäžããªãã - </p> - </section> - <section id="outro"> - <h>ãããã«</h> - <p> - 2床ã®ãªã©ã€ããçµãŠãèšäºã®ãã©ãŒããããšãµã€ããžã§ãã¬ãŒã¿ãäžããäžãŸã§ææ¡ããã - ä»åŸãæ¹åã®ã¢ã€ãã¢ã¯å€æ°ããã®ã§ããããããšé²ããŠãããããšããã ã - </p> - <p> - æåŸã«ããäžåºŠæžãã®ã ããHugo ã¯å€§å€ã«åªããéçãµã€ããžã§ãã¬ãŒã¿ã§ããã - ç¡é§ãªæãããªããã°ããã䜿ããšããã - ç§ã¯ç¡é§ã«æã£ãã®ã§ãããã°ã®èšäºãæžãæéãæœ°ããŠããã°ã·ã¹ãã ãäœã£ãŠããŸã£ãã - </p> - </section> -</article> diff --git a/vhosts/blog/content/posts/2023-04-01/implementation-of-minimal-png-image-encoder.dj b/vhosts/blog/content/posts/2023-04-01/implementation-of-minimal-png-image-encoder.dj new file mode 100644 index 00000000..55d1519b --- /dev/null +++ b/vhosts/blog/content/posts/2023-04-01/implementation-of-minimal-png-image-encoder.dj @@ -0,0 +1,544 @@ +--- +[article] +uuid = "ed36e185-5bfa-42e1-8358-0b1da9b0a063" +title = "PNG ç»åã®æå°æ§æãšã³ã³ãŒããå®è£
ãã" +description = "PNG ç»åãšã㊠valid ãªç¯å²ã§æå€§éææããããšã³ã³ãŒããæžãã" +tags = [] + +[[article.revisions]] +date = "2023-04-01" +remark = "å
¬é" +--- +{#intro} +# ã¯ããã« + +ãã®èšäºã§ã¯ãPNG ç»åãšã㊠valid ãªç¯å²ã§æå€§éææããããšã³ã³ãŒããæžãã +PNG ç»åã«å¯Ÿå¿ãããã¥ãŒã¢ã§ããã°èªã¿èŸŒããããå§çž®å¹çã«ã€ããŠã¯äžåèããªãã +ãŸããå®è£
ã«ã¯ Go èšèªã䜿ãããGo ã®æšæºã©ã€ãã©ãªã«ããããŸããŸãªã¢ã«ãŽãªãºã (PNG ç»åã«é¢ä¿ããç¯å²ã ãšãzlib ã CRC32ãAdler-32 ãªã©) ã¯äœ¿ããªãã + +{#basic-structure-of-png} +# PNG ãã¡ã€ã«ã®åºæ¬æ§é + +PNG ãã¡ã€ã«ã®åºæ¬æ§é ã¯æ¬¡ã®ããã«ãªã£ãŠããã + +1. PNG signature +1. IHDR chunk +1. ä»»æåã® chunk +1. IEND chunk + +Chunk ã«ã¯ç»åããŒã¿ãå
¥ãã IDAT chunkããã¬ããããŒã¿ãå
¥ãã PLTE chunkãããã¹ãããŒã¿ãå
¥ãã tEXt chunk ãªã©ããããã +ä»åã¯æå°æ§æãšããããšã§ IDAT chunk (ãš IHDR chunk ãš IEND chunk) ã®ã¿ãçšããã + +次ç¯ã§ãããããã®å
·äœçãªæ§é ã確èªãã€ã€å®è£
ããŠããã + +{#implement-png-encoder} +# PNG ã®ãšã³ã³ãŒããå®è£
ãã + +以äžã®ãœãŒã¹ã³ãŒããããŒã¹ã«ããã +ä»å PNG ã®ãã³ãŒãã¯æ±ããªãã®ã§ãèªã¿èŸŒã¿ã«ã¯ Go ã®æšæºã©ã€ãã©ãª `image/png` ãçšããã + +```go +package main + +import ( + "image" + _ "image/png" + "io" + "os" +) + +func main() { + inFile, err := os.Open("input.png") + if err != nil { + panic(err) + } + defer inFile.Close() + + img, _, err := image.Decode(inFile) + if err != nil { + panic(err) + } + + outFile, err := os.Create("output.png") + if err != nil { + panic(err) + } + defer outFile.Close() + + writePng(outFile, img) +} + +func writePng(w io.Writer, img image.Image) { + width := uint32(img.Bounds().Dx()) + height := uint32(img.Bounds().Dy()) + writeSignature(w) + writeChunkIhdr(w, width, height) + writeChunkIdat(w, width, height, img) + writeChunkIend(w) +} +``` + +以éã¯ã`writeSignature` ã `writeChunkIhdr` ãªã©ãå®è£
ããŠããã + +{#png-signature} +## PNG signature + +PNG signature ã¯ãPNG ç»åã®å
é ã«åºå®ã§ä»äžããããã€ãåã§ã8 ãã€ããããªãã + +1. 0x89 +1. 0x50 (ASCII ã³ãŒãã§ãPã) +1. 0x4E (ASCII ã³ãŒãã§ãNã) +1. 0x47 (ASCII ã³ãŒãã§ãGã) +1. 0x0D (ASCII ã³ãŒãã§ CR) +1. 0x0A (ASCII ã³ãŒãã§ LF) +1. 0x1A (ASCII ã³ãŒãã§ EOF) +1. 0x0A (ASCII ã³ãŒãã§ LF) + +CRLF ã LF ã¯ãéä¿¡äžã«æ¹è¡ã³ãŒãã®å€æã誀ã£ãŠãããªãããŠããªããã©ãããæ€ç¥ããã®ã«äœ¿ãããã + +`writeSignature` ã®å®è£
ã¯ãã¡ã: + +```go +import "encoding/binary" + +func writeSignature(w io.Writer) { + sig := [8]uint8{ + 0x89, + 0x50, // P + 0x4E, // N + 0x47, // G + 0x0D, // CR + 0x0A, // LF + 0x1A, // EOF (^Z) + 0x0A, // LF + } + binary.Write(w, binary.BigEndian, sig) +} +``` + +`encoding/binary` ããã±ãŒãžã® `binary.Write` ã䜿ããåºå®ã® 8 ãã€ããæžã蟌ãã + +{#structure-of-chunk} +## Chunk ã®æ§é + +IHDR chunk ã«é²ãåã«ãchunk äžè¬ã®æ§é ã確èªããã + +1. Length: chunk data ã®ãã€ãé· (笊å·ãªã 4 ãã€ãæŽæ°) +1. Chunk type: chunk ã®çš®é¡ã瀺ã 4 ãã€ããããªãåå +1. Chunk data: å®éã®ããŒã¿ã0 ãã€ãã§ããã +1. CRC: chunk type ãš chunk data ã® CRC (笊å·ãªã 4 ãã€ãæŽæ°) + +CRC (Cyclic Redundancy Check) ã¯èª€ãæ€åºç¬Šå·ã®äžçš®ãGo èšèªã§ã¯ `hash/crc32` ããã±ãŒãžã«ããããä»åã¯ãããèªåã§å®è£
ãããPNG ã®ä»æ§æžã« C èšèªã®ãµã³ãã«ã³ãŒããèŒã£ãŠãã ( [D. Sample CRC implementation](https://www.w3.org/TR/png/#D-CRCAppendix) ) ã®ã§ãããã Go ã«ç§»æ€ããã + +```go +var ( + crcTable [256]uint32 + crcTableComputed bool +) + +func makeCrcTable() { + for n := 0; n < 256; n++ { + c := uint32(n) + for k := 0; k < 8; k++ { + if (c & 1) != 0 { + c = 0xEDB88320 ^ (c >> 1) + } else { + c = c >> 1 + } + } + crcTable[n] = c + } + crcTableComputed = true +} + +func updateCrc(crc uint32, buf []byte) uint32 { + if !crcTableComputed { + makeCrcTable() + } + + c := crc + for n := 0; n < len(buf); n++ { + c = crcTable[(c^uint32(buf[n]))&0xFF] ^ (c >> 8) + } + return c +} + +func crc(buf []byte) uint32 { + return updateCrc(0xFFFFFFFF, buf) ^ 0xFFFFFFFF +} +``` + +ã§ãã `crc` 颿°ã䜿ã£ãŠãchunk äžè¬ãæžã蟌ã颿°ãçšæããŠãããã + +```go +func writeChunk(w io.Writer, chunkType string, data []byte) { + typeAndData := make([]byte, 0, len(chunkType)+len(data)) + typeAndData = append(typeAndData, []byte(chunkType)...) + typeAndData = append(typeAndData, data...) + + binary.Write(w, binary.BigEndian, uint32(len(data))) + binary.Write(w, binary.BigEndian, typeAndData) + binary.Write(w, binary.BigEndian, crc(typeAndData)) +} +``` + +仿§ã©ããã`chunkType` ãš `data` ãã CRC ãèšç®ãã`data` ã®é·ããšåãããŠæžã蟌ãã§ããã +PNG ã§ã¯åºæ¬çã« big endian ã䜿ãããšã«æ³šæããã + +æºåãã§ãããšããã§ãå
·äœç㪠chunk ããšã³ã³ãŒãããŠããã + +{#ihdr-chunk} +## IHDR chunk + +IHDR chunk ã¯æåã«é
眮ããã chunk ã§ãããæ¬¡ã®ãããªããŒã¿ãããªãã + +1. ç»åã®å¹
(笊å·ãªã 4 ãã€ãæŽæ°) +1. ç»åã®é«ã (笊å·ãªã 4 ãã€ãæŽæ°) +1. ãããæ·±åºŠ (笊å·ãªã 1 ãã€ãæŽæ°) + + * 1 è²ã«äœ¿ããããæ°ã1 ãã¯ã»ã«ã« 24 bit 䜿ã truecolor ç»åã§ã¯ 8 ã«ãªã + +1. è²ã¿ã€ã (笊å·ãªã 1 ãã€ãæŽæ°) + + * 0: ã°ã¬ãŒã¹ã±ãŒã« + * 2: Truecolor (ä»åã¯ããã«æ±ºãæã¡) + * 3: ãã¬ããã®ã€ã³ããã¯ã¹ + * 4: ã°ã¬ãŒã¹ã±ãŒã« + ã¢ã«ãã¡ + * 6: Truecolor + ã¢ã«ãã¡ + +1. å§çž®æ¹åŒ (笊å·ãªã 1 ãã€ãæŽæ°) + + * PNG ã®ä»æ§æžã« 0 ããå®çŸ©ãããŠããªãã®ã§ 0 ã§åºå® + +1. ãã£ã«ã¿æ¹åŒ (笊å·ãªã 1 ãã€ãæŽæ°) + + * PNG ã®ä»æ§æžã« 0 ããå®çŸ©ãããŠããªãã®ã§ 0 ã§åºå® + +1. ã€ã³ã¿ãŒã¬ãŒã¹æ¹åŒ (笊å·ãªã 1 ãã€ãæŽæ°) + + * ä»åã¯ã€ã³ã¿ãŒã¬ãŒã¹ããªãã®ã§ 0 + +ä»åã»ãšãã©ã®ããŒã¿ã¯æ±ºãæã¡ããã®ã§ãããŒã¿ã«å¿ããŠå€ããã®ã¯ width ãš height ã ãã«ãªããã³ãŒãã¯æ¬¡ã®ããã«ãªãã + +```go +import "bytes" + +func writeChunkIhdr(w io.Writer, width, height uint32) { + var buf bytes.Buffer + binary.Write(&buf, binary.BigEndian, width) + binary.Write(&buf, binary.BigEndian, height) + binary.Write(&buf, binary.BigEndian, uint8(8)) + binary.Write(&buf, binary.BigEndian, uint8(2)) + binary.Write(&buf, binary.BigEndian, uint8(0)) + binary.Write(&buf, binary.BigEndian, uint8(0)) + binary.Write(&buf, binary.BigEndian, uint8(0)) + + writeChunk(w, "IHDR", buf.Bytes()) +} +``` + +{#idat-chunk} +## IDAT chunk + +IDAT chunk ã¯ãå®éã®ç»åããŒã¿ãæ ŒçŽããã chunk ã§ãããIDAT chunk 㯠deflate ã¢ã«ãŽãªãºã ã«ããå§çž®ãããzlib 圢åŒã§æ ŒçŽãããã + +{#zlib} +### Zlib + +ãŸã㯠zlib ã«ã€ããŠç¢ºèªãããããããæ¬¡ã®ãããªæ§é ã«ãªã£ãŠããã + +1. åºå®ã§ 0x78 (笊å·ãªã 1 ãã€ãæŽæ°) +1. åºå®ã§ 0x01 (笊å·ãªã 1 ãã€ãæŽæ°) +1. ããŒã¿ +1. ããŒã¿ã® Adler-32 + +æåã® 2 ãã€ãã«ãæå³ã¯ããããPNG ã§ã¯åºå®ã§æ§ããªãã + +Adler-32 ã CRC ãšåããèª€ãæ€åºç¬Šå·ã§ããããã¡ãã zlib ã®ä»æ§æžã« C èšèªã§ãµã³ãã«ã³ãŒããèšèŒãããŠãã ( [9. Appendix: Sample code](https://www.rfc-editor.org/rfc/rfc1950#section-9) ) ã®ã§ãGo ã«ç§»æ€ããã + +```go +const adler32Base = 65521 + +func updateAdler32(adler uint32, buf []byte) uint32 { + s1 := adler & 0xFFFF + s2 := (adler >> 16) & 0xFFFF + + for n := 0; n < len(buf); n++ { + s1 = (s1 + uint32(buf[n])) % adler32Base + s2 = (s2 + s1) % adler32Base + } + return (s2 << 16) + s1 +} + +func adler32(buf []byte) uint32 { + return updateAdler32(1, buf) +} +``` + +ãããŒã¿ãã®éšåã«ã¯å§çž®ããããŒã¿ãå
¥ãã®ã ããçé¢ç®ã« deflate ã¢ã«ãŽãªãºã ãå®è£
ããå¿
èŠã¯ãªããZlib ã«ã¯ç¡å§çž®ã®ããŒã¿ãããã¯ãæ ŒçŽããããšãã§ããã®ã§ãããã䜿ããæ¬æ¥ã¯ãããŒã¿ã®å§çž®å¹çã®æªãã©ã³ãã ãªããŒã¿ããã®ãŸãŸæ ŒçŽããããã®ãã®ã ããä»å㯠deflate ã®å®è£
ããµããããã«äœ¿ãã + +1 ã€ã®ç¡å§çž®ãããã¯ã«ã¯ 65535 (2^16^ - 1) ãã€ããŸã§æ ŒçŽã§ãããããããã®ãããã¯ã¯æ¬¡ã®ãããªæ§æã«ãªã£ãŠããã + +1. æçµãããã¯ãªã 1ãããã§ãªããã° 0 (笊å·ãªã 1 ãã€ãæŽæ°) +1. ãããã¯ã®ãã€ãé· (笊å·ãªã 2 ãã€ãæŽæ°) +1. ãããã¯ã®ãã€ãé·ã® 1 ã®è£æ°ããããã¯ãããå転 (笊å·ãªã 2 ãã€ãæŽæ°) +1. ããŒã¿ (æå€§ 65535 ãã€ã) + +å®éã«ãã®ææã zlib ãå®è£
ãããã®ããã¡ã: + +```go +func encodeZlib(data []byte) []byte { + var buf bytes.Buffer + + binary.Write(&buf, binary.BigEndian, uint8(0x78)) + binary.Write(&buf, binary.BigEndian, uint8(0x01)) + blockSize := 65535 + isFinalBlock := false + for i := 0; !isFinalBlock; i++ { + var block []byte + if len(data) <= (i+1)*blockSize { + block = data[i*blockSize:] + isFinalBlock = true + } else { + block = data[i*blockSize : (i+1)*blockSize] + } + binary.Write(&buf, binary.BigEndian, isFinalBlock) + binary.Write(&buf, binary.LittleEndian, uint16(len(block))) + binary.Write(&buf, binary.LittleEndian, uint16(^len(block))) + binary.Write(&buf, binary.LittleEndian, block) + } + binary.Write(&buf, binary.BigEndian, adler32(data)) + + return buf.Bytes() +} +``` + +{#image-data} +### ç»åããŒã¿ + +ã§ã¯æ¬¡ã«ãzlib 圢åŒã§æ ŒçŽããããŒã¿ãçšæãããPNG ç»åã¯æ¬¡ã®ãããªé ã«ã¹ãã£ã³ããã +ç»åã®å·Šäžã®ãã¯ã»ã«ããåãè¡ã暪ã«ã¹ãã£ã³ããŠãããäžçªå³ãŸã§å°éãããæ¬¡ã®è¡ã®å·Šã«åããã +å³äžã®ãã¯ã»ã«ãŸã§è¡ãã°çµãããèŠã¯ Z ååã«é²ãã§ããã + +ãŸããããããã®è¡ã®å
é ã«ã¯ãå§çž®ã®ããã®ãã£ã«ã¿ã¿ã€ããæå®ããã +ãã ãä»åã¯ãã®å®è£
ãçç¥ããããã«ãåžžã«ãã£ã«ã¿ 0 (äœãå å·¥ããªã) ã䜿ãã + +å
ã»ã©ã® `encodeZlib` ã䜿ã£ãŠå®éã«å®è£
ãããã®ããã¡ã: + +```go +func writeChunkIdat(w io.Writer, width, height uint32, img image.Image) { + var pixels bytes.Buffer + for y := uint32(0); y < height; y++ { + binary.Write(&pixels, binary.BigEndian, uint8(0)) + for x := uint32(0); x < width; x++ { + r, g, b, _ := img.At(int(x), int(y)).RGBA() + binary.Write(&pixels, binary.BigEndian, uint8(r)) + binary.Write(&pixels, binary.BigEndian, uint8(g)) + binary.Write(&pixels, binary.BigEndian, uint8(b)) + } + } + + writeChunk(w, "IDAT", encodeZlib(pixels.Bytes())) +} +``` + +{#iend-chunk} +## IEND chunk + +æåŸã« IEND chunk ãæžã蟌ãããã㯠PNG ç»åã®æåŸã«é
眮ããã chunk ã§ãPNG ã®ãã³ãŒãã¯ãã® chunk ã«åºäŒããšããã§ãã³ãŒãã忢ããã + +ç¹ã«è¿œå ã®ããŒã¿ã¯ãªããå¿
èŠãªã®ã¯ chunk type ã® `IEND` ããããªã®ã§å®è£
ã¯ç°¡å: + +```go +func writeChunkIend(w io.Writer) { + writeChunk(w, "IEND", nil) +} +``` + +{#outro} +# ãããã« + +æåŸã«å
šãœãŒã¹ã³ãŒããåæ²ããŠããã + +```go +package main + +import ( + "bytes" + "encoding/binary" + "image" + _ "image/png" + "io" + "os" +) + +func main() { + inFile, err := os.Open("input.png") + if err != nil { + panic(err) + } + defer inFile.Close() + + img, _, err := image.Decode(inFile) + if err != nil { + panic(err) + } + + outFile, err := os.Create("output.png") + if err != nil { + panic(err) + } + defer outFile.Close() + + writePng(outFile, img) +} + +func writePng(w io.Writer, img image.Image) { + width := uint32(img.Bounds().Dx()) + height := uint32(img.Bounds().Dy()) + writeSignature(w) + writeChunkIhdr(w, width, height) + writeChunkIdat(w, width, height, img) + writeChunkIend(w) +} + +func writeSignature(w io.Writer) { + sig := [8]uint8{ + 0x89, + 0x50, // P + 0x4E, // N + 0x47, // G + 0x0D, // CR + 0x0A, // LF + 0x1A, // EOF (^Z) + 0x0A, // LF + } + binary.Write(w, binary.BigEndian, sig) +} + +func writeChunkIhdr(w io.Writer, width, height uint32) { + var buf bytes.Buffer + binary.Write(&buf, binary.BigEndian, width) + binary.Write(&buf, binary.BigEndian, height) + binary.Write(&buf, binary.BigEndian, uint8(8)) + binary.Write(&buf, binary.BigEndian, uint8(2)) + binary.Write(&buf, binary.BigEndian, uint8(0)) + binary.Write(&buf, binary.BigEndian, uint8(0)) + binary.Write(&buf, binary.BigEndian, uint8(0)) + + writeChunk(w, "IHDR", buf.Bytes()) +} + +func writeChunkIdat(w io.Writer, width, height uint32, img image.Image) { + var pixels bytes.Buffer + for y := uint32(0); y < height; y++ { + binary.Write(&pixels, binary.BigEndian, uint8(0)) + for x := uint32(0); x < width; x++ { + r, g, b, _ := img.At(int(x), int(y)).RGBA() + binary.Write(&pixels, binary.BigEndian, uint8(r)) + binary.Write(&pixels, binary.BigEndian, uint8(g)) + binary.Write(&pixels, binary.BigEndian, uint8(b)) + } + } + + writeChunk(w, "IDAT", encodeZlib(pixels.Bytes())) +} + +func encodeZlib(data []byte) []byte { + var buf bytes.Buffer + + binary.Write(&buf, binary.BigEndian, uint8(0x78)) + binary.Write(&buf, binary.BigEndian, uint8(0x01)) + blockSize := 65535 + isFinalBlock := false + for i := 0; !isFinalBlock; i++ { + var block []byte + if len(data) <= (i+1)*blockSize { + block = data[i*blockSize:] + isFinalBlock = true + } else { + block = data[i*blockSize : (i+1)*blockSize] + } + binary.Write(&buf, binary.BigEndian, isFinalBlock) + binary.Write(&buf, binary.LittleEndian, uint16(len(block))) + binary.Write(&buf, binary.LittleEndian, uint16(^len(block))) + binary.Write(&buf, binary.LittleEndian, block) + } + binary.Write(&buf, binary.BigEndian, adler32(data)) + + return buf.Bytes() +} + +func writeChunkIend(w io.Writer) { + writeChunk(w, "IEND", nil) +} + +func writeChunk(w io.Writer, chunkType string, data []byte) { + typeAndData := make([]byte, 0, len(chunkType)+len(data)) + typeAndData = append(typeAndData, []byte(chunkType)...) + typeAndData = append(typeAndData, data...) + + binary.Write(w, binary.BigEndian, uint32(len(data))) + binary.Write(w, binary.BigEndian, typeAndData) + binary.Write(w, binary.BigEndian, crc(typeAndData)) +} + +var ( + crcTable [256]uint32 + crcTableComputed bool +) + +func makeCrcTable() { + for n := 0; n < 256; n++ { + c := uint32(n) + for k := 0; k < 8; k++ { + if (c & 1) != 0 { + c = 0xEDB88320 ^ (c >> 1) + } else { + c = c >> 1 + } + } + crcTable[n] = c + } + crcTableComputed = true +} + +func updateCrc(crc uint32, buf []byte) uint32 { + if !crcTableComputed { + makeCrcTable() + } + + c := crc + for n := 0; n < len(buf); n++ { + c = crcTable[(c^uint32(buf[n]))&0xFF] ^ (c >> 8) + } + return c +} + +func crc(buf []byte) uint32 { + return updateCrc(0xFFFFFFFF, buf) ^ 0xFFFFFFFF +} + +const adler32Base = 65521 + +func updateAdler32(adler uint32, buf []byte) uint32 { + s1 := adler & 0xFFFF + s2 := (adler >> 16) & 0xFFFF + + for n := 0; n < len(buf); n++ { + s1 = (s1 + uint32(buf[n])) % adler32Base + s2 = (s2 + s1) % adler32Base + } + return (s2 << 16) + s1 +} + +func adler32(buf []byte) uint32 { + return updateAdler32(1, buf) +} +``` + +{#references} +# åè + +* [Portable Network Graphics (PNG) Specification (Third Edition)](https://www.w3.org/TR/png) +* [ZLIB Compressed Data Format Specification version 3.3](https://www.rfc-editor.org/rfc/rfc1950) diff --git a/vhosts/blog/content/posts/2023-04-01/implementation-of-minimal-png-image-encoder.ndoc b/vhosts/blog/content/posts/2023-04-01/implementation-of-minimal-png-image-encoder.ndoc deleted file mode 100644 index ec39a99f..00000000 --- a/vhosts/blog/content/posts/2023-04-01/implementation-of-minimal-png-image-encoder.ndoc +++ /dev/null @@ -1,605 +0,0 @@ ---- -[article] -uuid = "ed36e185-5bfa-42e1-8358-0b1da9b0a063" -title = "PNG ç»åã®æå°æ§æãšã³ã³ãŒããå®è£
ãã" -description = "PNG ç»åãšã㊠valid ãªç¯å²ã§æå€§éææããããšã³ã³ãŒããæžãã" -tags = [] - -[[article.revisions]] -date = "2023-04-01" -remark = "å
¬é" ---- -<article> - <section id="intro"> - <h>ã¯ããã«</h> - <p> - ãã®èšäºã§ã¯ãPNG ç»åãšã㊠valid ãªç¯å²ã§æå€§éææããããšã³ã³ãŒããæžãã - PNG ç»åã«å¯Ÿå¿ãããã¥ãŒã¢ã§ããã°èªã¿èŸŒããããå§çž®å¹çã«ã€ããŠã¯äžåèããªãã - ãŸããå®è£
ã«ã¯ Go èšèªã䜿ãããGo ã®æšæºã©ã€ãã©ãªã«ããããŸããŸãªã¢ã«ãŽãªãºã (PNG ç»åã«é¢ä¿ããç¯å²ã ãšãzlib ã CRC32ãAdler-32 ãªã©) ã¯äœ¿ããªãã - </p> - </section> - <section id="basic-structure-of-png"> - <h>PNG ãã¡ã€ã«ã®åºæ¬æ§é </h> - <p> - PNG ãã¡ã€ã«ã®åºæ¬æ§é ã¯æ¬¡ã®ããã«ãªã£ãŠããã - </p> - <ol> - <li>PNG signature</li> - <li>IHDR chunk</li> - <li>ä»»æåã® chunk</li> - <li>IEND chunk</li> - </ol> - <p> - Chunk ã«ã¯ç»åããŒã¿ãå
¥ãã IDAT chunkããã¬ããããŒã¿ãå
¥ãã PLTE chunkãããã¹ãããŒã¿ãå
¥ãã tEXt chunk ãªã©ããããã - ä»åã¯æå°æ§æãšããããšã§ IDAT chunk (ãš IHDR chunk ãš IEND chunk) ã®ã¿ãçšããã - </p> - <p> - 次ç¯ã§ãããããã®å
·äœçãªæ§é ã確èªãã€ã€å®è£
ããŠããã - </p> - </section> - <section id="implement-png-encoder"> - <h>PNG ã®ãšã³ã³ãŒããå®è£
ãã</h> - <p> - 以äžã®ãœãŒã¹ã³ãŒããããŒã¹ã«ããã - ä»å PNG ã®ãã³ãŒãã¯æ±ããªãã®ã§ãèªã¿èŸŒã¿ã«ã¯ Go ã®æšæºã©ã€ãã©ãª <code>image/png</code> ãçšããã - </p> - <codeblock language="go"> - <![CDATA[ - package main - - import ( - "image" - _ "image/png" - "io" - "os" - ) - - func main() { - inFile, err := os.Open("input.png") - if err != nil { - panic(err) - } - defer inFile.Close() - - img, _, err := image.Decode(inFile) - if err != nil { - panic(err) - } - - outFile, err := os.Create("output.png") - if err != nil { - panic(err) - } - defer outFile.Close() - - writePng(outFile, img) - } - - func writePng(w io.Writer, img image.Image) { - width := uint32(img.Bounds().Dx()) - height := uint32(img.Bounds().Dy()) - writeSignature(w) - writeChunkIhdr(w, width, height) - writeChunkIdat(w, width, height, img) - writeChunkIend(w) - } - ]]> - </codeblock> - <p> - 以éã¯ã<code>writeSignature</code> ã <code>writeChunkIhdr</code> ãªã©ãå®è£
ããŠããã - </p> - <section id="png-signature"> - <h>PNG signature</h> - <p> - PNG signature ã¯ãPNG ç»åã®å
é ã«åºå®ã§ä»äžããããã€ãåã§ã8 ãã€ããããªãã - </p> - <ol> - <li>0x89</li> - <li>0x50 (ASCII ã³ãŒãã§ãPã)</li> - <li>0x4E (ASCII ã³ãŒãã§ãNã)</li> - <li>0x47 (ASCII ã³ãŒãã§ãGã)</li> - <li>0x0D (ASCII ã³ãŒãã§ CR)</li> - <li>0x0A (ASCII ã³ãŒãã§ LF)</li> - <li>0x1A (ASCII ã³ãŒãã§ EOF)</li> - <li>0x0A (ASCII ã³ãŒãã§ LF)</li> - </ol> - <p> - CRLF ã LF ã¯ãéä¿¡äžã«æ¹è¡ã³ãŒãã®å€æã誀ã£ãŠãããªãããŠããªããã©ãããæ€ç¥ããã®ã«äœ¿ãããã - </p> - <p> - <code>writeSignature</code> ã®å®è£
ã¯ãã¡ã: - </p> - <codeblock language="go"> - <![CDATA[ - import "encoding/binary" - - func writeSignature(w io.Writer) { - sig := [8]uint8{ - 0x89, - 0x50, // P - 0x4E, // N - 0x47, // G - 0x0D, // CR - 0x0A, // LF - 0x1A, // EOF (^Z) - 0x0A, // LF - } - binary.Write(w, binary.BigEndian, sig) - } - ]]> - </codeblock> - <p> - <code>encoding/binary</code> ããã±ãŒãžã® <code>binary.Write</code> ã䜿ããåºå®ã® 8 ãã€ããæžã蟌ãã - </p> - </section> - <section id="structure-of-chunk"> - <h>Chunk ã®æ§é </h> - <p> - IHDR chunk ã«é²ãåã«ãchunk äžè¬ã®æ§é ã確èªããã - </p> - <ol> - <li>Length: chunk data ã®ãã€ãé· (笊å·ãªã 4 ãã€ãæŽæ°)</li> - <li>Chunk type: chunk ã®çš®é¡ã瀺ã 4 ãã€ããããªãåå</li> - <li>Chunk data: å®éã®ããŒã¿ã0 ãã€ãã§ããã</li> - <li>CRC: chunk type ãš chunk data ã® CRC (笊å·ãªã 4 ãã€ãæŽæ°)</li> - </ol> - <p> - CRC (Cyclic Redundancy Check) ã¯èª€ãæ€åºç¬Šå·ã®äžçš®ãGo èšèªã§ã¯ <code>hash/crc32</code> ããã±ãŒãžã«ããããä»åã¯ãããèªåã§å®è£
ãããPNG ã®ä»æ§æžã« C èšèªã®ãµã³ãã«ã³ãŒããèŒã£ãŠãã (<a href="https://www.w3.org/TR/png/#D-CRCAppendix">D. Sample CRC implementation</a>) ã®ã§ãããã Go ã«ç§»æ€ããã - </p> - <codeblock language="go"> - <![CDATA[ - var ( - crcTable [256]uint32 - crcTableComputed bool - ) - - func makeCrcTable() { - for n := 0; n < 256; n++ { - c := uint32(n) - for k := 0; k < 8; k++ { - if (c & 1) != 0 { - c = 0xEDB88320 ^ (c >> 1) - } else { - c = c >> 1 - } - } - crcTable[n] = c - } - crcTableComputed = true - } - - func updateCrc(crc uint32, buf []byte) uint32 { - if !crcTableComputed { - makeCrcTable() - } - - c := crc - for n := 0; n < len(buf); n++ { - c = crcTable[(c^uint32(buf[n]))&0xFF] ^ (c >> 8) - } - return c - } - - func crc(buf []byte) uint32 { - return updateCrc(0xFFFFFFFF, buf) ^ 0xFFFFFFFF - } - ]]> - </codeblock> - <p> - ã§ãã <code>crc</code> 颿°ã䜿ã£ãŠãchunk äžè¬ãæžã蟌ã颿°ãçšæããŠãããã - </p> - <codeblock language="go"> - <![CDATA[ - func writeChunk(w io.Writer, chunkType string, data []byte) { - typeAndData := make([]byte, 0, len(chunkType)+len(data)) - typeAndData = append(typeAndData, []byte(chunkType)...) - typeAndData = append(typeAndData, data...) - - binary.Write(w, binary.BigEndian, uint32(len(data))) - binary.Write(w, binary.BigEndian, typeAndData) - binary.Write(w, binary.BigEndian, crc(typeAndData)) - } - ]]> - </codeblock> - <p> - 仿§ã©ããã<code>chunkType</code> ãš <code>data</code> ãã CRC ãèšç®ãã<code>data</code> ã®é·ããšåãããŠæžã蟌ãã§ããã - PNG ã§ã¯åºæ¬çã« big endian ã䜿ãããšã«æ³šæããã - </p> - <p> - æºåãã§ãããšããã§ãå
·äœç㪠chunk ããšã³ã³ãŒãããŠããã - </p> - </section> - <section id="ihdr-chunk"> - <h>IHDR chunk</h> - <p> - IHDR chunk ã¯æåã«é
眮ããã chunk ã§ãããæ¬¡ã®ãããªããŒã¿ãããªãã - </p> - <ol> - <li>ç»åã®å¹
(笊å·ãªã 4 ãã€ãæŽæ°)</li> - <li>ç»åã®é«ã (笊å·ãªã 4 ãã€ãæŽæ°)</li> - <li> - ãããæ·±åºŠ (笊å·ãªã 1 ãã€ãæŽæ°) - <ul> - <li>1 è²ã«äœ¿ããããæ°ã1 ãã¯ã»ã«ã« 24 bit 䜿ã truecolor ç»åã§ã¯ 8 ã«ãªã</li> - </ul> - </li> - <li> - è²ã¿ã€ã (笊å·ãªã 1 ãã€ãæŽæ°) - <ul> - <li>0: ã°ã¬ãŒã¹ã±ãŒã«</li> - <li>2: Truecolor (ä»åã¯ããã«æ±ºãæã¡)</li> - <li>3: ãã¬ããã®ã€ã³ããã¯ã¹</li> - <li>4: ã°ã¬ãŒã¹ã±ãŒã« + ã¢ã«ãã¡</li> - <li>6: Truecolor + ã¢ã«ãã¡</li> - </ul> - </li> - <li> - å§çž®æ¹åŒ (笊å·ãªã 1 ãã€ãæŽæ°) - <ul> - PNG ã®ä»æ§æžã« 0 ããå®çŸ©ãããŠããªãã®ã§ 0 ã§åºå® - </ul> - </li> - <li> - ãã£ã«ã¿æ¹åŒ (笊å·ãªã 1 ãã€ãæŽæ°) - <ul> - PNG ã®ä»æ§æžã« 0 ããå®çŸ©ãããŠããªãã®ã§ 0 ã§åºå® - </ul> - </li> - <li> - ã€ã³ã¿ãŒã¬ãŒã¹æ¹åŒ (笊å·ãªã 1 ãã€ãæŽæ°) - <ul> - ä»åã¯ã€ã³ã¿ãŒã¬ãŒã¹ããªãã®ã§ 0 - </ul> - </li> - </ol> - <p> - ä»åã»ãšãã©ã®ããŒã¿ã¯æ±ºãæã¡ããã®ã§ãããŒã¿ã«å¿ããŠå€ããã®ã¯ width ãš height ã ãã«ãªããã³ãŒãã¯æ¬¡ã®ããã«ãªãã - </p> - <codeblock language="go"> - <![CDATA[ - import "bytes" - - func writeChunkIhdr(w io.Writer, width, height uint32) { - var buf bytes.Buffer - binary.Write(&buf, binary.BigEndian, width) - binary.Write(&buf, binary.BigEndian, height) - binary.Write(&buf, binary.BigEndian, uint8(8)) - binary.Write(&buf, binary.BigEndian, uint8(2)) - binary.Write(&buf, binary.BigEndian, uint8(0)) - binary.Write(&buf, binary.BigEndian, uint8(0)) - binary.Write(&buf, binary.BigEndian, uint8(0)) - - writeChunk(w, "IHDR", buf.Bytes()) - } - ]]> - </codeblock> - </section> - <section id="idat-chunk"> - <h>IDAT chunk</h> - <p> - IDAT chunk ã¯ãå®éã®ç»åããŒã¿ãæ ŒçŽããã chunk ã§ãããIDAT chunk 㯠deflate ã¢ã«ãŽãªãºã ã«ããå§çž®ãããzlib 圢åŒã§æ ŒçŽãããã - </p> - <section id="zlib"> - <h>Zlib</h> - <p> - ãŸã㯠zlib ã«ã€ããŠç¢ºèªãããããããæ¬¡ã®ãããªæ§é ã«ãªã£ãŠããã - </p> - <ol> - <li>åºå®ã§ 0x78 (笊å·ãªã 1 ãã€ãæŽæ°)</li> - <li>åºå®ã§ 0x01 (笊å·ãªã 1 ãã€ãæŽæ°)</li> - <li>ããŒã¿</li> - <li>ããŒã¿ã® Adler-32</li> - </ol> - <p> - æåã® 2 ãã€ãã«ãæå³ã¯ããããPNG ã§ã¯åºå®ã§æ§ããªãã - </p> - <p> - Adler-32 ã CRC ãšåããèª€ãæ€åºç¬Šå·ã§ããããã¡ãã zlib ã®ä»æ§æžã« C èšèªã§ãµã³ãã«ã³ãŒããèšèŒãããŠãã (<a href="https://www.rfc-editor.org/rfc/rfc1950#section-9">9. Appendix: Sample code</a>) ã®ã§ãGo ã«ç§»æ€ããã - </p> - <codeblock language="go"> - <![CDATA[ - const adler32Base = 65521 - - func updateAdler32(adler uint32, buf []byte) uint32 { - s1 := adler & 0xFFFF - s2 := (adler >> 16) & 0xFFFF - - for n := 0; n < len(buf); n++ { - s1 = (s1 + uint32(buf[n])) % adler32Base - s2 = (s2 + s1) % adler32Base - } - return (s2 << 16) + s1 - } - - func adler32(buf []byte) uint32 { - return updateAdler32(1, buf) - } - ]]> - </codeblock> - <p> - ãããŒã¿ãã®éšåã«ã¯å§çž®ããããŒã¿ãå
¥ãã®ã ããçé¢ç®ã« deflate ã¢ã«ãŽãªãºã ãå®è£
ããå¿
èŠã¯ãªããZlib ã«ã¯ç¡å§çž®ã®ããŒã¿ãããã¯ãæ ŒçŽããããšãã§ããã®ã§ãããã䜿ããæ¬æ¥ã¯ãããŒã¿ã®å§çž®å¹çã®æªãã©ã³ãã ãªããŒã¿ããã®ãŸãŸæ ŒçŽããããã®ãã®ã ããä»å㯠deflate ã®å®è£
ããµããããã«äœ¿ãã - </p> - <p> - 1 ã€ã®ç¡å§çž®ãããã¯ã«ã¯ 65535 (2<sup>16</sup> - 1) ãã€ããŸã§æ ŒçŽã§ãããããããã®ãããã¯ã¯æ¬¡ã®ãããªæ§æã«ãªã£ãŠããã - </p> - <ol> - <li>æçµãããã¯ãªã 1ãããã§ãªããã° 0 (笊å·ãªã 1 ãã€ãæŽæ°)</li> - <li>ãããã¯ã®ãã€ãé· (笊å·ãªã 2 ãã€ãæŽæ°)</li> - <li>ãããã¯ã®ãã€ãé·ã® 1 ã®è£æ°ããããã¯ãããå転 (笊å·ãªã 2 ãã€ãæŽæ°)</li> - <li>ããŒã¿ (æå€§ 65535 ãã€ã)</li> - </ol> - <p> - å®éã«ãã®ææã zlib ãå®è£
ãããã®ããã¡ã: - </p> - <codeblock language="go"> - <![CDATA[ - func encodeZlib(data []byte) []byte { - var buf bytes.Buffer - - binary.Write(&buf, binary.BigEndian, uint8(0x78)) - binary.Write(&buf, binary.BigEndian, uint8(0x01)) - blockSize := 65535 - isFinalBlock := false - for i := 0; !isFinalBlock; i++ { - var block []byte - if len(data) <= (i+1)*blockSize { - block = data[i*blockSize:] - isFinalBlock = true - } else { - block = data[i*blockSize : (i+1)*blockSize] - } - binary.Write(&buf, binary.BigEndian, isFinalBlock) - binary.Write(&buf, binary.LittleEndian, uint16(len(block))) - binary.Write(&buf, binary.LittleEndian, uint16(^len(block))) - binary.Write(&buf, binary.LittleEndian, block) - } - binary.Write(&buf, binary.BigEndian, adler32(data)) - - return buf.Bytes() - } - ]]> - </codeblock> - </section> - <section id="image-data"> - <h>ç»åããŒã¿</h> - <p> - ã§ã¯æ¬¡ã«ãzlib 圢åŒã§æ ŒçŽããããŒã¿ãçšæãããPNG ç»åã¯æ¬¡ã®ãããªé ã«ã¹ãã£ã³ããã - ç»åã®å·Šäžã®ãã¯ã»ã«ããåãè¡ã暪ã«ã¹ãã£ã³ããŠãããäžçªå³ãŸã§å°éãããæ¬¡ã®è¡ã®å·Šã«åããã - å³äžã®ãã¯ã»ã«ãŸã§è¡ãã°çµãããèŠã¯ Z ååã«é²ãã§ããã - </p> - <p> - ãŸããããããã®è¡ã®å
é ã«ã¯ãå§çž®ã®ããã®ãã£ã«ã¿ã¿ã€ããæå®ããã - ãã ãä»åã¯ãã®å®è£
ãçç¥ããããã«ãåžžã«ãã£ã«ã¿ 0 (äœãå å·¥ããªã) ã䜿ãã - </p> - <p> - å
ã»ã©ã® <code>encodeZlib</code> ã䜿ã£ãŠå®éã«å®è£
ãããã®ããã¡ã: - </p> - <codeblock language="go"> - <![CDATA[ - func writeChunkIdat(w io.Writer, width, height uint32, img image.Image) { - var pixels bytes.Buffer - for y := uint32(0); y < height; y++ { - binary.Write(&pixels, binary.BigEndian, uint8(0)) - for x := uint32(0); x < width; x++ { - r, g, b, _ := img.At(int(x), int(y)).RGBA() - binary.Write(&pixels, binary.BigEndian, uint8(r)) - binary.Write(&pixels, binary.BigEndian, uint8(g)) - binary.Write(&pixels, binary.BigEndian, uint8(b)) - } - } - - writeChunk(w, "IDAT", encodeZlib(pixels.Bytes())) - } - ]]> - </codeblock> - </section> - </section> - <section id="iend-chunk"> - <h>IEND chunk</h> - <p> - æåŸã« IEND chunk ãæžã蟌ãããã㯠PNG ç»åã®æåŸã«é
眮ããã chunk ã§ãPNG ã®ãã³ãŒãã¯ãã® chunk ã«åºäŒããšããã§ãã³ãŒãã忢ããã - </p> - <p> - ç¹ã«è¿œå ã®ããŒã¿ã¯ãªããå¿
èŠãªã®ã¯ chunk type ã® <code>IEND</code> ããããªã®ã§å®è£
ã¯ç°¡å: - </p> - <codeblock language="go"> - <![CDATA[ - func writeChunkIend(w io.Writer) { - writeChunk(w, "IEND", nil) - } - ]]> - </codeblock> - </section> - </section> - <section id="outro"> - <h>ãããã«</h> - <p> - æåŸã«å
šãœãŒã¹ã³ãŒããåæ²ããŠããã - </p> - <codeblock language="go"> - <![CDATA[ - package main - - import ( - "bytes" - "encoding/binary" - "image" - _ "image/png" - "io" - "os" - ) - - func main() { - inFile, err := os.Open("input.png") - if err != nil { - panic(err) - } - defer inFile.Close() - - img, _, err := image.Decode(inFile) - if err != nil { - panic(err) - } - - outFile, err := os.Create("output.png") - if err != nil { - panic(err) - } - defer outFile.Close() - - writePng(outFile, img) - } - - func writePng(w io.Writer, img image.Image) { - width := uint32(img.Bounds().Dx()) - height := uint32(img.Bounds().Dy()) - writeSignature(w) - writeChunkIhdr(w, width, height) - writeChunkIdat(w, width, height, img) - writeChunkIend(w) - } - - func writeSignature(w io.Writer) { - sig := [8]uint8{ - 0x89, - 0x50, // P - 0x4E, // N - 0x47, // G - 0x0D, // CR - 0x0A, // LF - 0x1A, // EOF (^Z) - 0x0A, // LF - } - binary.Write(w, binary.BigEndian, sig) - } - - func writeChunkIhdr(w io.Writer, width, height uint32) { - var buf bytes.Buffer - binary.Write(&buf, binary.BigEndian, width) - binary.Write(&buf, binary.BigEndian, height) - binary.Write(&buf, binary.BigEndian, uint8(8)) - binary.Write(&buf, binary.BigEndian, uint8(2)) - binary.Write(&buf, binary.BigEndian, uint8(0)) - binary.Write(&buf, binary.BigEndian, uint8(0)) - binary.Write(&buf, binary.BigEndian, uint8(0)) - - writeChunk(w, "IHDR", buf.Bytes()) - } - - func writeChunkIdat(w io.Writer, width, height uint32, img image.Image) { - var pixels bytes.Buffer - for y := uint32(0); y < height; y++ { - binary.Write(&pixels, binary.BigEndian, uint8(0)) - for x := uint32(0); x < width; x++ { - r, g, b, _ := img.At(int(x), int(y)).RGBA() - binary.Write(&pixels, binary.BigEndian, uint8(r)) - binary.Write(&pixels, binary.BigEndian, uint8(g)) - binary.Write(&pixels, binary.BigEndian, uint8(b)) - } - } - - writeChunk(w, "IDAT", encodeZlib(pixels.Bytes())) - } - - func encodeZlib(data []byte) []byte { - var buf bytes.Buffer - - binary.Write(&buf, binary.BigEndian, uint8(0x78)) - binary.Write(&buf, binary.BigEndian, uint8(0x01)) - blockSize := 65535 - isFinalBlock := false - for i := 0; !isFinalBlock; i++ { - var block []byte - if len(data) <= (i+1)*blockSize { - block = data[i*blockSize:] - isFinalBlock = true - } else { - block = data[i*blockSize : (i+1)*blockSize] - } - binary.Write(&buf, binary.BigEndian, isFinalBlock) - binary.Write(&buf, binary.LittleEndian, uint16(len(block))) - binary.Write(&buf, binary.LittleEndian, uint16(^len(block))) - binary.Write(&buf, binary.LittleEndian, block) - } - binary.Write(&buf, binary.BigEndian, adler32(data)) - - return buf.Bytes() - } - - func writeChunkIend(w io.Writer) { - writeChunk(w, "IEND", nil) - } - - func writeChunk(w io.Writer, chunkType string, data []byte) { - typeAndData := make([]byte, 0, len(chunkType)+len(data)) - typeAndData = append(typeAndData, []byte(chunkType)...) - typeAndData = append(typeAndData, data...) - - binary.Write(w, binary.BigEndian, uint32(len(data))) - binary.Write(w, binary.BigEndian, typeAndData) - binary.Write(w, binary.BigEndian, crc(typeAndData)) - } - - var ( - crcTable [256]uint32 - crcTableComputed bool - ) - - func makeCrcTable() { - for n := 0; n < 256; n++ { - c := uint32(n) - for k := 0; k < 8; k++ { - if (c & 1) != 0 { - c = 0xEDB88320 ^ (c >> 1) - } else { - c = c >> 1 - } - } - crcTable[n] = c - } - crcTableComputed = true - } - - func updateCrc(crc uint32, buf []byte) uint32 { - if !crcTableComputed { - makeCrcTable() - } - - c := crc - for n := 0; n < len(buf); n++ { - c = crcTable[(c^uint32(buf[n]))&0xFF] ^ (c >> 8) - } - return c - } - - func crc(buf []byte) uint32 { - return updateCrc(0xFFFFFFFF, buf) ^ 0xFFFFFFFF - } - - const adler32Base = 65521 - - func updateAdler32(adler uint32, buf []byte) uint32 { - s1 := adler & 0xFFFF - s2 := (adler >> 16) & 0xFFFF - - for n := 0; n < len(buf); n++ { - s1 = (s1 + uint32(buf[n])) % adler32Base - s2 = (s2 + s1) % adler32Base - } - return (s2 << 16) + s1 - } - - func adler32(buf []byte) uint32 { - return updateAdler32(1, buf) - } - ]]> - </codeblock> - </section> - <section id="references"> - <h>åè</h> - <ul> - <li><a href="https://www.w3.org/TR/png">Portable Network Graphics (PNG) Specification (Third Edition)</a></li> - <li><a href="https://www.rfc-editor.org/rfc/rfc1950">ZLIB Compressed Data Format Specification version 3.3</a></li> - </ul> - </section> -</article> diff --git a/vhosts/blog/content/posts/2023-04-04/phperkaigi-2023-report.dj b/vhosts/blog/content/posts/2023-04-04/phperkaigi-2023-report.dj new file mode 100644 index 00000000..e4047c79 --- /dev/null +++ b/vhosts/blog/content/posts/2023-04-04/phperkaigi-2023-report.dj @@ -0,0 +1,141 @@ +--- +[article] +uuid = "21ce39f0-d613-45f2-a760-89c368892d77" +title = "PHPerKaigi 2023 åå ã¬ã" +description = "2023-03-23 ãã 2023-03-25 ã«ãããŠéå¬ããããPHPerKaigi 2023 ã«åå ããã" +tags = [ + "conference", + "php", + "phperkaigi", +] + +[[article.revisions]] +date = "2023-04-04" +remark = "å
¬é" + +[[article.revisions]] +date = "2023-06-28" +remark = "ããŒã¯ã»ãã·ã§ã³ã®èšäºçã®å·çãäžæ¢" +--- +{#intro} +# ã¯ããã« + +2023-03-23 ãã 2023-03-25 ã«ãããŠéå¬ãããã [PHPerKaigi 2023](https://phperkaigi.jp/2023/) ã«åå ããã +ä»å¹Žã¯ 2ã€ã®ã»ãã·ã§ã³ã®ã¹ããŒã«ãŒãšããŠããŸããåœæ¥ã¹ã¿ãããšããŠåå ããã + +æšå¹Žãäžæšå¹Žã®åå ã¬ãã¯ãã¡ã: + +* [PHPerKaigi 2022](/posts/2022-05-01/phperkaigi-2022/) +* [PHPerKaigi 2021](/posts/2021-03-30/phperkaigi-2021/) + +{#as-speaker} +# ã¹ããŒã«ãŒãšã㊠+ +ãããŸã§ãšã®æå€§ã®éããšããŠãä»åã¯ã¹ããŒã«ãŒãšããŠç»å£ããããŸãã¯ããã«ã€ããŠæžãã2ã€ã®ã»ãã·ã§ã³ã§ç»å£ããã + +* 詳説ãåç
§ãïŒPHP åŠçç³»ã®å®è£
ããåç
§ãçè§£ãã + + * [ããããŒã¶ã«](https://fortee.jp/phperkaigi-2023/proposal/95e4dd94-5fc7-40fe-9e1a-230e36404cbe) + * [ã¹ã©ã€ã](/slides/2023-03-24/phperkaigi-2023/) + * 解説èšäº (å·çäž) â 远èš: èšäºçã®å·çã¯è«Šãã + +* PHPerãã£ã¬ã³ãžè§£èª¬ã»ãã·ã§ã³ - ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ + + * [ããããŒã¶ã«](https://fortee.jp/phperkaigi-2023/proposal/524c9dca-1d70-4b32-a939-9c73ffe5cb48) + * [ã¹ã©ã€ã](/slides/2023-03-25/phperkaigi-2023-tokens/) + * 解説èšäº (å·çäž) â 远èš: èšäºçã®å·çã¯è«Šãã + +PHPer ãã£ã¬ã³ãžã®è©±ã«ã€ããŠã¯åŸè¿°ããã +åç
§ã«ã€ããŠã¯ãPHP ãæžãå§ããé ãããã£ãšçåã«æã£ãŠããã®ã§ãä»çµã¿ãçè§£ããè¯ãæ©äŒãšãªã£ãã + +{#as-staff} +# åœæ¥ã¹ã¿ãããšã㊠+ +ä»åã¯ã¹ããŒã«ãŒã®ã¿ãªããåœæ¥ã¹ã¿ãããšããŠãåå ããã +ã«ã³ãã¡ã¬ã³ã¹ã®ã¹ã¿ãããšããŠã®åå ã¯åããŠã ã£ãããååå ã®ã¹ã¿ããã§ãã¹ã ãŒãºã«äœæ¥ãã§ãããããªä»çµã¿ãæŽããããŠããã + +PHPerKaigi ã¯äžè¬åå è
ã®ç®ç·ã§ãããã§ããã«ã³ãã¡ã¬ã³ã¹ã ãªããšããå°è±¡ã ã£ãã®ã ãããããã®æãã匷ãããã +ãªããšã¹ã¿ããã«ãšã£ãŠãããã§ããã«ã³ãã¡ã¬ã³ã¹ãªã®ã§ããã + +åçç¹ã¯ç§èªèº«ã®æå€§ HP ããŸã£ããè¶³ããŠããªãã£ãããšã§ãæ¬¡ã®æ©äŒã«ã¯æåŸãŸã§åããããã«ããããšããã§ããã + +{#as-attendee} +# åå è
ãšã㊠+ +{#recommended-sessions} +## ããããã»ãã·ã§ã³ + +5ã€ã®ã»ãã·ã§ã³ãå³éžããã + +[ãã©ãŠã¶ã®åããåŽã§ã200 OKããè¿ããŸã§ã«äœãèµ·ããŠããã®ã調ã¹ãŠã¿ã](https://fortee.jp/phperkaigi-2023/proposal/f7f2f18a-e6b0-47e4-ade0-e324f72428ae) + +Web ã«é¢ãããªããããã¯ãšã³ãã§ãããã³ããšã³ãã§ãç¥ã£ãŠãããŠã»ããç¥èã +ã¿ã€ãã«ãèŠãŠããããªè©±ã ãããªããšæ³åãã€ãã¬ãã«ãªãèŠãªããŠãããããã + +[PHPã§åŠã¶ "Cacheã®è·é¢" ã®è©±](https://fortee.jp/phperkaigi-2023/proposal/280706e0-7158-4237-8202-c9d64330b96f) + +ãããäžã»ãã·ã§ã³ãšåæ§ã«ãåºç€ãæããããè¯ãã»ãã·ã§ã³ã + +[é²è¡ç PHP: 倿§æ§ãçãæãããã® PHP å
¥é](https://fortee.jp/phperkaigi-2023/proposal/ad3ba31c-0214-4557-a0df-3755db8ed8cc) + +éçè§£æããŒã«ã®è©±ãéçè§£æã¯ PHP ã®ã¿ãªããæè¿ã®åçèšèªã®äžå€§æœ®æµãªã®ã§ãéããããªãã + +[PHPã®æé«æ©èœãé
åãæšãŠããïŒïŒ](https://fortee.jp/phperkaigi-2023/proposal/e00788a4-ef25-49ee-b254-9d2b53e19633) + +å®ã¯ãããäžã®ã»ãã·ã§ã³ãšåæ§ã®è©±ã +PHP ã®éçè§£æããŒã«ã¯é
åã«ã (ç¡çç¢ç) åãä»ãããããã®ãå€ãããå®è¡æã«ãæ€æ»ã§ãããšããç¹ã«ãããŠå°çšã®ã¯ã©ã¹ãäœãæ¹ãåªããŠããã + +[æéãæ°ã«ããæ®éã«ã«ã³ãã³ã°ããã€ã€ ISUCON12 æ¬éžåé¡ã PHP ã§ãã£ãŠã¿ã](https://fortee.jp/phperkaigi-2023/proposal/7e212cb2-be37-43e8-b6ee-5236d259fcbf) + +å人çã«æãæ¥œãã¿ã«ããŠããã»ãã·ã§ã³ã§ãããä»åã®ã¢ãªã¢ã¬ãªããŒã¯è³ (çãäžãã£ãã»ãã·ã§ã³ã«éå¶åŽããèŽãããè³) ã§ãããã +ãã¿ãã¬ã«ãªãããæçµçã« (Go ã§å®è£
ããã) æ¬æŠåªåã¹ã³ã¢ãè¶
ããŠããã + +{#phper-challenge} +## PHPer ãã£ã¬ã³ãž + +æšå¹Žã«åŒãç¶ããåŒç€Ÿããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿããã®ããŒã¯ã³åé¡ã®äœé¡ãæ
åœããã +ãŸããä»å¹Žã¯ããã«äœæããåé¡ã解説ããã»ãã·ã§ã³ã«ãç»å£ããã +ä»å¹Žã®ããŒã¯ã³ã¯ãæšå¹Žã® PHPerKaigi 2022 ãçµãã£ã段éããäœãå§ããçŽå幎ãããŠå¶äœããã + +åé¡ã®å¶äœäžã¯å€§å€æ¥œããã£ããããŸããããããã +ããã«è¶
çµ¶æå·§ãåãããã«æ³šåããŠããŸããè§£ãæ¥œãããšãã芳ç¹ã倱ã£ãŠããŸã£ãããããããã + +(WIP: 解説ããã°èšäºå·çäžãçµãã£ããããã«ãªã³ã¯) + +{#random-thoughts} +## éå€ãªææ³ + +ãªããããããã + +* ãã«ãã³ããããã£ã +* \\ïŸïŸïŸïŸïŸïœ°/ +* åæäŸ¿å© +* \\ïŸïŸïŸïŸïŸïœ°/ +* åè¢äŸ¿å© +* \\ïŸïŸïŸïŸïŸïœ°/ +* ããŒã«ãŒã®ãã¶ã€ã³è¯ã + +(ããšããèŠè¿ããŠèªåã§ããããããããªããªããããªã®ã§æžããŠãããšãäŒå Žã«å
¥å Žããéã«åæãã¿ãããããšå°æ¡ãšãã³ããã®å£°ã§ãããããŒããšããé³å£°ãæµããã®ããã¯ããã£ã) + +{#outro} +# ãããã« + +[å»å¹Žã®åå ã¬ã](/posts/2022-05-01/phperkaigi-2022/#section--next-year) ã§ã¯ãæ¥å¹Žã®ç®æšãšããŠæ¬¡ãæããã + +> * ããããŒã¶ã«ãåºã +> * PHPer ãã£ã¬ã³ãžã®ããŒã¯ã³åé¡ã 5é¡äœæãã +> * çŸå°ã«è¡ã +> * PHPer ãã£ã¬ã³ãžã§å§åãã + +ããããŒã¶ã«ã«é¢ããŠã¯æ¡æãããŠç»å£ã§ããããPHPer ãã£ã¬ã³ãžã¯è§£èª¬ããããªã£ãããŸããçŸå°ã«è¡ãã ãã§ãªããåœæ¥ã¹ã¿ãããšããŠåå ããã +4ã€ç®ã® PHPer ãã£ã¬ã³ãžã«é¢ããŠã¯ãä»å¹Žã¯åå ããŠããªãã +ã¹ã¿ããããããªããã ãšå
¥åããæéãæ¢ãæéãåãããã«ãªãã£ãã®ãšãã¹ã¿ããããã£ãŠããé¢ä¿ã§å°ãã ãæ©ãå
¥æããŠããŸãããŒã¯ã³ãããã€ãååšããŠããããã + +ã«ã³ãã¡ã¬ã³ã¹å
šäœã®ææ³ã«ã€ããŠã ããå€§èŠæš¡ãªã«ã³ãã¡ã¬ã³ã¹ã«ãªãã©ã€ã³ã§åå ããã®ã¯ä»åãåããŠã ã£ãã®ã§ããã®è©±ããããã + +ãªã³ã©ã€ã³ãšãªãã©ã€ã³ã ãšäœéšãå¥ç©ã«ãªããããããã䌌ãŠéãªããã®ãªã®ã ã +åãäžåãã¯ããã ãããããªã³ã©ã€ã³ããåå ããããšã®ãªããšããæ¹ã¯ãäžåºŠçŸå°åå ããŠã¿ãŠã¯ãããã ãããã + +ããŠãåå ã¬ãã¯å»å¹Žãäžæšå¹Žããã®èšèã§ç· ãæ¬ã£ãŠããã®ã§ãä»å¹Žãããã§çµããããšæãã + +ã§ã¯ãŸãæ¥å¹Žã diff --git a/vhosts/blog/content/posts/2023-04-04/phperkaigi-2023-report.ndoc b/vhosts/blog/content/posts/2023-04-04/phperkaigi-2023-report.ndoc deleted file mode 100644 index e9ad3d96..00000000 --- a/vhosts/blog/content/posts/2023-04-04/phperkaigi-2023-report.ndoc +++ /dev/null @@ -1,184 +0,0 @@ ---- -[article] -uuid = "21ce39f0-d613-45f2-a760-89c368892d77" -title = "PHPerKaigi 2023 åå ã¬ã" -description = "2023-03-23 ãã 2023-03-25 ã«ãããŠéå¬ããããPHPerKaigi 2023 ã«åå ããã" -tags = [ - "conference", - "php", - "phperkaigi", -] - -[[article.revisions]] -date = "2023-04-04" -remark = "å
¬é" - -[[article.revisions]] -date = "2023-06-28" -remark = "ããŒã¯ã»ãã·ã§ã³ã®èšäºçã®å·çãäžæ¢" ---- -<article> - <section id="intro"> - <h>ã¯ããã«</h> - <p> - 2023-03-23 ãã 2023-03-25 ã«ãããŠéå¬ãããã<a href="https://phperkaigi.jp/2023/">PHPerKaigi 2023</a> ã«åå ããã - ä»å¹Žã¯ 2ã€ã®ã»ãã·ã§ã³ã®ã¹ããŒã«ãŒãšããŠããŸããåœæ¥ã¹ã¿ãããšããŠåå ããã - </p> - <p> - æšå¹Žãäžæšå¹Žã®åå ã¬ãã¯ãã¡ã: - </p> - <ul> - <li><a href="/posts/2022-05-01/phperkaigi-2022/">PHPerKaigi 2022</a></li> - <li><a href="/posts/2021-03-30/phperkaigi-2021/">PHPerKaigi 2021</a></li> - </ul> - </section> - <section id="as-speaker"> - <h>ã¹ããŒã«ãŒãšããŠ</h> - <p> - ãããŸã§ãšã®æå€§ã®éããšããŠãä»åã¯ã¹ããŒã«ãŒãšããŠç»å£ããããŸãã¯ããã«ã€ããŠæžãã2ã€ã®ã»ãã·ã§ã³ã§ç»å£ããã - </p> - <ul> - <li> - 詳説ãåç
§ãïŒPHP åŠçç³»ã®å®è£
ããåç
§ãçè§£ãã - <ul> - <li><a href="https://fortee.jp/phperkaigi-2023/proposal/95e4dd94-5fc7-40fe-9e1a-230e36404cbe">ããããŒã¶ã«</a></li> - <li><a href="/slides/2023-03-24/phperkaigi-2023/">ã¹ã©ã€ã</a></li> - <li>解説èšäº (å·çäž) â 远èš: èšäºçã®å·çã¯è«Šãã</li> - </ul> - </li> - <li> - PHPerãã£ã¬ã³ãžè§£èª¬ã»ãã·ã§ã³ - ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ - <ul> - <li><a href="https://fortee.jp/phperkaigi-2023/proposal/524c9dca-1d70-4b32-a939-9c73ffe5cb48">ããããŒã¶ã«</a></li> - <li><a href="/slides/2023-03-25/phperkaigi-2023-tokens/">ã¹ã©ã€ã</a></li> - <li>解説èšäº (å·çäž) â 远èš: èšäºçã®å·çã¯è«Šãã</li> - </ul> - </li> - </ul> - <p> - PHPer ãã£ã¬ã³ãžã®è©±ã«ã€ããŠã¯åŸè¿°ããã - åç
§ã«ã€ããŠã¯ãPHP ãæžãå§ããé ãããã£ãšçåã«æã£ãŠããã®ã§ãä»çµã¿ãçè§£ããè¯ãæ©äŒãšãªã£ãã - </p> - </section> - <section id="as-staff"> - <h>åœæ¥ã¹ã¿ãããšããŠ</h> - <p> - ä»åã¯ã¹ããŒã«ãŒã®ã¿ãªããåœæ¥ã¹ã¿ãããšããŠãåå ããã - ã«ã³ãã¡ã¬ã³ã¹ã®ã¹ã¿ãããšããŠã®åå ã¯åããŠã ã£ãããååå ã®ã¹ã¿ããã§ãã¹ã ãŒãºã«äœæ¥ãã§ãããããªä»çµã¿ãæŽããããŠããã - </p> - <p> - PHPerKaigi ã¯äžè¬åå è
ã®ç®ç·ã§ãããã§ããã«ã³ãã¡ã¬ã³ã¹ã ãªããšããå°è±¡ã ã£ãã®ã ãããããã®æãã匷ãããã - ãªããšã¹ã¿ããã«ãšã£ãŠãããã§ããã«ã³ãã¡ã¬ã³ã¹ãªã®ã§ããã - </p> - <p> - åçç¹ã¯ç§èªèº«ã®æå€§ HP ããŸã£ããè¶³ããŠããªãã£ãããšã§ãæ¬¡ã®æ©äŒã«ã¯æåŸãŸã§åããããã«ããããšããã§ããã - </p> - </section> - <section id="as-attendee"> - <h>åå è
ãšããŠ</h> - <section id="recommended-sessions"> - <h>ããããã»ãã·ã§ã³</h> - <p> - 5ã€ã®ã»ãã·ã§ã³ãå³éžããã - </p> - <p> - <a href="https://fortee.jp/phperkaigi-2023/proposal/f7f2f18a-e6b0-47e4-ade0-e324f72428ae">ãã©ãŠã¶ã®åããåŽã§ã200 OKããè¿ããŸã§ã«äœãèµ·ããŠããã®ã調ã¹ãŠã¿ã</a> - </p> - <p> - Web ã«é¢ãããªããããã¯ãšã³ãã§ãããã³ããšã³ãã§ãç¥ã£ãŠãããŠã»ããç¥èã - ã¿ã€ãã«ãèŠãŠããããªè©±ã ãããªããšæ³åãã€ãã¬ãã«ãªãèŠãªããŠãããããã - </p> - <p> - <a href="https://fortee.jp/phperkaigi-2023/proposal/280706e0-7158-4237-8202-c9d64330b96f">PHPã§åŠã¶ "Cacheã®è·é¢" ã®è©±</a> - </p> - <p> - ãããäžã»ãã·ã§ã³ãšåæ§ã«ãåºç€ãæããããè¯ãã»ãã·ã§ã³ã - </p> - <p> - <a href="https://fortee.jp/phperkaigi-2023/proposal/ad3ba31c-0214-4557-a0df-3755db8ed8cc">é²è¡ç PHP: 倿§æ§ãçãæãããã® PHP å
¥é</a> - </p> - <p> - éçè§£æããŒã«ã®è©±ãéçè§£æã¯ PHP ã®ã¿ãªããæè¿ã®åçèšèªã®äžå€§æœ®æµãªã®ã§ãéããããªãã - </p> - <p> - <a href="https://fortee.jp/phperkaigi-2023/proposal/e00788a4-ef25-49ee-b254-9d2b53e19633">PHPã®æé«æ©èœãé
åãæšãŠããïŒïŒ</a> - </p> - <p> - å®ã¯ãããäžã®ã»ãã·ã§ã³ãšåæ§ã®è©±ã - PHP ã®éçè§£æããŒã«ã¯é
åã«ã (ç¡çç¢ç) åãä»ãããããã®ãå€ãããå®è¡æã«ãæ€æ»ã§ãããšããç¹ã«ãããŠå°çšã®ã¯ã©ã¹ãäœãæ¹ãåªããŠããã - </p> - <p> - <a href="https://fortee.jp/phperkaigi-2023/proposal/7e212cb2-be37-43e8-b6ee-5236d259fcbf">æéãæ°ã«ããæ®éã«ã«ã³ãã³ã°ããã€ã€ ISUCON12 æ¬éžåé¡ã PHP ã§ãã£ãŠã¿ã</a> - </p> - <p> - å人çã«æãæ¥œãã¿ã«ããŠããã»ãã·ã§ã³ã§ãããä»åã®ã¢ãªã¢ã¬ãªããŒã¯è³ (çãäžãã£ãã»ãã·ã§ã³ã«éå¶åŽããèŽãããè³) ã§ãããã - ãã¿ãã¬ã«ãªãããæçµçã« (Go ã§å®è£
ããã) æ¬æŠåªåã¹ã³ã¢ãè¶
ããŠããã - </p> - </section> - <section id="phper-challenge"> - <h>PHPer ãã£ã¬ã³ãž</h> - <p> - æšå¹Žã«åŒãç¶ããåŒç€Ÿããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿããã®ããŒã¯ã³åé¡ã®äœé¡ãæ
åœããã - ãŸããä»å¹Žã¯ããã«äœæããåé¡ã解説ããã»ãã·ã§ã³ã«ãç»å£ããã - ä»å¹Žã®ããŒã¯ã³ã¯ãæšå¹Žã® PHPerKaigi 2022 ãçµãã£ã段éããäœãå§ããçŽå幎ãããŠå¶äœããã - </p> - <p> - åé¡ã®å¶äœäžã¯å€§å€æ¥œããã£ããããŸããããããã - ããã«è¶
çµ¶æå·§ãåãããã«æ³šåããŠããŸããè§£ãæ¥œãããšãã芳ç¹ã倱ã£ãŠããŸã£ãããããããã - </p> - <p> - (WIP: 解説ããã°èšäºå·çäžãçµãã£ããããã«ãªã³ã¯) - </p> - </section> - <section id="random-thoughts"> - <h>éå€ãªææ³</h> - <p> - ãªããããããã - </p> - <ul> - <li>ãã«ãã³ããããã£ã</li> - <li>\ïŸïŸïŸïŸïŸïœ°/</li> - <li>åæäŸ¿å©</li> - <li>\ïŸïŸïŸïŸïŸïœ°/</li> - <li>åè¢äŸ¿å©</li> - <li>\ïŸïŸïŸïŸïŸïœ°/</li> - <li>ããŒã«ãŒã®ãã¶ã€ã³è¯ã</li> - </ul> - <p> - (ããšããèŠè¿ããŠèªåã§ããããããããªããªããããªã®ã§æžããŠãããšãäŒå Žã«å
¥å Žããéã«åæãã¿ãããããšå°æ¡ãšãã³ããã®å£°ã§ãããããŒããšããé³å£°ãæµããã®ããã¯ããã£ã) - </p> - </section> - </section> - <section id="outro"> - <h>ãããã«</h> - <p> - <a href="/posts/2022-05-01/phperkaigi-2022/#section--next-year">å»å¹Žã®åå ã¬ã</a>ã§ã¯ãæ¥å¹Žã®ç®æšãšããŠæ¬¡ãæããã - </p> - <blockquote> - <ul> - <li>ããããŒã¶ã«ãåºã</li> - <li>PHPer ãã£ã¬ã³ãžã®ããŒã¯ã³åé¡ã 5é¡äœæãã</li> - <li>çŸå°ã«è¡ã</li> - <li>PHPer ãã£ã¬ã³ãžã§å§åãã</li> - </ul> - </blockquote> - <p> - ããããŒã¶ã«ã«é¢ããŠã¯æ¡æãããŠç»å£ã§ããããPHPer ãã£ã¬ã³ãžã¯è§£èª¬ããããªã£ãããŸããçŸå°ã«è¡ãã ãã§ãªããåœæ¥ã¹ã¿ãããšããŠåå ããã - 4ã€ç®ã® PHPer ãã£ã¬ã³ãžã«é¢ããŠã¯ãä»å¹Žã¯åå ããŠããªãã - ã¹ã¿ããããããªããã ãšå
¥åããæéãæ¢ãæéãåãããã«ãªãã£ãã®ãšãã¹ã¿ããããã£ãŠããé¢ä¿ã§å°ãã ãæ©ãå
¥æããŠããŸãããŒã¯ã³ãããã€ãååšããŠããããã - </p> - <p> - ã«ã³ãã¡ã¬ã³ã¹å
šäœã®ææ³ã«ã€ããŠã ããå€§èŠæš¡ãªã«ã³ãã¡ã¬ã³ã¹ã«ãªãã©ã€ã³ã§åå ããã®ã¯ä»åãåããŠã ã£ãã®ã§ããã®è©±ããããã - </p> - <p> - ãªã³ã©ã€ã³ãšãªãã©ã€ã³ã ãšäœéšãå¥ç©ã«ãªããããããã䌌ãŠéãªããã®ãªã®ã ã - åãäžåãã¯ããã ãããããªã³ã©ã€ã³ããåå ããããšã®ãªããšããæ¹ã¯ãäžåºŠçŸå°åå ããŠã¿ãŠã¯ãããã ãããã - </p> - <p> - ããŠãåå ã¬ãã¯å»å¹Žãäžæšå¹Žããã®èšèã§ç· ãæ¬ã£ãŠããã®ã§ãä»å¹Žãããã§çµããããšæãã - </p> - <p> - ã§ã¯ãŸãæ¥å¹Žã - </p> - </section> -</article> diff --git a/vhosts/blog/content/posts/2023-06-25/phpconfuk-2023-report.dj b/vhosts/blog/content/posts/2023-06-25/phpconfuk-2023-report.dj new file mode 100644 index 00000000..ba1b7d6e --- /dev/null +++ b/vhosts/blog/content/posts/2023-06-25/phpconfuk-2023-report.dj @@ -0,0 +1,64 @@ +--- +[article] +uuid = "e1568c4c-9bdd-47b9-8b39-939ade4f3ba0" +title = "PHP ã«ã³ãã¡ã¬ã³ã¹çŠå²¡ 2023 åå ã¬ã" +description = "2023-06-24 ã«éå¬ããããPHP ã«ã³ãã¡ã¬ã³ã¹çŠå²¡ã«åå ããã" +tags = [ + "conference", + "php", + "phpconfuk", +] + +[[article.revisions]] +date = "2023-06-25" +remark = "å
¬é" +--- +{#intro} +# ã¯ããã« + +2023-06-24 ã«éå¬ãããã [PHP ã«ã³ãã¡ã¬ã³ã¹çŠå²¡ 2023](https://phpcon.fukuoka.jp/2023/) ã«åå ããã +ãŸãããã®åæ¥ã«å¬ãããã [éå
¬åŒã®åå€ç¥](https://connpass.com/event/282285/) ã«ãåå ããã +åå€ç¥ã§ã¯ã15åã®ç»å£ããããªã£ãã [ç»å£ã®æ¹ã®è³æã¯ãã¡ãã](/slides/2023-06-23/phpconfuk-2023-eve/) + +{#sessions-thoughts} +# ã»ãã·ã§ã³ã®ææ³ + +{#eve} +## åå€ç¥ + +â»ã»ãã·ã§ã³ã®é¡åãšçºè¡šè
åã¯ã [åå€ç¥ã€ãã³ãã® connpass ããŒãž](https://connpass.com/event/282285/) ããåŒçšã + +* ã¹ã¯ã©ã ïŒã®äžéšïŒãå°å
¥ããŠãããªã£ãããš (asumikam ãã) + + * ã¹ã¯ã©ã ã®ãäžéšããå°å
¥ããããšããããšã§ããããçæ³çãªåœ¢ã§æ¹åãé²ãã§ããããã«èŠåããããŸãããç¹ã«ããã©ã³ãéçšããããã€é »åºŠããã£ãŒãããã¯ãµã€ã¯ã«ã«å€§ããå€åãèµ·ããŠããã®ã¯é©ãã¹ãææã ãšæããŸããã + +* å°æ¹ã®å°ããªå匷äŒãäžçªã®æŽ»åèå°ã«ãã (tomio ãã) + + * ãããŸããã»ã©ã®ãç±ããæããŸãããç§èªèº«ãæè¿ã«ãªã£ãŠã«ã³ãã¡ã¬ã³ã¹ãå匷äŒãžã®åå ã»ç»å£ã掻çºã«ãããªãããã«ãªã£ãããšã§ãé ·ãç¹ãå€ãã£ãã§ãã + +{#conference} +## ã«ã³ãã¡ã¬ã³ã¹ + +â»ã»ãã·ã§ã³ã®é¡åãšçºè¡šè
åã¯ã [ã«ã³ãã¡ã¬ã³ã¹ã® fortee ããŒãž](https://fortee.jp/phpconfukuoka-2023/proposal/accepted) ããåŒçšã + +* [è²æå - ãšã³ãžãã¢ã®æèœãåŒãåºãç°å¢ãšãã¥ãŒã¿ãŒã®ç«ã¡åã - (å²¡åµ éå¹³ ãã)](https://fortee.jp/phpconfukuoka-2023/proposal/df5f06e8-900e-4e71-94d7-d0c3cc57a0ac) + + * ã¡ããã©åŒããŒã ã«æ°èŠã¡ã³ãããžã§ã€ã³ããã°ããã§ããªã³ããŒãã£ã³ã°ããã»ã¹ã«ã€ããŠèããŠãããšããã®çºè¡šã§ãããããã«ãã¹ãŠãåãå
¥ãããšããããã«ã¯ãããŸããããåŒç€Ÿã§ã®æ°äººè²æããã»ã¹ã®æ¹åã«ã€ãªãããã³ããããã€ãåŸããããšæããŸãã + +* ãªããžã§ã¯ãæåã¯æ¬åœã«å¿
èŠãïŒ (ããªãã²ããŠã ãããããã»ã ãã) + + * â»åœæ¥ D ããŒã«ã§ãããªãããã¢ã³ã«ã³ãã¡ã¬ã³ã¹ã»ãã·ã§ã³ã®ãããæ£åŒã¿ã€ãã«ã»ãªã³ã¯ãªã + * ç§èªèº«ãããªããžã§ã¯ãæåãã«ã€ããŠã¯è²ã
ãšèšãããããšãããã®ã§ãããã ããããã€ãŒããããããšããã§ãã + + * ããªããžã§ã¯ãæåã®è©±ã¯ããã©ãã€ã ã®ç°ãªãè€æ°ã®èšèªã«è§ŠããŠãããã©ããã§èŠãæ¹ããŸã£ããç°ãªãå°è±¡ããããOOPã¯ã©ãã§ãããã§ã (â»åäººã®ææ³ã§ã)ã ( [Twitter ã®ãã€ãŒããžã®ãªã³ã¯](https://twitter.com/nsfisis/status/1672502935983656960) ) + * ãOOPã¯çŸä»£ã®èšèªã§èããæå³ã¯ã»ãŒãªãå€ããã©ãã€ã ã ããšããç«å Žã§ãããOOPã«ã€ããŠããŸã倧ã£ãŽãã«è©±ããŠããšè²ããªãšããããåºãããããªãã§ããã (Twitterã¯å€§ã£ãŽããããªããã§ããïŒ)ã ( [Twitter ã®ãã€ãŒããžã®ãªã³ã¯](https://twitter.com/nsfisis/status/1672504892244787201) ) + +* [ãã®èª¬æãã³ãŒãã³ã¡ã³ãã«æžãïŒã³ãããã¡ãã»ãŒãžã«æžãïŒãã«ãªã¯ãšã¹ãã«æžãïŒ (ãããããïŒå²¡ç°æ£å¹³ ãã)](https://fortee.jp/phpconfukuoka-2023/proposal/ae71f3a7-4c3c-4c87-8816-8426bcc8d325) + + * Twitter ã«ããã€ãŒãããŸããããå®å
šã«èªåã®æèŠãšäžèŽããŠããã®ã§ããšãŠãå
±æã§ããŸãããä»åŸã¯ç€Ÿå
ã®ã³ãŒãã¬ãã¥ãŒæã«ããã¡ãã®è³æã貌ãã€ããããšã«ããŸãã + +{#outro} +# ãããã« + +å±
äœå°åããé¢ããå Žæãžã®é åŸåå ã¯åããŠã ã£ããã倧倿¥œãã (ãããå匷ã«ããªãïŒ) äœéšã ã£ãã +åãåã£ããç±ããå·ããåã«ãèªãã®æãåãããŠããããã diff --git a/vhosts/blog/content/posts/2023-06-25/phpconfuk-2023-report.ndoc b/vhosts/blog/content/posts/2023-06-25/phpconfuk-2023-report.ndoc deleted file mode 100644 index 39763514..00000000 --- a/vhosts/blog/content/posts/2023-06-25/phpconfuk-2023-report.ndoc +++ /dev/null @@ -1,106 +0,0 @@ ---- -[article] -uuid = "e1568c4c-9bdd-47b9-8b39-939ade4f3ba0" -title = "PHP ã«ã³ãã¡ã¬ã³ã¹çŠå²¡ 2023 åå ã¬ã" -description = "2023-06-24 ã«éå¬ããããPHP ã«ã³ãã¡ã¬ã³ã¹çŠå²¡ã«åå ããã" -tags = [ - "conference", - "php", - "phpconfuk", -] - -[[article.revisions]] -date = "2023-06-25" -remark = "å
¬é" ---- -<article> - <section id="intro"> - <h>ã¯ããã«</h> - <p> - 2023-06-24 ã«éå¬ãããã<a href="https://phpcon.fukuoka.jp/2023/">PHP ã«ã³ãã¡ã¬ã³ã¹çŠå²¡ 2023</a>ã«åå ããã - ãŸãããã®åæ¥ã«å¬ãããã<a href="https://connpass.com/event/282285/">éå
¬åŒã®åå€ç¥</a>ã«ãåå ããã - åå€ç¥ã§ã¯ã15åã®ç»å£ããããªã£ãã<a href="/slides/2023-06-23/phpconfuk-2023-eve/">ç»å£ã®æ¹ã®è³æã¯ãã¡ãã</a> - </p> - </section> - <section id="sessions-thoughts"> - <h>ã»ãã·ã§ã³ã®ææ³</h> - <section id="eve"> - <h>åå€ç¥</h> - <p> - â»ã»ãã·ã§ã³ã®é¡åãšçºè¡šè
åã¯ã<a href="https://connpass.com/event/282285/">åå€ç¥ã€ãã³ãã® connpass ããŒãž</a>ããåŒçšã - </p> - <ul> - <li> - ã¹ã¯ã©ã ïŒã®äžéšïŒãå°å
¥ããŠãããªã£ãããš (asumikam ãã) - <ul> - <li> - ã¹ã¯ã©ã ã®ãäžéšããå°å
¥ããããšããããšã§ããããçæ³çãªåœ¢ã§æ¹åãé²ãã§ããããã«èŠåããããŸããã - ç¹ã«ããã©ã³ãéçšããããã€é »åºŠããã£ãŒãããã¯ãµã€ã¯ã«ã«å€§ããå€åãèµ·ããŠããã®ã¯é©ãã¹ãææã ãšæããŸããã - </li> - </ul> - </li> - <li> - å°æ¹ã®å°ããªå匷äŒãäžçªã®æŽ»åèå°ã«ãã (tomio ãã) - <ul> - <li> - ãããŸããã»ã©ã®ãç±ããæããŸããã - ç§èªèº«ãæè¿ã«ãªã£ãŠã«ã³ãã¡ã¬ã³ã¹ãå匷äŒãžã®åå ã»ç»å£ã掻çºã«ãããªãããã«ãªã£ãããšã§ãé ·ãç¹ãå€ãã£ãã§ãã - </li> - </ul> - </li> - </ul> - </section> - <section id="conference"> - <h>ã«ã³ãã¡ã¬ã³ã¹</h> - <p> - â»ã»ãã·ã§ã³ã®é¡åãšçºè¡šè
åã¯ã<a href="https://fortee.jp/phpconfukuoka-2023/proposal/accepted">ã«ã³ãã¡ã¬ã³ã¹ã® fortee ããŒãž</a>ããåŒçšã - </p> - <ul> - <li> - <a href="https://fortee.jp/phpconfukuoka-2023/proposal/df5f06e8-900e-4e71-94d7-d0c3cc57a0ac">è²æå - ãšã³ãžãã¢ã®æèœãåŒãåºãç°å¢ãšãã¥ãŒã¿ãŒã®ç«ã¡åã - (å²¡åµ éå¹³ ãã)</a> - <ul> - <li> - ã¡ããã©åŒããŒã ã«æ°èŠã¡ã³ãããžã§ã€ã³ããã°ããã§ããªã³ããŒãã£ã³ã°ããã»ã¹ã«ã€ããŠèããŠãããšããã®çºè¡šã§ããã - ããã«ãã¹ãŠãåãå
¥ãããšããããã«ã¯ãããŸããããåŒç€Ÿã§ã®æ°äººè²æããã»ã¹ã®æ¹åã«ã€ãªãããã³ããããã€ãåŸããããšæããŸãã - </li> - </ul> - </li> - <li> - ãªããžã§ã¯ãæåã¯æ¬åœã«å¿
èŠãïŒ (ããªãã²ããŠã ãããããã»ã ãã) - <ul> - <li> - â»åœæ¥ D ããŒã«ã§ãããªãããã¢ã³ã«ã³ãã¡ã¬ã³ã¹ã»ãã·ã§ã³ã®ãããæ£åŒã¿ã€ãã«ã»ãªã³ã¯ãªã - </li> - <li> - ç§èªèº«ãããªããžã§ã¯ãæåãã«ã€ããŠã¯è²ã
ãšèšãããããšãããã®ã§ãããã ããããã€ãŒããããããšããã§ãã - <ul> - <li> - ããªããžã§ã¯ãæåã®è©±ã¯ããã©ãã€ã ã®ç°ãªãè€æ°ã®èšèªã«è§ŠããŠãããã©ããã§èŠãæ¹ããŸã£ããç°ãªãå°è±¡ããããOOPã¯ã©ãã§ãããã§ã (â»åäººã®ææ³ã§ã)ã (<a href="https://twitter.com/nsfisis/status/1672502935983656960">Twitter ã®ãã€ãŒããžã®ãªã³ã¯</a>) - </li> - <li> - ãOOPã¯çŸä»£ã®èšèªã§èããæå³ã¯ã»ãŒãªãå€ããã©ãã€ã ã ããšããç«å Žã§ãããOOPã«ã€ããŠããŸã倧ã£ãŽãã«è©±ããŠããšè²ããªãšããããåºãããããªãã§ããã (Twitterã¯å€§ã£ãŽããããªããã§ããïŒ)ã (<a href="https://twitter.com/nsfisis/status/1672504892244787201">Twitter ã®ãã€ãŒããžã®ãªã³ã¯</a>) - </li> - </ul> - </li> - </ul> - </li> - <li> - <a href="https://fortee.jp/phpconfukuoka-2023/proposal/ae71f3a7-4c3c-4c87-8816-8426bcc8d325">ãã®èª¬æãã³ãŒãã³ã¡ã³ãã«æžãïŒã³ãããã¡ãã»ãŒãžã«æžãïŒãã«ãªã¯ãšã¹ãã«æžãïŒ (ãããããïŒå²¡ç°æ£å¹³ ãã)</a> - <ul> - <li> - Twitter ã«ããã€ãŒãããŸããããå®å
šã«èªåã®æèŠãšäžèŽããŠããã®ã§ããšãŠãå
±æã§ããŸããã - ä»åŸã¯ç€Ÿå
ã®ã³ãŒãã¬ãã¥ãŒæã«ããã¡ãã®è³æã貌ãã€ããããšã«ããŸãã - </li> - </ul> - </li> - </ul> - </section> - </section> - <section id="outro"> - <h>ãããã«</h> - <p> - å±
äœå°åããé¢ããå Žæãžã®é åŸåå ã¯åããŠã ã£ããã倧倿¥œãã (ãããå匷ã«ããªãïŒ) äœéšã ã£ãã - åãåã£ããç±ããå·ããåã«ãèªãã®æãåãããŠããããã - </p> - </section> -</article> diff --git a/vhosts/blog/content/posts/2023-10-02/compile-php-runtime-to-wasm.dj b/vhosts/blog/content/posts/2023-10-02/compile-php-runtime-to-wasm.dj new file mode 100644 index 00000000..da7438ab --- /dev/null +++ b/vhosts/blog/content/posts/2023-10-02/compile-php-runtime-to-wasm.dj @@ -0,0 +1,286 @@ +--- +[article] +uuid = "0ed1ccc8-d437-481c-8cca-2131ce800cc0" +title = "PHP ã®åŠçç³»ã Emscripten ã§ WebAssembly ã«ã³ã³ãã€ã«ãã" +description = "PHP ã®åŠçç³» (php/php-src) ã Emscripten ã§ WebAssembly ã«ã³ã³ãã€ã«ããä»»æã®ã³ãŒããéé¢ãããç°å¢ã§è©äŸ¡ã§ããããã«ããã" +tags = [ + "php", + "wasm", +] + +[[article.revisions]] +date = "2023-10-02" +remark = "å
¬é" +--- +{#intro} +# ã¯ããã« + +[Emscripten](https://emscripten.org/) ãçšã㊠[PHP ã®åŠçç³»](https://github.com/php/php-src) ã [WebAssembly](https://developer.mozilla.org/docs/WebAssembly) ã«ã³ã³ãã€ã«ãããæ©èœãããçšåºŠçµãããšã§ãæã£ããããç°¡åã«å®çŸã§ããã®ã§ãåå¿é²ãšããŠèšããŠããã + +ãªãããã®èšäºã§ã¯ Emscripten ã WebAssembly ãšã¯äœãç¥ã£ãŠããããšãåæãšããã + +{#version} +# ããŒãžã§ã³æ
å ± + +ãã®èšäºäžã§äœ¿çšãããœãããŠã§ã¢çã®ããŒãžã§ã³ãèšèŒããã + +* Ubuntu 22.04 on WSL2 +* Docker version 24.0.6 +* Emscripten 3.1.46 +* Node.js 20.7.0 +* PHP 8.2.10 + +ãªããDocker ããäžã¯ Docker äžã§å°å
¥ããã®ã§ããã¹ããã·ã³ã«ã¯ã€ã³ã¹ããŒã«ããªããŠããã + +{#goal} +# æ¬èšäºã®ãŽãŒã« + +å
ã«ãã®èšäºã®ãŽãŒã«ã瀺ããŠããããããã瀺ãæé ã®ãšããã«é²ãããšã次ã®ãããªã³ãŒããåãããã«ãªãã +ãã®ã³ãŒãã¯ãã®ããšäœ¿ãã®ã§ã`index.mjs` ã®ååã§ä¿åããŠããããšã + +```javascript +import { readFile } from 'node:fs/promises'; +import PHPWasm from './php-wasm.mjs' + +const code = await readFile('/dev/stdin', { encoding: 'utf-8' }); + +const { ccall } = await PHPWasm(); +const result = ccall( + 'php_wasm_run', + 'number', ['string'], + [code], +); +console.log(`exit code: ${result}`); +``` + +æšæºå
¥åããäžããã³ãŒãã WebAssembly ã«ã³ã³ãã€ã«ããã PHP åŠçç³»ã®äžã§å®è¡ããŠããããã®ãã㪠`php-wasm.mjs` (ãšããããåŒã³åºããã `php-wasm.wasm`) ãäœæããã + +{#build} +# ãã«ã + +{#write-c-entrypoint} +## C ã®ãšã³ããªãã€ã³ããæžã + +å
ã»ã©ã®ã³ãŒãã§ã䜿ã£ãŠãããšã³ããªãã€ã³ãã§ãã `php_wasm_run` ãçšæããã + +```c +#include <stdio.h> +#include <emscripten.h> +#include <Zend/zend_execute.h> +#include <sapi/embed/php_embed.h> + +int EMSCRIPTEN_KEEPALIVE php_wasm_run(const char* code) { + zend_result result; + + int argc = 1; + char* argv[] = { "php.wasm", NULL }; + + PHP_EMBED_START_BLOCK(argc, argv); + + result = zend_eval_string_ex(code, NULL, "php.wasm code", 1); + + PHP_EMBED_END_BLOCK(); + + fprintf(stdout, "\n"); + fflush(stdout); + fprintf(stderr, "\n"); + fflush(stderr); + + return result == SUCCESS ? 0 : 1; +} +``` + +ã»ãšãã©ã¯ãã ã® PHP ã®å
¬é API ã䜿ã£ãã³ãŒãã ããEmscripten åãã®æ³šæç¹ã 2ç¹ããã + +ãŸã㯠`EMSCRIPTEN_KEEPALIVE` ã«ã€ããŠã +ãã㯠Emscripten ãçšæããŠããç¹æ®ãªãã¯ãã§ããã +ãã®ãã¯ããä»äžãããŠãã颿°ã¯ãã©ãããã䜿çšãããŠããªããšãã³ã³ãã€ã«åŸã® WebAssembly ãã€ããªããåé€ãããªãã +ãããããä»ãå¿ãããšãæªäœ¿çšã®é¢æ°ãšã¿ãªããåé€ãããã + +次ã«ãã³ãŒããè©äŸ¡ããããšã«åŒãã§ããæšæºåºåãšæšæºãšã©ãŒåºåã«å¯Ÿããæ¹è¡ã®åºåã«ã€ããŠã +åºåãããã¡ããåºåãããããã ããªãæ¹è¡ãåºåãããªããšã `fflush()` ã ãã§äºè¶³ãããšèããã®ã ãããªããšåããªãã£ãã®ã§è¿œå ããã +ããã«ãããPHP ã³ãŒãã®åºåã®åŸãã«äœåãªæ¹è¡ã远å ãããŠããŸãã +æ¹è¡ãåºåãããšããããã¡ãæ¶è²»ãããææ®µããåç¥ã®ããã¯ãæç€ºé¡ãããã + +{#compile-to-wasm} +## WebAssembly ã«ã³ã³ãã€ã«ãã + +ããã§ã¯ WebAssembly ã«ã³ã³ãã€ã«ããŠãããããããã㯠`Dockerfile` äžã®ã³ãã³ããšããŠæäœã瀺ãã + +ãŸã㯠[Emscripten å
¬åŒãæäŸããŠãã Docker ã€ã¡ãŒãž](https://hub.docker.com/r/emscripten/emsdk) ã䜿ã£ãŠãPHP åŠçç³»ãšå
ã»ã©ç€ºãã C èšèªã®ãœãŒã¹ã³ãŒãã WebAssembly ã«ã³ã³ãã€ã«ããã + +```dockerfile +FROM emscripten/emsdk:3.1.46 AS wasm-builder +``` + +次ã«ã [php/php-src](https://github.com/php/php-src) ãã PHP åŠçç³»ã®ãœãŒã¹ã³ãŒããååŸãããã«ãã«å¿
èŠãª apt ããã±ãŒãžãåã£ãŠããã +æå¹ã«ããæ¡åŒµãå¢ãããããªããããã§ã€ã³ã¹ããŒã«ããããã±ãŒãžãå¢ããããšã«ãªãã ããã + +```dockerfile +RUN git clone --depth=1 --branch=php-8.2.10 https://github.com/php/php-src + +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + autoconf \ + bison \ + pkg-config \ + re2c \ + && \ + : +``` + +ç¶ããŠãEmscripten ã®ããŒã«ãã§ã€ã³ãçšã㊠PHP åŠçç³»ããã«ãããã + +```dockerfile +RUN cd php-src && \ + ./buildconf --force && \ + emconfigure ./configure \ + --disable-all \ + --disable-mbregex \ + --disable-fiber-asm \ + --disable-cli \ + --disable-cgi \ + --disable-phpdbg \ + --enable-embed=static \ + --enable-mbstring \ + --without-iconv \ + --without-libxml \ + --without-pcre-jit \ + --without-pdo-sqlite \ + --without-sqlite3 \ + && \ + EMCC_CFLAGS='-s ERROR_ON_UNDEFINED_SYMBOLS=0' emmake make -j$(nproc) && \ + mv libs/libphp.a .. && \ + make clean && \ + git clean -fd && \ + : +``` + +ãããŸã§ãšæ¯ã¹ããšå°ãè€éãªã®ã§ããããã詳ããèŠãŠãããã + +ãŸãã`buildconf` 㯠PHP åŠçç³»ããã«ããããšãã« (Emscripten ãšã¯é¢ä¿ãªã) 䜿ãããŒã«ã§ããã +ãã®ããŒã«ã®æãéèŠãªä»äºã¯ã`configure` ã®çæã§ããã + +次㫠`configure` ããããã ããããã§ `emconfigure` ã䜿ãã +ããã䜿ãããšã§ãEmscripten ãäžæã諞ã
ã®ããŒã«ãã§ã€ã³ã WebAssembly ã®ãã«ãåãã«èª¿æŽããªãã `configure` ããŠãããã + +`configure` ã®åŸãã«æå®ããŠãããã©ã°ã¯ãéåžžã® PHP åŠçç³»ã®ãã«ãã§äœ¿ã `configure` ãšåããªã®ã§ã詳ããã¯ãã¡ãã® `cofigure --help` ãåç
§ããŠããã ãããã +ã»ãšãã©ã¯ãæ©èœã®ç¡å¹åã®ããã«æå®ããŠãã (äŸåããã©ã€ãã©ãªãæžããããã«ããããç°¡åã«ãããã)ã + +éåžžã® C ã®ãã«ããªãã`configure` ã®æ¬¡ã¯ `make` ãããšããã ããããã§ã `emmake` ã䜿ãã +圹å²ã¯ã»ãšãã© `emconfigure` ãšåæ§ã§ããã +æå®ããŠãã `EMCC_CFLAGS` ãšããç°å¢å€æ°ã¯ãEmscripten ã® C ã³ã³ãã€ã©ãžã®ãã©ã°ã§ãããã§ã¯ `ERROR_ON_UNDEFINED_SYMBOLS` ãç¡å¹åããŠããã +ããã«ãããã³ã³ãã€ã«äžã«åºçŸãã解決ã§ããªãã£ãã·ã³ãã«ãç¡èŠããããã«ãªã (代ããã«ããã®ã·ã³ãã«ãåŒãŒããšããã¿ã€ãã³ã°ã§å®è¡æãšã©ãŒã«ãªã)ã +ãã¹ãŠã®äŸåãå®å
šã«è§£æ±ºããã®ã¯é¢åãªã®ã§ãããŸã䜿ããªãæ©èœã«ã€ããŠã¯ç¡èŠããŠãããã ããã + +ãããŸã§ãå®è¡ãããš `libs/libphp.a` ãçæããããããã¯åŸã§äœ¿ãã®ã§ç§»åãããŠããã + +ããŠãPHP åŠçç³»ãã©ã€ãã©ãªåã§ããã®ã§ã次ã«å
ã»ã©èŒãã C ã®ãœãŒã¹ã³ãŒãããã«ãããŠãããã +`Dockerfile` ãšåãå Žæã« `php-wasm.c` ãšããååã§ä¿åããæ¬¡ã®ããã«ããã + +```dockerfile +COPY php-wasm.c /src/ + +RUN cd php-src && \ + emcc \ + -c \ + -o php-wasm.o \ + -I . \ + -I TSRM \ + -I Zend \ + -I main \ + ../php-wasm.c \ + && \ + mv php-wasm.o .. && \ + make clean && \ + git clean -fd && \ + : +``` + +`emcc` 㯠`cc` (C ã³ã³ãã€ã©/ãªã³ã«) ã® Emscripten çã§ã`-c` ã¯ãã³ã³ãã€ã«ãã®æã +`-o` ã `-I` ã¯æ®éã® C ã³ã³ãã€ã©ãšåæ§ãåºåãã¡ã€ã«ã®æå®ãšã€ã³ã¯ã«ãŒããã¹ã®æå®ã§ããã + +`libphp.a` ãš `php-wasm.o` ãæã«å
¥ã£ãã®ã§ããããããªã³ã¯ã㊠WebAssembly ã®ãã€ããªãšãã®ã©ããã§ãã JavaScript ãã¡ã€ã«ãçæããã +ããã«ã `emcc` ã³ãã³ãã䜿ãã + +```dockerfile +RUN emcc \ + -s ENVIRONMENT=node \ + -s ERROR_ON_UNDEFINED_SYMBOLS=0 \ + -s EXPORTED_RUNTIME_METHODS='["ccall"]' \ + -s EXPORT_ES6=1 \ + -s INITIAL_MEMORY=16777216 \ + -s INVOKE_RUN=0 \ + -s MODULARIZE=1 \ + -o php-wasm.js \ + php-wasm.o \ + libphp.a \ + ; +``` + +ããããã®ãã©ã°ã«ã€ããŠè§£èª¬ããã + +`-s ENVIRONMENT=node` ã¯ãçæãã WebAssembly/JavaScript ã®å®è¡ç°å¢ãæå®ããã +ä»å㯠`node` ãæå®ããŠããã®ã§ãNode.js åãã®ãã¡ã€ã«ãçæãããã + +`-s ERROR_ON_UNDEFINED_SYMBOLS=0` ã«ã€ããŠã¯ãã§ã«è¿°ã¹ãã®ã§çç¥ããã + +`-s EXPORTED_RUNTIME_METHODS='["ccall"]'` ã¯ãçæããã JavaScript ããå
¬éããã API ã§ããã +ãã§ã« `index.mjs` ã§äœ¿çšããŠãããã`ccall('颿°å', 'è¿ãå€ã®å', ['ä»®åŒæ°ã®å', ...], ['å®åŒæ°', ...])` ã®ããã«äœ¿ãã + +`-s EXPORT_ES6=1` ã¯ãJavaScript ã³ãŒãã ECMAScript 6 ã«æºæ ãã module ãšããŠçæããã +ãããæå®ããããšã§ã`require()` ã§ã¯ãªã `import` ã§ãã JavaScript ãçæãããããã + +`-s INITIAL_MEMORY=16777216` ã¯åŒãã§åã®ããšããçšéã«åãããŠé©åœã«æ±ºããŠã»ããã + +`-s INVOKE_RUN=0` ã¯ãmodule ãããŒããããšãã«åæã« `main()` ãåŒã¶ãã©ãã (ã ãšæã)ã +ä»å㯠`php_wasm_run()` ãã䜿ãã€ããããªãã®ã§åã£ãŠããã + +`-s MODULARIZE=1` ã¯ãå®è³ªçã«ã»ãŒå¿
é ã®ãªãã·ã§ã³ã§ããã1 ãæå®ããããšã§ãWebAssembly module ãã€ã³ã¹ã¿ã³ã¹åãã颿°ãããšã¯ã¹ããŒããããã㪠JavaScript ãã¡ã€ã«ãçæããããã«ãªãã +ãããæå®ããªããšãçæç©ã® JavaScript ãã¡ã€ã«ãèªã¿èŸŒããš WebAssembly module ãå³åº§ã«ã€ã³ã¹ã¿ã³ã¹åãããŠããŸããèµ·åã®ã¿ã€ãã³ã°ãå¶åŸ¡ã§ããªãã + +ãããŸã§å®è¡ãããšã`php-wasm.js` ãš `php-wasm.wasm` ãäœãããã +ã§ã¯ãããããã¯ãããã®å®è¡ç°å¢ãäœã£ãŠãããã + +ãšãã£ãŠããNode.js ã¯ãã«ãã€ã³ã§ WebAssembly ããµããŒãããŠããã®ã§ãã»ãšãã©ããããšã¯ãªãã +å
ã»ã©æ²èŒãã JavaScript ã®ã³ãŒãã¯ã`Dockerfile` ãšåããã£ã¬ã¯ããªã« `index.mjs` ã§é
眮ããããšã + +```dockerfile +FROM node:20.7 + +WORKDIR /app +COPY --from=wasm-builder /src/php-wasm.js /app/php-wasm.mjs +COPY --from=wasm-builder /src/php-wasm.wasm /app/php-wasm.wasm +COPY index.mjs /app/ + +ENTRYPOINT ["node", "index.mjs"] +``` + +{#run} +# å®è¡ + +`Dockerfile`ã`php-wasm.c`ã`index.mjs` ãçšæããããDocker ã³ã³ããããã«ãããŠå®è¡ããã + +```dockerfile +$ docker build -t php-wasm . +$ echo 'echo "Hello, World!", PHP_EOL;' | docker run --rm -i php-wasm +Hello, World! + + +exit code: 0 +``` + +{#outro} +# ãŸãšã + +[ãããŸã§ããŸãšãã Git ãªããžããª](https://github.com/nsfisis/tiny-php.wasm) ãçšæããã +ç°¡åã«ã³ã³ãã€ã«ã§ããã®ã§ãèå³ãããã°è©ŠããŠã¿ãŠã»ããã + +{#references} +# åèãªã³ã¯ + +* [php/php-src: ãã«ãã®æ¹æ³ã«ã€ããŠ](https://github.com/php/php-src) +* [Emscripten: ãã¥ãŒããªã¢ã«](https://emscripten.org/docs/getting_started/Tutorial.html) +* [Emscripten: ãã«ãã®åºæ¬](https://emscripten.org/docs/compiling/Building-Projects.html#building-projects) +* [Emscripten: `emcc` ãªã©ã®ãªãã¡ã¬ã³ã¹](https://emscripten.org/docs/tools_reference/emcc.html#emccdoc) +* [Emscripten: çæããã JavaScript ã® API](https://emscripten.org/docs/api_reference/module.html#module) diff --git a/vhosts/blog/content/posts/2023-10-02/compile-php-runtime-to-wasm.ndoc b/vhosts/blog/content/posts/2023-10-02/compile-php-runtime-to-wasm.ndoc deleted file mode 100644 index 19143c44..00000000 --- a/vhosts/blog/content/posts/2023-10-02/compile-php-runtime-to-wasm.ndoc +++ /dev/null @@ -1,335 +0,0 @@ ---- -[article] -uuid = "0ed1ccc8-d437-481c-8cca-2131ce800cc0" -title = "PHP ã®åŠçç³»ã Emscripten ã§ WebAssembly ã«ã³ã³ãã€ã«ãã" -description = "PHP ã®åŠçç³» (php/php-src) ã Emscripten ã§ WebAssembly ã«ã³ã³ãã€ã«ããä»»æã®ã³ãŒããéé¢ãããç°å¢ã§è©äŸ¡ã§ããããã«ããã" -tags = [ - "php", - "wasm", -] - -[[article.revisions]] -date = "2023-10-02" -remark = "å
¬é" ---- -<article> - <section id="intro"> - <h>ã¯ããã«</h> - <p> - <a href="https://emscripten.org/">Emscripten</a> ãçšã㊠<a href="https://github.com/php/php-src">PHP ã®åŠçç³»</a>ã <a href="https://developer.mozilla.org/docs/WebAssembly">WebAssembly</a> ã«ã³ã³ãã€ã«ãããæ©èœãããçšåºŠçµãããšã§ãæã£ããããç°¡åã«å®çŸã§ããã®ã§ãåå¿é²ãšããŠèšããŠããã - </p> - <p> - ãªãããã®èšäºã§ã¯ Emscripten ã WebAssembly ãšã¯äœãç¥ã£ãŠããããšãåæãšããã - </p> - </section> - <section id="version"> - <h>ããŒãžã§ã³æ
å ±</h> - <p> - ãã®èšäºäžã§äœ¿çšãããœãããŠã§ã¢çã®ããŒãžã§ã³ãèšèŒããã - </p> - <ul> - <li>Ubuntu 22.04 on WSL2</li> - <li>Docker version 24.0.6</li> - <li>Emscripten 3.1.46</li> - <li>Node.js 20.7.0</li> - <li>PHP 8.2.10</li> - </ul> - <p> - ãªããDocker ããäžã¯ Docker äžã§å°å
¥ããã®ã§ããã¹ããã·ã³ã«ã¯ã€ã³ã¹ããŒã«ããªããŠããã - </p> - </section> - <section id="goal"> - <h>æ¬èšäºã®ãŽãŒã«</h> - <p> - å
ã«ãã®èšäºã®ãŽãŒã«ã瀺ããŠããããããã瀺ãæé ã®ãšããã«é²ãããšã次ã®ãããªã³ãŒããåãããã«ãªãã - ãã®ã³ãŒãã¯ãã®ããšäœ¿ãã®ã§ã<code>index.mjs</code> ã®ååã§ä¿åããŠããããšã - </p> - <codeblock language="javascript"> - <![CDATA[ - import { readFile } from 'node:fs/promises'; - import PHPWasm from './php-wasm.mjs' - - const code = await readFile('/dev/stdin', { encoding: 'utf-8' }); - - const { ccall } = await PHPWasm(); - const result = ccall( - 'php_wasm_run', - 'number', ['string'], - [code], - ); - console.log(`exit code: ${result}`); - ]]> - </codeblock> - <p> - æšæºå
¥åããäžããã³ãŒãã WebAssembly ã«ã³ã³ãã€ã«ããã PHP åŠçç³»ã®äžã§å®è¡ããŠããããã®ãã㪠<code>php-wasm.mjs</code> (ãšããããåŒã³åºããã <code>php-wasm.wasm</code>) ãäœæããã - </p> - </section> - <section id="build"> - <h>ãã«ã</h> - <section id="write-c-entrypoint"> - <h>C ã®ãšã³ããªãã€ã³ããæžã</h> - <p> - å
ã»ã©ã®ã³ãŒãã§ã䜿ã£ãŠãããšã³ããªãã€ã³ãã§ãã <code>php_wasm_run</code> ãçšæããã - </p> - <codeblock language="c"> - <![CDATA[ - #include <stdio.h> - #include <emscripten.h> - #include <Zend/zend_execute.h> - #include <sapi/embed/php_embed.h> - - int EMSCRIPTEN_KEEPALIVE php_wasm_run(const char* code) { - zend_result result; - - int argc = 1; - char* argv[] = { "php.wasm", NULL }; - - PHP_EMBED_START_BLOCK(argc, argv); - - result = zend_eval_string_ex(code, NULL, "php.wasm code", 1); - - PHP_EMBED_END_BLOCK(); - - fprintf(stdout, "\n"); - fflush(stdout); - fprintf(stderr, "\n"); - fflush(stderr); - - return result == SUCCESS ? 0 : 1; - } - ]]> - </codeblock> - <p> - ã»ãšãã©ã¯ãã ã® PHP ã®å
¬é API ã䜿ã£ãã³ãŒãã ããEmscripten åãã®æ³šæç¹ã 2ç¹ããã - </p> - <p> - ãŸã㯠<code>EMSCRIPTEN_KEEPALIVE</code> ã«ã€ããŠã - ãã㯠Emscripten ãçšæããŠããç¹æ®ãªãã¯ãã§ããã - ãã®ãã¯ããä»äžãããŠãã颿°ã¯ãã©ãããã䜿çšãããŠããªããšãã³ã³ãã€ã«åŸã® WebAssembly ãã€ããªããåé€ãããªãã - ãããããä»ãå¿ãããšãæªäœ¿çšã®é¢æ°ãšã¿ãªããåé€ãããã - </p> - <p> - 次ã«ãã³ãŒããè©äŸ¡ããããšã«åŒãã§ããæšæºåºåãšæšæºãšã©ãŒåºåã«å¯Ÿããæ¹è¡ã®åºåã«ã€ããŠã - åºåãããã¡ããåºåãããããã ããªãæ¹è¡ãåºåãããªããšã <code>fflush()</code> ã ãã§äºè¶³ãããšèããã®ã ãããªããšåããªãã£ãã®ã§è¿œå ããã - ããã«ãããPHP ã³ãŒãã®åºåã®åŸãã«äœåãªæ¹è¡ã远å ãããŠããŸãã - æ¹è¡ãåºåãããšããããã¡ãæ¶è²»ãããææ®µããåç¥ã®ããã¯ãæç€ºé¡ãããã - </p> - </section> - <section id="compile-to-wasm"> - <h>WebAssembly ã«ã³ã³ãã€ã«ãã</h> - <p> - ããã§ã¯ WebAssembly ã«ã³ã³ãã€ã«ããŠãããããããã㯠<code>Dockerfile</code> äžã®ã³ãã³ããšããŠæäœã瀺ãã - </p> - <p> - ãŸã㯠<a href="https://hub.docker.com/r/emscripten/emsdk">Emscripten å
¬åŒãæäŸããŠãã Docker ã€ã¡ãŒãž</a>ã䜿ã£ãŠãPHP åŠçç³»ãšå
ã»ã©ç€ºãã C èšèªã®ãœãŒã¹ã³ãŒãã WebAssembly ã«ã³ã³ãã€ã«ããã - </p> - <codeblock language="dockerfile"> - <![CDATA[ - FROM emscripten/emsdk:3.1.46 AS wasm-builder - ]]> - </codeblock> - <p> - 次ã«ã<a href="https://github.com/php/php-src">php/php-src</a> ãã PHP åŠçç³»ã®ãœãŒã¹ã³ãŒããååŸãããã«ãã«å¿
èŠãª apt ããã±ãŒãžãåã£ãŠããã - æå¹ã«ããæ¡åŒµãå¢ãããããªããããã§ã€ã³ã¹ããŒã«ããããã±ãŒãžãå¢ããããšã«ãªãã ããã - </p> - <codeblock language="dockerfile"> - <![CDATA[ - RUN git clone --depth=1 --branch=php-8.2.10 https://github.com/php/php-src - - RUN apt-get update && \ - apt-get install -y --no-install-recommends \ - autoconf \ - bison \ - pkg-config \ - re2c \ - && \ - : - ]]> - </codeblock> - <p> - ç¶ããŠãEmscripten ã®ããŒã«ãã§ã€ã³ãçšã㊠PHP åŠçç³»ããã«ãããã - </p> - <codeblock language="dockerfile"> - <![CDATA[ - RUN cd php-src && \ - ./buildconf --force && \ - emconfigure ./configure \ - --disable-all \ - --disable-mbregex \ - --disable-fiber-asm \ - --disable-cli \ - --disable-cgi \ - --disable-phpdbg \ - --enable-embed=static \ - --enable-mbstring \ - --without-iconv \ - --without-libxml \ - --without-pcre-jit \ - --without-pdo-sqlite \ - --without-sqlite3 \ - && \ - EMCC_CFLAGS='-s ERROR_ON_UNDEFINED_SYMBOLS=0' emmake make -j$(nproc) && \ - mv libs/libphp.a .. && \ - make clean && \ - git clean -fd && \ - : - ]]> - </codeblock> - <p> - ãããŸã§ãšæ¯ã¹ããšå°ãè€éãªã®ã§ããããã詳ããèŠãŠãããã - </p> - <p> - ãŸãã<code>buildconf</code> 㯠PHP åŠçç³»ããã«ããããšãã« (Emscripten ãšã¯é¢ä¿ãªã) 䜿ãããŒã«ã§ããã - ãã®ããŒã«ã®æãéèŠãªä»äºã¯ã<code>configure</code> ã®çæã§ããã - </p> - <p> - 次㫠<code>configure</code> ããããã ããããã§ <code>emconfigure</code> ã䜿ãã - ããã䜿ãããšã§ãEmscripten ãäžæã諞ã
ã®ããŒã«ãã§ã€ã³ã WebAssembly ã®ãã«ãåãã«èª¿æŽããªãã <code>configure</code> ããŠãããã - </p> - <p> - <code>configure</code> ã®åŸãã«æå®ããŠãããã©ã°ã¯ãéåžžã® PHP åŠçç³»ã®ãã«ãã§äœ¿ã <code>configure</code> ãšåããªã®ã§ã詳ããã¯ãã¡ãã® <code>cofigure --help</code> ãåç
§ããŠããã ãããã - ã»ãšãã©ã¯ãæ©èœã®ç¡å¹åã®ããã«æå®ããŠãã (äŸåããã©ã€ãã©ãªãæžããããã«ããããç°¡åã«ãããã)ã - </p> - <p> - éåžžã® C ã®ãã«ããªãã<code>configure</code> ã®æ¬¡ã¯ <code>make</code> ãããšããã ããããã§ã <code>emmake</code> ã䜿ãã - 圹å²ã¯ã»ãšãã© <code>emconfigure</code> ãšåæ§ã§ããã - æå®ããŠãã <code>EMCC_CFLAGS</code> ãšããç°å¢å€æ°ã¯ãEmscripten ã® C ã³ã³ãã€ã©ãžã®ãã©ã°ã§ãããã§ã¯ <code>ERROR_ON_UNDEFINED_SYMBOLS</code> ãç¡å¹åããŠããã - ããã«ãããã³ã³ãã€ã«äžã«åºçŸãã解決ã§ããªãã£ãã·ã³ãã«ãç¡èŠããããã«ãªã (代ããã«ããã®ã·ã³ãã«ãåŒãŒããšããã¿ã€ãã³ã°ã§å®è¡æãšã©ãŒã«ãªã)ã - ãã¹ãŠã®äŸåãå®å
šã«è§£æ±ºããã®ã¯é¢åãªã®ã§ãããŸã䜿ããªãæ©èœã«ã€ããŠã¯ç¡èŠããŠãããã ããã - </p> - <p> - ãããŸã§ãå®è¡ãããš <code>libs/libphp.a</code> ãçæããããããã¯åŸã§äœ¿ãã®ã§ç§»åãããŠããã - </p> - <p> - ããŠãPHP åŠçç³»ãã©ã€ãã©ãªåã§ããã®ã§ã次ã«å
ã»ã©èŒãã C ã®ãœãŒã¹ã³ãŒãããã«ãããŠãããã - <code>Dockerfile</code> ãšåãå Žæã« <code>php-wasm.c</code> ãšããååã§ä¿åããæ¬¡ã®ããã«ããã - </p> - <codeblock language="dockerfile"> - <![CDATA[ - COPY php-wasm.c /src/ - - RUN cd php-src && \ - emcc \ - -c \ - -o php-wasm.o \ - -I . \ - -I TSRM \ - -I Zend \ - -I main \ - ../php-wasm.c \ - && \ - mv php-wasm.o .. && \ - make clean && \ - git clean -fd && \ - : - ]]> - </codeblock> - <p> - <code>emcc</code> 㯠<code>cc</code> (C ã³ã³ãã€ã©/ãªã³ã«) ã® Emscripten çã§ã<code>-c</code> ã¯ãã³ã³ãã€ã«ãã®æã - <code>-o</code> ã <code>-I</code> ã¯æ®éã® C ã³ã³ãã€ã©ãšåæ§ãåºåãã¡ã€ã«ã®æå®ãšã€ã³ã¯ã«ãŒããã¹ã®æå®ã§ããã - </p> - <p> - <code>libphp.a</code> ãš <code>php-wasm.o</code> ãæã«å
¥ã£ãã®ã§ããããããªã³ã¯ã㊠WebAssembly ã®ãã€ããªãšãã®ã©ããã§ãã JavaScript ãã¡ã€ã«ãçæããã - ããã«ã <code>emcc</code> ã³ãã³ãã䜿ãã - </p> - <codeblock language="dockerfile"> - <![CDATA[ - RUN emcc \ - -s ENVIRONMENT=node \ - -s ERROR_ON_UNDEFINED_SYMBOLS=0 \ - -s EXPORTED_RUNTIME_METHODS='["ccall"]' \ - -s EXPORT_ES6=1 \ - -s INITIAL_MEMORY=16777216 \ - -s INVOKE_RUN=0 \ - -s MODULARIZE=1 \ - -o php-wasm.js \ - php-wasm.o \ - libphp.a \ - ; - ]]> - </codeblock> - <p> - ããããã®ãã©ã°ã«ã€ããŠè§£èª¬ããã - </p> - <p> - <code>-s ENVIRONMENT=node</code> ã¯ãçæãã WebAssembly/JavaScript ã®å®è¡ç°å¢ãæå®ããã - ä»å㯠<code>node</code> ãæå®ããŠããã®ã§ãNode.js åãã®ãã¡ã€ã«ãçæãããã - </p> - <p> - <code>-s ERROR_ON_UNDEFINED_SYMBOLS=0</code> ã«ã€ããŠã¯ãã§ã«è¿°ã¹ãã®ã§çç¥ããã - </p> - <p> - <code>-s EXPORTED_RUNTIME_METHODS='["ccall"]'</code> ã¯ãçæããã JavaScript ããå
¬éããã API ã§ããã - ãã§ã« <code>index.mjs</code> ã§äœ¿çšããŠãããã<code>ccall('颿°å', 'è¿ãå€ã®å', ['ä»®åŒæ°ã®å', ...], ['å®åŒæ°', ...])</code> ã®ããã«äœ¿ãã - </p> - <p> - <code>-s EXPORT_ES6=1</code> ã¯ãJavaScript ã³ãŒãã ECMAScript 6 ã«æºæ ãã module ãšããŠçæããã - ãããæå®ããããšã§ã<code>require()</code> ã§ã¯ãªã <code>import</code> ã§ãã JavaScript ãçæãããããã - </p> - <p> - <code>-s INITIAL_MEMORY=16777216</code> ã¯åŒãã§åã®ããšããçšéã«åãããŠé©åœã«æ±ºããŠã»ããã - </p> - <p> - <code>-s INVOKE_RUN=0</code> ã¯ãmodule ãããŒããããšãã«åæã« <code>main()</code> ãåŒã¶ãã©ãã (ã ãšæã)ã - ä»å㯠<code>php_wasm_run()</code> ãã䜿ãã€ããããªãã®ã§åã£ãŠããã - </p> - <p> - <code>-s MODULARIZE=1</code> ã¯ãå®è³ªçã«ã»ãŒå¿
é ã®ãªãã·ã§ã³ã§ããã1 ãæå®ããããšã§ãWebAssembly module ãã€ã³ã¹ã¿ã³ã¹åãã颿°ãããšã¯ã¹ããŒããããã㪠JavaScript ãã¡ã€ã«ãçæããããã«ãªãã - ãããæå®ããªããšãçæç©ã® JavaScript ãã¡ã€ã«ãèªã¿èŸŒããš WebAssembly module ãå³åº§ã«ã€ã³ã¹ã¿ã³ã¹åãããŠããŸããèµ·åã®ã¿ã€ãã³ã°ãå¶åŸ¡ã§ããªãã - </p> - <p> - ãããŸã§å®è¡ãããšã<code>php-wasm.js</code> ãš <code>php-wasm.wasm</code> ãäœãããã - ã§ã¯ãããããã¯ãããã®å®è¡ç°å¢ãäœã£ãŠãããã - </p> - <p> - ãšãã£ãŠããNode.js ã¯ãã«ãã€ã³ã§ WebAssembly ããµããŒãããŠããã®ã§ãã»ãšãã©ããããšã¯ãªãã - å
ã»ã©æ²èŒãã JavaScript ã®ã³ãŒãã¯ã<code>Dockerfile</code> ãšåããã£ã¬ã¯ããªã« <code>index.mjs</code> ã§é
眮ããããšã - </p> - <codeblock language="dockerfile"> - <![CDATA[ - FROM node:20.7 - - WORKDIR /app - COPY --from=wasm-builder /src/php-wasm.js /app/php-wasm.mjs - COPY --from=wasm-builder /src/php-wasm.wasm /app/php-wasm.wasm - COPY index.mjs /app/ - - ENTRYPOINT ["node", "index.mjs"] - ]]> - </codeblock> - </section> - </section> - <section id="run"> - <h>å®è¡</h> - <p> - <code>Dockerfile</code>ã<code>php-wasm.c</code>ã<code>index.mjs</code> ãçšæããããDocker ã³ã³ããããã«ãããŠå®è¡ããã - </p> - <codeblock language="dockerfile"> - <![CDATA[ - $ docker build -t php-wasm . - $ echo 'echo "Hello, World!", PHP_EOL;' | docker run --rm -i php-wasm - Hello, World! - - - exit code: 0 - ]]> - </codeblock> - </section> - <section id="outro"> - <h>ãŸãšã</h> - <p> - <a href="https://github.com/nsfisis/tiny-php.wasm">ãããŸã§ããŸãšãã Git ãªããžããª</a>ãçšæããã - ç°¡åã«ã³ã³ãã€ã«ã§ããã®ã§ãèå³ãããã°è©ŠããŠã¿ãŠã»ããã - </p> - </section> - <section id="references"> - <h>åèãªã³ã¯</h> - <ul> - <li><a href="https://github.com/php/php-src">php/php-src: ãã«ãã®æ¹æ³ã«ã€ããŠ</a></li> - <li><a href="https://emscripten.org/docs/getting_started/Tutorial.html">Emscripten: ãã¥ãŒããªã¢ã«</a></li> - <li><a href="https://emscripten.org/docs/compiling/Building-Projects.html#building-projects">Emscripten: ãã«ãã®åºæ¬</a></li> - <li><a href="https://emscripten.org/docs/tools_reference/emcc.html#emccdoc">Emscripten: <code>emcc</code> ãªã©ã®ãªãã¡ã¬ã³ã¹</a></li> - <li><a href="https://emscripten.org/docs/api_reference/module.html#module">Emscripten: çæããã JavaScript ã® API</a></li> - </ul> - </section> -</article> diff --git a/vhosts/blog/content/posts/2023-10-13/i-entered-the-open-university-of-japan.dj b/vhosts/blog/content/posts/2023-10-13/i-entered-the-open-university-of-japan.dj new file mode 100644 index 00000000..1347d901 --- /dev/null +++ b/vhosts/blog/content/posts/2023-10-13/i-entered-the-open-university-of-japan.dj @@ -0,0 +1,22 @@ +--- +[article] +uuid = "78419bf2-a1e6-421f-875b-3d93e777b04f" +title = "æŸé倧åŠã«å
¥åŠããŸãã" +description = "æŸé倧åŠã«å
¥åŠããŸãããé 匵ããŸãã" +tags = [ + "ouj", +] + +[[article.revisions]] +date = "2023-10-13" +remark = "å
¬é" +--- +{#i-entered-ouj} +# æŸé倧åŠã«å
¥åŠããŸãã + +ãšãããã£ããããããããäžåºŠå€§åŠçãããããšã«ããŸããã +ä»äºã®ã»ããããããŸã§ã©ãããã«ã¿ã€ã ã§ç¶ããŠãããŸãã + +é»ã£ãŠãããããå
¬è¡šããã»ããã¢ãããŒã·ã§ã³ã®åäžã«ç¹ããã ãããšæãããã®ããã°ã«èšäºãšããŠèŒããŸããã + +以äžãçãã§ããå ±åã§ããã diff --git a/vhosts/blog/content/posts/2023-10-13/i-entered-the-open-university-of-japan.ndoc b/vhosts/blog/content/posts/2023-10-13/i-entered-the-open-university-of-japan.ndoc deleted file mode 100644 index 31927141..00000000 --- a/vhosts/blog/content/posts/2023-10-13/i-entered-the-open-university-of-japan.ndoc +++ /dev/null @@ -1,28 +0,0 @@ ---- -[article] -uuid = "78419bf2-a1e6-421f-875b-3d93e777b04f" -title = "æŸé倧åŠã«å
¥åŠããŸãã" -description = "æŸé倧åŠã«å
¥åŠããŸãããé 匵ããŸãã" -tags = [ - "ouj", -] - -[[article.revisions]] -date = "2023-10-13" -remark = "å
¬é" ---- -<article> - <section id="i-entered-ouj"> - <h>æŸé倧åŠã«å
¥åŠããŸãã</h> - <p> - ãšãããã£ããããããããäžåºŠå€§åŠçãããããšã«ããŸããã - ä»äºã®ã»ããããããŸã§ã©ãããã«ã¿ã€ã ã§ç¶ããŠãããŸãã - </p> - <p> - é»ã£ãŠãããããå
¬è¡šããã»ããã¢ãããŒã·ã§ã³ã®åäžã«ç¹ããã ãããšæãããã®ããã°ã«èšäºãšããŠèŒããŸããã - </p> - <p> - 以äžãçãã§ããå ±åã§ããã - </p> - </section> -</article> diff --git a/vhosts/blog/content/posts/2023-12-03/isucon-13.dj b/vhosts/blog/content/posts/2023-12-03/isucon-13.dj new file mode 100644 index 00000000..991ef433 --- /dev/null +++ b/vhosts/blog/content/posts/2023-12-03/isucon-13.dj @@ -0,0 +1,75 @@ +--- +[article] +uuid = "d0c404bb-4700-4a6f-9911-621e9872d8c6" +title = "ISUCON 13 ã«åå ãã" +description = "ISUCON 13 ã«åå ãããããŒã åããã€ãããããæçµã¹ã³ã¢ 13,580 ç¹" +tags = [ + "isucon", +] + +[[article.revisions]] +date = "2023-12-03" +remark = "å
¬é" +--- +{#intro} +# ã¯ããã« + +å
æ¥ 11æ25æ¥ã [ISUCON 13](https://isucon.net/archives/57801192.html) ã«åå ããã +ISUCON ãžã®åå ã¯ä»åãåããŠãšãªãã +ç§ nsfisis ã®1人ããŒã ããã€ãããããšããŠåå ããæçµã¹ã³ã¢ã¯ 13,580 ç¹ã ã£ãã䜿çšèšèªã¯ Goã + +::: note +ãISUCONãã¯ãLINEã€ããŒæ ªåŒäŒç€Ÿã®åæšãŸãã¯ç»é²åæšã§ãã [ISUCON å
¬åŒãµã€ãã¯ãã¡ãã](https://isucon.net/) +::: + +{#goals} +# ç®æš + +ä»åã¯ååå ãšããããšããããç®æšã以äžã®ããã«å®ããã + +* æ£ã®ã¹ã³ã¢ãåã + + * ISUCON ã§ã¯ãµãŒãåäœã®æŽåæ§ããã§ãã¯ããã倱æãããšã¹ã³ã¢ 0 ãšãªã + +* é床æ¹å以å€ã«æéãæµªè²»ããªã (= ããããªã) + + * ããããžã§ãã³ã°ããããã°ãããã«ãŠã§ã¢ã®èšå®æ¹æ³ã®èª¿æ»ãªã©ãæ§èœæ¹åã«å¯äžããªãæéãæå°éã«ãã + +{#strategy} +# æŠç¥ + +ISUCON ã§é«ã¹ã³ã¢ãåºãæŠç¥ã«ã€ããŠã¯ãæŠéåã®é«ãæ¹ã
ãè¯è³ªãªèšäºãæžããŠãã ãã£ãŠããã +ããã§ã¯ãäžè¿°ãããããªäœãç®æšãéæããããã®æŠç¥ã«ã€ããŠæžãããšæãã + +{#do-not-destroy-environment} +## ç°å¢ãç Žå£ããªã + +ããã«ãŠã§ã¢ã®èšå®ãã¢ããªã±ãŒã·ã§ã³ã³ãŒããªã©ã倿Žãå ãããããããã®ã¯ãå¿
ãããã¯ã¢ãããåãã Git ã§ç®¡çããã +埩æ§äžèœã«ãªã£ãŠç°å¢ããšäœãçŽãããšã ãã¯å¿
ãé¿ããã + +{#revert-changes-immediately} +## ããã«å€æŽãåãæ¶ã + +ããã§ãå£ããŠããŸã£ããšãã¯ãå³åº§ã«å€æŽãåãæ¶ããå£ããçç±ã調ã¹ãããšã«åºå·ããªãã + +{#do-small-deployment} +## å°ãããããã€ãã + +äžåºŠã«è€æ°ã®å€æŽãå ãããå¯èœãªéãå°ããªåäœã§ãããã€ããããããŠãã®éœåºŠãã³ãããŒã¯ãèµ°ãããæŽåæ§ãã§ãã¯ãéããã©ããã (åœç¶éããªã£ãŠãããã©ããã) 確ãããã + +{#use-familiar-tools} +## 䜿ãæ
£ããéå
·ã䜿ã + +䜿çšããèšèªãããã«ãŠã§ã¢ãããŒã«é¡ãã䜿ãæ
£ãããã®ã«éå®ããã +ããã®ããŒã«ã®ãªãã·ã§ã³ã¯ã»ãšãã©ããã§æå®ã§ããããšèšãããããªãã®ã ãã䜿ãã +ãèªåã§ã¯äœ¿ã£ãããšããªãã ISUCON 匷è
ããå§ãããŠããããšãã£ãçç±ã§ããŒã«ãéžå®ããªã (ãã¡ãããæ¬çªãŸã§ã«ç·Žç¿ããŠç¿çãããšããéžæè¢ã¯ååšãã)ã + +{#performance-optimization} +# ããã©ãŒãã³ã¹ã®æé©å + +ãã£ãšåŒ·ã人ã®èšäºãåèã«ããŠã»ããã + +{#outro} +# ãããã« + +äºåã®æºåãå«ããŠã倧倿¥œããã€ãã³ãã ã£ããæ¬¡åããããªãæ¯éãŸãåå ãããããã®éã¯ãé äœãã¹ã³ã¢ãç®æšãšããŠç«ãŠãããããã«ãªããããã®ã§ããã diff --git a/vhosts/blog/content/posts/2023-12-03/isucon-13.ndoc b/vhosts/blog/content/posts/2023-12-03/isucon-13.ndoc deleted file mode 100644 index 30b82b9f..00000000 --- a/vhosts/blog/content/posts/2023-12-03/isucon-13.ndoc +++ /dev/null @@ -1,92 +0,0 @@ ---- -[article] -uuid = "d0c404bb-4700-4a6f-9911-621e9872d8c6" -title = "ISUCON 13 ã«åå ãã" -description = "ISUCON 13 ã«åå ãããããŒã åããã€ãããããæçµã¹ã³ã¢ 13,580 ç¹" -tags = [ - "isucon", -] - -[[article.revisions]] -date = "2023-12-03" -remark = "å
¬é" ---- -<article> - <section id="intro"> - <h>ã¯ããã«</h> - <p> - å
æ¥ 11æ25æ¥ã<a href="https://isucon.net/archives/57801192.html">ISUCON 13</a> ã«åå ããã - ISUCON ãžã®åå ã¯ä»åãåããŠãšãªãã - ç§ nsfisis ã®1人ããŒã ããã€ãããããšããŠåå ããæçµã¹ã³ã¢ã¯ 13,580 ç¹ã ã£ãã䜿çšèšèªã¯ Goã - </p> - <note> - ãISUCONãã¯ãLINEã€ããŒæ ªåŒäŒç€Ÿã®åæšãŸãã¯ç»é²åæšã§ãã<a href="https://isucon.net/">ISUCON å
¬åŒãµã€ãã¯ãã¡ãã</a> - </note> - </section> - <section id="goals"> - <h>ç®æš</h> - <p> - ä»åã¯ååå ãšããããšããããç®æšã以äžã®ããã«å®ããã - </p> - <ul> - <li> - æ£ã®ã¹ã³ã¢ãåã - <ul> - <li>ISUCON ã§ã¯ãµãŒãåäœã®æŽåæ§ããã§ãã¯ããã倱æãããšã¹ã³ã¢ 0 ãšãªã</li> - </ul> - </li> - <li> - é床æ¹å以å€ã«æéãæµªè²»ããªã (= ããããªã) - <ul> - <li>ããããžã§ãã³ã°ããããã°ãããã«ãŠã§ã¢ã®èšå®æ¹æ³ã®èª¿æ»ãªã©ãæ§èœæ¹åã«å¯äžããªãæéãæå°éã«ãã</li> - </ul> - </li> - </ul> - </section> - <section id="strategy"> - <h>æŠç¥</h> - <p> - ISUCON ã§é«ã¹ã³ã¢ãåºãæŠç¥ã«ã€ããŠã¯ãæŠéåã®é«ãæ¹ã
ãè¯è³ªãªèšäºãæžããŠãã ãã£ãŠããã - ããã§ã¯ãäžè¿°ãããããªäœãç®æšãéæããããã®æŠç¥ã«ã€ããŠæžãããšæãã - </p> - <section id="do-not-destroy-environment"> - <h>ç°å¢ãç Žå£ããªã</h> - <p> - ããã«ãŠã§ã¢ã®èšå®ãã¢ããªã±ãŒã·ã§ã³ã³ãŒããªã©ã倿Žãå ãããããããã®ã¯ãå¿
ãããã¯ã¢ãããåãã Git ã§ç®¡çããã - 埩æ§äžèœã«ãªã£ãŠç°å¢ããšäœãçŽãããšã ãã¯å¿
ãé¿ããã - </p> - </section> - <section id="revert-changes-immediately"> - <h>ããã«å€æŽãåãæ¶ã</h> - <p> - ããã§ãå£ããŠããŸã£ããšãã¯ãå³åº§ã«å€æŽãåãæ¶ããå£ããçç±ã調ã¹ãããšã«åºå·ããªãã - </p> - </section> - <section id="do-small-deployment"> - <h>å°ãããããã€ãã</h> - <p> - äžåºŠã«è€æ°ã®å€æŽãå ãããå¯èœãªéãå°ããªåäœã§ãããã€ããããããŠãã®éœåºŠãã³ãããŒã¯ãèµ°ãããæŽåæ§ãã§ãã¯ãéããã©ããã (åœç¶éããªã£ãŠãããã©ããã) 確ãããã - </p> - </section> - <section id="use-familiar-tools"> - <h>䜿ãæ
£ããéå
·ã䜿ã</h> - <p> - 䜿çšããèšèªãããã«ãŠã§ã¢ãããŒã«é¡ãã䜿ãæ
£ãããã®ã«éå®ããã - ããã®ããŒã«ã®ãªãã·ã§ã³ã¯ã»ãšãã©ããã§æå®ã§ããããšèšãããããªãã®ã ãã䜿ãã - ãèªåã§ã¯äœ¿ã£ãããšããªãã ISUCON 匷è
ããå§ãããŠããããšãã£ãçç±ã§ããŒã«ãéžå®ããªã (ãã¡ãããæ¬çªãŸã§ã«ç·Žç¿ããŠç¿çãããšããéžæè¢ã¯ååšãã)ã - </p> - </section> - </section> - <section id="performance-optimization"> - <h>ããã©ãŒãã³ã¹ã®æé©å</h> - <p> - ãã£ãšåŒ·ã人ã®èšäºãåèã«ããŠã»ããã - </p> - </section> - <section id="outro"> - <h>ãããã«</h> - <p> - äºåã®æºåãå«ããŠã倧倿¥œããã€ãã³ãã ã£ããæ¬¡åããããªãæ¯éãŸãåå ãããããã®éã¯ãé äœãã¹ã³ã¢ãç®æšãšããŠç«ãŠãããããã«ãªããããã®ã§ããã - </p> - </section> -</article> diff --git a/vhosts/blog/content/posts/2023-12-31/2023-reflections.dj b/vhosts/blog/content/posts/2023-12-31/2023-reflections.dj new file mode 100644 index 00000000..61c09ab7 --- /dev/null +++ b/vhosts/blog/content/posts/2023-12-31/2023-reflections.dj @@ -0,0 +1,76 @@ +--- +[article] +uuid = "bfdeed72-dd32-4d55-887f-ba004701ff4c" +title = "2023å¹Žã®æ¯ãè¿ã" +description = "2023幎ã«ãã£ãããšãæ¯ãè¿ã" +tags = [ +] + +[[article.revisions]] +date = "2023-12-31" +remark = "å
¬é" +--- +{#intro} +# ã¯ããã« + +ç·ãããªã幎æ«ã®æ¯ãè¿ããšããµãã®ã女ãããŠã¿ããšãŠãããªãã + +{#conferences} +# ç»å£ã»ã«ã³ãã¡ã¬ã³ã¹ã¹ã¿ãã + +å匷äŒãã«ã³ãã¡ã¬ã³ã¹ã§ç»å£ãããã¹ã¿ãããããããå§ããã®ã¯ä»å¹Žãããããã +LT çãå«ããŠèš 11 åã®ç»å£ããããªã£ãã + +* PHP å匷äŒ@æ±äº¬ã§ã®ç»å£ (èš 8 å) + + * [第 148 å](/slides/2023-01-18/phpstudy-tokyo-148/) + * [第 149 å](/slides/2023-02-15/phpstudy-tokyo-149/) + * [第 150 å](/slides/2023-03-15/phpstudy-tokyo-150/) + * [第 151 å](/slides/2023-04-12/phpstudy-tokyo-151/) + * [第 153 å](/slides/2023-06-21/phpstudy-tokyo-153/) + * [第 154 å](/slides/2023-07-26/phpstudy-tokyo-154/) + * [第 155 å](/slides/2023-08-24/phpstudy-tokyo-155/) + * [第 157 å](/slides/2023-10-25/phpstudy-tokyo-157/) + +* PHPerKaigi 2023 ã§ã®ç»å£ + + * [ã¬ã®ã¥ã©ãŒããŒã¯](/slides/2023-03-24/phperkaigi-2023/) + * [ããŒã¯ã³è§£èª¬ã»ãã·ã§ã³](/slides/2023-03-25/phperkaigi-2023-tokens/) + +* PHPerKaigi 2023 ã§ã®åœæ¥ã¹ã¿ããæ¥ +* [éå
¬åŒã§ãããªããã PHP ã«ã³ãã¡ã¬ã³ã¹çŠå²¡ 2023 ã® åå€ç¥ã€ãã³ãã§ã®ç»å£](/slides/2023-06-23/phpconfuk-2023-eve/) +* PHPerKaigi 2024 ã§ã®ã³ã¢ã¹ã¿ããæ¥ + +{#articles} +# æžããèšäº + +ç»å£ãå¢ãããããèšäºãæžãæ©äŒãæžã£ãŠããŸã£ãã +ç¹ã«ç€Ÿå
èšäºã®æ¬æ°ã倧ããæžå°ããŠãããäžæšå¹Žã¯çŽ 100 æ¬ãæšå¹Žã¯çŽ 60 æ¬ã®ç€Ÿå
èšäºãæžããŠããããä»å¹Žã¯ 30 æ¬åŒ·ã«çãŸã£ãã +ãã®é ãšæ¯ã¹ããšæç« ãæžãçèãè¡°ããŠããããã«æããã + +* 瀟å€èšäº (ãã®ããã°): 8æ¬ +* 瀟å
èšäº: 34æ¬ + + * 幎éã§æãèšäºãæžãã人ãšããŠç€Ÿå
衚地ããã + +{#coding} +# äœã£ããã® + +ã¬ã©ã¯ã¿ãããã€ãäœã£ãã圹ã«ã¯ç«ããªãããäœãã®ã楜ãããšããå¹çšãããã + +* [PHPerKaigi2023-tokens](https://github.com/nsfisis/PHPerKaigi2023-tokens) : PHPerKaigi 2023 ã§ãããªããã PHPer ãã£ã¬ã³ãžãšããäŒç»ã§çšæããåé¡ +* [twitter2x-quine](https://github.com/nsfisis/twitter2x-quine) : Twitter ã®ããŽã ð ã«ããå€å quine +* [9-puzzle-quine.php](https://github.com/nsfisis/9-puzzle-quine.php) : 9ããºã«ãéã¹ãå€å quine + +{#misc} +# ãã®ä» + +* [æŸé倧åŠã«å
¥åŠãã](/posts/2023-10-13/i-entered-the-open-university-of-japan/) +* [ISUCON ã«ååå ãã](/posts/2023-12-03/isucon-13/) +* ããŒã¿ããŒã¹ã¹ãã·ã£ãªã¹ããååŸãã +* 挢æ€2çŽãååŸãã + +{#outro} +# ãããã« + +ä»å¹Žã倧å€ãäžè©±ã«ãªããŸãããããã幎ãïŒ diff --git a/vhosts/blog/content/posts/2023-12-31/2023-reflections.ndoc b/vhosts/blog/content/posts/2023-12-31/2023-reflections.ndoc deleted file mode 100644 index 8952926c..00000000 --- a/vhosts/blog/content/posts/2023-12-31/2023-reflections.ndoc +++ /dev/null @@ -1,92 +0,0 @@ ---- -[article] -uuid = "bfdeed72-dd32-4d55-887f-ba004701ff4c" -title = "2023å¹Žã®æ¯ãè¿ã" -description = "2023幎ã«ãã£ãããšãæ¯ãè¿ã" -tags = [ -] - -[[article.revisions]] -date = "2023-12-31" -remark = "å
¬é" ---- -<article> - <section id="intro"> - <h>ã¯ããã«</h> - <p> - ç·ãããªã幎æ«ã®æ¯ãè¿ããšããµãã®ã女ãããŠã¿ããšãŠãããªãã - </p> - </section> - <section id="conferences"> - <h>ç»å£ã»ã«ã³ãã¡ã¬ã³ã¹ã¹ã¿ãã</h> - <p> - å匷äŒãã«ã³ãã¡ã¬ã³ã¹ã§ç»å£ãããã¹ã¿ãããããããå§ããã®ã¯ä»å¹Žãããããã - LT çãå«ããŠèš 11 åã®ç»å£ããããªã£ãã - </p> - <ul> - <li>PHP å匷äŒ@æ±äº¬ã§ã®ç»å£ (èš 8 å) - <ul> - <li><a href="/slides/2023-01-18/phpstudy-tokyo-148/">第 148 å</a></li> - <li><a href="/slides/2023-02-15/phpstudy-tokyo-149/">第 149 å</a></li> - <li><a href="/slides/2023-03-15/phpstudy-tokyo-150/">第 150 å</a></li> - <li><a href="/slides/2023-04-12/phpstudy-tokyo-151/">第 151 å</a></li> - <li><a href="/slides/2023-06-21/phpstudy-tokyo-153/">第 153 å</a></li> - <li><a href="/slides/2023-07-26/phpstudy-tokyo-154/">第 154 å</a></li> - <li><a href="/slides/2023-08-24/phpstudy-tokyo-155/">第 155 å</a></li> - <li><a href="/slides/2023-10-25/phpstudy-tokyo-157/">第 157 å</a></li> - </ul> - </li> - <li>PHPerKaigi 2023 ã§ã®ç»å£ - <ul> - <li><a href="/slides/2023-03-24/phperkaigi-2023/">ã¬ã®ã¥ã©ãŒããŒã¯</a></li> - <li><a href="/slides/2023-03-25/phperkaigi-2023-tokens/">ããŒã¯ã³è§£èª¬ã»ãã·ã§ã³</a></li> - </ul> - </li> - <li>PHPerKaigi 2023 ã§ã®åœæ¥ã¹ã¿ããæ¥</li> - <li><a href="/slides/2023-06-23/phpconfuk-2023-eve/">éå
¬åŒã§ãããªããã PHP ã«ã³ãã¡ã¬ã³ã¹çŠå²¡ 2023 ã® åå€ç¥ã€ãã³ãã§ã®ç»å£</a></li> - <li>PHPerKaigi 2024 ã§ã®ã³ã¢ã¹ã¿ããæ¥</li> - </ul> - </section> - <section id="articles"> - <h>æžããèšäº</h> - <p> - ç»å£ãå¢ãããããèšäºãæžãæ©äŒãæžã£ãŠããŸã£ãã - ç¹ã«ç€Ÿå
èšäºã®æ¬æ°ã倧ããæžå°ããŠãããäžæšå¹Žã¯çŽ 100 æ¬ãæšå¹Žã¯çŽ 60 æ¬ã®ç€Ÿå
èšäºãæžããŠããããä»å¹Žã¯ 30 æ¬åŒ·ã«çãŸã£ãã - ãã®é ãšæ¯ã¹ããšæç« ãæžãçèãè¡°ããŠããããã«æããã - </p> - <ul> - <li>瀟å€èšäº (ãã®ããã°): 8æ¬</li> - <li>瀟å
èšäº: 34æ¬ - <ul> - <li>幎éã§æãèšäºãæžãã人ãšããŠç€Ÿå
衚地ããã</li> - </ul> - </li> - </ul> - </section> - <section id="coding"> - <h>äœã£ããã®</h> - <p> - ã¬ã©ã¯ã¿ãããã€ãäœã£ãã圹ã«ã¯ç«ããªãããäœãã®ã楜ãããšããå¹çšãããã - </p> - <ul> - <li><a href="https://github.com/nsfisis/PHPerKaigi2023-tokens">PHPerKaigi2023-tokens</a>: PHPerKaigi 2023 ã§ãããªããã PHPer ãã£ã¬ã³ãžãšããäŒç»ã§çšæããåé¡</li> - <li><a href="https://github.com/nsfisis/twitter2x-quine">twitter2x-quine</a>: Twitter ã®ããŽã ð ã«ããå€å quine</li> - <li><a href="https://github.com/nsfisis/9-puzzle-quine.php">9-puzzle-quine.php</a>: 9ããºã«ãéã¹ãå€å quine</li> - </ul> - </section> - <section id="misc"> - <h>ãã®ä»</h> - <ul> - <li><a href="/posts/2023-10-13/i-entered-the-open-university-of-japan/">æŸé倧åŠã«å
¥åŠãã</a></li> - <li><a href="/posts/2023-12-03/isucon-13/">ISUCON ã«ååå ãã</a></li> - <li>ããŒã¿ããŒã¹ã¹ãã·ã£ãªã¹ããååŸãã</li> - <li>挢æ€2çŽãååŸãã</li> - </ul> - </section> - <section id="outro"> - <h>ãããã«</h> - <p> - ä»å¹Žã倧å€ãäžè©±ã«ãªããŸãããããã幎ãïŒ - </p> - </section> -</article> diff --git a/vhosts/blog/content/posts/2024-01-10/neovim-insert-namespace-declaration-to-empty-php-file.dj b/vhosts/blog/content/posts/2024-01-10/neovim-insert-namespace-declaration-to-empty-php-file.dj new file mode 100644 index 00000000..483b0b9a --- /dev/null +++ b/vhosts/blog/content/posts/2024-01-10/neovim-insert-namespace-declaration-to-empty-php-file.dj @@ -0,0 +1,205 @@ +--- +[article] +uuid = "05cb16e1-05bc-4359-bc06-88ac20510740" +title = "ãNeovimã 空㮠PHP ãã¡ã€ã«ã« namespace 宣èšãæ¿å
¥ãã" +description = "Neovim ã§ç©ºã® PHP ãã¡ã€ã«ãéãããšãããã£ã¬ã¯ããªã®æ§é ã«åºã¥ããŠèªåçã« namespace 宣èšãæ¿å
¥ããããã«ããã" +tags = [ + "neovim", + "php", +] + +[[article.revisions]] +date = "2024-01-10" +remark = "å
¬é" +--- +::: note +ãã®èšäºã¯ [Vim é§
äŒ](https://vim-jp.org/ekiden/) #136 ã®èšäºã§ãã +::: + +{#intro} +# ããããããš + +Neovim ã§ç©ºã® PHP ãã¡ã€ã«ãéãããšãããã®ãã¡ã€ã«ã眮ãããŠãããã£ã¬ã¯ããªã®æ§é ã«åºã¥ããŠãèªåçã« `namespace` 宣èšãæ¿å
¥ããããå
·äœçã«ã¯ããããã¬ãã«ã®åå空éã `MyNamespace` ã§ããããã¡ã€ã« `src/Foo/Bar/Baz.php` ãéãããšãã«ããã®ãã¡ã€ã«ã空ã§ãããªããæ¬¡ã®ãããªãã³ãã¬ãŒããèªåçã«æ¿å
¥ãããŠã»ããã + +```php +<?php + +namespace MyNamespace\Foo\Bar; +``` + +{#version} +# ããŒãžã§ã³æ
å ± + +``` +$ nvim --version +NVIM v0.9.2 +Build type: Release +LuaJIT 2.1.1693350652 +``` + +ä»å㯠Lua ã§åŠçãèšè¿°ãããããVim ã§ã¯åäœããªãã以äžã®èª¬æã§ã Neovim ã«çµã£ãŠè¿°ã¹ãã +ãŸãããã¹åºåããã¹ã©ãã·ã¥ã§ããåæã§èšè¿°ãããããWindows ã«ã¯å¯Ÿå¿ããŠããªãã + +{#ftplugin} +# ftplugin ãçšæãã + +Neovim ã«ã¯ç¹å®ã®ãã¡ã€ã«ã¿ã€ãã«å¯ŸããŠç¹å¥ãªåŠçããããªãããã® ftplugin ãšåŒã°ããä»çµã¿ãããã +Neovim ã®èšå®ã眮ããã£ã¬ã¯ã㪠(äŸãã° `~/.config/nvim`) ã®é
äžã« `ftplugin/<FILE_TYPE>.vim` ãŸã㯠`ftplugin/<FILE_TYPE>.lua` ãšãããã¡ã€ã«ãé
眮ãããšããã® `<FILE_TYPE>` ãèªã¿èŸŒãŸãããšãã«ãã®ãã¡ã€ã«ãèªåçã«å®è¡ãããã + +ä»åã¯ãNeovim ãããã©ã«ãã§çšæããŠãã PHP çš ftplugin ãåäœããããšã«è¿œå ã®åŠçããããªãããã®ã§ã`after/ftplugin/php.{vim,lua}` ãšãããã¡ã€ã«ãé
眮ãããååããå¯ãããããšããã`after/ftplugin` 以äžã®ãã¡ã€ã«ã¯ `ftplugin` 以äžã®ãã¡ã€ã«ãããããšã«å®è¡ãããã + +ãã®èšäºã§ã¯ Lua ã§åŠçãèšè¿°ãããããæ¡åŒµåã«ã¯ `.lua` ãçšããã +ãã以éèŒããã³ãŒãã¯ããã¹ãŠ `after/ftplugin/php.lua` ã®äžã«èšè¿°ããŠããã + +{#did-ftplugin} +# äºéèªã¿èŸŒã¿ãé²ã + +ãã¡ã€ã«ã¿ã€ãã¯èªã¿èŸŒãã ããšã«å€æŽãããããšãããã®ã§ãftplugin ã¯è€æ°åå®è¡ããããã +äºéèªã¿èŸŒã¿ãé²ãããã«ã`did_ftplugin_<FILE_TYPE>_after` ãšãããããã¡ããŒã«ã«å€æ°ãå®çŸ©ããŠããã®ãæ
£ç¿ãšãªã£ãŠããã + +```lua +if vim.b.did_ftplugin_php_after then + return +end + +-- ããã«å®éã®åŠçãæžã + +vim.b.did_ftplugin_php_after = true +``` + +{#implement} +# å®è£
ãã + +ã§ã¯å®è£
ããŠããããä»åç§ã¯æ¬¡ã®ãããªããžãã¯ãšããã以éããä» Neovim ã§éãã PHP ãã¡ã€ã«ãã®ããšãã察象ãã¡ã€ã«ããšåŒã¶ããšã«ããã + +1. 察象ãã¡ã€ã«ã空ã§ãªããã°äœãããªã +1. 察象ãã¡ã€ã«ã眮ããããã£ã¬ã¯ããªãäžã«èŸ¿ã£ãŠã`composer.json` ãèŠã€ãã +1. `composer.json` ã® `autoload.psr-4` ãèŠãŠããããã¬ãã«ã®åå空éãšãã£ã¬ã¯ããªãç¹å®ãã +1. 察象ãã¡ã€ã«ã眮ããããã£ã¬ã¯ããªãããããã¬ãã«ã®ãã£ã¬ã¯ããªãåºæºãšããŠã©ã®ããã«ãã¹ãããŠããã調ã¹ã +1. ãªãŒãããŒãã®èšå®ãšç
§ããåãããŠã察象ãã¡ã€ã«ãå±ãã¹ãåå空éãç¹å®ãã +1. PHP ã®éå§ã¿ã°ãšãšãã« `namespace` 宣èšãæ¿å
¥ãã + +å®è£
ãç°¡åã«ãããããComposer ãçšããªãå Žåã PSR 4 以å€ã®ãªãŒãããŒãèŠåã䜿ãå Žåã«ã¯å¯Ÿå¿ããªããå°ã
é·ããªããã以äžã«ã¹ã¯ãªããå
šæãèŒããã + +```lua +if vim.b.did_ftplugin_php_after then + return +end + +-- base_dir ãèµ·ç¹ãšããŠãã£ã¬ã¯ããªãäžåãã«èŸ¿ã£ãŠãããcomposer.json ãæ¢ã +-- :help vim.fs.find() +local function find_composer_json(base_dir) + return vim.fs.find('composer.json', { + path = base_dir, + upward = true, + -- ããŒã ãã£ã¬ã¯ããªãŸã§å°éãããæ¢çŽ¢ãæã¡åã + stop = vim.loop.os_homedir(), + type = 'file', + })[1] +end + +-- JSON ãã¡ã€ã«ãèªã¿èŸŒã¿ããã³ãŒãããŠè¿ã +-- :help readblob() +-- :help vim.json.decode +-- :help luaref-pcall() +local function load_json(file_path) + -- readblob() 㯠Vim script ã§ã¯ Blob ãªããžã§ã¯ããè¿ãããLua ããåŒã¶ãš string ã«å€æããã + local ok_read, content = pcall(vim.fn.readblob, file_path) + if not ok_read then + return nil + end + local ok_decode, obj = pcall(vim.json.decode, content) + if not ok_decode then + return nil + end + return obj +end + +-- 察象ãã¡ã€ã«ã®çœ®ããããã£ã¬ã¯ããªãåºã« namespace 宣èšãçæãã +-- :help nvim_buf_get_name() +-- :help vim.fs.dirname() +local function generate_namespace_declaration() + -- composer.json ãæ¢ãããããã¬ãã«ã®åå空éãšãã£ã¬ã¯ããªãç¹å®ãã + local current_dir = vim.fs.dirname(vim.api.nvim_buf_get_name(0)) + local path_to_composer_json = find_composer_json(current_dir) + if not path_to_composer_json then + return nil -- failed to locate composer.json + end + local composer_json = load_json(path_to_composer_json) + if not composer_json then + return nil -- failed to load composer.json + end + -- autoload.psr-4 ãæ¢ããåãæåŸ
ãããåãšäžèŽãããã©ãã調ã¹ã + local psr4 = vim.tbl_get(composer_json, 'autoload', 'psr-4') + if not psr4 then + return nil -- autoload.psr-4 section is absent + end + if vim.tbl_count(psr4) ~= 1 then + return nil -- psr-4 section is ambiguous + end + local psr4_namespace, psr4_dir + for k, v in pairs(psr4) do + psr4_namespace = k + psr4_dir = v + end + if type(psr4_dir) == 'table' then + if #psr4_dir == 1 then + psr4_dir = psr4_dir[1] + else + return nil -- psr-4 section is ambiguous + end + end + if type(psr4_namespace) ~= 'string' or type(psr4_dir) ~= 'string' then + return nil -- psr-4 section is invalid + end + -- æ«å°Ÿã®ã¹ã©ãã·ã¥ãšããã¯ã¹ã©ãã·ã¥ãåãé€ããŠãã + if psr4_namespace:sub(-1, -1) == '\\' then + psr4_namespace = psr4_namespace:sub(0, -2) + end + if psr4_dir:sub(-1, -1) == '/' then + psr4_dir = psr4_dir:sub(0, -2) + end + + -- 察象ãã¡ã€ã«ã眮ããããã£ã¬ã¯ããªãšãããã¬ãã«ã®ãã£ã¬ã¯ããªãæ¯èŒãããã®å·®åãåå空éãšãã + local namespace_root_dir = vim.fs.dirname(path_to_composer_json) .. '/' .. psr4_dir + if not vim.startswith(current_dir, namespace_root_dir) then + return nil + end + local current_path_suffix = current_dir:sub(#namespace_root_dir + 1) + local namespace = psr4_namespace .. current_path_suffix:gsub('/', '\\') + return ("namespace %s;"):format(namespace) +end + +local function generate_template() + local lines = { + '<?php', + '', + 'declare(strict_types=1);', + '', + } + local namespace_decl = generate_namespace_declaration() + if namespace_decl then + lines[#lines + 1] = namespace_decl + lines[#lines + 1] = '' + end + lines[#lines + 1] = '' + return lines +end + +if vim.fn.line('$') == 1 and vim.fn.getline(1) == '' then + -- 察象ãã¡ã€ã«ã空ãªãããã³ãã¬ãŒããæ¿å
¥ããŠã«ãŒãœã«ãæ«å°Ÿã«ç§»åããã + -- :help setline() + -- :help cursor() + vim.fn.setline(1, generate_template()) + vim.fn.cursor('$', 0) +end + +vim.b.did_ftplugin_php_after = true +``` + +{#outro} +# ãããã« + +ç°¡æçãªå®è£
ã ããå€ãã®ã±ãŒã¹ã§ã¯ããŸãåããŠããããã ã +æå€§ã®åé¡ã¯ PSR 4 ã«æºæ ããªããã¬ãŒã ã¯ãŒã¯ãçšããŠãããšãŸã£ãã圹ã«ç«ããªãããšã§ãä»ãŸãã«è·å Žã§å°ã£ãŠããã +ãã¡ãã¯ãããæ¹è¯ãããã diff --git a/vhosts/blog/content/posts/2024-01-10/neovim-insert-namespace-declaration-to-empty-php-file.ndoc b/vhosts/blog/content/posts/2024-01-10/neovim-insert-namespace-declaration-to-empty-php-file.ndoc deleted file mode 100644 index 88a09cc5..00000000 --- a/vhosts/blog/content/posts/2024-01-10/neovim-insert-namespace-declaration-to-empty-php-file.ndoc +++ /dev/null @@ -1,221 +0,0 @@ ---- -[article] -uuid = "05cb16e1-05bc-4359-bc06-88ac20510740" -title = "ãNeovimã 空㮠PHP ãã¡ã€ã«ã« namespace 宣èšãæ¿å
¥ãã" -description = "Neovim ã§ç©ºã® PHP ãã¡ã€ã«ãéãããšãããã£ã¬ã¯ããªã®æ§é ã«åºã¥ããŠèªåçã« namespace 宣èšãæ¿å
¥ããããã«ããã" -tags = [ - "neovim", - "php", -] - -[[article.revisions]] -date = "2024-01-10" -remark = "å
¬é" ---- -<article> - <note> - ãã®èšäºã¯ <a href="https://vim-jp.org/ekiden/">Vim é§
äŒ</a> #136 ã®èšäºã§ãã - </note> - <section id="intro"> - <h>ããããããš</h> - <p> - Neovim ã§ç©ºã® PHP ãã¡ã€ã«ãéãããšãããã®ãã¡ã€ã«ã眮ãããŠãããã£ã¬ã¯ããªã®æ§é ã«åºã¥ããŠãèªåçã« <code>namespace</code> 宣èšãæ¿å
¥ããããå
·äœçã«ã¯ããããã¬ãã«ã®åå空éã <code>MyNamespace</code> ã§ããããã¡ã€ã« <code>src/Foo/Bar/Baz.php</code> ãéãããšãã«ããã®ãã¡ã€ã«ã空ã§ãããªããæ¬¡ã®ãããªãã³ãã¬ãŒããèªåçã«æ¿å
¥ãããŠã»ããã - </p> - <codeblock language="php"> - <![CDATA[ - <?php - - namespace MyNamespace\Foo\Bar; - ]]> - </codeblock> - </section> - <section id="version"> - <h>ããŒãžã§ã³æ
å ±</h> - <codeblock> - <![CDATA[ - $ nvim --version - NVIM v0.9.2 - Build type: Release - LuaJIT 2.1.1693350652 - ]]> - </codeblock> - <p> - ä»å㯠Lua ã§åŠçãèšè¿°ãããããVim ã§ã¯åäœããªãã以äžã®èª¬æã§ã Neovim ã«çµã£ãŠè¿°ã¹ãã - ãŸãããã¹åºåããã¹ã©ãã·ã¥ã§ããåæã§èšè¿°ãããããWindows ã«ã¯å¯Ÿå¿ããŠããªãã - </p> - </section> - <section id="ftplugin"> - <h>ftplugin ãçšæãã</h> - <p> - Neovim ã«ã¯ç¹å®ã®ãã¡ã€ã«ã¿ã€ãã«å¯ŸããŠç¹å¥ãªåŠçããããªãããã® ftplugin ãšåŒã°ããä»çµã¿ãããã - Neovim ã®èšå®ã眮ããã£ã¬ã¯ã㪠(äŸãã° <code>~/.config/nvim</code>) ã®é
äžã« <code>ftplugin/<FILE_TYPE>.vim</code> ãŸã㯠<code>ftplugin/<FILE_TYPE>.lua</code> ãšãããã¡ã€ã«ãé
眮ãããšããã® <code><FILE_TYPE></code> ãèªã¿èŸŒãŸãããšãã«ãã®ãã¡ã€ã«ãèªåçã«å®è¡ãããã - </p> - <p> - ä»åã¯ãNeovim ãããã©ã«ãã§çšæããŠãã PHP çš ftplugin ãåäœããããšã«è¿œå ã®åŠçããããªãããã®ã§ã<code>after/ftplugin/php.{vim,lua}</code> ãšãããã¡ã€ã«ãé
眮ãããååããå¯ãããããšããã<code>after/ftplugin</code> 以äžã®ãã¡ã€ã«ã¯ <code>ftplugin</code> 以äžã®ãã¡ã€ã«ãããããšã«å®è¡ãããã - </p> - <p> - ãã®èšäºã§ã¯ Lua ã§åŠçãèšè¿°ãããããæ¡åŒµåã«ã¯ <code>.lua</code> ãçšããã - ãã以éèŒããã³ãŒãã¯ããã¹ãŠ <code>after/ftplugin/php.lua</code> ã®äžã«èšè¿°ããŠããã - </p> - </section> - <section id="did-ftplugin"> - <h>äºéèªã¿èŸŒã¿ãé²ã</h> - <p> - ãã¡ã€ã«ã¿ã€ãã¯èªã¿èŸŒãã ããšã«å€æŽãããããšãããã®ã§ãftplugin ã¯è€æ°åå®è¡ããããã - äºéèªã¿èŸŒã¿ãé²ãããã«ã<code>did_ftplugin_<FILE_TYPE>_after</code> ãšãããããã¡ããŒã«ã«å€æ°ãå®çŸ©ããŠããã®ãæ
£ç¿ãšãªã£ãŠããã - </p> - <codeblock language="lua"> - <![CDATA[ - if vim.b.did_ftplugin_php_after then - return - end - - -- ããã«å®éã®åŠçãæžã - - vim.b.did_ftplugin_php_after = true - ]]> - </codeblock> - </section> - <section id="implement"> - <h>å®è£
ãã</h> - <p> - ã§ã¯å®è£
ããŠããããä»åç§ã¯æ¬¡ã®ãããªããžãã¯ãšããã以éããä» Neovim ã§éãã PHP ãã¡ã€ã«ãã®ããšãã察象ãã¡ã€ã«ããšåŒã¶ããšã«ããã - </p> - <ol> - <li>察象ãã¡ã€ã«ã空ã§ãªããã°äœãããªã</li> - <li>察象ãã¡ã€ã«ã眮ããããã£ã¬ã¯ããªãäžã«èŸ¿ã£ãŠã<code>composer.json</code> ãèŠã€ãã</li> - <li><code>composer.json</code> ã® <code>autoload.psr-4</code> ãèŠãŠããããã¬ãã«ã®åå空éãšãã£ã¬ã¯ããªãç¹å®ãã</li> - <li>察象ãã¡ã€ã«ã眮ããããã£ã¬ã¯ããªãããããã¬ãã«ã®ãã£ã¬ã¯ããªãåºæºãšããŠã©ã®ããã«ãã¹ãããŠããã調ã¹ã</li> - <li>ãªãŒãããŒãã®èšå®ãšç
§ããåãããŠã察象ãã¡ã€ã«ãå±ãã¹ãåå空éãç¹å®ãã</li> - <li>PHP ã®éå§ã¿ã°ãšãšãã« <code>namespace</code> 宣èšãæ¿å
¥ãã</li> - </ol> - <p> - å®è£
ãç°¡åã«ãããããComposer ãçšããªãå Žåã PSR 4 以å€ã®ãªãŒãããŒãèŠåã䜿ãå Žåã«ã¯å¯Ÿå¿ããªããå°ã
é·ããªããã以äžã«ã¹ã¯ãªããå
šæãèŒããã - </p> - <codeblock language="lua"> - <![CDATA[ - if vim.b.did_ftplugin_php_after then - return - end - - -- base_dir ãèµ·ç¹ãšããŠãã£ã¬ã¯ããªãäžåãã«èŸ¿ã£ãŠãããcomposer.json ãæ¢ã - -- :help vim.fs.find() - local function find_composer_json(base_dir) - return vim.fs.find('composer.json', { - path = base_dir, - upward = true, - -- ããŒã ãã£ã¬ã¯ããªãŸã§å°éãããæ¢çŽ¢ãæã¡åã - stop = vim.loop.os_homedir(), - type = 'file', - })[1] - end - - -- JSON ãã¡ã€ã«ãèªã¿èŸŒã¿ããã³ãŒãããŠè¿ã - -- :help readblob() - -- :help vim.json.decode - -- :help luaref-pcall() - local function load_json(file_path) - -- readblob() 㯠Vim script ã§ã¯ Blob ãªããžã§ã¯ããè¿ãããLua ããåŒã¶ãš string ã«å€æããã - local ok_read, content = pcall(vim.fn.readblob, file_path) - if not ok_read then - return nil - end - local ok_decode, obj = pcall(vim.json.decode, content) - if not ok_decode then - return nil - end - return obj - end - - -- 察象ãã¡ã€ã«ã®çœ®ããããã£ã¬ã¯ããªãåºã« namespace 宣èšãçæãã - -- :help nvim_buf_get_name() - -- :help vim.fs.dirname() - local function generate_namespace_declaration() - -- composer.json ãæ¢ãããããã¬ãã«ã®åå空éãšãã£ã¬ã¯ããªãç¹å®ãã - local current_dir = vim.fs.dirname(vim.api.nvim_buf_get_name(0)) - local path_to_composer_json = find_composer_json(current_dir) - if not path_to_composer_json then - return nil -- failed to locate composer.json - end - local composer_json = load_json(path_to_composer_json) - if not composer_json then - return nil -- failed to load composer.json - end - -- autoload.psr-4 ãæ¢ããåãæåŸ
ãããåãšäžèŽãããã©ãã調ã¹ã - local psr4 = vim.tbl_get(composer_json, 'autoload', 'psr-4') - if not psr4 then - return nil -- autoload.psr-4 section is absent - end - if vim.tbl_count(psr4) ~= 1 then - return nil -- psr-4 section is ambiguous - end - local psr4_namespace, psr4_dir - for k, v in pairs(psr4) do - psr4_namespace = k - psr4_dir = v - end - if type(psr4_dir) == 'table' then - if #psr4_dir == 1 then - psr4_dir = psr4_dir[1] - else - return nil -- psr-4 section is ambiguous - end - end - if type(psr4_namespace) ~= 'string' or type(psr4_dir) ~= 'string' then - return nil -- psr-4 section is invalid - end - -- æ«å°Ÿã®ã¹ã©ãã·ã¥ãšããã¯ã¹ã©ãã·ã¥ãåãé€ããŠãã - if psr4_namespace:sub(-1, -1) == '\\' then - psr4_namespace = psr4_namespace:sub(0, -2) - end - if psr4_dir:sub(-1, -1) == '/' then - psr4_dir = psr4_dir:sub(0, -2) - end - - -- 察象ãã¡ã€ã«ã眮ããããã£ã¬ã¯ããªãšãããã¬ãã«ã®ãã£ã¬ã¯ããªãæ¯èŒãããã®å·®åãåå空éãšãã - local namespace_root_dir = vim.fs.dirname(path_to_composer_json) .. '/' .. psr4_dir - if not vim.startswith(current_dir, namespace_root_dir) then - return nil - end - local current_path_suffix = current_dir:sub(#namespace_root_dir + 1) - local namespace = psr4_namespace .. current_path_suffix:gsub('/', '\\') - return ("namespace %s;"):format(namespace) - end - - local function generate_template() - local lines = { - '<?php', - '', - 'declare(strict_types=1);', - '', - } - local namespace_decl = generate_namespace_declaration() - if namespace_decl then - lines[#lines + 1] = namespace_decl - lines[#lines + 1] = '' - end - lines[#lines + 1] = '' - return lines - end - - if vim.fn.line('$') == 1 and vim.fn.getline(1) == '' then - -- 察象ãã¡ã€ã«ã空ãªãããã³ãã¬ãŒããæ¿å
¥ããŠã«ãŒãœã«ãæ«å°Ÿã«ç§»åããã - -- :help setline() - -- :help cursor() - vim.fn.setline(1, generate_template()) - vim.fn.cursor('$', 0) - end - - vim.b.did_ftplugin_php_after = true - ]]> - </codeblock> - </section> - <section id="outro"> - <h>ãããã«</h> - <p> - ç°¡æçãªå®è£
ã ããå€ãã®ã±ãŒã¹ã§ã¯ããŸãåããŠããããã ã - æå€§ã®åé¡ã¯ PSR 4 ã«æºæ ããªããã¬ãŒã ã¯ãŒã¯ãçšããŠãããšãŸã£ãã圹ã«ç«ããªãããšã§ãä»ãŸãã«è·å Žã§å°ã£ãŠããã - ãã¡ãã¯ãããæ¹è¯ãããã - </p> - </section> -</article> diff --git a/vhosts/blog/content/posts/2024-02-03/install-wireguard-on-personal-server.dj b/vhosts/blog/content/posts/2024-02-03/install-wireguard-on-personal-server.dj new file mode 100644 index 00000000..89ecd7b4 --- /dev/null +++ b/vhosts/blog/content/posts/2024-02-03/install-wireguard-on-personal-server.dj @@ -0,0 +1,144 @@ +--- +[article] +uuid = "210673d0-c19e-4195-a280-968a0729dd41" +title = "ãåå¿é²ã å人çšãµãŒãã« WireGuard ãå°å
¥ãã" +description = "å人çšãµãŒãã¹ã®ã»ã«ããã¹ãã«äœ¿ã£ãŠãããµãŒãã« WireGuard ãå°å
¥ããäœæ¥ãããã¡ã¢" +tags = [ + "note-to-self", + "wireguard", +] + +[[article.revisions]] +date = "2024-02-03" +remark = "å
¬é" + +[[article.revisions]] +date = "2024-02-17" +remark = "80 çªããŒãã«ã€ããŠè¿œèš" +--- +{#intro} +# ã¯ããã« + +å人çšãµãŒãã¹ã®ã»ã«ããã¹ãã«äœ¿ã£ãŠãããµãŒãã« [WireGuard](https://www.wireguard.com/) ãå°å
¥ããäœæ¥ãããã®ã§ã¡ã¢ã + +ç»å Žãããã¹ãã¯ä»¥äžã®ãšãã: + +* ãµãŒã (Ubuntu): `10.10.1.1` +* ã¯ã©ã€ã¢ã³ã 1 (Windows): `10.10.1.2` +* ã¯ã©ã€ã¢ã³ã 2 (Android): `10.10.1.3` + +åŸãã® IP ã¢ãã¬ã¹ã¯ VPN å
ã§äœ¿çšãããã©ã€ããŒã IP ã¢ãã¬ã¹ã + +{#install-wireguard-server} +# WireGuard ã®ã€ã³ã¹ããŒã«: ãµãŒã + +ãŸãã¯å人çšãµãŒãã¹ããã¹ãããŠãã Ubuntu ã®ãµãŒãã« WireGuard ãã€ã³ã¹ããŒã«ããã + +``` +$ sudo apt install wireguard +``` + +次ã«ãWireGuard ã§äœ¿çšããéµãçæããã + +``` +$ wg genkey | sudo tee /etc/wireguard/server.key | wg pubkey | sudo tee /etc/wireguard/server.pub +$ sudo chmod 600 /etc/wireguard/server.{key,pub} +``` + +{#install-wireguard-client} +# WireGuard ã®ã€ã³ã¹ããŒã«: ã¯ã©ã€ã¢ã³ã + +å
¬åŒãµã€ãããå OS åãã®ã¯ã©ã€ã¢ã³ããœãããŠã§ã¢ãå
¥æããã€ã³ã¹ããŒã«ãããæ¬¡ã«ãèšå®ããããªãã + +```ini +# ã¯ã©ã€ã¢ã³ã 1 ã®å Žå +[Interface] +Address = 10.10.1.2/32 +PrivateKey = <ã¯ã©ã€ã¢ã³ã 1 ã®ç§å¯éµ> + +[Peer] +PublicKey = <ãµãŒãã®å
¬ééµ> +AllowedIPs = <ãµãŒãã®å€éš IP ã¢ãã¬ã¹>/32 +Endpoint = <ãµãŒãã®å€éš IP ã¢ãã¬ã¹>:51820 +``` + +```ini +# ã¯ã©ã€ã¢ã³ã 2 ã®å Žå +[Interface] +Address = 10.10.1.3/32 +PrivateKey = <ã¯ã©ã€ã¢ã³ã 2 ã®ç§å¯éµ> + +[Peer] +PublicKey = <ãµãŒãã®å
¬ééµ> +AllowedIPs = <ãµãŒãã®å€éš IP ã¢ãã¬ã¹>/32 +Endpoint = <ãµãŒãã®å€éš IP ã¢ãã¬ã¹>:51820 +``` + +`PrivateKey` ã `PublicKey` ã¯éµãã¡ã€ã«ã®ãã¹ã§ã¯ãªãäžèº«ãæžãããšã«æ³šæã + +{#configure-wireguard} +# WireGuard ã®èšå® + +äžåºŠãµãŒããžæ»ããWireGuard ã®èšå®ãã¡ã€ã«ãæžãã + +``` +$ sudo vim /etc/wireguard/wg0.conf +``` + +```ini +[Interface] +Address = 10.10.1.1/32 +SaveConfig = true +PrivateKey = <ãµãŒãã®ç§å¯éµ> +ListenPort = 51820 + +[Peer] +PublicKey = <ã¯ã©ã€ã¢ã³ã 1 ã®å
¬ééµ> +AllowedIPs = 10.10.1.2/32 + +[Peer] +PublicKey = <ã¯ã©ã€ã¢ã³ã 2 ã®å
¬ééµ> +AllowedIPs = 10.10.1.3/32 +``` + +次ã«ãWireGuard ã®ãµãŒãã¹ãèµ·åããã + +``` +$ sudo systemctl enable wg-quick@wg0 +$ sudo systemctl start wg-quick@wg0 +``` + +{#configure-firewall} +# ãã¡ã€ã¢ãŠã©ãŒã«ã®èšå® + +ç¶ããŠãã¡ã€ã¢ãŠã©ãŒã«ãèšå®ããããŸã㯠WireGuard ã䜿çšãã UDP ã®ããŒããéãã`wg0` ãéãéä¿¡ãèš±å¯ããã + +``` +$ sudo ufw allow 51820/udp +$ sudo ufw allow in on wg0 +$ sudo ufw allow out on wg0 +``` + +次ã«ã80 ã 443 ãªã©ã®å¿
èŠãªããŒãã«ã€ããŠã`wg0` ãçµç±ããŠã®ã¢ã¯ã»ã¹ã®ã¿èš±å¯ããã + +``` +$ sudo ufw allow in on wg0 to any port 80 proto tcp +$ sudo ufw allow in on wg0 to any port 443 proto tcp +``` + +æåŸã«ã`ufw` ãæå¹ã«ããã + +``` +$ sudo ufw status +$ sudo ufw enable +``` + +{#connect-each-other} +# æ¥ç¶ãã + +ããã§ãåã¯ã©ã€ã¢ã³ãã§ VPN ãæå¹ã«ãããšãåœè©²ãµãŒãã® 80 ããŒãã 443 ããŒãã«ã¢ã¯ã»ã¹ã§ããããã«ãªã£ãã¯ãã ã念ã®ãã VPN ãåã£ãç¶æ
ã§ã¢ã¯ã»ã¹ã§ããªãããšã確èªããŠãããšããã ããã + +{#edit-80-port} +# 远èš: 80 çªããŒãã«ã€ã㊠+ +Let's Encrypt ã§ãµãŒãã®èšŒææžãååŸããŠããå Žåã80 çªããŒãã空ããŠããå¿
èŠããããæ°ã¥ããªããã¡ã«èšŒææžãåããªãããæ³šæã diff --git a/vhosts/blog/content/posts/2024-02-03/install-wireguard-on-personal-server.ndoc b/vhosts/blog/content/posts/2024-02-03/install-wireguard-on-personal-server.ndoc deleted file mode 100644 index 9dee8fce..00000000 --- a/vhosts/blog/content/posts/2024-02-03/install-wireguard-on-personal-server.ndoc +++ /dev/null @@ -1,180 +0,0 @@ ---- -[article] -uuid = "210673d0-c19e-4195-a280-968a0729dd41" -title = "ãåå¿é²ã å人çšãµãŒãã« WireGuard ãå°å
¥ãã" -description = "å人çšãµãŒãã¹ã®ã»ã«ããã¹ãã«äœ¿ã£ãŠãããµãŒãã« WireGuard ãå°å
¥ããäœæ¥ãããã¡ã¢" -tags = [ - "note-to-self", - "wireguard", -] - -[[article.revisions]] -date = "2024-02-03" -remark = "å
¬é" - -[[article.revisions]] -date = "2024-02-17" -remark = "80 çªããŒãã«ã€ããŠè¿œèš" ---- -<article> - <section id="intro"> - <h>ã¯ããã«</h> - <p> - å人çšãµãŒãã¹ã®ã»ã«ããã¹ãã«äœ¿ã£ãŠãããµãŒãã« <a href="https://www.wireguard.com/">WireGuard</a> ãå°å
¥ããäœæ¥ãããã®ã§ã¡ã¢ã - </p> - <p> - ç»å Žãããã¹ãã¯ä»¥äžã®ãšãã: - </p> - <ul> - <li>ãµãŒã (Ubuntu): <code>10.10.1.1</code></li> - <li>ã¯ã©ã€ã¢ã³ã 1 (Windows): <code>10.10.1.2</code></li> - <li>ã¯ã©ã€ã¢ã³ã 2 (Android): <code>10.10.1.3</code></li> - </ul> - <p> - åŸãã® IP ã¢ãã¬ã¹ã¯ VPN å
ã§äœ¿çšãããã©ã€ããŒã IP ã¢ãã¬ã¹ã - </p> - </section> - <section id="install-wireguard-server"> - <h>WireGuard ã®ã€ã³ã¹ããŒã«: ãµãŒã</h> - <p> - ãŸãã¯å人çšãµãŒãã¹ããã¹ãããŠãã Ubuntu ã®ãµãŒãã« WireGuard ãã€ã³ã¹ããŒã«ããã - </p> - <codeblock> - <![CDATA[ - $ sudo apt install wireguard - ]]> - </codeblock> - <p> - 次ã«ãWireGuard ã§äœ¿çšããéµãçæããã - </p> - <codeblock> - <![CDATA[ - $ wg genkey | sudo tee /etc/wireguard/server.key | wg pubkey | sudo tee /etc/wireguard/server.pub - $ sudo chmod 600 /etc/wireguard/server.{key,pub} - ]]> - </codeblock> - </section> - <section id="install-wireguard-client"> - <h>WireGuard ã®ã€ã³ã¹ããŒã«: ã¯ã©ã€ã¢ã³ã</h> - <p> - å
¬åŒãµã€ãããå OS åãã®ã¯ã©ã€ã¢ã³ããœãããŠã§ã¢ãå
¥æããã€ã³ã¹ããŒã«ãããæ¬¡ã«ãèšå®ããããªãã - </p> - <codeblock language="ini"> - <![CDATA[ - # ã¯ã©ã€ã¢ã³ã 1 ã®å Žå - [Interface] - Address = 10.10.1.2/32 - PrivateKey = <ã¯ã©ã€ã¢ã³ã 1 ã®ç§å¯éµ> - - [Peer] - PublicKey = <ãµãŒãã®å
¬ééµ> - AllowedIPs = <ãµãŒãã®å€éš IP ã¢ãã¬ã¹>/32 - Endpoint = <ãµãŒãã®å€éš IP ã¢ãã¬ã¹>:51820 - ]]> - </codeblock> - <codeblock language="ini"> - <![CDATA[ - # ã¯ã©ã€ã¢ã³ã 2 ã®å Žå - [Interface] - Address = 10.10.1.3/32 - PrivateKey = <ã¯ã©ã€ã¢ã³ã 2 ã®ç§å¯éµ> - - [Peer] - PublicKey = <ãµãŒãã®å
¬ééµ> - AllowedIPs = <ãµãŒãã®å€éš IP ã¢ãã¬ã¹>/32 - Endpoint = <ãµãŒãã®å€éš IP ã¢ãã¬ã¹>:51820 - ]]> - </codeblock> - <p> - <code>PrivateKey</code> ã <code>PublicKey</code> ã¯éµãã¡ã€ã«ã®ãã¹ã§ã¯ãªãäžèº«ãæžãããšã«æ³šæã - </p> - </section> - <section id="configure-wireguard"> - <h> - WireGuard ã®èšå® - </h> - <p> - äžåºŠãµãŒããžæ»ããWireGuard ã®èšå®ãã¡ã€ã«ãæžãã - </p> - <codeblock> - <![CDATA[ - $ sudo vim /etc/wireguard/wg0.conf - ]]> - </codeblock> - <codeblock language="ini"> - <![CDATA[ - [Interface] - Address = 10.10.1.1/32 - SaveConfig = true - PrivateKey = <ãµãŒãã®ç§å¯éµ> - ListenPort = 51820 - - [Peer] - PublicKey = <ã¯ã©ã€ã¢ã³ã 1 ã®å
¬ééµ> - AllowedIPs = 10.10.1.2/32 - - [Peer] - PublicKey = <ã¯ã©ã€ã¢ã³ã 2 ã®å
¬ééµ> - AllowedIPs = 10.10.1.3/32 - ]]> - </codeblock> - <p> - 次ã«ãWireGuard ã®ãµãŒãã¹ãèµ·åããã - </p> - <codeblock> - <![CDATA[ - $ sudo systemctl enable wg-quick@wg0 - $ sudo systemctl start wg-quick@wg0 - ]]> - </codeblock> - </section> - <section id="configure-firewall"> - <h> - ãã¡ã€ã¢ãŠã©ãŒã«ã®èšå® - </h> - <p> - ç¶ããŠãã¡ã€ã¢ãŠã©ãŒã«ãèšå®ããããŸã㯠WireGuard ã䜿çšãã UDP ã®ããŒããéãã<code>wg0</code> ãéãéä¿¡ãèš±å¯ããã - </p> - <codeblock> - <![CDATA[ - $ sudo ufw allow 51820/udp - $ sudo ufw allow in on wg0 - $ sudo ufw allow out on wg0 - ]]> - </codeblock> - <p> - 次ã«ã80 ã 443 ãªã©ã®å¿
èŠãªããŒãã«ã€ããŠã<code>wg0</code> ãçµç±ããŠã®ã¢ã¯ã»ã¹ã®ã¿èš±å¯ããã - </p> - <codeblock> - <![CDATA[ - $ sudo ufw allow in on wg0 to any port 80 proto tcp - $ sudo ufw allow in on wg0 to any port 443 proto tcp - ]]> - </codeblock> - <p> - æåŸã«ã<code>ufw</code> ãæå¹ã«ããã - </p> - <codeblock> - <![CDATA[ - $ sudo ufw status - $ sudo ufw enable - ]]> - </codeblock> - </section> - <section id="connect-each-other"> - <h> - æ¥ç¶ãã - </h> - <p> - ããã§ãåã¯ã©ã€ã¢ã³ãã§ VPN ãæå¹ã«ãããšãåœè©²ãµãŒãã® 80 ããŒãã 443 ããŒãã«ã¢ã¯ã»ã¹ã§ããããã«ãªã£ãã¯ãã ã念ã®ãã VPN ãåã£ãç¶æ
ã§ã¢ã¯ã»ã¹ã§ããªãããšã確èªããŠãããšããã ããã - </p> - </section> - <section id="edit-80-port"> - <h> - 远èš: 80 çªããŒãã«ã€ã㊠- </h> - <p> - Let's Encrypt ã§ãµãŒãã®èšŒææžãååŸããŠããå Žåã80 çªããŒãã空ããŠããå¿
èŠããããæ°ã¥ããªããã¡ã«èšŒææžãåããªãããæ³šæã - </p> - </section> -</article> diff --git a/vhosts/blog/content/posts/2024-02-10/yapcjapan-2024-report.dj b/vhosts/blog/content/posts/2024-02-10/yapcjapan-2024-report.dj new file mode 100644 index 00000000..3153f96b --- /dev/null +++ b/vhosts/blog/content/posts/2024-02-10/yapcjapan-2024-report.dj @@ -0,0 +1,44 @@ +--- +[article] +uuid = "230a0048-93c0-4aac-91ef-bb3108f3e587" +title = "YAPC::Hiroshima 2024 åå ã¬ã" +description = "2024-02-10 ã«éå¬ããããYAPC::Hiroshima 2024 ã«åå ããã" +tags = [ + "conference", + "perl", + "yapc", +] + +[[article.revisions]] +date = "2024-02-10" +remark = "å
¬é" +--- +{#intro} +# ã¯ããã« + +2024-02-10 ã«éå¬ãããã [YAPC::Hiroshima 2024](https://yapcjapan.org/2024hiroshima/) ã«åå ããã + +{#sessions-thoughts} +# ã»ãã·ã§ã³ã®ææ³ + +â»ã»ãã·ã§ã³ã®é¡åãšçºè¡šè
åã¯ã [ã«ã³ãã¡ã¬ã³ã¹ã® fortee ããŒãž](https://fortee.jp/yapc-hiroshima-2024) ããåŒçšã + +* [VISAã«ãŒãã®è£åŽãš âæãæããâ æ±ºæžã·ã¹ãã ã®è²ãŠæ¹ (äžè°· ãã)](https://fortee.jp/yapc-hiroshima-2024/proposal/c0e77f91-f856-48a0-9741-b9afb662cd30) + + * ãã¹ãã¹ããŒã«ãŒè³ã«ãéžã°ããŠããŸãããã倧å€é¢çœãçºè¡šã§ãããç§èªèº«ã¯ã«ãŒã決æžã®ç¥èããŸã£ãããªãã£ãã®ã§ãããå·§ã¿ãªèª¬æã«ããããããã£ããããªæ°ããããç¶æ
ã«ãªããŸããã + +* [awkã§ã€ãã£ãŠããããWebã¢ããªã±ãŒã·ã§ã³ (ãããŸãŒ ãã)](https://fortee.jp/yapc-hiroshima-2024/proposal/0e545260-61e1-465e-951c-91d6afb7782c) + + * ã²ãŒã ã§ãããã°ã©ãã³ã°ã§ãçžããã¬ã€ã»ã©æ¥œãããã®ã¯ãªããšæããŸããçºè¡šäžã§ã¯ããã£ãšæµãããŠããŸããããããŒã¿ããŒã¹ãšã®éä¿¡ã TLSãGitHub ã® SSO ãªã©ãããã awk ã§æžããããšã¯æãã¬æ©èœã倿°å®è£
ãããŠãããã«ã³ãã¡ã¬ã³ã¹ãªã©ã®å Žã§ãããªããªãå³ããããšã®ãªãçæ°ã«è§Šããããšãã§ããŸããã + +* ããŒããŒã (æç«ã
ãã) + + * â» æåŸ
è¬æŒã®ãã fortee ã®ããããŒã¶ã«ããŒãžãªã + * ç§ãå°åŠ6幎çã®ãšããããã°ã©ãã³ã°ãå§ããããšæåã«éããã®ãã [ãšã»ã»ã® Java å
¥é](https://www.tohoho-web.com/java/) ãã§ãããç§ã®äººçã®éãæ±ºå®ãããã®ç¬¬äžæ©ç®ã®ãµã€ãã®éå¶è
ãä»ãŸãã«ç®ã®åã§è©±ããŠãããšããã®ã¯ãæåãªã©ãšããèšèã§ã¯ãšãŠãèšãå°œãããŸãããããã ãã§ãåºå³¶ãŸã§æ¥ã䟡å€ããã£ããšæèšã§ããŸãã + +{#outro} +# ãããã« + +æé«ã ã£ããç¹ã«ãæç«ã
æ°ã®è¬æŒãçã§æèŽã§ããã®ã¯ãææ
šãšãšãã«å€§ãã«åºæ¿ãšãªã£ããæ¬¡åã® YAPC ã«ãæ¯éåå ãããã + +P.S. Perl ãæžããããšããªããšãåäºåã«æ¥œãããã€ãã³ããªã®ã§ããPerl ãæžããªãããšããçç±ã§åå ããªãã£ãããã¯ãæ¬¡åæ¯éåå ãæ€èšããŠã¿ãŠã»ããã diff --git a/vhosts/blog/content/posts/2024-02-10/yapcjapan-2024-report.ndoc b/vhosts/blog/content/posts/2024-02-10/yapcjapan-2024-report.ndoc deleted file mode 100644 index 3e78dc36..00000000 --- a/vhosts/blog/content/posts/2024-02-10/yapcjapan-2024-report.ndoc +++ /dev/null @@ -1,55 +0,0 @@ ---- -[article] -uuid = "230a0048-93c0-4aac-91ef-bb3108f3e587" -title = "YAPC::Hiroshima 2024 åå ã¬ã" -description = "2024-02-10 ã«éå¬ããããYAPC::Hiroshima 2024 ã«åå ããã" -tags = [ - "conference", - "perl", - "yapc", -] - -[[article.revisions]] -date = "2024-02-10" -remark = "å
¬é" ---- -<article> - <section id="intro"> - <h>ã¯ããã«</h> - <p> - 2024-02-10 ã«éå¬ãããã<a href="https://yapcjapan.org/2024hiroshima/">YAPC::Hiroshima 2024</a> ã«åå ããã - </p> - </section> - <section id="sessions-thoughts"> - <h>ã»ãã·ã§ã³ã®ææ³</h> - <p> - â»ã»ãã·ã§ã³ã®é¡åãšçºè¡šè
åã¯ã<a href="https://fortee.jp/yapc-hiroshima-2024">ã«ã³ãã¡ã¬ã³ã¹ã® fortee ããŒãž</a>ããåŒçšã - </p> - <ul> - <li><a href="https://fortee.jp/yapc-hiroshima-2024/proposal/c0e77f91-f856-48a0-9741-b9afb662cd30">VISAã«ãŒãã®è£åŽãš âæãæããâ æ±ºæžã·ã¹ãã ã®è²ãŠæ¹ (äžè°· ãã)</a> - <ul> - <li>ãã¹ãã¹ããŒã«ãŒè³ã«ãéžã°ããŠããŸãããã倧å€é¢çœãçºè¡šã§ãããç§èªèº«ã¯ã«ãŒã決æžã®ç¥èããŸã£ãããªãã£ãã®ã§ãããå·§ã¿ãªèª¬æã«ããããããã£ããããªæ°ããããç¶æ
ã«ãªããŸããã</li> - </ul> - </li> - <li><a href="https://fortee.jp/yapc-hiroshima-2024/proposal/0e545260-61e1-465e-951c-91d6afb7782c">awkã§ã€ãã£ãŠããããWebã¢ããªã±ãŒã·ã§ã³ (ãããŸãŒ ãã)</a> - <ul> - <li>ã²ãŒã ã§ãããã°ã©ãã³ã°ã§ãçžããã¬ã€ã»ã©æ¥œãããã®ã¯ãªããšæããŸããçºè¡šäžã§ã¯ããã£ãšæµãããŠããŸããããããŒã¿ããŒã¹ãšã®éä¿¡ã TLSãGitHub ã® SSO ãªã©ãããã awk ã§æžããããšã¯æãã¬æ©èœã倿°å®è£
ãããŠãããã«ã³ãã¡ã¬ã³ã¹ãªã©ã®å Žã§ãããªããªãå³ããããšã®ãªãçæ°ã«è§Šããããšãã§ããŸããã</li> - </ul> - </li> - <li>ããŒããŒã (æç«ã
ãã)</li> - <ul> - <li>â» æåŸ
è¬æŒã®ãã fortee ã®ããããŒã¶ã«ããŒãžãªã</li> - <li>ç§ãå°åŠ6幎çã®ãšããããã°ã©ãã³ã°ãå§ããããšæåã«éããã®ãã<a href="https://www.tohoho-web.com/java/">ãšã»ã»ã® Java å
¥é</a>ãã§ãããç§ã®äººçã®éãæ±ºå®ãããã®ç¬¬äžæ©ç®ã®ãµã€ãã®éå¶è
ãä»ãŸãã«ç®ã®åã§è©±ããŠãããšããã®ã¯ãæåãªã©ãšããèšèã§ã¯ãšãŠãèšãå°œãããŸãããããã ãã§ãåºå³¶ãŸã§æ¥ã䟡å€ããã£ããšæèšã§ããŸãã</li> - </ul> - </ul> - </section> - <section id="outro"> - <h>ãããã«</h> - <p> - æé«ã ã£ããç¹ã«ãæç«ã
æ°ã®è¬æŒãçã§æèŽã§ããã®ã¯ãææ
šãšãšãã«å€§ãã«åºæ¿ãšãªã£ããæ¬¡åã® YAPC ã«ãæ¯éåå ãããã - </p> - <p> - P.S. Perl ãæžããããšããªããšãåäºåã«æ¥œãããã€ãã³ããªã®ã§ããPerl ãæžããªãããšããçç±ã§åå ããªãã£ãããã¯ãæ¬¡åæ¯éåå ãæ€èšããŠã¿ãŠã»ããã - </p> - </section> -</article> diff --git a/vhosts/blog/content/posts/2024-02-22/phpkansai-2024-report.dj b/vhosts/blog/content/posts/2024-02-22/phpkansai-2024-report.dj new file mode 100644 index 00000000..83205e13 --- /dev/null +++ b/vhosts/blog/content/posts/2024-02-22/phpkansai-2024-report.dj @@ -0,0 +1,44 @@ +--- +[article] +uuid = "fd8fcb03-8e4d-4ca7-8499-0674accc51a9" +title = "PHPã«ã³ãã¡ã¬ã³ã¹é¢è¥¿ 2024 åå ã¬ã" +description = "2024-02-11 ã«éå¬ããããPHPã«ã³ãã¡ã¬ã³ã¹é¢è¥¿ 2024 ã«åå ããã" +tags = [ + "conference", + "php", + "phpkansai", +] + +[[article.revisions]] +date = "2024-02-21" +remark = "å
¬é" +--- +{#intro} +# ã¯ããã« + +2024-02-11 ã«éå¬ãããã [PHPã«ã³ãã¡ã¬ã³ã¹é¢è¥¿ 2024](https://2024.kphpug.jp/) ã«åå ããã + +{#sessions-thoughts} +# ã»ãã·ã§ã³ã®ææ³ + +â»ã»ãã·ã§ã³ã®é¡åãšçºè¡šè
åã¯ã [ã«ã³ãã¡ã¬ã³ã¹ã® fortee ããŒãž](https://fortee.jp/phpcon-kansai2024) ããåŒçšã + +* [RDBã¢ã³ããã¿ãŒã³ãšæŠã - åé€ãã©ã° å®å
šæ»ç¥ã¬ã€ã (æœæ ¹ 壮倧 ãã)](https://fortee.jp/phpcon-kansai2024/proposal/4e03491c-2a97-40aa-8ff9-a68593b0e847) + + * ã¢ã³ããã¿ãŒã³ãšããŠçŽã®äžã§ã®ç¥èã ããããã®ã®ãå®éã«ã©ãèšèšãã¹ããªã®ãããããã¯ä»ãã§ã«äœ¿ãããŠããå Žåã«ã©ãçŽããŠããã¹ããªã®ãã«ã€ããŠã¯ãç¥èããŸã£ããè¶³ããŠããªãã£ããããããæ©äŒãšãªããŸãããããŒã¿ããŒã¹åéã«ã€ããŠã¯ãä»åŸãç¥èã®ã€ã³ããããšçµéšãå¿
èŠã ãšæããŠããŸãã + +* [PHPã³ãã¥ããã£ããã®é
åãšç±çãããªãã«ãïŒïŒïŒ (ããšã¿ã ãã)](https://fortee.jp/phpcon-kansai2024/proposal/c903c4be-77bb-47b9-85a1-5bfdfd61c1aa) + + * ãããã®èšäºãèªãã§ããããªãããŸã äžåºŠãã«ã³ãã¡ã¬ã³ã¹ãå匷äŒã«åå ããããšããªããªãããã®èšäºã¯ã©ãã§ãããã®ã§ã¹ã©ã€ããèŠãŠãã ãããäŒããã¹ãããšã¯ä»¥äžã§ãã + +* [ã»ãèšèªã«ãã£ãŠPHPã«ãªãæ©èœ (ç°äžã²ããŠã ãã)](https://fortee.jp/phpcon-kansai2024/proposal/0e0befdb-2028-42c8-98e2-b19e434f5a82) + + * ç§ã¯ããã°ã©ãã³ã°èšèªã®æ¯èŒã倧奜ããªã®ã§ãéåžžã«æ¥œããã£ãã§ããUFCS (Uniform Function Call Syntax) ã®ç¥å床ã®äœãã«ã¯é©ããŸããããDèšèªer ã§äŒå Žãåãå°œããããŠãããããã¯ããã§é©ããªã®ã§ãããªããããããŸãããå人çã«ãã»ãèšèªã«ãã£ãŠPHPã«ãªãæ©èœãã®äžã§äžçªã»ããã®ã¯ä»£æ°çããŒã¿åã§ãã + +{#outro} +# ãããã« + +[æ¬ã«ã³ãã¡ã¬ã³ã¹ã®åæ¥ 2024-02-10 㯠YAPC::Hiroshima ã«åå ããŠãã](/posts/2024-02-10/yapcjapan-2024-report/) ã2æ¥é£ç¶ã®ã«ã³ãã¡ã¬ã³ã¹ãšãªã£ããããªãç²ãã¯ãããããã®åå
å®ãã鱿«ãšãªã£ãããã«æãã + +ç¿3æã¯ PHPerKaigi 2024ã4æã¯ PHPã«ã³ãã¡ã¬ã³ã¹å°ç°å 2024 ããããããããã¹ã¿ããå
Œã¹ããŒã«ãŒã§åå äºå®ã§ããã +ä»åºŠã¯æäŸããåŽãšããŠãæºè¶³ã®ããã«ã³ãã¡ã¬ã³ã¹ã«ãªãããã«ãããã diff --git a/vhosts/blog/content/posts/2024-02-22/phpkansai-2024-report.ndoc b/vhosts/blog/content/posts/2024-02-22/phpkansai-2024-report.ndoc deleted file mode 100644 index 430fbc62..00000000 --- a/vhosts/blog/content/posts/2024-02-22/phpkansai-2024-report.ndoc +++ /dev/null @@ -1,55 +0,0 @@ ---- -[article] -uuid = "fd8fcb03-8e4d-4ca7-8499-0674accc51a9" -title = "PHPã«ã³ãã¡ã¬ã³ã¹é¢è¥¿ 2024 åå ã¬ã" -description = "2024-02-11 ã«éå¬ããããPHPã«ã³ãã¡ã¬ã³ã¹é¢è¥¿ 2024 ã«åå ããã" -tags = [ - "conference", - "php", - "phpkansai", -] - -[[article.revisions]] -date = "2024-02-21" -remark = "å
¬é" ---- -<article> - <section id="intro"> - <h>ã¯ããã«</h> - <p> - 2024-02-11 ã«éå¬ãããã<a href="https://2024.kphpug.jp/">PHPã«ã³ãã¡ã¬ã³ã¹é¢è¥¿ 2024</a> ã«åå ããã - </p> - </section> - <section id="sessions-thoughts"> - <h>ã»ãã·ã§ã³ã®ææ³</h> - <p> - â»ã»ãã·ã§ã³ã®é¡åãšçºè¡šè
åã¯ã<a href="https://fortee.jp/phpcon-kansai2024">ã«ã³ãã¡ã¬ã³ã¹ã® fortee ããŒãž</a>ããåŒçšã - </p> - <ul> - <li><a href="https://fortee.jp/phpcon-kansai2024/proposal/4e03491c-2a97-40aa-8ff9-a68593b0e847">RDBã¢ã³ããã¿ãŒã³ãšæŠã - åé€ãã©ã° å®å
šæ»ç¥ã¬ã€ã (æœæ ¹ 壮倧 ãã)</a> - <ul> - <li>ã¢ã³ããã¿ãŒã³ãšããŠçŽã®äžã§ã®ç¥èã ããããã®ã®ãå®éã«ã©ãèšèšãã¹ããªã®ãããããã¯ä»ãã§ã«äœ¿ãããŠããå Žåã«ã©ãçŽããŠããã¹ããªã®ãã«ã€ããŠã¯ãç¥èããŸã£ããè¶³ããŠããªãã£ããããããæ©äŒãšãªããŸãããããŒã¿ããŒã¹åéã«ã€ããŠã¯ãä»åŸãç¥èã®ã€ã³ããããšçµéšãå¿
èŠã ãšæããŠããŸãã</li> - </ul> - </li> - <li><a href="https://fortee.jp/phpcon-kansai2024/proposal/c903c4be-77bb-47b9-85a1-5bfdfd61c1aa">PHPã³ãã¥ããã£ããã®é
åãšç±çãããªãã«ãïŒïŒïŒ (ããšã¿ã ãã)</a> - <ul> - <li>ãããã®èšäºãèªãã§ããããªãããŸã äžåºŠãã«ã³ãã¡ã¬ã³ã¹ãå匷äŒã«åå ããããšããªããªãããã®èšäºã¯ã©ãã§ãããã®ã§ã¹ã©ã€ããèŠãŠãã ãããäŒããã¹ãããšã¯ä»¥äžã§ãã</li> - </ul> - </li> - <li><a href="https://fortee.jp/phpcon-kansai2024/proposal/0e0befdb-2028-42c8-98e2-b19e434f5a82">ã»ãèšèªã«ãã£ãŠPHPã«ãªãæ©èœ (ç°äžã²ããŠã ãã)</a></li> - <ul> - <li>ç§ã¯ããã°ã©ãã³ã°èšèªã®æ¯èŒã倧奜ããªã®ã§ãéåžžã«æ¥œããã£ãã§ããUFCS (Uniform Function Call Syntax) ã®ç¥å床ã®äœãã«ã¯é©ããŸããããDèšèªer ã§äŒå Žãåãå°œããããŠãããããã¯ããã§é©ããªã®ã§ãããªããããããŸãããå人çã«ãã»ãèšèªã«ãã£ãŠPHPã«ãªãæ©èœãã®äžã§äžçªã»ããã®ã¯ä»£æ°çããŒã¿åã§ãã</li> - </ul> - </ul> - </section> - <section id="outro"> - <h>ãããã«</h> - <p> - <a href="/posts/2024-02-10/yapcjapan-2024-report/">æ¬ã«ã³ãã¡ã¬ã³ã¹ã®åæ¥ 2024-02-10 㯠YAPC::Hiroshima ã«åå ããŠãã</a>ã2æ¥é£ç¶ã®ã«ã³ãã¡ã¬ã³ã¹ãšãªã£ããããªãç²ãã¯ãããããã®åå
å®ãã鱿«ãšãªã£ãããã«æãã - </p> - <p> - ç¿3æã¯ PHPerKaigi 2024ã4æã¯ PHPã«ã³ãã¡ã¬ã³ã¹å°ç°å 2024 ããããããããã¹ã¿ããå
Œã¹ããŒã«ãŒã§åå äºå®ã§ããã - ä»åºŠã¯æäŸããåŽãšããŠãæºè¶³ã®ããã«ã³ãã¡ã¬ã³ã¹ã«ãªãããã«ãããã - </p> - </section> -</article> diff --git a/vhosts/blog/content/posts/2024-03-17/phperkaigi-2024-report.dj b/vhosts/blog/content/posts/2024-03-17/phperkaigi-2024-report.dj new file mode 100644 index 00000000..29e16cc8 --- /dev/null +++ b/vhosts/blog/content/posts/2024-03-17/phperkaigi-2024-report.dj @@ -0,0 +1,85 @@ +--- +[article] +uuid = "750be5c8-ca52-4cbd-86fe-5645b06bde95" +title = "PHPerKaigi 2024 åå ã¬ã" +description = "2024-03-07 ãã 2024-03-09 ã«ãããŠéå¬ããããPHPerKaigi 2024 ã«åå ããã" +tags = [ + "conference", + "php", + "phperkaigi", +] + +[[article.revisions]] +date = "2024-03-17" +remark = "å
¬é" + +[[article.revisions]] +date = "2024-07-07" +remark = "Wasm ã©ã³ã¿ã€ã ã®é²æã«ã€ããŠè¿œèš" +--- +{#intro} +# ã¯ããã« + +2024-03-07 ãã 2024-03-09 ã«ãããŠéå¬ãããã [PHPerKaigi 2024](https://phperkaigi.jp/2024/) ã«åå ããã +ä»å¹Žã¯ã¹ããŒã«ãŒãšããŠããŸããã³ã¢ã¹ã¿ãããšããŠåå ããã + +éå»ã®åå ã¬ãã¯ãã¡ã: + +* [PHPerKaigi 2023](/posts/2023-04-04/phperkaigi-2023-report/) +* [PHPerKaigi 2022](/posts/2022-05-01/phperkaigi-2022/) +* [PHPerKaigi 2021](/posts/2021-03-30/phperkaigi-2021/) + +{#as-speaker} +# ã¹ããŒã«ãŒãšã㊠+ +æšå¹Žã«ç¶ããã¹ããŒã«ãŒãšããŠç»å£ããããªã£ãã + +* WebAssembly ãçè§£ãã ãVM ã®äœæãéããŠã + + * [ããããŒã¶ã«](https://fortee.jp/phperkaigi-2024/proposal/bc5dc153-17af-4079-8f1b-2660af97e2c8) + * [ã¹ã©ã€ã](/slides/2024-03-08/phperkaigi-2024/) + +WebAssembly ã® VM ã PHP ã§å®è£
ããå®è£
ã«è³ããŸã§ã®éçšã WebAssembly ã®ç¹åŸŽãèšèªåŠçç³»ãäœã楜ããã«ã€ããŠèªã£ãã +ã¿ã€ãã«ã«ãããWebAssembly ãçè§£ããããšããç®çãéæã§ãããããªããŒã¯ã ã£ãããšèšããããšçåã¯æ®ããã®ã®ãå®éã«äœã£ã人ã«ããã§ããªã話ãããããšã¯ã§ãããšæãã + +{#as-staff} +# ã³ã¢ã¹ã¿ãããšã㊠+ +æšå¹Žã¯åœæ¥ã¹ã¿ãããšããŠåå ããããä»å¹Žã¯ã³ã¢ã¹ã¿ãããšããŠéå¶ã«åå ããã +ä»å¹Žã¯ã³ãŒããŽã«ãäŒç»ãææ¡ãããã®æºåãšã·ã¹ãã ã®éçºãåœæ¥ã®éçšããããªã£ãã +ãã®ã·ã¹ãã ã¯çŸåšãäžèšã® URL ããé²èЧã§ããåœæ¥åºé¡ãããåé¡ãåå è
ã®æ¹ã
ã®åçãèŠãããã + +[Albatross.PHP](https://t.nil.ninja/phperkaigi/2024/golf/) + +ã·ã¹ãã ã®éçºå®äºãåé¡ã®äœæå®äºã¯ã¹ã±ãžã¥ãŒã«ã®ãªã®ãªãšãªã£ãã®ã ããåœæ¥ã¯ããããå®å®ããŠçšŒåããŠããã®ã§ã¯ãªãããšæãã + +{#as-attendee} +# åå è
ãšã㊠+ +{#my-best-session} +## ãã€ãã¹ãã»ãã·ã§ã³ + +[RubyVM ã PHP ã§å®è£
ãããHello World ãåºåãããŸã§ã](https://fortee.jp/phperkaigi-2024/proposal/ac59d0dd-795a-47cb-ba59-c0b1772d00cc) (ããã㌠ãã) + +ä»åäžçªæ¥œãã¿ã«ããŠããã»ãã·ã§ã³ã§ãããæåŸ
ã©ããã®é¢çœãã ã£ãã +ç§ãä»å VM ãäœããšããããŒãã§ç»å£ããããšããããé«ãè§£å床ã§åãåãããšãã§ããããã«æãã + +P.S. Ask the Speaker ã§è©±ãããRuby VM (written in PHP) on PHP VM (compiled to Wasm) on Wasm VM (written in PHP) on PHP ãšããã¢ã€ãã¢ã¯ãããžããªã®ã§ãç¶å ±ããåŸ
ã¡ãã ãã (èªäœ Wasm runtime ã«äžè¶³ããŠããæ©èœãéæå®è£
äžã§ã)ã + +2024-07-07 远èš: [ã³ããã a312e95](https://github.com/nsfisis/php-waddiwasi/commit/a312e95a95d243943535f94653822d6796d4637f) ã§ãã€ãã« Ruby VM on PHP VM on Wasm VM on PHP ãå®çŸãããçŸæç¹ã§ã®åãããã㯠README ã«èšèŒããŠããã + +{#outro} +# ãããã« + +ä»å¹Žã¯ã¹ããŒã«ãŒãšã¹ã¿ãããšãã«éçºã䌎ããã®ã ã£ãã®ã§ (Wasm åŠçç³»ãšã³ãŒããŽã«ãã·ã¹ãã )ãäž¡è
ãã¶ã€ãã£ãçµæãšããŠæºå段éã¯å»å¹Žããã倧å€ã«ãªã£ãã + +[ãŽãªãŽãªã«éçºããªããã°ãããªãã»ãã·ã§ã³ã®ã¹ããŒã«ãŒãšãŽãªãŽãªã«éçºããªããã°ãããªãäŒç»ã®ã¹ã¿ãããåãã«ã³ãã¡ã¬ã³ã¹ã§ãã£ãŠã¯ãããªã](https://twitter.com/nsfisis/status/1765366490277253502) + +ãã ãããã§ãã³ã¢ã¹ã¿ãããšããŠå幎ã»ã©é¢ãã£ãã ãã«ãçµãã£ãŠã¿ããšææ
šæ·±ãã +äŸå¹Žã©ããããç¥ã®ãããªæŽ»æ°ã»ç±æ°ãæããããšãã§ããã + +æ¥æã¯ããŸãç»å£ãšã¹ã¿ãã (ãã¡ãã¯åœæ¥ã¹ã¿ãã) ããããªã [PHP ã«ã³ãã¡ã¬ã³ã¹å°ç°å](https://phpcon-odawara.jp/) ãããã®ã§ãè¯ãããŒã¯ã»è¯ãã«ã³ãã¡ã¬ã³ã¹ãäœããããã«ãããã + +ããŠãåå ã¬ãã¯äŸå¹Žãã®èšèã§ç· ãæ¬ã£ãŠããã®ã§ãä»å¹Žãããã§çµããããšæãã + +ã§ã¯ãŸãæ¥å¹Žã diff --git a/vhosts/blog/content/posts/2024-03-17/phperkaigi-2024-report.ndoc b/vhosts/blog/content/posts/2024-03-17/phperkaigi-2024-report.ndoc deleted file mode 100644 index c5eee896..00000000 --- a/vhosts/blog/content/posts/2024-03-17/phperkaigi-2024-report.ndoc +++ /dev/null @@ -1,110 +0,0 @@ ---- -[article] -uuid = "750be5c8-ca52-4cbd-86fe-5645b06bde95" -title = "PHPerKaigi 2024 åå ã¬ã" -description = "2024-03-07 ãã 2024-03-09 ã«ãããŠéå¬ããããPHPerKaigi 2024 ã«åå ããã" -tags = [ - "conference", - "php", - "phperkaigi", -] - -[[article.revisions]] -date = "2024-03-17" -remark = "å
¬é" - -[[article.revisions]] -date = "2024-07-07" -remark = "Wasm ã©ã³ã¿ã€ã ã®é²æã«ã€ããŠè¿œèš" ---- -<article> - <section id="intro"> - <h>ã¯ããã«</h> - <p> - 2024-03-07 ãã 2024-03-09 ã«ãããŠéå¬ãããã<a href="https://phperkaigi.jp/2024/">PHPerKaigi 2024</a> ã«åå ããã - ä»å¹Žã¯ã¹ããŒã«ãŒãšããŠããŸããã³ã¢ã¹ã¿ãããšããŠåå ããã - </p> - <p> - éå»ã®åå ã¬ãã¯ãã¡ã: - </p> - <ul> - <li><a href="/posts/2023-04-04/phperkaigi-2023-report/">PHPerKaigi 2023</a></li> - <li><a href="/posts/2022-05-01/phperkaigi-2022/">PHPerKaigi 2022</a></li> - <li><a href="/posts/2021-03-30/phperkaigi-2021/">PHPerKaigi 2021</a></li> - </ul> - </section> - <section id="as-speaker"> - <h>ã¹ããŒã«ãŒãšããŠ</h> - <p> - æšå¹Žã«ç¶ããã¹ããŒã«ãŒãšããŠç»å£ããããªã£ãã - </p> - <ul> - <li> - WebAssembly ãçè§£ãã ãVM ã®äœæãéããŠã - <ul> - <li><a href="https://fortee.jp/phperkaigi-2024/proposal/bc5dc153-17af-4079-8f1b-2660af97e2c8">ããããŒã¶ã«</a></li> - <li><a href="/slides/2024-03-08/phperkaigi-2024/">ã¹ã©ã€ã</a></li> - </ul> - </li> - </ul> - <p> - WebAssembly ã® VM ã PHP ã§å®è£
ããå®è£
ã«è³ããŸã§ã®éçšã WebAssembly ã®ç¹åŸŽãèšèªåŠçç³»ãäœã楜ããã«ã€ããŠèªã£ãã - ã¿ã€ãã«ã«ãããWebAssembly ãçè§£ããããšããç®çãéæã§ãããããªããŒã¯ã ã£ãããšèšããããšçåã¯æ®ããã®ã®ãå®éã«äœã£ã人ã«ããã§ããªã話ãããããšã¯ã§ãããšæãã - </p> - </section> - <section id="as-staff"> - <h>ã³ã¢ã¹ã¿ãããšããŠ</h> - <p> - æšå¹Žã¯åœæ¥ã¹ã¿ãããšããŠåå ããããä»å¹Žã¯ã³ã¢ã¹ã¿ãããšããŠéå¶ã«åå ããã - ä»å¹Žã¯ã³ãŒããŽã«ãäŒç»ãææ¡ãããã®æºåãšã·ã¹ãã ã®éçºãåœæ¥ã®éçšããããªã£ãã - ãã®ã·ã¹ãã ã¯çŸåšãäžèšã® URL ããé²èЧã§ããåœæ¥åºé¡ãããåé¡ãåå è
ã®æ¹ã
ã®åçãèŠãããã - </p> - <p> - <a href="https://t.nil.ninja/phperkaigi/2024/golf/">Albatross.PHP</a> - </p> - <p> - ã·ã¹ãã ã®éçºå®äºãåé¡ã®äœæå®äºã¯ã¹ã±ãžã¥ãŒã«ã®ãªã®ãªãšãªã£ãã®ã ããåœæ¥ã¯ããããå®å®ããŠçšŒåããŠããã®ã§ã¯ãªãããšæãã - </p> - </section> - <section id="as-attendee"> - <h>åå è
ãšããŠ</h> - <section id="my-best-session"> - <h>ãã€ãã¹ãã»ãã·ã§ã³</h> - <p> - <a href="https://fortee.jp/phperkaigi-2024/proposal/ac59d0dd-795a-47cb-ba59-c0b1772d00cc">RubyVM ã PHP ã§å®è£
ãããHello World ãåºåãããŸã§ã</a> (ããã㌠ãã) - </p> - <p> - ä»åäžçªæ¥œãã¿ã«ããŠããã»ãã·ã§ã³ã§ãããæåŸ
ã©ããã®é¢çœãã ã£ãã - ç§ãä»å VM ãäœããšããããŒãã§ç»å£ããããšããããé«ãè§£å床ã§åãåãããšãã§ããããã«æãã - </p> - <p> - P.S. Ask the Speaker ã§è©±ãããRuby VM (written in PHP) on PHP VM (compiled to Wasm) on Wasm VM (written in PHP) on PHP ãšããã¢ã€ãã¢ã¯ãããžããªã®ã§ãç¶å ±ããåŸ
ã¡ãã ãã (èªäœ Wasm runtime ã«äžè¶³ããŠããæ©èœãéæå®è£
äžã§ã)ã - </p> - <p> - 2024-07-07 远èš: <a href="https://github.com/nsfisis/php-waddiwasi/commit/a312e95a95d243943535f94653822d6796d4637f">ã³ããã a312e95</a> ã§ãã€ãã« Ruby VM on PHP VM on Wasm VM on PHP ãå®çŸãããçŸæç¹ã§ã®åãããã㯠README ã«èšèŒããŠããã - </p> - </section> - </section> - <section id="outro"> - <h>ãããã«</h> - <p> - ä»å¹Žã¯ã¹ããŒã«ãŒãšã¹ã¿ãããšãã«éçºã䌎ããã®ã ã£ãã®ã§ (Wasm åŠçç³»ãšã³ãŒããŽã«ãã·ã¹ãã )ãäž¡è
ãã¶ã€ãã£ãçµæãšããŠæºå段éã¯å»å¹Žããã倧å€ã«ãªã£ãã - </p> - <p> - <a href="https://twitter.com/nsfisis/status/1765366490277253502">ãŽãªãŽãªã«éçºããªããã°ãããªãã»ãã·ã§ã³ã®ã¹ããŒã«ãŒãšãŽãªãŽãªã«éçºããªããã°ãããªãäŒç»ã®ã¹ã¿ãããåãã«ã³ãã¡ã¬ã³ã¹ã§ãã£ãŠã¯ãããªã</a> - </p> - <p> - ãã ãããã§ãã³ã¢ã¹ã¿ãããšããŠå幎ã»ã©é¢ãã£ãã ãã«ãçµãã£ãŠã¿ããšææ
šæ·±ãã - äŸå¹Žã©ããããç¥ã®ãããªæŽ»æ°ã»ç±æ°ãæããããšãã§ããã - </p> - <p> - æ¥æã¯ããŸãç»å£ãšã¹ã¿ãã (ãã¡ãã¯åœæ¥ã¹ã¿ãã) ããããªã <a href="https://phpcon-odawara.jp/">PHP ã«ã³ãã¡ã¬ã³ã¹å°ç°å</a> ãããã®ã§ãè¯ãããŒã¯ã»è¯ãã«ã³ãã¡ã¬ã³ã¹ãäœããããã«ãããã - </p> - <p> - ããŠãåå ã¬ãã¯äŸå¹Žãã®èšèã§ç· ãæ¬ã£ãŠããã®ã§ãä»å¹Žãããã§çµããããšæãã - </p> - <p> - ã§ã¯ãŸãæ¥å¹Žã - </p> - </section> -</article> diff --git a/vhosts/blog/content/posts/2024-03-20/my-bucket-list.dj b/vhosts/blog/content/posts/2024-03-20/my-bucket-list.dj new file mode 100644 index 00000000..d998cc2b --- /dev/null +++ b/vhosts/blog/content/posts/2024-03-20/my-bucket-list.dj @@ -0,0 +1,46 @@ +--- +[article] +uuid = "6b749793-c760-4597-8a4c-b32d027b7585" +title = "æ»ã¬ãŸã§ã«äœãèªäœââäžèЧãããã¯äººçã® TODO ãªã¹ã" +description = "é§æ" +tags = [ +] + +[[article.revisions]] +date = "2024-03-20" +remark = "å
¬é" + +[[article.revisions]] +date = "2024-04-07" +remark = "URL slug ã todos-in-my-life ãã my-bucket-list ãžå€æŽ" +--- + +ããã¯ç ããªãå€ã«ããŒããžæžãæ£ãããæããªããšãæç« ã®äœè£ã«çŽãããã®ã§ããããããè«çãšåŒã¹ããã®ãæåŸ
ããŠã¯ãªãã¬ã + +Knuth æ°ãããã°ã©ãã³ã°ã¯æèžã§ãããæã£ãŠããããåŽåœ¹ã«äŒŽããããã¯ãã£ãã§ãã©ã¯ãã£ã«ã«ãªè¡çºãæããŠããèšã£ãŠããã®ã§ã¯ãªã (Knuth ãã©ãèããŠãããã¯ç¥ããªãããå°ãªããšãç§ã«ãšã£ãŠã¯)ãããããè¶£å³ããã°ã©ãã³ã°ãç©¢ããªãèªç±æå¿ã®äžã§èšè¿°ãããããã°ã©ã ãšã¯ããªãã¡ãçµµæãã«ãšã£ãŠã®çµµãæåæžãã«ãšã£ãŠã®æç« ã«çãããããã°ã©ã ãšã¯ããœãŒã¹ã³ãŒããšã¯ãèžè¡äœåã®äžåœ¢æ
ãªã®ã§ããã + +ãã®äººçã§ããã°ã©ãã³ã°ãšããè¡çºã«é
ããããããã«ã¯ãçŸããäœåãéºããã°ãªãã¬ãããªãã¡ãç°¡æœã§ãçè§£ãããããåçž®ãããæ©èœçã§ãéãã軜ããããååãæã¡ãããŸãåããã®ãã ã + +äœãäœããããã¯åã
ç°ãªãã§ãããããç§ã«ãšã£ãŠã¯è»èŒªã®åçºæãšããŠç¥ãããèªäœââã§ããã + +è»èŒªã®åçºæãæããŠã¯ãããªãããããæ¹å€ãã人éãšããã®ã¯ããããã¯ãã£ããã£ããã©ã¯ãã£ã«ãªãã£ã«ãã©ãŒã«ã¹ãããšã³ãžãã¢ãšãã人皮ã§ãããä»ç§ã衚çŸè
ããããšãããªããèªãã®æã§èªãã®è»èŒªãäœãããšã«äœã®æããæ±ãå¿
èŠãããããã + +ããããããç§ã®æ»ã¬ãŸã§ã«äœãèªäœââäžèЧãããã¯äººçã® TODO ãªã¹ãã§ãã (çŸæç¹ã§ãã§ã«éšåçãããã¯å
šé¢çã«éæããŠãããã®ãå«ã)ã + +* èªäœ C ã³ã³ãã€ã© +* èªäœã¢ã»ã³ãã© +* èªäœãªã³ã« +* èªäœ Scheme åŠçç³» +* èªäœ ML ã³ã³ãã€ã© +* èªäœ Lua åŠçç³» +* èªäœ JVM +* èªäœ Wasm åŠçç³» +* èªäœæ£èŠè¡šçŸãšã³ãžã³ +* èªäœ JavaScript åŠçç³» +* èªäœãã©ãŠã¶ +* èªäœãšãã£ã¿ +* èªäœ ActivityPub å®è£
+ +éžå®çç±ã¯äœããããšããããšã®ã»ãã«ãªããããã«é¡æãšãã£ã³ãã¹ãããçµµçãšçµµå
·ãããã°ãçããšãçãããã®ããã¥ããã³ãŒããæžãããããã + +ãããé¡ããã¯ãç§ã«ããããçã¿åºãã ãã®æéããããããšãã diff --git a/vhosts/blog/content/posts/2024-03-20/my-bucket-list.ndoc b/vhosts/blog/content/posts/2024-03-20/my-bucket-list.ndoc deleted file mode 100644 index 8bef847c..00000000 --- a/vhosts/blog/content/posts/2024-03-20/my-bucket-list.ndoc +++ /dev/null @@ -1,57 +0,0 @@ ---- -[article] -uuid = "6b749793-c760-4597-8a4c-b32d027b7585" -title = "æ»ã¬ãŸã§ã«äœãèªäœââäžèЧãããã¯äººçã® TODO ãªã¹ã" -description = "é§æ" -tags = [ -] - -[[article.revisions]] -date = "2024-03-20" -remark = "å
¬é" - -[[article.revisions]] -date = "2024-04-07" -remark = "URL slug ã todos-in-my-life ãã my-bucket-list ãžå€æŽ" ---- -<article> - <p> - ããã¯ç ããªãå€ã«ããŒããžæžãæ£ãããæããªããšãæç« ã®äœè£ã«çŽãããã®ã§ããããããè«çãšåŒã¹ããã®ãæåŸ
ããŠã¯ãªãã¬ã - </p> - <p> - Knuth æ°ãããã°ã©ãã³ã°ã¯æèžã§ãããæã£ãŠããããåŽåœ¹ã«äŒŽããããã¯ãã£ãã§ãã©ã¯ãã£ã«ã«ãªè¡çºãæããŠããèšã£ãŠããã®ã§ã¯ãªã (Knuth ãã©ãèããŠãããã¯ç¥ããªãããå°ãªããšãç§ã«ãšã£ãŠã¯)ãããããè¶£å³ããã°ã©ãã³ã°ãç©¢ããªãèªç±æå¿ã®äžã§èšè¿°ãããããã°ã©ã ãšã¯ããªãã¡ãçµµæãã«ãšã£ãŠã®çµµãæåæžãã«ãšã£ãŠã®æç« ã«çãããããã°ã©ã ãšã¯ããœãŒã¹ã³ãŒããšã¯ãèžè¡äœåã®äžåœ¢æ
ãªã®ã§ããã - </p> - <p> - ãã®äººçã§ããã°ã©ãã³ã°ãšããè¡çºã«é
ããããããã«ã¯ãçŸããäœåãéºããã°ãªãã¬ãããªãã¡ãç°¡æœã§ãçè§£ãããããåçž®ãããæ©èœçã§ãéãã軜ããããååãæã¡ãããŸãåããã®ãã ã - </p> - <p> - äœãäœããããã¯åã
ç°ãªãã§ãããããç§ã«ãšã£ãŠã¯è»èŒªã®åçºæãšããŠç¥ãããèªäœââã§ããã - </p> - <p> - è»èŒªã®åçºæãæããŠã¯ãããªãããããæ¹å€ãã人éãšããã®ã¯ããããã¯ãã£ããã£ããã©ã¯ãã£ã«ãªãã£ã«ãã©ãŒã«ã¹ãããšã³ãžãã¢ãšãã人皮ã§ãããä»ç§ã衚çŸè
ããããšãããªããèªãã®æã§èªãã®è»èŒªãäœãããšã«äœã®æããæ±ãå¿
èŠãããããã - </p> - <p> - ããããããç§ã®æ»ã¬ãŸã§ã«äœãèªäœââäžèЧãããã¯äººçã® TODO ãªã¹ãã§ãã (çŸæç¹ã§ãã§ã«éšåçãããã¯å
šé¢çã«éæããŠãããã®ãå«ã)ã - </p> - <ul> - <li>èªäœ C ã³ã³ãã€ã©</li> - <li>èªäœã¢ã»ã³ãã©</li> - <li>èªäœãªã³ã«</li> - <li>èªäœ Scheme åŠçç³»</li> - <li>èªäœ ML ã³ã³ãã€ã©</li> - <li>èªäœ Lua åŠçç³»</li> - <li>èªäœ JVM</li> - <li>èªäœ Wasm åŠçç³»</li> - <li>èªäœæ£èŠè¡šçŸãšã³ãžã³</li> - <li>èªäœ JavaScript åŠçç³»</li> - <li>èªäœãã©ãŠã¶</li> - <li>èªäœãšãã£ã¿</li> - <li>èªäœ ActivityPub å®è£
</li> - </ul> - <p> - éžå®çç±ã¯äœããããšããããšã®ã»ãã«ãªããããã«é¡æãšãã£ã³ãã¹ãããçµµçãšçµµå
·ãããã°ãçããšãçãããã®ããã¥ããã³ãŒããæžãããããã - </p> - <p> - ãããé¡ããã¯ãç§ã«ããããçã¿åºãã ãã®æéããããããšãã - </p> -</article> diff --git a/vhosts/blog/content/posts/2024-04-14/phpcon-odawara-2024-report.dj b/vhosts/blog/content/posts/2024-04-14/phpcon-odawara-2024-report.dj new file mode 100644 index 00000000..3207d3d0 --- /dev/null +++ b/vhosts/blog/content/posts/2024-04-14/phpcon-odawara-2024-report.dj @@ -0,0 +1,76 @@ +--- +[article] +uuid = "be9c896d-7efa-42dd-a50a-dda5fd3a7f5c" +title = "PHP ã«ã³ãã¡ã¬ã³ã¹å°ç°å 2024 åå ã¬ã" +description = "2024-04-13 ã«éå¬ããããPHP ã«ã³ãã¡ã¬ã³ã¹å°ç°å 2024 ã«åå ããã" +tags = [ + "conference", + "php", + "phpcon-odawara", +] + +[[article.revisions]] +date = "2024-04-14" +remark = "å
¬é" + +[[article.revisions]] +date = "2024-06-01" +remark = "ã»ãã·ã§ã³ã®ææ³ã远å " +--- +{#intro} +# ã¯ããã« + +2024-04-13 ã«éå¬ããã [PHP ã«ã³ãã¡ã¬ã³ã¹å°ç°å](https://phpcon-odawara.jp/) ã«ãã¹ããŒã«ãŒãšããŠããŸãåœæ¥ã¹ã¿ãããšããŠåå ããã + +{#as-speaker} +# ã¹ããŒã«ãŒãšã㊠+ +PHP åŠç系㮠JIT ã³ã³ãã€ã«ã«ããã PHP 8.4 ã§ã®å€æŽã«ã€ããŠãç»å£ããããªã£ãã + +* æ¥ãæ° JIT ãšã³ãžã³ã«ã€ããŠç¥ã£ãæ°ã«ãªã + + * [ããããŒã¶ã«](https://fortee.jp/phpconodawara-2024/proposal/bc9669f6-6583-489c-aa6a-1b68abf7c291) + * [ã¹ã©ã€ã](/slides/2024-04-13/phpcon-odawara-2024/) + +ä»åãã©ããã話ãå§ããã倧ãã«è¿·ã£ãã®ã ããæçµçã«ã¯ PHP åŠç系㮠opcode ã VM ãšãã£ãæŠå¿µã¯æ¢ç¥ã®ãã®ãšãããããã JIT ã³ã³ãã€ã«ãžç¹ãããšãã£ãæ§æã«ããã + +PHP ã®åŠçç³»ãã¹ã¯ãªããã opcode ãžå€æããéçšã«ã€ããŠã¯ãã¡ããã©åãã«ã³ãã¡ã¬ã³ã¹ã® [ããããŒããã®çºè¡š](https://fortee.jp/phpconodawara-2024/proposal/21d94a60-404d-4fba-8c60-d1c8889a0138) ããããåèã«ããŠããã ããšããã ããã +ãŸããæ°ãã IR ã«ã€ããŠãã詳ããç¥ããããšããæ¹ã¯ãã¹ã©ã€ãæ«å°Ÿã®ãåèè³æãã«ãããªã³ã¯ãåç
§ããã ãã®ãããããšæãã + +Tracing JIT ã®çºç«æ¡ä»¶ããIR ã䜿ã£ãŠå®çŸãããæé©åæ¹æ³ãªã©ã調ã¹ããã®ã®çºè¡šã«å
¥ããªãã£ã話ãããŸããšããã®ã§ããããã©ããã«æã£ãŠãããã°ãšèããŠããã + +{#as-staff} +# ã¹ã¿ãããšã㊠+ +åœæ¥ã¹ã¿ãããšããŠåæ¥ã®æºåãšåœæ¥ã®éå¶ããããªã£ããä»åã¯ã¢ãã®ç§»åãæ¯èŒç (æ¯èŒå¯Ÿè±¡: [PHPerKaigi](/posts/2024-03-17/phperkaigi-2024-report/) ) å°ãªããäœåã«ã¯ããªãäœè£ããã£ãã + +èªåã®æ
åœç¯å²å
ã§ã¯ãäžåºŠã¿ã€ã ããŒããŒä¿ã®ãšãã«æéãæãããééãã以å€ã¯ãã¹ã ãŒãºã«é²ããããããšæãã + +ãŸããããã¯ã³ã¢ã¹ã¿ããã®æ¹ã
ã®ãããã ããããåéå¬ãšããŠã¯å€§ããªãã©ãã«ãªãçµãã£ããšèšããã®ã§ã¯ãªãã ãããã + +{#as-attendee} +# åå è
ãšã㊠+ +çºè¡šã¿ã€ãã«ãšçºè¡šè
å㯠fortee ããåŒçš + +* FigmaãšPHPã§äœãã1ããªãããšã衚瀺厩ãããªãæåŒ·ã®åž³ç¥šå°å·ãœãªã¥ãŒã·ã§ã³ (ãã€ãã¡ ãã) + + * ããããŒã¶ã«ãªã³ã¯: https://fortee.jp/phpconodawara-2024/proposal/7c57d5ca-213a-4d7a-aaf0-26ddc44897f0 + * ææ³: æåã®ã¢ã€ãã¢ããéäžã®æ³¥èãã¯ãŒã¯ã¢ã©ãŠã³ããŸã§éåžžã«ãããããã£ãã§ãã垳祚ã«ã¯äœåºŠãèŠãããããŠããã®ã§ãæ©äŒãããã°è©ŠããŠã¿ããã§ãã + +* PHPã®æ¬¡æããŒãžã§ã³ã¯ãã®ææã©ããªã£ãŠããã®ããInternalsã®éçºäœå¶ã«ã€ã㊠(ãŠããã ãã) + + * ããããŒã¶ã«ãªã³ã¯: https://fortee.jp/phpconodawara-2024/proposal/740b034a-81f0-4b7a-90e9-cd3fa01c651f + * ææ³: åã
ããåºãããšããŠãã RFC ãããã®ã§ãRFC ã«ã€ããŠã®æ¥æ¬èªæ
å ±ãå¢ããã®ã¯å€§å€ãããããã§ããããšã¯äœæ¥ãé²ããªããã°......ã + +* Architecture Decision Record ãäžå¹ŽéçšããŠã¿ã (坿 亮 ãã) + + * ããããŒã¶ã«ãªã³ã¯: https://fortee.jp/phpconodawara-2024/proposal/56218b4f-b724-4199-82f1-67497501a9ef + * ææ³: ä»åæã楜ãã¿ã«ããŠããçºè¡šã®äžã€ã§ããèšèšæéã®èª¿æ»ã»å
±æçã«ã¯èª²é¡ãæããŠããã®ã§ãåŒããŒã ã§ãå°å
¥ã®ããã«åããŠããããšæããŸãã + +{#outro} +# ãããã« + +ææ¶ã®æå PHP ã«ã³ãã¡ã¬ã³ã¹ãæãè¿ããšãªã£ããããŸã ãŸã æ°é®®ã«æ¥œããã + +ãŸãä»åºŠãã«ã³ãã¡ã¬ã³ã¹ã§äŒããŸããã (éæºå°ãããããã£ãŠããªãã®ã ããã©ã575 ãæµè¡ã£ãŠããããã)ã diff --git a/vhosts/blog/content/posts/2024-04-14/phpcon-odawara-2024-report.ndoc b/vhosts/blog/content/posts/2024-04-14/phpcon-odawara-2024-report.ndoc deleted file mode 100644 index b30f460e..00000000 --- a/vhosts/blog/content/posts/2024-04-14/phpcon-odawara-2024-report.ndoc +++ /dev/null @@ -1,102 +0,0 @@ ---- -[article] -uuid = "be9c896d-7efa-42dd-a50a-dda5fd3a7f5c" -title = "PHP ã«ã³ãã¡ã¬ã³ã¹å°ç°å 2024 åå ã¬ã" -description = "2024-04-13 ã«éå¬ããããPHP ã«ã³ãã¡ã¬ã³ã¹å°ç°å 2024 ã«åå ããã" -tags = [ - "conference", - "php", - "phpcon-odawara", -] - -[[article.revisions]] -date = "2024-04-14" -remark = "å
¬é" - -[[article.revisions]] -date = "2024-06-01" -remark = "ã»ãã·ã§ã³ã®ææ³ã远å " ---- -<article> - <section id="intro"> - <h>ã¯ããã«</h> - <p> - 2024-04-13 ã«éå¬ããã<a href="https://phpcon-odawara.jp/">PHP ã«ã³ãã¡ã¬ã³ã¹å°ç°å</a>ã«ãã¹ããŒã«ãŒãšããŠããŸãåœæ¥ã¹ã¿ãããšããŠåå ããã - </p> - </section> - <section id="as-speaker"> - <h>ã¹ããŒã«ãŒãšããŠ</h> - <p> - PHP åŠç系㮠JIT ã³ã³ãã€ã«ã«ããã PHP 8.4 ã§ã®å€æŽã«ã€ããŠãç»å£ããããªã£ãã - </p> - <ul> - <li> - æ¥ãæ° JIT ãšã³ãžã³ã«ã€ããŠç¥ã£ãæ°ã«ãªã - <ul> - <li><a href="https://fortee.jp/phpconodawara-2024/proposal/bc9669f6-6583-489c-aa6a-1b68abf7c291">ããããŒã¶ã«</a></li> - <li><a href="/slides/2024-04-13/phpcon-odawara-2024/">ã¹ã©ã€ã</a></li> - </ul> - </li> - </ul> - <p> - ä»åãã©ããã話ãå§ããã倧ãã«è¿·ã£ãã®ã ããæçµçã«ã¯ PHP åŠç系㮠opcode ã VM ãšãã£ãæŠå¿µã¯æ¢ç¥ã®ãã®ãšãããããã JIT ã³ã³ãã€ã«ãžç¹ãããšãã£ãæ§æã«ããã - </p> - <p> - PHP ã®åŠçç³»ãã¹ã¯ãªããã opcode ãžå€æããéçšã«ã€ããŠã¯ãã¡ããã©åãã«ã³ãã¡ã¬ã³ã¹ã®<a href="https://fortee.jp/phpconodawara-2024/proposal/21d94a60-404d-4fba-8c60-d1c8889a0138">ããããŒããã®çºè¡š</a>ããããåèã«ããŠããã ããšããã ããã - ãŸããæ°ãã IR ã«ã€ããŠãã詳ããç¥ããããšããæ¹ã¯ãã¹ã©ã€ãæ«å°Ÿã®ãåèè³æãã«ãããªã³ã¯ãåç
§ããã ãã®ãããããšæãã - </p> - <p> - Tracing JIT ã®çºç«æ¡ä»¶ããIR ã䜿ã£ãŠå®çŸãããæé©åæ¹æ³ãªã©ã調ã¹ããã®ã®çºè¡šã«å
¥ããªãã£ã話ãããŸããšããã®ã§ããããã©ããã«æã£ãŠãããã°ãšèããŠããã - </p> - </section> - <section id="as-staff"> - <h>ã¹ã¿ãããšããŠ</h> - <p> - åœæ¥ã¹ã¿ãããšããŠåæ¥ã®æºåãšåœæ¥ã®éå¶ããããªã£ããä»åã¯ã¢ãã®ç§»åãæ¯èŒç (æ¯èŒå¯Ÿè±¡: <a href="/posts/2024-03-17/phperkaigi-2024-report/">PHPerKaigi</a>) å°ãªããäœåã«ã¯ããªãäœè£ããã£ãã - </p> - <p> - èªåã®æ
åœç¯å²å
ã§ã¯ãäžåºŠã¿ã€ã ããŒããŒä¿ã®ãšãã«æéãæãããééãã以å€ã¯ãã¹ã ãŒãºã«é²ããããããšæãã - </p> - <p> - ãŸããããã¯ã³ã¢ã¹ã¿ããã®æ¹ã
ã®ãããã ããããåéå¬ãšããŠã¯å€§ããªãã©ãã«ãªãçµãã£ããšèšããã®ã§ã¯ãªãã ãããã - </p> - </section> - <section id="as-attendee"> - <h>åå è
ãšããŠ</h> - <p> - çºè¡šã¿ã€ãã«ãšçºè¡šè
å㯠fortee ããåŒçš - </p> - <ul> - <li> - FigmaãšPHPã§äœãã1ããªãããšã衚瀺厩ãããªãæåŒ·ã®åž³ç¥šå°å·ãœãªã¥ãŒã·ã§ã³ (ãã€ãã¡ ãã) - <ul> - <li>ããããŒã¶ã«ãªã³ã¯: https://fortee.jp/phpconodawara-2024/proposal/7c57d5ca-213a-4d7a-aaf0-26ddc44897f0</li> - <li>ææ³: æåã®ã¢ã€ãã¢ããéäžã®æ³¥èãã¯ãŒã¯ã¢ã©ãŠã³ããŸã§éåžžã«ãããããã£ãã§ãã垳祚ã«ã¯äœåºŠãèŠãããããŠããã®ã§ãæ©äŒãããã°è©ŠããŠã¿ããã§ãã</li> - </ul> - </li> - <li> - PHPã®æ¬¡æããŒãžã§ã³ã¯ãã®ææã©ããªã£ãŠããã®ããInternalsã®éçºäœå¶ã«ã€ã㊠(ãŠããã ãã) - <ul> - <li>ããããŒã¶ã«ãªã³ã¯: https://fortee.jp/phpconodawara-2024/proposal/740b034a-81f0-4b7a-90e9-cd3fa01c651f</li> - <li>ææ³: åã
ããåºãããšããŠãã RFC ãããã®ã§ãRFC ã«ã€ããŠã®æ¥æ¬èªæ
å ±ãå¢ããã®ã¯å€§å€ãããããã§ããããšã¯äœæ¥ãé²ããªããã°......ã</li> - </ul> - </li> - <li> - Architecture Decision Record ãäžå¹ŽéçšããŠã¿ã (坿 亮 ãã) - <ul> - <li>ããããŒã¶ã«ãªã³ã¯: https://fortee.jp/phpconodawara-2024/proposal/56218b4f-b724-4199-82f1-67497501a9ef</li> - <li>ææ³: ä»åæã楜ãã¿ã«ããŠããçºè¡šã®äžã€ã§ããèšèšæéã®èª¿æ»ã»å
±æçã«ã¯èª²é¡ãæããŠããã®ã§ãåŒããŒã ã§ãå°å
¥ã®ããã«åããŠããããšæããŸãã</li> - </ul> - </li> - </ul> - </section> - <section id="outro"> - <h>ãããã«</h> - <p> - ææ¶ã®æå PHP ã«ã³ãã¡ã¬ã³ã¹ãæãè¿ããšãªã£ããããŸã ãŸã æ°é®®ã«æ¥œããã - </p> - <p> - ãŸãä»åºŠãã«ã³ãã¡ã¬ã³ã¹ã§äŒããŸããã (éæºå°ãããããã£ãŠããªãã®ã ããã©ã575 ãæµè¡ã£ãŠããããã)ã - </p> - </section> -</article> diff --git a/vhosts/blog/content/posts/2024-04-21/pipefail-option-in-gitlab-ci-cd.dj b/vhosts/blog/content/posts/2024-04-21/pipefail-option-in-gitlab-ci-cd.dj new file mode 100644 index 00000000..9872d284 --- /dev/null +++ b/vhosts/blog/content/posts/2024-04-21/pipefail-option-in-gitlab-ci-cd.dj @@ -0,0 +1,155 @@ +--- +[article] +uuid = "a4c326a6-5ffe-450c-abf2-45833c5efb6a" +title = "ãGitLabã GitLab CI/CD äžã§ã® bash/sh 㯠pipefail ãæå¹ã«ãªã£ãŠãã" +description = "GitLab CI/CD ã§ bash/sh ã¹ã¯ãªãããåãããšãpipefail ãªãã·ã§ã³ãæå¹ã«ãªã£ãç¶æ
ã§å®è¡ãããã" +tags = [ + "ci-cd", + "gitlab", +] + +[[article.revisions]] +date = "2022-11-17" +remark = "ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿã®ç€Ÿå
èšäºãšããŠå
¬é" +isInternal = true + +[[article.revisions]] +date = "2024-04-21" +remark = "ããã°èšäºãšããŠäžè¬å
¬é" +--- +::: note +ãã®èšäºã¯ã2022-11-17 ã« [ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ](https://www.dgcircus.com/) ã®ç€Ÿå
Qiita Team ã«å
¬éãããèšäºãããŒã¹ã«ãå çä¿®æ£ããŠäžè¬å
¬éãããã®ã§ãã +::: + +ããã£ãã®ã§ã¡ã¢ã + +{#background} +# åæ + +{#gitlab-ci-cd} +## GitLab CI/CD ã«ã€ã㊠+ +GitLab CI/CD ã§ã¯ãDocker executor ãçšããŠä»»æã® Docker image äžã§ã¹ã¯ãªãããèµ°ãããããšãã§ããã + +äŸ: + +```yaml +hello-world: + stage: test + image: alpine:latest + script: + - 'echo "Hello, World!"' + rules: + - if: '$CI_MERGE_REQUEST_IID' + when: always +``` + +ããã§ã`script` ã«æå®ããã³ãã³ãã倱æãã (exit status ã 0 以å€ã«ãªã) ãšãå³åº§ã«å®è¡ã忢ããããžã§ãã¯å€±æããã + +ã§ã¯ã次ã®ãããªã±ãŒã¹ã ãšã©ããªããã + +```yaml +hello-world: + stage: test + image: alpine:latest + script: + - 'exit 1 | exit 0' + rules: + - if: '$CI_MERGE_REQUEST_IID' + when: always +``` + +倱æããã³ãã³ãããã€ãã«æ¥ç¶ãããéåžž Bash ã§ã¯ããã€ãã®æåŸã®ã³ãã³ãã® exit code ãå
šäœã® exit code ã«ãªãã + +{#pipefail-option} +## `pipefail` ãªãã·ã§ã³ã«ã€ã㊠+ +åè¿°ãããããªã±ãŒã¹ã«ãããŠãéäžã§å€±æãããšãã«å
šäœã倱æãããã«ã¯ã`pipefail` ãªãã·ã§ã³ãæå¹ã«ããã + +```bash +# On ã«ãã +set -o pipefail +# Off ã«ãã +set +o pipefail +``` + +ãããããšããã€ãå
šäœã倱æããããã«ãªãã +ãã®èšå®ã¯ãããã©ã«ãã ãš off ã«ãªã£ãŠããã + +{#problem} +# çºçããåé¡ + +次ã®ãã㪠GitLab CI/CD ãžã§ãã倱æããŠããŸã£ãã + +```yaml +hoge: + stage: test + image: alpine:latest + script: + - 'cat hoge.txt | grep piyo | sed -e "s/foo/bar/g"' + rules: + - if: '$CI_MERGE_REQUEST_IID' + when: always +``` + +`grep` ã³ãã³ãã¯ããã¿ãŒã³ã«ãããããè¡ãäžè¡ããªãã£ããšããexit code 1 ãè¿ãããã£ãŠã`pipefail` ã on ã«ãªã£ãŠãããšããã®ãžã§ãã¯å€±æããã +çŸåšã® `pipefail` ãã©ããªã£ãŠããã確ããããã `set +o` ã§å
šãªãã·ã§ã³ãåºåããããšããã`pipefail` ã on ã«ãªã£ãŠããã + +ããããå
è¿°ããããã« Bash ã«ããã `pipefail` ã®ããã©ã«ãå€ã¯ off ã®ã¯ãã ã +å®éã«ãããŒã«ã«ã§ `alpine:latest` ãåãããŠã¿ããšããã + +``` +$ docker run --rm alpine:latest sh -c "set +o" +set +o errexit +set +o noglob +set +o ignoreeof +set +o monitor +set +o noexec +set +o xtrace +set +o verbose +set +o noclobber +set +o allexport +set +o notify +set +o nounset +set +o vi +set +o pipefail +``` + +確ãã« `pipefail` ã¯ç¡å¹ã«ãªã£ãŠããã + +ãªãã¹ã¯ãªããå
ã§ `set -o pipefail` ããŠããããã§ããªãã®ã« `pipefail` ã on ã«ãªã£ãŠããã®ãã + +{#where-pipefail-is-enabled} +# ã©ãã§ `pipefail` ã on ã«ãªãã + +`.gitlab-ci.yml` ã§æç€ºçã«ã¯æžããŠããªãã®ã§ãGitLab Runner (GitLab CI/CD ã®ã¹ã¯ãªãããå®è¡ããããã°ã©ã ) ãåæã«è¿œå ããŠããã«éããªãã +ãã仮説ãç«ãŠãŠ [GitLab Runner ã®ãªããžããª](https://gitlab.com/gitlab-org/gitlab-runner) ã調æ»ãããšããã [ãœãŒã¹ã³ãŒãäžã®ä»¥äžã®ç®æ](https://gitlab.com/gitlab-org/gitlab-runner/-/blob/c75da0796a0e3048991dccfdf2784e3d931beda4/shells/bash.go#L276) ã§ `set -o pipefail` ããŠããããšã倿ãã (ã³ã¡ã³ãã¯çè
ã«ãã)ã + +```go +// pipefail ãªãã·ã§ã³ãååšããªãç°å¢ã«ã察å¿ããããã +// å
ã« set -o ã§ãªãã·ã§ã³äžèЧã衚瀺ãããããšãset -o pipefail ããŠãã +buf.WriteString("if set -o | grep pipefail > /dev/null; then set -o pipefail; fi; set -o errexit\n") +``` + +{#how-to-solve} +# ã©ã®ããã«è§£æ±ºããã + +éåžžã® Bash ã¹ã¯ãªãããæžãå Žåãšåæ§ã«ã`pipefail` ã on ã«ãªã£ãŠããŠã¯å°ãå Žæã ã off ã«ããŠããã°ããã + +```yaml + hoge: + stage: test + image: alpine:latest + script: ++ - 'set +o pipefail' + - 'cat hoge.txt | grep piyo | sed -e "s/foo/bar/g"' ++ - 'set -o pipefail' # ãã®äŸã®å Žåãããã§çµãããªã®ã§æ»ããªããŠããã + rules: + - if: '$CI_MERGE_REQUEST_IID' + when: always +``` + +{#remarks} +# åè + +ãªããäžè¿°ããå®è£
ãã¡ã€ã«ã¯ `shells/bash.go` ã ãã`alpine:latest` ã®äŸã§ãããã§ãã£ãããã«ãã·ã§ã«ã `sh` ã§ããå Žåã«ãé©çšãããã diff --git a/vhosts/blog/content/posts/2024-04-21/pipefail-option-in-gitlab-ci-cd.ndoc b/vhosts/blog/content/posts/2024-04-21/pipefail-option-in-gitlab-ci-cd.ndoc deleted file mode 100644 index d65fffb5..00000000 --- a/vhosts/blog/content/posts/2024-04-21/pipefail-option-in-gitlab-ci-cd.ndoc +++ /dev/null @@ -1,180 +0,0 @@ ---- -[article] -uuid = "a4c326a6-5ffe-450c-abf2-45833c5efb6a" -title = "ãGitLabã GitLab CI/CD äžã§ã® bash/sh 㯠pipefail ãæå¹ã«ãªã£ãŠãã" -description = "GitLab CI/CD ã§ bash/sh ã¹ã¯ãªãããåãããšãpipefail ãªãã·ã§ã³ãæå¹ã«ãªã£ãç¶æ
ã§å®è¡ãããã" -tags = [ - "ci-cd", - "gitlab", -] - -[[article.revisions]] -date = "2022-11-17" -remark = "ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿã®ç€Ÿå
èšäºãšããŠå
¬é" -isInternal = true - -[[article.revisions]] -date = "2024-04-21" -remark = "ããã°èšäºãšããŠäžè¬å
¬é" ---- -<article> - <note> - ãã®èšäºã¯ã2022-11-17 ã«<a href="https://www.dgcircus.com/">ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ</a> ã®ç€Ÿå
Qiita Team ã«å
¬éãããèšäºãããŒã¹ã«ãå çä¿®æ£ããŠäžè¬å
¬éãããã®ã§ãã - </note> - <p> - ããã£ãã®ã§ã¡ã¢ã - </p> - <section id="background"> - <h>åæ</h> - <section id="gitlab-ci-cd"> - <h>GitLab CI/CD ã«ã€ããŠ</h> - <p> - GitLab CI/CD ã§ã¯ãDocker executor ãçšããŠä»»æã® Docker image äžã§ã¹ã¯ãªãããèµ°ãããããšãã§ããã - </p> - <p> - äŸ: - </p> - <codeblock language="yaml" filename=".gitlab-ci.yml"> - <![CDATA[ - hello-world: - stage: test - image: alpine:latest - script: - - 'echo "Hello, World!"' - rules: - - if: '$CI_MERGE_REQUEST_IID' - when: always - ]]> - </codeblock> - <p> - ããã§ã<code>script</code> ã«æå®ããã³ãã³ãã倱æãã (exit status ã 0 以å€ã«ãªã) ãšãå³åº§ã«å®è¡ã忢ããããžã§ãã¯å€±æããã - </p> - <p> - ã§ã¯ã次ã®ãããªã±ãŒã¹ã ãšã©ããªããã - </p> - <codeblock language="yaml" filename=".gitlab-ci.yml"> - <![CDATA[ - hello-world: - stage: test - image: alpine:latest - script: - - 'exit 1 | exit 0' - rules: - - if: '$CI_MERGE_REQUEST_IID' - when: always - ]]> - </codeblock> - <p> - 倱æããã³ãã³ãããã€ãã«æ¥ç¶ãããéåžž Bash ã§ã¯ããã€ãã®æåŸã®ã³ãã³ãã® exit code ãå
šäœã® exit code ã«ãªãã - </p> - </section> - <section id="pipefail-option"> - <h><code>pipefail</code> ãªãã·ã§ã³ã«ã€ããŠ</h> - <p> - åè¿°ãããããªã±ãŒã¹ã«ãããŠãéäžã§å€±æãããšãã«å
šäœã倱æãããã«ã¯ã<code>pipefail</code> ãªãã·ã§ã³ãæå¹ã«ããã - </p> - <codeblock language="bash"> - <![CDATA[ - # On ã«ãã - set -o pipefail - # Off ã«ãã - set +o pipefail - ]]> - </codeblock> - <p> - ãããããšããã€ãå
šäœã倱æããããã«ãªãã - ãã®èšå®ã¯ãããã©ã«ãã ãš off ã«ãªã£ãŠããã - </p> - </section> - </section> - <section id="problem"> - <h>çºçããåé¡</h> - <p> - 次ã®ãã㪠GitLab CI/CD ãžã§ãã倱æããŠããŸã£ãã - </p> - <codeblock language="yaml" filename=".gitlab-ci.yml"> - <![CDATA[ - hoge: - stage: test - image: alpine:latest - script: - - 'cat hoge.txt | grep piyo | sed -e "s/foo/bar/g"' - rules: - - if: '$CI_MERGE_REQUEST_IID' - when: always - ]]> - </codeblock> - <p> - <code>grep</code> ã³ãã³ãã¯ããã¿ãŒã³ã«ãããããè¡ãäžè¡ããªãã£ããšããexit code 1 ãè¿ãããã£ãŠã<code>pipefail</code> ã on ã«ãªã£ãŠãããšããã®ãžã§ãã¯å€±æããã - çŸåšã® <code>pipefail</code> ãã©ããªã£ãŠããã確ããããã <code>set +o</code> ã§å
šãªãã·ã§ã³ãåºåããããšããã<code>pipefail</code> ã on ã«ãªã£ãŠããã - </p> - <p> - ããããå
è¿°ããããã« Bash ã«ããã <code>pipefail</code> ã®ããã©ã«ãå€ã¯ off ã®ã¯ãã ã - å®éã«ãããŒã«ã«ã§ <code>alpine:latest</code> ãåãããŠã¿ããšããã - </p> - <codeblock> - <![CDATA[ - $ docker run --rm alpine:latest sh -c "set +o" - set +o errexit - set +o noglob - set +o ignoreeof - set +o monitor - set +o noexec - set +o xtrace - set +o verbose - set +o noclobber - set +o allexport - set +o notify - set +o nounset - set +o vi - set +o pipefail - ]]> - </codeblock> - <p> - 確ãã« <code>pipefail</code> ã¯ç¡å¹ã«ãªã£ãŠããã - </p> - <p> - ãªãã¹ã¯ãªããå
ã§ <code>set -o pipefail</code> ããŠããããã§ããªãã®ã« <code>pipefail</code> ã on ã«ãªã£ãŠããã®ãã - </p> - </section> - <section id="where-pipefail-is-enabled"> - <h>ã©ãã§ <code>pipefail</code> ã on ã«ãªãã</h> - <p> - <code>.gitlab-ci.yml</code> ã§æç€ºçã«ã¯æžããŠããªãã®ã§ãGitLab Runner (GitLab CI/CD ã®ã¹ã¯ãªãããå®è¡ããããã°ã©ã ) ãåæã«è¿œå ããŠããã«éããªãã - ãã仮説ãç«ãŠãŠ <a href="https://gitlab.com/gitlab-org/gitlab-runner">GitLab Runner ã®ãªããžããª</a> ã調æ»ãããšããã<a href="https://gitlab.com/gitlab-org/gitlab-runner/-/blob/c75da0796a0e3048991dccfdf2784e3d931beda4/shells/bash.go#L276">ãœãŒã¹ã³ãŒãäžã®ä»¥äžã®ç®æ</a> ã§ <code>set -o pipefail</code> ããŠããããšã倿ãã (ã³ã¡ã³ãã¯çè
ã«ãã)ã - </p> - <codeblock language="go"> - <![CDATA[ - // pipefail ãªãã·ã§ã³ãååšããªãç°å¢ã«ã察å¿ããããã - // å
ã« set -o ã§ãªãã·ã§ã³äžèЧã衚瀺ãããããšãset -o pipefail ããŠãã - buf.WriteString("if set -o | grep pipefail > /dev/null; then set -o pipefail; fi; set -o errexit\n") - ]]> - </codeblock> - </section> - <section id="how-to-solve"> - <h>ã©ã®ããã«è§£æ±ºããã</h> - <p> - éåžžã® Bash ã¹ã¯ãªãããæžãå Žåãšåæ§ã«ã<code>pipefail</code> ã on ã«ãªã£ãŠããŠã¯å°ãå Žæã ã off ã«ããŠããã°ããã - </p> - <codeblock language="yaml" diff="true" filename=".gitlab-ci.yml"> - <![CDATA[ - hoge: - stage: test - image: alpine:latest - script: - + - 'set +o pipefail' - - 'cat hoge.txt | grep piyo | sed -e "s/foo/bar/g"' - + - 'set -o pipefail' # ãã®äŸã®å Žåãããã§çµãããªã®ã§æ»ããªããŠããã - rules: - - if: '$CI_MERGE_REQUEST_IID' - when: always - ]]> - </codeblock> - </section> - <section id="remarks"> - <h>åè</h> - <p> - ãªããäžè¿°ããå®è£
ãã¡ã€ã«ã¯ <code>shells/bash.go</code> ã ãã<code>alpine:latest</code> ã®äŸã§ãããã§ãã£ãããã«ãã·ã§ã«ã <code>sh</code> ã§ããå Žåã«ãé©çšãããã - </p> - </section> -</article> diff --git a/vhosts/blog/content/posts/2024-04-29/zsh-file-completion-for-composer-custom-commands.dj b/vhosts/blog/content/posts/2024-04-29/zsh-file-completion-for-composer-custom-commands.dj new file mode 100644 index 00000000..5738de84 --- /dev/null +++ b/vhosts/blog/content/posts/2024-04-29/zsh-file-completion-for-composer-custom-commands.dj @@ -0,0 +1,86 @@ +--- +[article] +uuid = "9b26c1ed-45c3-4cad-9476-cbf2cf2e4de7" +title = "ãZshã Composer ã®ã«ã¹ã¿ã ã³ãã³ãã«å¯Ÿãã Zsh è£å®ã§åŒæ°ã«ãã¡ã€ã«ãè£å®ããã" +description = "Zsh ã® Composer ã«å¯Ÿããè£å®ã¯ã«ã¹ã¿ã ã³ãã³ãããã®åŒæ°ãè£å®ããªããã«ã¹ã¿ã ã³ãã³ãã®åŒæ°ãšããŠãã¡ã€ã«ãè£å®ãããæ¹æ³ã調ã¹ãã" +tags = [ + "composer", + "php", + "zsh", +] + +[[article.revisions]] +date = "2024-04-29" +remark = "å
¬é" +--- +{#version-info} +# ããŒãžã§ã³æ
å ± + +* Composer: 2.7.4 +* PHP: 8.3.6 +* Zsh: 5.9 + +{#intro} +# ã¯ããã« + +[Composer](https://getcomposer.org/) 㯠PHP ã®ããã¡ã¯ãã¹ã¿ã³ããŒããªããã±ãŒãžãããŒãžã£ã§ããã +Zsh ã§ã¯ã`composer` ã³ãã³ãã«å¯Ÿããè£å®ãæäŸãããŠããã`composer` ãšå
¥åããŠã¿ãããŒãæŒããšãå©çšå¯èœãªã³ãã³ãããªãã·ã§ã³ãè£å®ãããã +Zsh ã®è£å®ã¯ã·ã§ã«é¢æ°ã®åœ¢ã§å®è£
ãããŠããã`composer` ã³ãã³ãã«å¯Ÿå¿ããè£å®ããããªãã®ã¯ `_composer` ã§ããã +[èšäºå·çæç¹ã§ã®è£å®é¢æ°ã®å®çŸ©ã¯ãGitHub ã®ãã©ãŒãªããžããªããåç
§ã§ããã](https://github.com/zsh-users/zsh/blob/a66e92918568881af110a3e2e3018b317c054e4a/Completion/Unix/Command/_composer) + +{#problem} +# çºçããŠããåé¡ + +`composer` ã³ãã³ãã¯ã«ã¹ã¿ã ã³ãã³ã (`composer.json` ã® `scripts` ã§å®çŸ©ãããã³ãã³ã) ã«å¯ŸããŠè£å®ããããªããªãã +ã€ãŸããéäžãŸã§å
¥åãããã«ã¹ã¿ã ã³ãã³ããè£å®ããªãããã«ã¹ã¿ã ã³ãã³ãã®åŒæ°ãè£å®ããªãã +äŸãã°ãPHPUnit ãåŒã³åºã `phpunit` ãšããã«ã¹ã¿ã ã³ãã³ããå®çŸ©ã `composer phpu` ãŸã§æã£ãŠã¿ãããŒãæŒããŠãã`composer phpunit` ã«ã¯ãªããªãã +ãŸãã`composer phpunit -- --` ãŸã§æã£ãŠã¿ãããŒãæŒããŠãã`phpunit` ã³ãã³ãã®ãªãã·ã§ã³ã¯è£å®ãããªãã + +ãã®ããšã¯ãå
ã»ã©ãªã³ã¯ãèŒãã `_composer` 颿°ãå®çŸ©ããŠãããã¡ã€ã«ã®åé ã«ãæžãããŠããã + +```zsh +# - @todo We don't complete custom commands (including script aliases). This is +# easy to do in the general case, but it probably requires some clever caching +# to avoid introducing a noticeable lag to every completion operation, due to +# the way command resolution works and the fact that discovering custom +# commands requires making slow calls to Composer +``` + +{#what-i-want-to-achive} +# ããããããš + +確ãã«ãã«ã¹ã¿ã ã³ãã³ãã«å¯ŸããŠå®å
šãªè£å®ãæäŸããã®ã¯äžå¯èœãããããã¯å®çŸã§ããŠãé
ããªããããã ããã +ããããäžå®å
šãªãã©ãŒã«ããã¯ãæäŸããããããªãå¯èœãªã¯ãã ã + +ãã®èšäºã§ã¯ããããã®ã«ã¹ã¿ã ã³ãã³ãã«ã€ããŠãZsh ãæäŸããããã©ã«ãã®ãã¡ã€ã«ã»ãã£ã¬ã¯ããªè£å®ãé©çšããã +ã€ãŸãã`composer phpunit -- tests/` ãŸã§æã£ãŠã¿ãããŒãæŒããšã`tests` ãã£ã¬ã¯ããªã®äžã«ãããã¹ããã¡ã€ã«ãŸãã¯ãã£ã¬ã¯ããªãè£å®ãããã + +{#solution} +# 解決ç + +ãŸãã¯ãZsh ã§è£å®é¢æ°ãæäŸããå Žåã®ãã€ã©ãŒãã¬ãŒãã³ãŒããæžãã +以äžã¯ `~/.zshrc` ã«ãã¹ãŠæžãåæã ãã`autoload` ãèšå®ãããªã©ããã°å¥ãã¡ã€ã«ã«åé¢ã§ãã (è©³çŽ°ãªæé ã¯å²æ)ã + +```zsh +compdef _my_composer composer composer.phar +``` + +`compdef` 㯠Zsh ãçšæããŠãã颿°ã§ã第äžåŒæ°ã«è£å®é¢æ°ã®ååã第äºåŒæ°ä»¥éã«è£å®ãé©çšããã³ãã³ãåã䞊ã¹ãã +ãã®å Žåã¯ã`composer` ã³ãã³ãã `composer.phar` ã³ãã³ãã«å¯Ÿã㊠`_my_composer` ã䜿ã£ãŠè£å®ããããªãããå®çŸ©ããŠããã + +次㫠`_my_composer` ãå®çŸ©ãããåºæ¬çã«ã¯ããã©ã«ãã® `composer` ã³ãã³ãã®è£å®é¢æ° (ã€ãŸã `_composer` 颿°) ã䜿ãããããäœãè¿ããªãã£ãå Žåã«éããZsh ã®ãã¡ã€ã«ã»ãã£ã¬ã¯ããªè£å®ãžãã©ãŒã«ããã¯ããã + +```zsh +function _my_composer() { + _composer "$@" || _files "$@" +} +``` + +`_composer` ã³ãã³ãã¯äœãè£å®åè£ããªãã£ããšãéãŒã㪠exit status ã§çµäºããã®ã§ãããã§ãã£ããªã `_files` ãåŒã³åºãã +`_files` ã¯ãZsh ãããã©ã«ãã§çšæããŠãããã¡ã€ã«ã»ãã£ã¬ã¯ããªã®è£å®ããããªã颿°ã§ããã + +{#conclusion} +# ãŸãšã + +ãããã®èšå®ããããªãããšã§ãéšåçãªãã Composer ã®ã«ã¹ã¿ã ã³ãã³ãã«å¯ŸããŠè£å®ããããªãããšãã§ããã +ç¹ã«ãPHPUnit ã PHPStan ãªã©ã®å¯Ÿè±¡ãã¡ã€ã«ã»ãã£ã¬ã¯ããªãåŒæ°ã«åããããªã³ãã³ãã䜿ãå Žåã«æçšã§ãããã diff --git a/vhosts/blog/content/posts/2024-04-29/zsh-file-completion-for-composer-custom-commands.ndoc b/vhosts/blog/content/posts/2024-04-29/zsh-file-completion-for-composer-custom-commands.ndoc deleted file mode 100644 index 33ef19d2..00000000 --- a/vhosts/blog/content/posts/2024-04-29/zsh-file-completion-for-composer-custom-commands.ndoc +++ /dev/null @@ -1,103 +0,0 @@ ---- -[article] -uuid = "9b26c1ed-45c3-4cad-9476-cbf2cf2e4de7" -title = "ãZshã Composer ã®ã«ã¹ã¿ã ã³ãã³ãã«å¯Ÿãã Zsh è£å®ã§åŒæ°ã«ãã¡ã€ã«ãè£å®ããã" -description = "Zsh ã® Composer ã«å¯Ÿããè£å®ã¯ã«ã¹ã¿ã ã³ãã³ãããã®åŒæ°ãè£å®ããªããã«ã¹ã¿ã ã³ãã³ãã®åŒæ°ãšããŠãã¡ã€ã«ãè£å®ãããæ¹æ³ã調ã¹ãã" -tags = [ - "composer", - "php", - "zsh", -] - -[[article.revisions]] -date = "2024-04-29" -remark = "å
¬é" ---- -<article> - <section id="version-info"> - <h>ããŒãžã§ã³æ
å ±</h> - <ul> - <li>Composer: 2.7.4</li> - <li>PHP: 8.3.6</li> - <li>Zsh: 5.9</li> - </ul> - </section> - <section id="intro"> - <h>ã¯ããã«</h> - <p> - <a href="https://getcomposer.org/">Composer</a> 㯠PHP ã®ããã¡ã¯ãã¹ã¿ã³ããŒããªããã±ãŒãžãããŒãžã£ã§ããã - Zsh ã§ã¯ã<code>composer</code> ã³ãã³ãã«å¯Ÿããè£å®ãæäŸãããŠããã<code>composer</code> ãšå
¥åããŠã¿ãããŒãæŒããšãå©çšå¯èœãªã³ãã³ãããªãã·ã§ã³ãè£å®ãããã - Zsh ã®è£å®ã¯ã·ã§ã«é¢æ°ã®åœ¢ã§å®è£
ãããŠããã<code>composer</code> ã³ãã³ãã«å¯Ÿå¿ããè£å®ããããªãã®ã¯ <code>_composer</code> ã§ããã - <a href="https://github.com/zsh-users/zsh/blob/a66e92918568881af110a3e2e3018b317c054e4a/Completion/Unix/Command/_composer">èšäºå·çæç¹ã§ã®è£å®é¢æ°ã®å®çŸ©ã¯ãGitHub ã®ãã©ãŒãªããžããªããåç
§ã§ããã</a> - </p> - </section> - <section id="problem"> - <h>çºçããŠããåé¡</h> - <p> - <code>composer</code> ã³ãã³ãã¯ã«ã¹ã¿ã ã³ãã³ã (<code>composer.json</code> ã® <code>scripts</code> ã§å®çŸ©ãããã³ãã³ã) ã«å¯ŸããŠè£å®ããããªããªãã - ã€ãŸããéäžãŸã§å
¥åãããã«ã¹ã¿ã ã³ãã³ããè£å®ããªãããã«ã¹ã¿ã ã³ãã³ãã®åŒæ°ãè£å®ããªãã - äŸãã°ãPHPUnit ãåŒã³åºã <code>phpunit</code> ãšããã«ã¹ã¿ã ã³ãã³ããå®çŸ©ã <code>composer phpu</code> ãŸã§æã£ãŠã¿ãããŒãæŒããŠãã<code>composer phpunit</code> ã«ã¯ãªããªãã - ãŸãã<code>composer phpunit -- --</code> ãŸã§æã£ãŠã¿ãããŒãæŒããŠãã<code>phpunit</code> ã³ãã³ãã®ãªãã·ã§ã³ã¯è£å®ãããªãã - </p> - <p> - ãã®ããšã¯ãå
ã»ã©ãªã³ã¯ãèŒãã <code>_composer</code> 颿°ãå®çŸ©ããŠãããã¡ã€ã«ã®åé ã«ãæžãããŠããã - </p> - <codeblock language="zsh"> - <![CDATA[ - # - @todo We don't complete custom commands (including script aliases). This is - # easy to do in the general case, but it probably requires some clever caching - # to avoid introducing a noticeable lag to every completion operation, due to - # the way command resolution works and the fact that discovering custom - # commands requires making slow calls to Composer - ]]> - </codeblock> - </section> - <section id="what-i-want-to-achive"> - <h>ããããããš</h> - <p> - 確ãã«ãã«ã¹ã¿ã ã³ãã³ãã«å¯ŸããŠå®å
šãªè£å®ãæäŸããã®ã¯äžå¯èœãããããã¯å®çŸã§ããŠãé
ããªããããã ããã - ããããäžå®å
šãªãã©ãŒã«ããã¯ãæäŸããããããªãå¯èœãªã¯ãã ã - </p> - <p> - ãã®èšäºã§ã¯ããããã®ã«ã¹ã¿ã ã³ãã³ãã«ã€ããŠãZsh ãæäŸããããã©ã«ãã®ãã¡ã€ã«ã»ãã£ã¬ã¯ããªè£å®ãé©çšããã - ã€ãŸãã<code>composer phpunit -- tests/</code> ãŸã§æã£ãŠã¿ãããŒãæŒããšã<code>tests</code> ãã£ã¬ã¯ããªã®äžã«ãããã¹ããã¡ã€ã«ãŸãã¯ãã£ã¬ã¯ããªãè£å®ãããã - </p> - </section> - <section id="solution"> - <h>解決ç</h> - <p> - ãŸãã¯ãZsh ã§è£å®é¢æ°ãæäŸããå Žåã®ãã€ã©ãŒãã¬ãŒãã³ãŒããæžãã - 以äžã¯ <code>~/.zshrc</code> ã«ãã¹ãŠæžãåæã ãã<code>autoload</code> ãèšå®ãããªã©ããã°å¥ãã¡ã€ã«ã«åé¢ã§ãã (è©³çŽ°ãªæé ã¯å²æ)ã - </p> - <codeblock language="zsh"> - <![CDATA[ - compdef _my_composer composer composer.phar - ]]> - </codeblock> - <p> - <code>compdef</code> 㯠Zsh ãçšæããŠãã颿°ã§ã第äžåŒæ°ã«è£å®é¢æ°ã®ååã第äºåŒæ°ä»¥éã«è£å®ãé©çšããã³ãã³ãåã䞊ã¹ãã - ãã®å Žåã¯ã<code>composer</code> ã³ãã³ãã <code>composer.phar</code> ã³ãã³ãã«å¯Ÿã㊠<code>_my_composer</code> ã䜿ã£ãŠè£å®ããããªãããå®çŸ©ããŠããã - </p> - <p> - 次㫠<code>_my_composer</code> ãå®çŸ©ãããåºæ¬çã«ã¯ããã©ã«ãã® <code>composer</code> ã³ãã³ãã®è£å®é¢æ° (ã€ãŸã <code>_composer</code> 颿°) ã䜿ãããããäœãè¿ããªãã£ãå Žåã«éããZsh ã®ãã¡ã€ã«ã»ãã£ã¬ã¯ããªè£å®ãžãã©ãŒã«ããã¯ããã - </p> - <codeblock language="zsh"> - <![CDATA[ - function _my_composer() { - _composer "$@" || _files "$@" - } - ]]> - </codeblock> - <p> - <code>_composer</code> ã³ãã³ãã¯äœãè£å®åè£ããªãã£ããšãéãŒã㪠exit status ã§çµäºããã®ã§ãããã§ãã£ããªã <code>_files</code> ãåŒã³åºãã - <code>_files</code> ã¯ãZsh ãããã©ã«ãã§çšæããŠãããã¡ã€ã«ã»ãã£ã¬ã¯ããªã®è£å®ããããªã颿°ã§ããã - </p> - </section> - <section id="conclusion"> - <h>ãŸãšã</h> - <p> - ãããã®èšå®ããããªãããšã§ãéšåçãªãã Composer ã®ã«ã¹ã¿ã ã³ãã³ãã«å¯ŸããŠè£å®ããããªãããšãã§ããã - ç¹ã«ãPHPUnit ã PHPStan ãªã©ã®å¯Ÿè±¡ãã¡ã€ã«ã»ãã£ã¬ã¯ããªãåŒæ°ã«åããããªã³ãã³ãã䜿ãå Žåã«æçšã§ãããã - </p> - </section> -</article> diff --git a/vhosts/blog/content/posts/2024-05-11/phpconkagawa-2024-report.dj b/vhosts/blog/content/posts/2024-05-11/phpconkagawa-2024-report.dj new file mode 100644 index 00000000..a1ec6829 --- /dev/null +++ b/vhosts/blog/content/posts/2024-05-11/phpconkagawa-2024-report.dj @@ -0,0 +1,64 @@ +--- +[article] +uuid = "f13aa9d6-4533-4a15-872a-c298ab2090db" +title = "PHP ã«ã³ãã¡ã¬ã³ã¹éŠå· 2024 åå ã¬ã" +description = "2024-05-11 ã«éå¬ããããPHP ã«ã³ãã¡ã¬ã³ã¹éŠå· 2024 ã«åå ããã" +tags = [ + "conference", + "php", + "phpconkagawa", +] + +[[article.revisions]] +date = "2024-05-11" +remark = "å
¬é" +--- +{#intro} +# ã¯ããã« + +2024-05-11 ã«éå¬ããã [PHP ã«ã³ãã¡ã¬ã³ã¹éŠå· 2024](https://phpcon.kagawa.jp/2024/) ã«åå ããã + +{#session-thoughts} +# ã»ãã·ã§ã³ææ³ + +* æ³¥ãŸã¿ãã®æè¡é©æ°: ããªãã®[ PHPããŒãžã§ã³ã¢ãã | æ°ãã¬ãŒã ã¯ãŒã¯æ¡çš | ã¢ãŒããã¯ãã£å·æ° | ⊠]ãåŸæŒãããããã« by nrslib + + * fortee URL: https://fortee.jp/phpconkagawa-2024/proposal/7f4622af-03b6-4b83-a0ef-e1cfc7b7c930 + * ææ³: ã¡ããã©ãšãããã€ã°ã¬ãŒã·ã§ã³äœæ¥ãããŠããã®ã§ãé ·ããªããæèŽããŸãããçµå±ã¯èª°ããç§»è¡äœæ¥ã¯æ ¹æ°ãšè
åãªã®ã ãšããããšã«åæ°ãããããŸããã + +* PHP 9 ã«åãã - åçããããã£ãã©ãããã°ããïŒ by èç¬ æ³°èŒ + + * fortee URL: https://fortee.jp/phpconkagawa-2024/proposal/039ebb21-d104-4df2-86bb-be2680979b7b + * ææ³: ãããäžãšåããç§»è¡äœæ¥ã®è©±ã§ã¯ãããçµå±ã®ãšããã¯ãé 匵ã£ãŠå°éã«ãã£ãŠããããããªããšããããããŸã (ãšã¯ãããã¡ãã¯éçè§£æã§ããçšåºŠæœ°ããŸãã)ãPHP èšèªã®ã³ãã¥ããã£å
šäœã§é 匵ã£ãŠãããŸãããã + +* 1人ããã»ãã¢ããã»ã¢ãããã®å¹æçãªäœ¿ãåã by ãŸããŸã + + * fortee URL: https://fortee.jp/phpconkagawa-2024/proposal/db3e9634-4a79-46c1-84fd-8ffa4d495a13 + * ææ³: ä»äŒç€Ÿã§ãã¢ãããéšåçã«åãå
¥ããŠãããã®ã®ãè¿·ããšãããå€ããæ¥œãã¿ã«ããŠããçºè¡šã§ãããŸãã¯äœãäžã€å€ããªãããšã«ã¯å§ãŸããªãã®ã§ãçºè¡šããåŸããã³ããèªåãã¡ã®ããŒã ã«åæ ãã¹ããäœããããããå€ããŠã¿ãäºå®ã§ãã + +* mb_trim颿°ãäœããŸãã - PHPã«æ°ãã颿°ã远å ããŸãã - by ãŠããã + + * fortee URL: https://fortee.jp/phpconkagawa-2024/proposal/0ec36f50-c4b7-4aa4-abef-006f8bab3931 + * ææ³: RFC ãå¿
èŠãšãããããªæ©èœè¿œå ã®ããã»ã¹ãæ¥æ¬èªã§è§£èª¬ããè³æãã©ãã©ããšå¢ããŠããã®ã¯ãããŒãã«ãäžãããšããæå³ã§éåžžã«ãããããã§ããç§ã以åããåºããåºãããšèããŠããæžãããã® RFC ãããã®ã§ãããå
·äœçãªããã»ã¹ãæç€ºããããšãã¯ãããæ°ã«ãªããŸããã + +* (ãPHPã«ã³ãã¡ã¬ã³ã¹å°ç°å2024ããå®è¡å§å¡é·ããµãããã by asumikam) + + * fortee URL: https://fortee.jp/phpconkagawa-2024/proposal/c1efd828-72c9-4719-93f7-2ca3f8f20ac1 + * åè: ã¡ãã£ãšãããã©ãã«ã«ããååäžã®çºè¡šãèŠãããªãã£ãã®ã§ãçã§æèŽããããã§ã¯ãªããã¹ã©ã€ããæèŠããŠææ³ãæžããŠããŸãã + * ææ³: Thanks ã®ã¹ã©ã€ãéåžžã«å¬ããã£ãã§ãããã¡ãããçŽ æŽãããã«ã³ãã¡ã¬ã³ã¹ã®å ŽãããããšãããããŸããïŒã¹ã¿ããåéããã°æ¥å¹Žãæ¯éåå ãããŠãã ããã + +{#lightning-talk} +# æèŠªäŒ LT + +ä»åç»å£è
ã§ã¯ãªãã£ãã®ã ããããããŒã¶ã«åéæã«çšæããŠããã¹ã©ã€ã (LT çšã«äœã£ãŠããã®ã ãããããã LT æ ããªãã£ãã®ã§ãèµå
¥ãã«ãªã£ãŠãã) ããã£ãã®ã§æèŠªäŒã® LT ã§çºè¡šããã + +äžèº«ã¯ [第150åPHPå匷äŒ@æ±äº¬ã§ç»å£ããå
容](/slides/2023-03-15/phpstudy-tokyo-150/) ãšã»ãŒåãã§ãã¿ã€ãã«ãããã©ãã®ããã«çްé·ã FizzBuzz ãæžããã«ããã ãã®ææãã»äžçºãã¿çºè¡šã§ãããåå¥ã«ã¹ã©ã€ãã¯ã¢ããããŒãããªãã®ã§ãåè¿°ã®ãªã³ã¯ãåç
§ããŠã»ããã + +ãªãããã®çºè¡šã«ã¯ [ããã°èšäºããŒãžã§ã³](/posts/2022-09-29/write-fizzbuzz-in-php-2-letters-per-line/) ãããã + +{#outro} +# ãããã« + +ååäžã®çºè¡šã«éã«åããªãã£ãããšããšã«ããå¿æ®ããªã®ã ãããã以å€ã¯ PHP ã«ã³ãã¡ã¬ã³ã¹å°ç°åã®ã¹ã¿ããã®æ¹ã
ãã¯ããå€ãã®æ¹ãšäº€æµã§ããéåžžã«æ¥œããã«ã³ãã¡ã¬ã³ã¹ã ã£ããæ¥å¹Žããããããªã®ã§ (ãã®åã ãšæ¥å¹Žãæå PHP ã«ã³ãã¡ã¬ã³ã¹ã«ãªããªããïŒ)ãæ¯éåå ãããã + +ãããããããã°éŠå·ã§ãã©ãé£ã¹ãŠãªããª......ã diff --git a/vhosts/blog/content/posts/2024-05-11/phpconkagawa-2024-report.ndoc b/vhosts/blog/content/posts/2024-05-11/phpconkagawa-2024-report.ndoc deleted file mode 100644 index 66c07558..00000000 --- a/vhosts/blog/content/posts/2024-05-11/phpconkagawa-2024-report.ndoc +++ /dev/null @@ -1,107 +0,0 @@ ---- -[article] -uuid = "f13aa9d6-4533-4a15-872a-c298ab2090db" -title = "PHP ã«ã³ãã¡ã¬ã³ã¹éŠå· 2024 åå ã¬ã" -description = "2024-05-11 ã«éå¬ããããPHP ã«ã³ãã¡ã¬ã³ã¹éŠå· 2024 ã«åå ããã" -tags = [ - "conference", - "php", - "phpconkagawa", -] - -[[article.revisions]] -date = "2024-05-11" -remark = "å
¬é" ---- -<article> - <section id="intro"> - <h>ã¯ããã«</h> - <p> - 2024-05-11 ã«éå¬ããã <a href="https://phpcon.kagawa.jp/2024/">PHP ã«ã³ãã¡ã¬ã³ã¹éŠå· 2024</a> ã«åå ããã - </p> - </section> - <section id="session-thoughts"> - <h>ã»ãã·ã§ã³ææ³</h> - <ul> - <li> - æ³¥ãŸã¿ãã®æè¡é©æ°: ããªãã®[ PHPããŒãžã§ã³ã¢ãã | æ°ãã¬ãŒã ã¯ãŒã¯æ¡çš | ã¢ãŒããã¯ãã£å·æ° | ⊠]ãåŸæŒãããããã« by nrslib - <ul> - <li> - fortee URL: https://fortee.jp/phpconkagawa-2024/proposal/7f4622af-03b6-4b83-a0ef-e1cfc7b7c930 - </li> - <li> - ææ³: ã¡ããã©ãšãããã€ã°ã¬ãŒã·ã§ã³äœæ¥ãããŠããã®ã§ãé ·ããªããæèŽããŸãããçµå±ã¯èª°ããç§»è¡äœæ¥ã¯æ ¹æ°ãšè
åãªã®ã ãšããããšã«åæ°ãããããŸããã - </li> - </ul> - </li> - <li> - PHP 9 ã«åãã - åçããããã£ãã©ãããã°ããïŒ by èç¬ æ³°èŒ - <ul> - <li> - fortee URL: https://fortee.jp/phpconkagawa-2024/proposal/039ebb21-d104-4df2-86bb-be2680979b7b - </li> - <li> - ææ³: ãããäžãšåããç§»è¡äœæ¥ã®è©±ã§ã¯ãããçµå±ã®ãšããã¯ãé 匵ã£ãŠå°éã«ãã£ãŠããããããªããšããããããŸã (ãšã¯ãããã¡ãã¯éçè§£æã§ããçšåºŠæœ°ããŸãã)ãPHP èšèªã®ã³ãã¥ããã£å
šäœã§é 匵ã£ãŠãããŸãããã - </li> - </ul> - </li> - <li> - 1人ããã»ãã¢ããã»ã¢ãããã®å¹æçãªäœ¿ãåã by ãŸããŸã - <ul> - <li> - fortee URL: https://fortee.jp/phpconkagawa-2024/proposal/db3e9634-4a79-46c1-84fd-8ffa4d495a13 - </li> - <li> - ææ³: ä»äŒç€Ÿã§ãã¢ãããéšåçã«åãå
¥ããŠãããã®ã®ãè¿·ããšãããå€ããæ¥œãã¿ã«ããŠããçºè¡šã§ãããŸãã¯äœãäžã€å€ããªãããšã«ã¯å§ãŸããªãã®ã§ãçºè¡šããåŸããã³ããèªåãã¡ã®ããŒã ã«åæ ãã¹ããäœããããããå€ããŠã¿ãäºå®ã§ãã - </li> - </ul> - </li> - <li> - mb_trim颿°ãäœããŸãã - PHPã«æ°ãã颿°ã远å ããŸãã - by ãŠããã - <ul> - <li> - fortee URL: https://fortee.jp/phpconkagawa-2024/proposal/0ec36f50-c4b7-4aa4-abef-006f8bab3931 - </li> - <li> - ææ³: RFC ãå¿
èŠãšãããããªæ©èœè¿œå ã®ããã»ã¹ãæ¥æ¬èªã§è§£èª¬ããè³æãã©ãã©ããšå¢ããŠããã®ã¯ãããŒãã«ãäžãããšããæå³ã§éåžžã«ãããããã§ããç§ã以åããåºããåºãããšèããŠããæžãããã® RFC ãããã®ã§ãããå
·äœçãªããã»ã¹ãæç€ºããããšãã¯ãããæ°ã«ãªããŸããã - </li> - </ul> - </li> - <li> - (ãPHPã«ã³ãã¡ã¬ã³ã¹å°ç°å2024ããå®è¡å§å¡é·ããµãããã by asumikam) - <ul> - <li> - fortee URL: https://fortee.jp/phpconkagawa-2024/proposal/c1efd828-72c9-4719-93f7-2ca3f8f20ac1 - </li> - <li> - åè: ã¡ãã£ãšãããã©ãã«ã«ããååäžã®çºè¡šãèŠãããªãã£ãã®ã§ãçã§æèŽããããã§ã¯ãªããã¹ã©ã€ããæèŠããŠææ³ãæžããŠããŸãã - </li> - <li> - ææ³: Thanks ã®ã¹ã©ã€ãéåžžã«å¬ããã£ãã§ãããã¡ãããçŽ æŽãããã«ã³ãã¡ã¬ã³ã¹ã®å ŽãããããšãããããŸããïŒã¹ã¿ããåéããã°æ¥å¹Žãæ¯éåå ãããŠãã ããã - </li> - </ul> - </li> - </ul> - </section> - <section id="lightning-talk"> - <h>æèŠªäŒ LT</h> - <p> - ä»åç»å£è
ã§ã¯ãªãã£ãã®ã ããããããŒã¶ã«åéæã«çšæããŠããã¹ã©ã€ã (LT çšã«äœã£ãŠããã®ã ãããããã LT æ ããªãã£ãã®ã§ãèµå
¥ãã«ãªã£ãŠãã) ããã£ãã®ã§æèŠªäŒã® LT ã§çºè¡šããã - </p> - <p> - äžèº«ã¯<a href="/slides/2023-03-15/phpstudy-tokyo-150/">第150åPHPå匷äŒ@æ±äº¬ã§ç»å£ããå
容</a>ãšã»ãŒåãã§ãã¿ã€ãã«ãããã©ãã®ããã«çްé·ã FizzBuzz ãæžããã«ããã ãã®ææãã»äžçºãã¿çºè¡šã§ãããåå¥ã«ã¹ã©ã€ãã¯ã¢ããããŒãããªãã®ã§ãåè¿°ã®ãªã³ã¯ãåç
§ããŠã»ããã - </p> - <p> - ãªãããã®çºè¡šã«ã¯<a href="/posts/2022-09-29/write-fizzbuzz-in-php-2-letters-per-line/">ããã°èšäºããŒãžã§ã³</a>ãããã - </p> - </section> - <section id="outro"> - <h>ãããã«</h> - <p> - ååäžã®çºè¡šã«éã«åããªãã£ãããšããšã«ããå¿æ®ããªã®ã ãããã以å€ã¯ PHP ã«ã³ãã¡ã¬ã³ã¹å°ç°åã®ã¹ã¿ããã®æ¹ã
ãã¯ããå€ãã®æ¹ãšäº€æµã§ããéåžžã«æ¥œããã«ã³ãã¡ã¬ã³ã¹ã ã£ããæ¥å¹Žããããããªã®ã§ (ãã®åã ãšæ¥å¹Žãæå PHP ã«ã³ãã¡ã¬ã³ã¹ã«ãªããªããïŒ)ãæ¯éåå ãããã - </p> - <p> - ãããããããã°éŠå·ã§ãã©ãé£ã¹ãŠãªããª......ã - </p> - </section> -</article> diff --git a/vhosts/blog/content/posts/2024-06-19/scalamatsuri-2024-report.dj b/vhosts/blog/content/posts/2024-06-19/scalamatsuri-2024-report.dj new file mode 100644 index 00000000..85d713de --- /dev/null +++ b/vhosts/blog/content/posts/2024-06-19/scalamatsuri-2024-report.dj @@ -0,0 +1,48 @@ +--- +[article] +uuid = "8d6f3690-3da3-4235-a81b-b9707cee22ad" +title = "ScalaMatsuri 2024 åå ã¬ã" +description = "2024-06-08 ãã 2024-06-09 ã«ãããŠéå¬ããããScalaMatsuri 2024 ã«åå ããã" +tags = [ + "conference", + "scala", + "scalamatsuri", +] + +[[article.revisions]] +date = "2024-06-19" +remark = "å
¬é" +--- +{#intro} +# ã¯ããã« + +2024-06-08 ãã 2024-06-09 ã«ãããŠéå¬ããã [ScalaMatsuri 2024](https://2024.scalamatsuri.org/ja) ã«åå ããã + +Day 2 ã«ã¯åœæ¥åå ã§ããªãã£ããããday 2 ã®ã»ãã·ã§ã³ã®ææ³ã¯ YouTube ã«ã¢ããããŒããããã¢ãŒã«ã€ãåç»ãèŠ³ãŠæžããŠããã + +{#sessions} +# ã»ãã·ã§ã³ææ³ + +ç¹ã«å°è±¡ã«æ®ã£ãã»ãã·ã§ã³ããday 1 ãš day 2 ã§äžã€ãã€éžãã (ã¿ã€ãã«ãšç»å£è
å㯠[å
¬åŒããŒã ããŒãžã®ãããã°ã©ã ã](https://2024.scalamatsuri.org/ja/programs) ããåŒçš)ã + +* [Scala to WebAssembly: åæ©ãšæ¹æ³](https://2024.scalamatsuri.org/ja/programs/SESSION_DAY_1_02) (Rikito Taniguchi ãã) + + * [æè¿ WebAssembly ã®åŠçç³»ãäœã£ã](/posts/2024-03-17/phperkaigi-2024-report/#section--as-speaker) ããšããã£ãŠãæ°ã«ãªã£ãŠããã»ãã·ã§ã³ã§ããç§ã®åŠç系㯠WasmGC proposal ãå®è£
ããŠããªãã®ã§åãããªãã®ã§ããããã€ããµããŒãããŠåãããŠã¿ããã§ããã + +* [äœã£ãŠåŠã¶ Extensible Effects](https://2024.scalamatsuri.org/ja/programs/SESSION_DAY_2_04) (Kory ããã»hsjoihs ãã) + + * ä»åäžçªæ¥œãã¿ã«ããŠããã»ãã·ã§ã³ã§ããDay 2 åœæ¥ã¯åå ã§ãããåŸæ¥ã¢ãŒã«ã€ãåç»ãèŠèŽããã®ã§ãããæåŸ
ãè£åããªãæ¿åãªã»ãã·ã§ã³ã§ãããåŸæ¥éããã [NB-Scala ã¬ããã¹ãã¯ãã£ã (éå
¬åŒåŸå€ç¥)](https://nextbeat.connpass.com/event/315988/) ã®çºè¡šãæèŽããã®ã§ãããã©ã¡ããéåžžã«é¢çœãã£ãã§ãã + +{#others} +# ãã®ä»ææ³ + +* è¯ãäŒå Žã ã£ããããåãæ²æ±°ãããã¹ã©ã€ãã®æåãµã€ãºã®åé¡ã¯ã巚倧ãªã¹ã¯ãªãŒã³ãçšæããããšã§è§£æ±ºãããšããçºèŠããã£ã +* ã©ã³ãã«ãåŒåœãçšæãããŠãããããããã£ã ( [åèç»å](https://x.com/nsfisis/status/1799276217583260092) ) + +{#outro} +# ãããã« + +ç§ã Scala ãæžããã远ã£ããããŠããã®ã¯ Scala 2 ã®é ã§ãScala 3 ã¯ã»ãšãã©æµŠå³¶å€ªéç¶æ
ã ã£ãã®ã ããéåžžã«æ¥œããé¢çœãã€ãã³ãã ã£ãã +ã€ãã³ãã«è§ŠçºãããŠãé·ãã塩挬ãã«ãªã£ãŠãã Scala 補ã®è¶£å³ãããžã§ã¯ããä¹
ãã¶ãã«è§Šã£ãŠããã®ã ããããããŸã楜ããã + +ScalaMatsuri éå¶ã®çããŸãã¹ããŒã«ãŒã®çããŸãã¹ãã³ãµãŒã®çããŸãæé«ã®ã€ãã³ããããããšãããããŸããïŒæ¬¡åãæ¥œãã¿ã«ããŠããŸãã diff --git a/vhosts/blog/content/posts/2024-06-19/scalamatsuri-2024-report.ndoc b/vhosts/blog/content/posts/2024-06-19/scalamatsuri-2024-report.ndoc deleted file mode 100644 index ae30633b..00000000 --- a/vhosts/blog/content/posts/2024-06-19/scalamatsuri-2024-report.ndoc +++ /dev/null @@ -1,63 +0,0 @@ ---- -[article] -uuid = "8d6f3690-3da3-4235-a81b-b9707cee22ad" -title = "ScalaMatsuri 2024 åå ã¬ã" -description = "2024-06-08 ãã 2024-06-09 ã«ãããŠéå¬ããããScalaMatsuri 2024 ã«åå ããã" -tags = [ - "conference", - "scala", - "scalamatsuri", -] - -[[article.revisions]] -date = "2024-06-19" -remark = "å
¬é" ---- -<article> - <section id="intro"> - <h>ã¯ããã«</h> - <p> - 2024-06-08 ãã 2024-06-09 ã«ãããŠéå¬ããã <a href="https://2024.scalamatsuri.org/ja">ScalaMatsuri 2024</a> ã«åå ããã - </p> - <p> - Day 2 ã«ã¯åœæ¥åå ã§ããªãã£ããããday 2 ã®ã»ãã·ã§ã³ã®ææ³ã¯ YouTube ã«ã¢ããããŒããããã¢ãŒã«ã€ãåç»ãèŠ³ãŠæžããŠããã - </p> - </section> - <section id="sessions"> - <h>ã»ãã·ã§ã³ææ³</h> - <p> - ç¹ã«å°è±¡ã«æ®ã£ãã»ãã·ã§ã³ããday 1 ãš day 2 ã§äžã€ãã€éžãã (ã¿ã€ãã«ãšç»å£è
å㯠<a href="https://2024.scalamatsuri.org/ja/programs">å
¬åŒããŒã ããŒãžã®ãããã°ã©ã ã</a> ããåŒçš)ã - </p> - <ul> - <li> - <a href="https://2024.scalamatsuri.org/ja/programs/SESSION_DAY_1_02">Scala to WebAssembly: åæ©ãšæ¹æ³</a> (Rikito Taniguchi ãã) - <ul> - <a href="/posts/2024-03-17/phperkaigi-2024-report/#section--as-speaker">æè¿ WebAssembly ã®åŠçç³»ãäœã£ã</a> ããšããã£ãŠãæ°ã«ãªã£ãŠããã»ãã·ã§ã³ã§ããç§ã®åŠç系㯠WasmGC proposal ãå®è£
ããŠããªãã®ã§åãããªãã®ã§ããããã€ããµããŒãããŠåãããŠã¿ããã§ããã - </ul> - </li> - <li> - <a href="https://2024.scalamatsuri.org/ja/programs/SESSION_DAY_2_04">äœã£ãŠåŠã¶ Extensible Effects</a> (Kory ããã»hsjoihs ãã) - <ul> - ä»åäžçªæ¥œãã¿ã«ããŠããã»ãã·ã§ã³ã§ããDay 2 åœæ¥ã¯åå ã§ãããåŸæ¥ã¢ãŒã«ã€ãåç»ãèŠèŽããã®ã§ãããæåŸ
ãè£åããªãæ¿åãªã»ãã·ã§ã³ã§ãããåŸæ¥éããã <a href="https://nextbeat.connpass.com/event/315988/">NB-Scala ã¬ããã¹ãã¯ãã£ã (éå
¬åŒåŸå€ç¥)</a> ã®çºè¡šãæèŽããã®ã§ãããã©ã¡ããéåžžã«é¢çœãã£ãã§ãã - </ul> - </li> - </ul> - </section> - <section id="others"> - <h>ãã®ä»ææ³</h> - <ul> - <li>è¯ãäŒå Žã ã£ããããåãæ²æ±°ãããã¹ã©ã€ãã®æåãµã€ãºã®åé¡ã¯ã巚倧ãªã¹ã¯ãªãŒã³ãçšæããããšã§è§£æ±ºãããšããçºèŠããã£ã</li> - <li>ã©ã³ãã«ãåŒåœãçšæãããŠãããããããã£ã (<a href="https://x.com/nsfisis/status/1799276217583260092">åèç»å</a>)</li> - </ul> - </section> - <section id="outro"> - <h>ãããã«</h> - <p> - ç§ã Scala ãæžããã远ã£ããããŠããã®ã¯ Scala 2 ã®é ã§ãScala 3 ã¯ã»ãšãã©æµŠå³¶å€ªéç¶æ
ã ã£ãã®ã ããéåžžã«æ¥œããé¢çœãã€ãã³ãã ã£ãã - ã€ãã³ãã«è§ŠçºãããŠãé·ãã塩挬ãã«ãªã£ãŠãã Scala 補ã®è¶£å³ãããžã§ã¯ããä¹
ãã¶ãã«è§Šã£ãŠããã®ã ããããããŸã楜ããã - </p> - <p> - ScalaMatsuri éå¶ã®çããŸãã¹ããŒã«ãŒã®çããŸãã¹ãã³ãµãŒã®çããŸãæé«ã®ã€ãã³ããããããšãããããŸããïŒæ¬¡åãæ¥œãã¿ã«ããŠããŸãã - </p> - </section> -</article> diff --git a/vhosts/blog/content/posts/2024-07-19/reparojson-fix-only-json-formatter.dj b/vhosts/blog/content/posts/2024-07-19/reparojson-fix-only-json-formatter.dj new file mode 100644 index 00000000..eb63da08 --- /dev/null +++ b/vhosts/blog/content/posts/2024-07-19/reparojson-fix-only-json-formatter.dj @@ -0,0 +1,132 @@ +--- +[article] +uuid = "222488dd-cf07-4961-83aa-a014b05369ff" +title = "reparojson: ææ³ãšã©ãŒãçŽãã ãã® JSON ãã©ãŒããã¿ãäœã£ã" +description = "ææ³ãšã©ãŒã ããçŽãã空çœã®åé€ãæ¿å
¥ãšãã£ãæŽåœ¢åŠçãäžåãããªããªã JSON ãã©ãŒããã¿ãäœæãããNeovim ãšé£æºãããèšå®äŸã玹ä»ããã" +tags = [ + "neovim", + "vim", +] + +[[article.revisions]] +date = "2024-07-19" +remark = "å
¬é" +--- +::: note +ãã®èšäºã¯ [Vim é§
äŒ](https://vim-jp.org/ekiden/) #218 ã®èšäºã§ãã +::: + +{#intro} +# 欲ããã£ããã® + +Vim ã§ JSON ãç·šéããŠãããšãã«ãææ³ãšã©ãŒ (æ«å°Ÿã«ã³ããã«ã³ãã®äžè¶³) ã®ã¿ãä¿®æ£ããŠäžåã®æŽåœ¢ããããªããªããã©ã°ã€ã³ã欲ããã£ãã +æŽåœ¢ãåæã«ãããªããã©ã°ã€ã³ã¯èŠã€ãã£ãã ãã§ã倿°ãã£ãã®ã ããæŽåœ¢ããªããã®ã¯èŠã€ããããªãã£ãã®ã§èªäœããããšã«ããã + +ãªããäœæããããŒã«èªäœã¯åäœã® CLI ãšããŠåäœããVim ãšã¯ç¡é¢ä¿ã«äœ¿ãããšãã§ããã +ãã®èšäºã§ã¯ Neovim ãšçµã¿åãããå Žåã®èšå®ã玹ä»ãããããããä»»æã®ãšãã£ã¿ã§äœ¿ããã ããã + +{#reparojson} +# äœã£ããã® + +äœæãããã®ããã¡ã: [ReparoJSON](https://github.com/nsfisis/reparojson) + +次ã®ããã«åäœããã + +``` +$ echo '[ 1 2 ]' | reparojson +[ 1, 2 ] + +$ echo '[ 1, 2, ]' | reparojson +[ 1, 2 ] + +$ echo '{ "foo": 1 "bar": 2 }' | reparojson +{ "foo": 1, "bar": 2 } + +$ echo '{ "foo": 1, "bar": 2, }' | reparojson +{ "foo": 1, "bar": 2 } +``` + +ããŒãžã§ã³ 0.1.1 æç¹ã§ä¿®æ£å¯Ÿè±¡ã®ææ³ãšã©ãŒã¯æ¬¡ã®ãšãã: + +* é
åæ«å°Ÿã®äœèšãªã«ã³ã (åé€ãã) +* é
åå
ã®ã«ã³ãäžè¶³ (æ¿å
¥ãã) +* ãªããžã§ã¯ãæ«å°Ÿã®äœèšãªã«ã³ã (åé€ãã) +* ãªããžã§ã¯ãå
ã®ã«ã³ãäžè¶³ (æ¿å
¥ãã) + +ä»ã«ãèªåã§çŽããããªãšã©ãŒã¯ããã€ãæãã€ãã (ãªããžã§ã¯ãã®ããŒãã¯ã©ãŒããããŠããªãç)ãç§èªèº«ãããŸãå°ã£ãŠããªãã®ã§åªå
床ã¯äœãã + +{#itegration-with-neovim} +# Neovim ãšã®é£æº + +Neovim ã§ JSON ãã¡ã€ã«ãä¿åãããšãã«ãäžèšã®ããŒã«ãèªåã§èµ°ãããããã«èšå®ããã + +ããã§ã¯ã [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) ãš [efm-langserver](https://github.com/mattn/efm-langserver) ãçšããèšå®äŸã玹ä»ããã + +```lua + local lspconfig = require('lspconfig') + + lspconfig.efm.setup({ + init_options = { documentFormatting = true }, + settings = { + rootMarkers = {".git/"}, + languages = { + json = { + { + formatCommand = "reparojson -q", + formatStdin = true, + }, + }, + }, + } + }) + + vim.api.nvim_create_autocmd('LspAttach', { + callback = function(e) + vim.api.nvim_create_autocmd('BufWritePre', { + buffer = e.buf, + callback = function() + vim.lsp.buf.format({ async = false }) + end + }) + end, + }) +``` + +ã»ãšãã©ã¯ nvim-lspconfig ãš efm-langserver ã䜿ãéã®ãã€ã©ãŒãã¬ãŒãã ãã`formatCommand` ã§ `-q` ãã©ã°ãæå®ããŠããããšã«æ³šæããŠã»ããã +ãã®ããŒã«ã¯ãããã©ã«ãã§ã¯ JSON ãä¿®æ£ãããå Žå exit code 1 ã§çµäºããã +ããã¯ãå
¥åãæåããæ£ããã£ãå Žåãšä¿®æ£ããŠæ£ãããªã£ãå Žåãåºå¥ããããã ããç°åžžçµäºããŠããŸããšçœ®ãæããçºçããªãã +ãã®ããã`-q` ãã©ã°ãæå®ããŠãä¿®æ£ããããšãã exit code 0 ã§çµäºããããã«ããŠããã + +{#outro} +# ãããã« + +ãã®ããŒã«ãåšåãçºæ®ããã®ã¯ãè¡ã®å
¥ãæãæã§ãããæ¬¡ã®ãã㪠JSON ãããã + +```json + { + "a": true, + "b": false + } +``` + +2è¡ç®ãš3è¡ç®ãå
¥ãæããŠä»¥äžã®ããã«ç·šéããã + +```json + { + "b": false + "a": true, + } +``` + +ããã¯äžæ£ãª JSON ã ãããã®ããŒã«ãéãã°æ¬¡ã®ããã«ãªãã + +```json + { + "b": false, + "a": true + } +``` + +ãã¡ããããã®ãããªæäœãææ³ãå£ããã«ãããªã Vim ãã©ã°ã€ã³ã¯ååšããã +ããããåãªãè¡ã®å
¥ãæãã§ããã° `ddp` ã®3ã¹ãããŒã¯ã§ãããªãããšãã§ããå°çšã®ããŒãã€ã³ããèŠããå¿
èŠããªãã +ãã®ããŒã«ãçšããããšã§ããã Vimmer-friendly 㪠JSON ç·šéãå¯èœãšãªãã diff --git a/vhosts/blog/content/posts/2024-07-19/reparojson-fix-only-json-formatter.ndoc b/vhosts/blog/content/posts/2024-07-19/reparojson-fix-only-json-formatter.ndoc deleted file mode 100644 index 5efe8bbd..00000000 --- a/vhosts/blog/content/posts/2024-07-19/reparojson-fix-only-json-formatter.ndoc +++ /dev/null @@ -1,153 +0,0 @@ ---- -[article] -uuid = "222488dd-cf07-4961-83aa-a014b05369ff" -title = "reparojson: ææ³ãšã©ãŒãçŽãã ãã® JSON ãã©ãŒããã¿ãäœã£ã" -description = "ææ³ãšã©ãŒã ããçŽãã空çœã®åé€ãæ¿å
¥ãšãã£ãæŽåœ¢åŠçãäžåãããªããªã JSON ãã©ãŒããã¿ãäœæãããNeovim ãšé£æºãããèšå®äŸã玹ä»ããã" -tags = [ - "neovim", - "vim", -] - -[[article.revisions]] -date = "2024-07-19" -remark = "å
¬é" ---- -<article> - <note> - ãã®èšäºã¯ <a href="https://vim-jp.org/ekiden/">Vim é§
äŒ</a> #218 ã®èšäºã§ãã - </note> - <section id="intro"> - <h>欲ããã£ããã®</h> - <p> - Vim ã§ JSON ãç·šéããŠãããšãã«ãææ³ãšã©ãŒ (æ«å°Ÿã«ã³ããã«ã³ãã®äžè¶³) ã®ã¿ãä¿®æ£ããŠäžåã®æŽåœ¢ããããªããªããã©ã°ã€ã³ã欲ããã£ãã - æŽåœ¢ãåæã«ãããªããã©ã°ã€ã³ã¯èŠã€ãã£ãã ãã§ã倿°ãã£ãã®ã ããæŽåœ¢ããªããã®ã¯èŠã€ããããªãã£ãã®ã§èªäœããããšã«ããã - </p> - <p> - ãªããäœæããããŒã«èªäœã¯åäœã® CLI ãšããŠåäœããVim ãšã¯ç¡é¢ä¿ã«äœ¿ãããšãã§ããã - ãã®èšäºã§ã¯ Neovim ãšçµã¿åãããå Žåã®èšå®ã玹ä»ãããããããä»»æã®ãšãã£ã¿ã§äœ¿ããã ããã - </p> - </section> - <section id="reparojson"> - <h>äœã£ããã®</h> - <p> - äœæãããã®ããã¡ã: <a href="https://github.com/nsfisis/reparojson">ReparoJSON</a> - </p> - <p> - 次ã®ããã«åäœããã - </p> - <codeblock> - <![CDATA[ - $ echo '[ 1 2 ]' | reparojson - [ 1, 2 ] - - $ echo '[ 1, 2, ]' | reparojson - [ 1, 2 ] - - $ echo '{ "foo": 1 "bar": 2 }' | reparojson - { "foo": 1, "bar": 2 } - - $ echo '{ "foo": 1, "bar": 2, }' | reparojson - { "foo": 1, "bar": 2 } - ]]> - </codeblock> - <p> - ããŒãžã§ã³ 0.1.1 æç¹ã§ä¿®æ£å¯Ÿè±¡ã®ææ³ãšã©ãŒã¯æ¬¡ã®ãšãã: - </p> - <ul> - <li>é
åæ«å°Ÿã®äœèšãªã«ã³ã (åé€ãã)</li> - <li>é
åå
ã®ã«ã³ãäžè¶³ (æ¿å
¥ãã)</li> - <li>ãªããžã§ã¯ãæ«å°Ÿã®äœèšãªã«ã³ã (åé€ãã)</li> - <li>ãªããžã§ã¯ãå
ã®ã«ã³ãäžè¶³ (æ¿å
¥ãã)</li> - </ul> - <p> - ä»ã«ãèªåã§çŽããããªãšã©ãŒã¯ããã€ãæãã€ãã (ãªããžã§ã¯ãã®ããŒãã¯ã©ãŒããããŠããªãç)ãç§èªèº«ãããŸãå°ã£ãŠããªãã®ã§åªå
床ã¯äœãã - </p> - </section> - <section id="itegration-with-neovim"> - <h>Neovim ãšã®é£æº</h> - <p> - Neovim ã§ JSON ãã¡ã€ã«ãä¿åãããšãã«ãäžèšã®ããŒã«ãèªåã§èµ°ãããããã«èšå®ããã - </p> - <p> - ããã§ã¯ã<a href="https://github.com/neovim/nvim-lspconfig">nvim-lspconfig</a> ãš <a href="https://github.com/mattn/efm-langserver">efm-langserver</a> ãçšããèšå®äŸã玹ä»ããã - </p> - <codeblock language="lua"> - <![CDATA[ - local lspconfig = require('lspconfig') - - lspconfig.efm.setup({ - init_options = { documentFormatting = true }, - settings = { - rootMarkers = {".git/"}, - languages = { - json = { - { - formatCommand = "reparojson -q", - formatStdin = true, - }, - }, - }, - } - }) - - vim.api.nvim_create_autocmd('LspAttach', { - callback = function(e) - vim.api.nvim_create_autocmd('BufWritePre', { - buffer = e.buf, - callback = function() - vim.lsp.buf.format({ async = false }) - end - }) - end, - }) - ]]> - </codeblock> - <p> - ã»ãšãã©ã¯ nvim-lspconfig ãš efm-langserver ã䜿ãéã®ãã€ã©ãŒãã¬ãŒãã ãã<code>formatCommand</code> ã§ <code>-q</code> ãã©ã°ãæå®ããŠããããšã«æ³šæããŠã»ããã - ãã®ããŒã«ã¯ãããã©ã«ãã§ã¯ JSON ãä¿®æ£ãããå Žå exit code 1 ã§çµäºããã - ããã¯ãå
¥åãæåããæ£ããã£ãå Žåãšä¿®æ£ããŠæ£ãããªã£ãå Žåãåºå¥ããããã ããç°åžžçµäºããŠããŸããšçœ®ãæããçºçããªãã - ãã®ããã<code>-q</code> ãã©ã°ãæå®ããŠãä¿®æ£ããããšãã exit code 0 ã§çµäºããããã«ããŠããã - </p> - </section> - <section id="outro"> - <h>ãããã«</h> - <p> - ãã®ããŒã«ãåšåãçºæ®ããã®ã¯ãè¡ã®å
¥ãæãæã§ãããæ¬¡ã®ãã㪠JSON ãããã - </p> - <codeblock language="json"> - <![CDATA[ - { - "a": true, - "b": false - } - ]]> - </codeblock> - <p> - 2è¡ç®ãš3è¡ç®ãå
¥ãæããŠä»¥äžã®ããã«ç·šéããã - </p> - <codeblock language="json"> - <![CDATA[ - { - "b": false - "a": true, - } - ]]> - </codeblock> - <p> - ããã¯äžæ£ãª JSON ã ãããã®ããŒã«ãéãã°æ¬¡ã®ããã«ãªãã - </p> - <codeblock language="json"> - <![CDATA[ - { - "b": false, - "a": true - } - ]]> - </codeblock> - <p> - ãã¡ããããã®ãããªæäœãææ³ãå£ããã«ãããªã Vim ãã©ã°ã€ã³ã¯ååšããã - ããããåãªãè¡ã®å
¥ãæãã§ããã° <code>ddp</code> ã®3ã¹ãããŒã¯ã§ãããªãããšãã§ããå°çšã®ããŒãã€ã³ããèŠããå¿
èŠããªãã - ãã®ããŒã«ãçšããããšã§ããã Vimmer-friendly 㪠JSON ç·šéãå¯èœãšãªãã - </p> - </section> -</article> diff --git a/vhosts/blog/content/posts/2024-08-19/go-template-access-outer-scope-pipeline-within-with-or-range.dj b/vhosts/blog/content/posts/2024-08-19/go-template-access-outer-scope-pipeline-within-with-or-range.dj new file mode 100644 index 00000000..6a6f9c3f --- /dev/null +++ b/vhosts/blog/content/posts/2024-08-19/go-template-access-outer-scope-pipeline-within-with-or-range.dj @@ -0,0 +1,118 @@ +--- +[article] +uuid = "eed112e4-3227-4b3f-9991-7e11c288ee2b" +title = "ãGoã text/template ã® with ã range ã®å
åŽããå€åŽã® \".\" ã«ã¢ã¯ã»ã¹ãã" +description = "Goèšèªã® text/template ã«ããã with ã range 㯠\".\" ãäžæžãããããããã®å
åŽããå€åŽã® \".\" ã«ã¢ã¯ã»ã¹ããæ¹æ³ã調ã¹ãã" +tags = [ + "go", +] + +[[article.revisions]] +date = "2024-08-19" +remark = "å
¬é" +--- +{#tldr} +# TL;DR + +åžžã«ãããã¬ãã«ãæãç¹æ®å€æ° `$` ã䜿ãã°ããã + +{#intro} +# ã¯ããã« + +Go ã«ã¯ãæšæºã©ã€ãã©ãªã«ãã³ãã¬ãŒãã©ã€ãã©ãª `text/template` ãããã +ãã® `text/template` ã«ãããå¶åŸ¡æ§é ã`with` ãš `range` ã¯æ¬¡ã®ããã«äœ¿ãããã + +``` +# {{ .Title }} + +# User + +{{ with .User }} + {{ .Name }} ({{ .ID }}) +{{ end }} + +# Items + +{{ range .Items }} + - {{ . }} +{{ end }} +``` + +`text/template` ã® `.` ã¯ãçŸåšã®æäœå¯Ÿè±¡ã衚ãç¹æ®ãªãªããžã§ã¯ãã§ããã + +`with` ã `range` ã¯ã`.` ã倿Žãã广ãæã€ã +`with` ã¯åŒæ°ã«æž¡ããããªããžã§ã¯ãã `.` ãžã»ããããŠãå
éšã®ãã³ãã¬ãŒããå®è¡ããã +`range` ã¯åŒæ°ã«æž¡ãããã€ãã¬ãŒãå¯èœãªãªããžã§ã¯ãã«å¯Ÿããããããã®èŠçŽ ã `.` ãžã»ããããŠãèŠçŽ ã®åæ°ã ãå
éšã®ãã³ãã¬ãŒããå®è¡ããã + +ã€ãŸããã®ãã³ãã¬ãŒãã¯ã次ã®ãããªæ§é ãã¬ã³ããªã³ã°ããŠãã (`Execute()` ã®ç¬¬2åŒæ°)ã + +```go +tmpl.Execute(out, Params{ + Title: "foo", + User: User{ + ID: 123, + Name: "john", + }, + Items: []string{ + "hoge", + "piyo", + "fuga", + }, +}) +``` + +{#what-i-want-to-do} +# ããããããš + +ä»åãããªãããã®ã¯ã`with` ã `range` ã®äžã§ããã®å€åŽã§äœ¿ãããŠãããããã¬ãã«ã®ãªããžã§ã¯ããåç
§ããããšã ã + +``` +{{ with .User }} + ãããã .Title ãåç
§ããã«ã¯ïŒ +{{ end }} + +{{ range .Items }} + ãããã .User ãåç
§ããã«ã¯ïŒ +{{ end }} +``` + +`with` ã `range` ã¯ã`.` ãèªèº«ã®å¯Ÿè±¡ãªããžã§ã¯ãã«å€æŽããã®ã§ã +åã« `{{ with .User }}` ã®äžã§ `.Title` ãšæžããŠãããã㯠`User` ã® `Title` ããããã£ãåç
§ããŠãããšã¿ãªãããã + +`text/template` ã§ã¯å€æ°ã䜿ããã®ã§ããã³ãã¬ãŒãã®å
é ã§ + +``` +{{ $params := . }} +``` + +ãšã§ãããŠããã°å®çŸã¯å¯èœã§ããã + +ããããªãããé »çºããã·ãã¥ãšãŒã·ã§ã³ã«ããŠã¯ããŸãã«äžæ°å¥œã§ãããããã¹ããŒããªæ¹æ³ãçšæãããŠããã¯ãã ã + +{#solution} +# è§£æ±ºæ¹æ³ + +åžžã«ãããã¬ãã«ãæãç¹æ®å€æ° `$` ã䜿ãã°ããã + +``` +{{ with .User }} + {{ $.Title }} +{{ end }} + +{{ range .Items }} + {{ $.User.Name }} +{{ end }} +``` + +`$` ã¯ããã³ãã¬ãŒããå®è¡ããããšãã«æž¡ããããªããžã§ã¯ããæãã +ããã䜿ãã°çŸåšã® `.` ã«é¢ä¿ãªããããã¬ãã«ãåç
§ã§ããã + +ãã®ããšã¯ã[`text/template` ã®å
¬åŒããã¥ã¡ã³ã](https://pkg.go.dev/text/template#hdr-Variables)ã«ã以äžã®ããã«èšèŒãããŠããã + +> When execution begins, $ is set to the data argument passed to Execute, that is, to the starting value of dot. + +{#reference} +# åè + +* [çŽæ¥ã®åºå
žã§ãã Stack Overflow ã®åç: "In a template how do you access an outer scope while inside of a "with" or "range" scope?"](https://stackoverflow.com/questions/14800204/in-a-template-how-do-you-access-an-outer-scope-while-inside-of-a-with-or-rang) +* [倧å
ã®åºå
žã§ãã `text/template` ã®å
¬åŒããã¥ã¡ã³ã](https://pkg.go.dev/text/template#hdr-Variables) diff --git a/vhosts/blog/content/posts/2024-08-19/go-template-access-outer-scope-pipeline-within-with-or-range.ndoc b/vhosts/blog/content/posts/2024-08-19/go-template-access-outer-scope-pipeline-within-with-or-range.ndoc deleted file mode 100644 index ee7b0ab8..00000000 --- a/vhosts/blog/content/posts/2024-08-19/go-template-access-outer-scope-pipeline-within-with-or-range.ndoc +++ /dev/null @@ -1,141 +0,0 @@ ---- -[article] -uuid = "eed112e4-3227-4b3f-9991-7e11c288ee2b" -title = "ãGoã text/template ã® with ã range ã®å
åŽããå€åŽã® \".\" ã«ã¢ã¯ã»ã¹ãã" -description = "Goèšèªã® text/template ã«ããã with ã range 㯠\".\" ãäžæžãããããããã®å
åŽããå€åŽã® \".\" ã«ã¢ã¯ã»ã¹ããæ¹æ³ã調ã¹ãã" -tags = [ - "go", -] - -[[article.revisions]] -date = "2024-08-19" -remark = "å
¬é" ---- -<article> - <section id="tldr"> - <h>TL;DR</h> - <p> - åžžã«ãããã¬ãã«ãæãç¹æ®å€æ° <code>$</code> ã䜿ãã°ããã - </p> - </section> - <section id="intro"> - <h>ã¯ããã«</h> - <p> - Go ã«ã¯ãæšæºã©ã€ãã©ãªã«ãã³ãã¬ãŒãã©ã€ãã©ãª <code>text/template</code> ãããã - ãã® <code>text/template</code> ã«ãããå¶åŸ¡æ§é ã<code>with</code> ãš <code>range</code> ã¯æ¬¡ã®ããã«äœ¿ãããã - </p> - <codeblock> - <![CDATA[ - # {{ .Title }} - - # User - - {{ with .User }} - {{ .Name }} ({{ .ID }}) - {{ end }} - - # Items - - {{ range .Items }} - - {{ . }} - {{ end }} - ]]> - </codeblock> - <p> - <code>text/template</code> ã® <code>.</code> ã¯ãçŸåšã®æäœå¯Ÿè±¡ã衚ãç¹æ®ãªãªããžã§ã¯ãã§ããã - </p> - <p> - <code>with</code> ã <code>range</code> ã¯ã<code>.</code> ã倿Žãã广ãæã€ã - <code>with</code> ã¯åŒæ°ã«æž¡ããããªããžã§ã¯ãã <code>.</code> ãžã»ããããŠãå
éšã®ãã³ãã¬ãŒããå®è¡ããã - <code>range</code> ã¯åŒæ°ã«æž¡ãããã€ãã¬ãŒãå¯èœãªãªããžã§ã¯ãã«å¯Ÿããããããã®èŠçŽ ã <code>.</code> ãžã»ããããŠãèŠçŽ ã®åæ°ã ãå
éšã®ãã³ãã¬ãŒããå®è¡ããã - </p> - <p> - ã€ãŸããã®ãã³ãã¬ãŒãã¯ã次ã®ãããªæ§é ãã¬ã³ããªã³ã°ããŠãã (<code>Execute()</code> ã®ç¬¬2åŒæ°)ã - </p> - <codeblock language="go"> - <![CDATA[ - tmpl.Execute(out, Params{ - Title: "foo", - User: User{ - ID: 123, - Name: "john", - }, - Items: []string{ - "hoge", - "piyo", - "fuga", - }, - }) - ]]> - </codeblock> - </section> - <section id="what-i-want-to-do"> - <h>ããããããš</h> - <p> - ä»åãããªãããã®ã¯ã<code>with</code> ã <code>range</code> ã®äžã§ããã®å€åŽã§äœ¿ãããŠãããããã¬ãã«ã®ãªããžã§ã¯ããåç
§ããããšã ã - </p> - <codeblock> - <![CDATA[ - {{ with .User }} - ãããã .Title ãåç
§ããã«ã¯ïŒ - {{ end }} - - {{ range .Items }} - ãããã .User ãåç
§ããã«ã¯ïŒ - {{ end }} - ]]> - </codeblock> - <p> - <code>with</code> ã <code>range</code> ã¯ã<code>.</code> ãèªèº«ã®å¯Ÿè±¡ãªããžã§ã¯ãã«å€æŽããã®ã§ã - åã« <code>{{ with .User }}</code> ã®äžã§ <code>.Title</code> ãšæžããŠãããã㯠<code>User</code> ã® <code>Title</code> ããããã£ãåç
§ããŠãããšã¿ãªãããã - </p> - <p> - <code>text/template</code> ã§ã¯å€æ°ã䜿ããã®ã§ããã³ãã¬ãŒãã®å
é ã§ - </p> - <codeblock> - <![CDATA[ - {{ $params := . }} - ]]> - </codeblock> - <p> - ãšã§ãããŠããã°å®çŸã¯å¯èœã§ããã - </p> - <p> - ããããªãããé »çºããã·ãã¥ãšãŒã·ã§ã³ã«ããŠã¯ããŸãã«äžæ°å¥œã§ãããããã¹ããŒããªæ¹æ³ãçšæãããŠããã¯ãã ã - </p> - </section> - <section id="solution"> - <h>è§£æ±ºæ¹æ³</h> - <p> - åžžã«ãããã¬ãã«ãæãç¹æ®å€æ° <code>$</code> ã䜿ãã°ããã - </p> - <codeblock> - <![CDATA[ - {{ with .User }} - {{ $.Title }} - {{ end }} - - {{ range .Items }} - {{ $.User.Name }} - {{ end }} - ]]> - </codeblock> - <p> - <code>$</code> ã¯ããã³ãã¬ãŒããå®è¡ããããšãã«æž¡ããããªããžã§ã¯ããæãã - ããã䜿ãã°çŸåšã® <code>.</code> ã«é¢ä¿ãªããããã¬ãã«ãåç
§ã§ããã - </p> - <p> - ãã®ããšã¯ã<a href="https://pkg.go.dev/text/template#hdr-Variables"><code>text/template</code> ã®å
¬åŒããã¥ã¡ã³ã</a>ã«ã以äžã®ããã«èšèŒãããŠããã - </p> - <blockquote> - When execution begins, $ is set to the data argument passed to Execute, that is, to the starting value of dot. - </blockquote> - </section> - <section id="reference"> - <h>åè</h> - <ul> - <li><a href="https://stackoverflow.com/questions/14800204/in-a-template-how-do-you-access-an-outer-scope-while-inside-of-a-with-or-rang">çŽæ¥ã®åºå
žã§ãã Stack Overflow ã®åç: "In a template how do you access an outer scope while inside of a "with" or "range" scope?"</a></li> - <li><a href="https://pkg.go.dev/text/template#hdr-Variables">倧å
ã®åºå
žã§ãã <code>text/template</code> ã®å
¬åŒããã¥ã¡ã³ã</a></li> - </ul> - </section> -</article> diff --git a/vhosts/blog/content/posts/2024-09-28/mncore-challenge-1.dj b/vhosts/blog/content/posts/2024-09-28/mncore-challenge-1.dj new file mode 100644 index 00000000..f862b55e --- /dev/null +++ b/vhosts/blog/content/posts/2024-09-28/mncore-challenge-1.dj @@ -0,0 +1,37 @@ +--- +[article] +uuid = "ee7289ee-ff2e-439d-b343-7f87504192fd" +title = "MN-Core Challenge #1 åå ã¬ã" +description = "2024-08-28 ãã 2024-09-24 ã«ãããŠéå¬ããã MN-Core Challenge #1 ã«åå ããã" +tags = [ + "mncore-challenge", +] + +[[article.revisions]] +date = "2024-09-28" +remark = "å
¬é" +--- +::: note +ãã ã®åå èšã§è§£èª¬ã¯ãªãã +::: + +{#intro} +# ã¯ããã« + +2024-08-28 ãã 2024-09-24 ã®çŽ1ã¶æã«æž¡ãéå¬ããã [MN-Core Challenge #1](https://mncore-challenge.preferred.jp/) ã«åå ãããç§ nsfisis ([ããã㯠`0b0100000111111000`](https://x.com/nsfisis/status/1838276770560364977)) ã¯ã¹ã³ã¢ 1181 ã§ãæçµé äœ 29 äœã ã£ãã + +ãã®èšäºã§è§£èª¬ã¯ããªãããæåºããåçã¯ãã¡ãã®ãªããžã㪠([GitHub: nsfisis/mncore-challenge](https://github.com/nsfisis/mncore-challenge)) ã«ã¢ããããŒãããŠããã + +{#thought} +# ææ³ + +MN-Core ã«ã¯åããŠè§Šããããããã§ãåé¡ãªãå
šå (é€ FizzBuzz) è§£ããããç·è·¯ãæ·ãããŠãããååã®åé¡ãè§£ãããšã§èªç¶ãšåŸåãè§£ãã ãã®ç¥èã身ã«ä»ãããã«èšèšãããŠããã + +é嬿éäžã¯ã»ãŒåžžã« MN-Core Challenge ã®ããšãèãç¶ããŠãããæéäž (åæ²ããåçã貯ããããã®ãªããžããªãé€ã) èªåã® Git ãªããžããªãã»ãšãã©è§Šãããšããªãã£ããéäžæŽæ°ãã§ããã«èŠããæéããã£ãããäžã€æ°ä»ããšäžã€çž®ãŸã楜ãããŽã«ãã ã£ãã + +æãããã€ã³ãã倿°ããã®ã ããæžããŠãããšããªããªãã®ã§èªåã§åçããã ãã«ããŠããã + +{#outro} +# ãããã« + +æåŸã«ãªããŸããããéå¶ã®ã¿ãªããŸãçŽ æŽããã³ã³ãã¹ããããããšãããããŸããïŒéåžžã«æ¥œããæéã§ããïŒç¬¬2åãéŠãé·ãããŠåŸ
ã£ãŠããŸãïŒ diff --git a/vhosts/blog/content/posts/2024-09-28/mncore-challenge-1.ndoc b/vhosts/blog/content/posts/2024-09-28/mncore-challenge-1.ndoc deleted file mode 100644 index 462ccab5..00000000 --- a/vhosts/blog/content/posts/2024-09-28/mncore-challenge-1.ndoc +++ /dev/null @@ -1,45 +0,0 @@ ---- -[article] -uuid = "ee7289ee-ff2e-439d-b343-7f87504192fd" -title = "MN-Core Challenge #1 åå ã¬ã" -description = "2024-08-28 ãã 2024-09-24 ã«ãããŠéå¬ããã MN-Core Challenge #1 ã«åå ããã" -tags = [ - "mncore-challenge", -] - -[[article.revisions]] -date = "2024-09-28" -remark = "å
¬é" ---- -<article> - <note> - ãã ã®åå èšã§è§£èª¬ã¯ãªãã - </note> - <section id="intro"> - <h>ã¯ããã«</h> - <p> - 2024-08-28 ãã 2024-09-24 ã®çŽ1ã¶æã«æž¡ãéå¬ããã <a href="https://mncore-challenge.preferred.jp/">MN-Core Challenge #1</a> ã«åå ãããç§ nsfisis (<a href="https://x.com/nsfisis/status/1838276770560364977">ããã㯠<code>0b0100000111111000</code></a>) ã¯ã¹ã³ã¢ 1181 ã§ãæçµé äœ 29 äœã ã£ãã - </p> - <p> - ãã®èšäºã§è§£èª¬ã¯ããªãããæåºããåçã¯ãã¡ãã®ãªããžã㪠(<a href="https://github.com/nsfisis/mncore-challenge">GitHub: nsfisis/mncore-challenge</a>) ã«ã¢ããããŒãããŠããã - </p> - </section> - <section id="thought"> - <h>ææ³</h> - <p> - MN-Core ã«ã¯åããŠè§Šããããããã§ãåé¡ãªãå
šå (é€ FizzBuzz) è§£ããããç·è·¯ãæ·ãããŠãããååã®åé¡ãè§£ãããšã§èªç¶ãšåŸåãè§£ãã ãã®ç¥èã身ã«ä»ãããã«èšèšãããŠããã - </p> - <p> - é嬿éäžã¯ã»ãŒåžžã« MN-Core Challenge ã®ããšãèãç¶ããŠãããæéäž (åæ²ããåçã貯ããããã®ãªããžããªãé€ã) èªåã® Git ãªããžããªãã»ãšãã©è§Šãããšããªãã£ããéäžæŽæ°ãã§ããã«èŠããæéããã£ãããäžã€æ°ä»ããšäžã€çž®ãŸã楜ãããŽã«ãã ã£ãã - </p> - <p> - æãããã€ã³ãã倿°ããã®ã ããæžããŠãããšããªããªãã®ã§èªåã§åçããã ãã«ããŠããã - </p> - </section> - <section id="outro"> - <h>ãããã«</h> - <p> - æåŸã«ãªããŸããããéå¶ã®ã¿ãªããŸãçŽ æŽããã³ã³ãã¹ããããããšãããããŸããïŒéåžžã«æ¥œããæéã§ããïŒç¬¬2åãéŠãé·ãããŠåŸ
ã£ãŠããŸãïŒ - </p> - </section> -</article> diff --git a/vhosts/blog/content/posts/2024-12-04/cohackpp-report.dj b/vhosts/blog/content/posts/2024-12-04/cohackpp-report.dj new file mode 100644 index 00000000..80da994f --- /dev/null +++ b/vhosts/blog/content/posts/2024-12-04/cohackpp-report.dj @@ -0,0 +1,197 @@ +--- +[article] +uuid = "ea0593d3-691c-4e08-8db4-98b8925717ec" +title = "çŽ
çœãºã±åæŠã«åå <ããŸãã" +description = "2024-11-30 ã«éå¬ãããçŽ
çœãºã±åæŠã«åå ãããºé£å¶ã®ã¡ã³ããšã㊠LT ããŸããã" +tags = [ + "cohackpp", + "php", +] + +[[article.revisions]] +date = "2024-12-04" +remark = "å
¬é" + +[[article.revisions]] +date = "2024-12-05" +remark = "ãè²ãŠããæ ã»ãè²ãŠããããæ ãåéãããŠéã«è¡šèšããŠããã®ã§ä¿®æ£" +--- +{#intro} +# ã¯ããã« + +2024-11-30 ã«éå¬ããã [çŽ
çœãºã±åæŠ](https://connpass.com/event/329428/) ãªãå¬ãã«åå ããŸãããç§ã¯ããºãé£å¶ã®ã¡ã³ããšã㊠LT ããããªããŸããã + +çŽ
çœãºã±åæŠã®ã€ãã³ãããŒãžã«ãã説æã以äžã«åŒçšããŸãã + +> Webãšã³ãžãã¢ã® [asumikam](https://x.com/asumikam) ãšWebãšã³ãžãã¢ã® [stefafafan](https://x.com/stefafafan) ã2024幎7æ7æ¥ã«çµå©ããŸããã +> +> ãã£ãããªã®ã§æè¡ããŒã¯ãšãã§çŽ
çœæŠãããŸãããïŒããã§ããïŒãã£ãŠãããŸãïŒ +> +> å Žæã¯ã¡ïŒå°ç°åã¡ïŒçãäžãã£ãŠãããŸããã¥ïŒïŒïŒ + +ãã£ãããšèšãã°ãããã¯ã«ã³ãã¡ã¬ã³ã¹ã®åœ¢åŒããšã£ãçµå©æ«é²å®Žã§ããã¿ã€ãã«ã®ããºã㯠PHPerããã±ã㯠Perl Monger ã®ç¥ã§ãã + +{#thoughts} +# ææ³ + +ç§ã¯ããºãé£å¶ã®ã¹ããŒã«ãŒãšã㊠LT ãããŠããã®ã§ããããã®åã«ãŸãã¯ç»å£ä»¥å€ã®ææ³ãã + +ããïœæé«ã§ããããã©ã®æ ã®ã¹ããŒãã®æ¹ãè¯ãã£ãã®ã§ãããç¹ã« (asumikam ãã/stefafafan ããã«)ãè²ãŠããããæ ã®ãäºæ¹ãå°è±¡ã«æ®ã£ãŠããŸãã +(asumikam ãã/stefafafan ããã)ãè²ãŠããæ ãšããŠãäžè©±ã«ãªã£ãæ¹ã«å£°ããããããšã¯ã§ãããšæããã§ããã +ããã ãã§ãªãããèªåãè²ãŠãã®ã ããšèšãã人ãããŠããããŠããã« 100 ç¹ã§å¿ãã人ããããšããããšããã®çŽ æŽããã人埳ã + +æ¹ããŠãasumikam ãããstefafafan ããããçµå©ããã§ãšãããããŸãïŒ + +{#lt} +# LT + +{#prepare} +## åæŠæºå + +ããŠãæãåæŠã®åã«æ»ããŸããŠãäž¡é£å¶ã®ç»å£è
ãçºè¡šããåŸã
ã«è¬ã®ã€ãã³ãã®èŒªéãèŠããŠããé ãasumikam ããããæ¬¡ã®ãããªé£çµ¡ãåããŸããã + + + +æåã¯çŽè¿ã®ã«ã³ãã¡ã¬ã³ã¹ã«åºããŠèœéžããããããŒã¶ã«ããŒãã LT ã«ç·šéããŠè©±ãããšããŠããã®ã§ããããã®æ©äŒã§ãªããã°è©±ããªãã»ãã®æ©äŒã§è©±ãããšã«æå³ãããããŒãã«ããããšãã¿åºãããããªããæçµçã«æ¬¡ã®ããŒãã§ã®ç»å£ãšãªããŸããã + +{#battle} +## ããå°åžžã«åè² + +åœæ¥ã¯ããããã°ã©ãã³ã°ãããŒè¬åº§ããšé¡ããŠçºè¡šããããªããŸããã +çµå©åŒã®ãããŒãç¹ã«ãå¿ã¿èšèããžãã©ãŒã«ã¹ãããããç¡çããããã°ã©ãã³ã°ã«é©çšãããšãããã®ã§ãã +[ã¹ã©ã€ãã¯ãã¡ãã«ã¢ããããŒãããŠããŸãã](/slides/2024-11-30/cohackpp/) + +æçµçã«ãç¥ãã®ã¡ãã»ãŒãžãä»èŸŒãã ãœãŒã¹ã³ãŒãã§ç· ãããšããæ§æã¯ãæãªãã綺éºã«ãŸãšãŸã£ããšæã£ãŠããŸããå¿ã¿èšèã®æ¡ã¯ä»ã«ã倧éã«ãã£ãã®ã§ãããæè¡ LT ãã€çµå©ç¥ãã¹ããŒãã«ããããã«ã©ãããŠãæåŸã®ãœãŒã¹ã³ãŒããå¿
èŠã ã£ãã®ã§ãæéã®é¢ä¿äžãããã«ã¯ç ç²ãšãªã£ãŠããããŸãã ( [ããã«ãªã£ãæ¡ã®ã²ãšã€](https://x.com/nsfisis/status/1862798137452327206) )ã + +ããããçµå©åŒã»æ«é²å®Žã§ã®ã¹ããŒãèªäœãåããŠã ã£ãã®ã§ãããªãã«ç·åŒµããŠããã®ã§ãããç»å£æããã®åŸã®åå¿ã䌺ãéãæŠã奜è©ã ã£ãããã§è¯ãã£ãã§ãã + +{#congrats} +# ãçµå©ããã§ãšãããããŸã + +https://github.com/nsfisis/cohackpp/blob/main/congrats.php + +```php +<?php +$s=<<<'Q' +<?php +% +$s=<<<'Q' +@$c=[`]; +$m="";for($k=0;$k<min(13,intdiv(__LINE__-119,80)+1);$k++){$C=str_replace("\n","", +$c[$k]);$f=!0;foreach(str_split(base64_decode($C))as$l){$L=ord($l);$m.=str_repeat +($f?"#":chr(32),$L&127);$f=!$f;if($L&128){$m.="\n";$f=!0;continue;}}}print( +str_replace([chr(96),chr(37),chr(64)],[implode("\n",array_map(fn($C)=>"'".trim( +chunk_split(str_replace("\n","",$C),80,"\n"))."',",$c)),"\n{$m}","{$s}\nQ;\n"],$s)); +Q; +$c=['0AFOgQFOgQFOgQFOgQFOgQFEAgiBAUIECIEBQwQHgQE8AQYFBoEBOgQGBAaBAToEBwQFgQE6BQYFBIEB +OwQHBASBATwEBgUDgQE8BQYEA4EBPQQGBAOBAT0FBgEFgQERBhsIBAQMgQERKQQFC4EBESkFAQ6BAREp +FIEBESkUgQERKRSBAU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6B +AU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6BAQ4EPIEBDQY7gQENBjuBAQ0GO4EBDQU8gQENBTyBAQwG +PIEBDAY8gQEMBjyBAQwGPIEBDAY8gQEMBjyBAQwHO4EBDAc7gQENBzqBAQ0IOYEBDgg4gQEOCiUCD4EB +DwwdBw+BARAQDhEPgQERLg+BARItD4EBFCsPgQEXJRKBARsbGIEBToEBToEBToEBToEBToHQ', +'0AFOgQFOgQFOgQEPASMFFoEBDwMhBRaBAQ4FIAUWgQEOBSAFFoEBDQUhBRaBAQ0FIQUWgQEMBSIFFoEB +DAUiBRaBAQsFIwUWgQELBQgBGgUWgQEKBQkDGAUWgQEKBQgGBCoDgQEJBQkFBSoDgQEFAQMECQYFKgOB +AQQDAQUJBQYqA4EBBAgJBQcqA4EBAwkJBRkFFoEBBAcJBRoFFoEBBQYIBRsFFoEBBgYHBRsFFoEBBwYF +BRwFFoEBCAYDBR0FFoEBCQYCBR0FFoEBCgseBRaBAQsJHwUWgQEMByAFFoEBDAcFAxgFFoEBDQUFBBgF +FoEBDQQGBRYGFoEBDAUHBAcmBYEBCwUIBQYmBYEBCwQKBAYmBYEBCgQLBQUmBYEBCQUMBS+BAQgFDAYv +gQEDHC+BAQMdLoEBAx0ugQEDHi2BAQMJBAUIBC2BARAFCAQtgQEQBQgELYEBEAUJAS+BARAFESEHgQEQ +BREhB4EBBwEIBQYBCiEHgQEHBAUFBAQJIQeBAQcEBQUEBAkEGAUHgQEGBQUFBAUIBBgFB4EBBgUFBQUE +CAQYBQeBAQYFBQUFBAgEGAUHgQEGBAYFBQUHBBgFB4EBBgQGBQYEBwQYBQeBAQUFBgUGBQYEGAUHgQEF +BQYFBwQGBBgFB4EBBQQHBQcEBgQYBQeBAQUEBwUHBQUEGAUHgQEEBQcFBwUFBBgFB4EBBAUHBQgEBQQY +BQeBAQQECAUIBAUEGAUHgQEDBQgFCAEIBBgFB4EBAwUIBREEGAUHgQECBQkFEQQYBQeBAQIFCQURIQeB +AQQCCgURIQeBARAFESEHgQEQBREhB4EBEAURIQeBARAFEQQYBQeBARAFEQQYBQeBARAFEQQYBQeBARAF +EQQYBQeBAU6BAU6BAU6B0A==', +'0AFOgQFOgQFOgQEOAjEBDIEBDgUqBwqBAQ0FJwwJgQENBSETCIEBDQURAQcXDIEBDQURGxCBAQ0FERcU +gQENBBIOBAUUgQEMBRIGDAUUgQEMBRIFDQUUgQEMBRIFDgQUgQEMBRIFDgQUgQEMBBMFDgQUgQELBRMF +DgQUgQELBRMFDgUTgQELBRMFDgUTgQEDGQcFDgUTgQEDGwUoA4EBAxsFKAOBAQMbBSgDgQEDGwUoA4EB +CgUKBQUFDwUSgQEKBAsEBgUQBBKBAQkFCwQGBRAFEYEBCQULBAYFEAURgQEJBQoFBgUQBRGBAQkFCgUG +BREFEIEBCQQLBQYFEQUQgQEIBQsFBgUSBQkBBYEBCAULBQYFEgUJAwOBAQgFCwUGBQoFBAUIBAKBAQgF +CwQHBQQLBAYHAwOBAQgECwUHFAUGBQQDgQEHBQsFAxgFBwQEA4EBBwULBQMVCQ4DgQEHBQsFAw8QDQOB +AQcEDAUDCRcLBIEBBgULBQUCHwgFgQEGBQsFKAQHgQEGBQsFM4EBBgULBTOBAQYFCgUKIgiBAQUHCQUK +IgiBAQUICAUKIgiBAQUKBgUKIgiBAQULBAULBRgFCIEBBA0DBQsFGAUIgQEEBQIHAgULBRgFCIEBBgMD +DAwFGAUIgQENCwwFGAUIgQEOCgwFGAUIgQEQBw0FGAUIgQERBwwFGAUIgQERCAsiCIEBEAoKIgiBARAL +CSIIgQEPDQgiCIEBDwUCBwcFGAUIgQEOBgMHBgUYBQiBAQ0GBQcFBRgFCIEBDAcGBgUFGAUIgQELBwgE +BgUYBQiBAQoHCgMGBRgFCIEBCQcMAQcFGAUIgQEIBxUFGAUIgQEHCBUiCIEBBggWIgiBAQQJFyIIgQEF +BxgiCIEBBQUaBRgFCIEBBgMbBRgFCIEBJAUYBQiBAU6BAU6BAU6B0A==', +'0AFOgQFOgQFOgQFOgQFOgQFOgQFOgQEZBi+BARkGL4EBGgUvgQEaBS+BARoFL4EBGgUvgQEaBS+BARoF +L4EBGgUvgQEaBRkBFYEBGgUZAxOBARoFDwEIBRKBARoFCwUIBxCBARoFBgoHCg6BARoVCQkNgQEJJgsJ +C4EBCSYMCQqBAQohEgkIgQEKGxoIB4EBChUhCQWBARkFIwkEgQEZBSUGBYEBGQUmBAaBARkFKAIGgQEZ +BTCBARkFMIEBGQUwgQEZBTCBARkFMIEBGQUwgQEZBTCBARkFCRAXgQEZBQQYFIEBGSMSgQEZJBGBARkS +CAwPgQEXDhIJDoEBFQwYCA2BARMMGwcNgQESDB0HDIEBEA4eBgyBAQ8IAwQfBguBAQ4IBAQfBguBAQ0H +BgQgBQuBAQwHBwQgBQuBAQsHCAUfBQuBAQoGCgUfBQuBAQoGCgUfBQuBAQkGCwUfBQuBAQkFDAUeBguB +AQgGDAUeBguBAQgGDAUdBwuBAQgGDAUdBgyBAQgGDAUcBwyBAQkFDAUbBw2BAQkGCwUZCQ2BAQkHCgUY +CQ6BAQoIBwYVCw+BAQsIBQcSDRCBAQwSChURgQENEQoTE4EBDhAKERWBARANDA4XgQESCwwLGoEBFQYO +BSCBAU6BAU6BAU6BAU6BAU6BAU6B0A==', +'0AFOgQFOgQFOgQFOgQFOgQFOgQFOgQEuBhqBAS4FG4EBLgUbgQEuBRuBARICGQYbgQEPBRkGG4EBDgYZ +BRyBAQ8FGQUcgQEPBhgFHIEBDwYXBhyBARAFFwUdgQEQBRcFHYEBEAYNERqBAREFChcXgQERBQccFYEB +EQYEIBOBARIFAg4DExGBARIRBwYEChCBARIOCgUHCQ+BARMKDQUJCA6BARIJDgYKCA2BAREIEAUNBwyB +ARAJEAUOBgyBAQ8KDwYPBguBAQ4MDgUQBwqBAQ4MDgURBgqBAQ0GAgYMBRMFCoEBDAYEBQwFEwYJgQEM +BgQFCwYTBgmBAQsGBQYKBRUFCYEBCgYHBQkGFQYIgQEKBQgGCAYVBgiBAQkGCQUIBRcFCIEBCQUKBgYG +FwUIgQEJBQsFBgUYBQiBAQgFDAYEBhgFCIEBCAUNBQMGGQUIgQEIBQ0GAgYZBQiBAQcFDwwaBQiBAQcF +DwwaBQiBAQcFEAobBQiBAQcFEAoaBgiBAQcFEQgbBgiBAQcFEgYcBgiBAQcFEQgbBQmBAQcFEAoZBgmB +AQcFEAoZBgmBAQcFDwwXBgqBAQcFDg4VBwqBAQcGDAcCBxQGC4EBCAULBwQEFQcLgQEIBggIBgIVBwyB +AQgIBAkHARUHDYEBCRMcCQ2BAQoRHAkOgQELDhwKD4EBDAwbChGBAQ4HGwwSgQEsDxOBASgRFYEBKQ4X +gQEpDBmBASoIHIEBKwMggQFOgQFOgQFOgQFOgQFOgQFOgQFOgdA=', +'0AFOgQFOgQFOgQFOgQFOgQFOgQFOgQFOgQFOgQFOgQE1DwqBASkbCoEBHiYKgQETMQqBAQc9CoEBBjQU +gQEGIQQKGYEBBhcOBxyBAQcOFAcegQEHBhsHH4EBJwYhgQEmBiKBASUGFgEMgQEkBhUDDIEBIwYWBAuB +ASMGFwQKgQEiBg8DBgQKgQEhBg8EBwQJgQEhBhAEBwQIgQEgBhEFBgQIgQEgBRMEBwQHgQEfBhQEBgUG +gQEfBhQEBwQGgQEfBRYEBgIIgQEeBhYEEIEBHgYXBA+BAR4FGAMQgQEeBSuBAR0GK4EBHQYrgQEdBiuB +AR0GK4EBHQYrgQEdBiuBAR0GK4EBHQYrgQEdBiuBAR4FK4EBHgYqgQEeBiqBAR4HKYEBHwYpgQEfByiB +ASAHJ4EBIAcngQEhByaBASEJJIEBIgkjgQEjCiGBASQLH4EBJQwdgQEmDxmBASgTE4EBKhMRgQErEhGB +AS4PEYEBMAwSgQE0CBKBAU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6B0A==', +'0AFOgQFOgQFOgQFOgQFOgQFOgQFOgQFOgQEXATaBARQENoEBEgY2gQESBzWBARMGNYEBEwc0gQEUBjSB +ARQGNIEBFQYzgQEVBiABEoEBFgYeAxGBARYGHAYQgQEWBxoHEIEBFwYYCg+BARcHFQsQgQEYBhMLEoEB +GAYRCxSBARkGDgsWgQEZBgwLGIEBGgYJCxqBARoHBwocgQEbBgUKHoEBGwcCCiCBARwRIYEBHA8jgQEd +DCWBAR0KJ4EBHAoogQEbCSqBARoILIEBGQgtgQEXCC+BARYIMIEBFQgxgQEVBzKBARQHM4EBEwc0gQES +BzWBARIGNoEBEQY3gQERBjeBAREFOIEBEAY4gQEQBjiBARAGOIEBEAY4gQEQBjiBARAGOIEBEAY4gQEQ +BjiBARAHN4EBEAc3gQERBzaBAREINYEBEgkzgQETCiEDDYEBEw0WCw2BARQtDYEBFisNgQEXKg2BARon +DYEBHSARgQEjDxyBAU6BAU6BAU6BAU6BAU6BAU6BAU6B0A==', +'0AFOgQFOgQFOgQFOgQFOgQFOgQFOgQEXBDOBARcLLIEBFxQjgQEXIRaBARchFoEBGh4WgQEiFhaBASsN +FoEBNgEXgQFOgQFOgQFOgQFOgQFOgQFOgQFOgQFOgQFOgQEkDR2BAR4WGoEBGR0YgQEVIxaBARApFYEB +DRcLCxSBAQ4QFAkTgQEODBoIEoEBDgkeBxKBAQ4GIgcRgQEPAiYGEYEBNwcQgQE4BhCBATgGEIEBOAYQ +gQE4BhCBATkFEIEBOQUQgQE5BRCBATgGEIEBOAYQgQE4BhCBATgGEIEBNwcQgQE3BhGBATcGEYEBNgcR +gQE1BxKBATUHEoEBNAcTgQEzCBOBATIIFIEBMQgVgQEvCRaBAS4JF4EBLAoYgQEqCxmBAScMG4EBJQ0c +gQEhDx6BARwTH4EBGBQigQEZESSBARoNJ4EBGgoqgQEbBS6BAU6BAU6BAU6BAU6BAU6BAU6BAU6B0A==', +'0AFOgQFOgQFOgQFOgQFOgQFDAgmBAUEECYEBQgQIgQE7AQYFB4EBOQQGBAeBATkEBwQGgQE5BQYFBYEB +OgQHBAWBATsEBgUEgQE7BQYEBIEBPAQGBASBATwFBgEGgQEQBhsIBAQNgQEQKQQFDIEBECkFAQ+BARAp +FYEBECkVgQEQKRWBAU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6B +AU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6BAQ0EPYEBDAY8gQEMBjyBAQwGPIEBDAU9gQEMBT2BAQsG +PYEBCwY9gQELBj2BAQsGPYEBCwY9gQELBj2BAQsHPIEBCwc8gQEMBzuBAQwIOoEBDQg5gQENCiUCEIEB +DgwdBxCBAQ8QDhEQgQEQLhCBAREtEIEBEysQgQEWJROBARobGYEBToEBToEBToEBToEBToHQ', +'0AFOgQFOgQFOgQFOgQFCAwmBAUEECYEBQQUIgQE5AwYFB4EBOAQHBAeBASkCDgQGBQaBASYGDQUGBAaB +ASYGDgQHBAWBASYGDgUGBAWBAScFDwQHBASBAScGDwQGAwWBAScGDwUNgQEoBRAEDYEBKAUQAw6BASgG +IIEBKQUQAw2BASkFDAcNgQEpBgYMDYEBCgMdFw2BAQsVAh8NgQELNQ6BAQsxEoEBCysYgQELJh2BARkI +CwUdgQEsBhyBAS0FHIEBLQUcgQEuBRuBAS4FG4EBLwUagQEvBRqBATAFGYEBMAYYgQExBRiBATEGF4EB +MgUXgQEyBhaBATMGFYEBNAUVgQE0BhSBATUGE4EBEAIWCgMHEoEBEAYSFRGBAQ8GExURgQEPBRQUEoEB +DgYaDROBAQ4GIwQTgQEOBTuBAQ0GO4EBDQY7gQENBTyBAQ0FPIEBDQU8gQENBTyBAQ0FPIEBDQU8gQEN +BjuBAQ0GO4EBDgY6gQEOBzmBAQ4IOIEBDwg3gQEQCh4BFYEBEQwVBxWBARInFYEBEyYVgQEVJBWBARgh +FYEBGxoZgQFOgQFOgQFOgQFOgdA=', +'0AFOgQFOgQFOgQFOgQFOgQFOgQFOgQFOgQFOgQFOgQFOgQFOgQEJBz6BAQkGP4EBCQY/gQEJBigDFIEB +CQYlBhSBAQkGJQcTgQEJBiYHEoEBCQYnBhKBAQkGJwcRgQEJBigGEYEBCQYoBxCBAQkGKQYQgQEJBioG +D4EBCQYqBg+BAQkGKgcOgQEJBisGDoEBCgUrBg6BAQoFLAYNgQEKBSwGDYEBCgUtBgyBAQoFLQYMgQEK +BS0GDIEBCgUuBguBAQoFLgYLgQEKBS4GC4EBCgYtBguBAQoGLgYKgQEKBi4GCoEBCgYuBgqBAQoGLwYJ +gQELBS8GCYEBCwUvBgmBAQsFLwYJgQELBhMBGgYJgQELBhMCGgYIgQELBhMDGQYIgQEMBRMEGAYIgQEM +BhEGFwYIgQEMBhEGFwYIgQEMBhAGGQUIgQENBg8GGQUIgQENBg8GGQUIgQENBg4GGgILgQEOBg0GJ4EB +DgcLBiiBAQ4HCgcogQEPBwgHKYEBEAcGCCmBARAKAQkqgQEREiuBARIRK4EBEhAsgQETDi2BARULLoEB +FwcwgQFOgQFOgQFOgQFOgQFOgQFOgQFOgQFOgQFOgQFOgQFOgdA=', +'0AFOgQFOgQFOgQFOgQFOgQFOgQFOgQElBiOBASYFI4EBJgUjgQEmBSOBASYFI4EBJgUjgQEmBSOBASYF +I4EBJgUQBQ6BAQ4IEAUGDw6BAQ4yDoEBDjIOgQEOMg6BAQ4rFYEBGhIigQEmBSOBASYFI4EBJgUjgQEm +BSOBASYFI4EBJgUjgQEmBSOBASYFI4EBJgUjgQEmBRQCDYEBDQMWBQwKDYEBDQ8JHA2BAQ4zDYEBDjMN +gQEOMg6BARAnF4EBJQYjgQEmBSOBASYFI4EBJgUjgQEmBSOBASYFI4EBJgUjgQEmBSOBASYFI4EBJgUj +gQEmBSOBAR0EBQUjgQEXFCOBARQZIYEBEh4egQERIRyBARAJDBAZgQEPBxARF4EBDgYSExWBAQ4FEwYD +CxSBAQ4FEwYFCxKBAQ0FFAYHChGBAQ0FFAYJCg+BAQ0FFAYKCg6BAQ0GEwYMCQ2BAQ4FEwYNCQyBAQ4G +EQYQBg2BAQ4HDwcRBQ2BAQ8IDAgSAw6BAQ8bFAEPgQERGCWBARIWJoEBFBIogQEXDSqBAU6BAU6BAU6B +AU6BAU6BAU6B0A==', +'0AFOgQFOgQFOgQFOgQFOgQFOgQEpBh+BASkGH4EBKQYfgQEqBR+BASoFH4EBKgUfgQEqBR+BASoFH4EB +KgUfgQEqBR+BARkuB4EBBkEHgQEHQAeBAQdAB4EBB0AHgQEHDBcFH4EBKgUfgQEqBR+BASoFH4EBKgUf +gQEqBR+BASoFH4EBKgUfgQEgDx+BAR4RH4EBHBMfgQEbFB+BARoIBAkfgQEZBwkGH4EBGQYLBh6BARgG +DQUegQEYBQ4GHYEBFwYPBR2BARcFEAUdgQEXBRAFHYEBFwUQBhyBARcFEAYcgQEXBQ8HHIEBFwUPBxyB +ARcGDgccgQEXBg0IHIEBGAYMBx2BARgHCggdgQEZCAYKHYEBGhcdgQEbFh2BARwVHYEBHgsBBh6BASAG +BAYegQEpBh+BASkGH4EBKAYggQEnByCBASYHIYEBJQcigQEkCCKBASIJI4EBIAokgQEeCyWBARwLJ4EB +GQ0ogQEWDiqBARcMK4EBGAktgQEZBTCBARoCMoEBToEBToEBToEBToEBToEBToHQ',]; +$m="";for($k=0;$k<min(13,intdiv(__LINE__-119,80)+1);$k++){$C=str_replace("\n","", +$c[$k]);$f=!0;foreach(str_split(base64_decode($C))as$l){$L=ord($l);$m.=str_repeat +($f?"#":chr(32),$L&127);$f=!$f;if($L&128){$m.="\n";$f=!0;continue;}}}print( +str_replace([chr(96),chr(37),chr(64)],[implode("\n",array_map(fn($C)=>"'".trim( +chunk_split(str_replace("\n","",$C),80,"\n"))."',",$c)),"\n{$m}","{$s}\nQ;\n"],$s)); +``` diff --git a/vhosts/blog/content/posts/2024-12-04/cohackpp-report.ndoc b/vhosts/blog/content/posts/2024-12-04/cohackpp-report.ndoc deleted file mode 100644 index 5d77af55..00000000 --- a/vhosts/blog/content/posts/2024-12-04/cohackpp-report.ndoc +++ /dev/null @@ -1,217 +0,0 @@ ---- -[article] -uuid = "ea0593d3-691c-4e08-8db4-98b8925717ec" -title = "çŽ
çœãºã±åæŠã«åå <ããŸãã" -description = "2024-11-30 ã«éå¬ãããçŽ
çœãºã±åæŠã«åå ãããºé£å¶ã®ã¡ã³ããšã㊠LT ããŸããã" -tags = [ - "cohackpp", - "php", -] - -[[article.revisions]] -date = "2024-12-04" -remark = "å
¬é" - -[[article.revisions]] -date = "2024-12-05" -remark = "ãè²ãŠããæ ã»ãè²ãŠããããæ ãåéãããŠéã«è¡šèšããŠããã®ã§ä¿®æ£" ---- -<article> - <section id="intro"> - <h>ã¯ããã«</h> - <p> - 2024-11-30 ã«éå¬ããã<a href="https://connpass.com/event/329428/">çŽ
çœãºã±åæŠ</a>ãªãå¬ãã«åå ããŸãããç§ã¯ããºãé£å¶ã®ã¡ã³ããšã㊠LT ããããªããŸããã - </p> - <p> - çŽ
çœãºã±åæŠã®ã€ãã³ãããŒãžã«ãã説æã以äžã«åŒçšããŸãã - </p> - <blockquote> - <p> - Webãšã³ãžãã¢ã®<a href="https://x.com/asumikam">asumikam</a>ãšWebãšã³ãžãã¢ã®<a href="https://x.com/stefafafan">stefafafan</a>ã2024幎7æ7æ¥ã«çµå©ããŸããã - </p> - <p> - ãã£ãããªã®ã§æè¡ããŒã¯ãšãã§çŽ
çœæŠãããŸãããïŒããã§ããïŒãã£ãŠãããŸãïŒ - </p> - <p> - å Žæã¯ã¡ïŒå°ç°åã¡ïŒçãäžãã£ãŠãããŸããã¥ïŒïŒïŒ - </p> - </blockquote> - <p> - ãã£ãããšèšãã°ãããã¯ã«ã³ãã¡ã¬ã³ã¹ã®åœ¢åŒããšã£ãçµå©æ«é²å®Žã§ããã¿ã€ãã«ã®ããºã㯠PHPerããã±ã㯠Perl Monger ã®ç¥ã§ãã - </p> - </section> - <section id="thoughts"> - <h>ææ³</h> - <p> - ç§ã¯ããºãé£å¶ã®ã¹ããŒã«ãŒãšã㊠LT ãããŠããã®ã§ããããã®åã«ãŸãã¯ç»å£ä»¥å€ã®ææ³ãã - </p> - <p> - ããïœæé«ã§ããããã©ã®æ ã®ã¹ããŒãã®æ¹ãè¯ãã£ãã®ã§ãããç¹ã« (asumikam ãã/stefafafan ããã«)ãè²ãŠããããæ ã®ãäºæ¹ãå°è±¡ã«æ®ã£ãŠããŸãã - (asumikam ãã/stefafafan ããã)ãè²ãŠããæ ãšããŠãäžè©±ã«ãªã£ãæ¹ã«å£°ããããããšã¯ã§ãããšæããã§ããã - ããã ãã§ãªãããèªåãè²ãŠãã®ã ããšèšãã人ãããŠããããŠããã« 100 ç¹ã§å¿ãã人ããããšããããšããã®çŽ æŽããã人埳ã - </p> - <p> - æ¹ããŠãasumikam ãããstefafafan ããããçµå©ããã§ãšãããããŸãïŒ - </p> - </section> - <section id="lt"> - <h>LT</h> - <section id="prepare"> - <h>åæŠæºå</h> - <p> - ããŠãæãåæŠã®åã«æ»ããŸããŠãäž¡é£å¶ã®ç»å£è
ãçºè¡šããåŸã
ã«è¬ã®ã€ãã³ãã®èŒªéãèŠããŠããé ãasumikam ããããæ¬¡ã®ãããªé£çµ¡ãåããŸããã - </p> - <img src="/posts/2024-12-04/cohackpp-report/lt.png" alt="asumikamãããŸãããããã€ããããŸã§ãããºã±åæŠã§ãLTã¿ã€ã ããããšã«ãªããæè¡ã§3人ããºãåŽãéžåºããããšã«ãªã£ãã®ã§ãããããŸãããããLTãããŸããããããºãé£å¶ã§äžç·ã«é ããç®æããŸãããããnsfisisãOKã§ãïŒã"></img> - <p> - æåã¯çŽè¿ã®ã«ã³ãã¡ã¬ã³ã¹ã«åºããŠèœéžããããããŒã¶ã«ããŒãã LT ã«ç·šéããŠè©±ãããšããŠããã®ã§ããããã®æ©äŒã§ãªããã°è©±ããªãã»ãã®æ©äŒã§è©±ãããšã«æå³ãããããŒãã«ããããšãã¿åºãããããªããæçµçã«æ¬¡ã®ããŒãã§ã®ç»å£ãšãªããŸããã - </p> - </section> - <section id="battle"> - <h>ããå°åžžã«åè² </h> - <p> - åœæ¥ã¯ããããã°ã©ãã³ã°ãããŒè¬åº§ããšé¡ããŠçºè¡šããããªããŸããã - çµå©åŒã®ãããŒãç¹ã«ãå¿ã¿èšèããžãã©ãŒã«ã¹ãããããç¡çããããã°ã©ãã³ã°ã«é©çšãããšãããã®ã§ãã - <a href="/slides/2024-11-30/cohackpp/">ã¹ã©ã€ãã¯ãã¡ãã«ã¢ããããŒãããŠããŸãã</a> - </p> - <p> - æçµçã«ãç¥ãã®ã¡ãã»ãŒãžãä»èŸŒãã ãœãŒã¹ã³ãŒãã§ç· ãããšããæ§æã¯ãæãªãã綺éºã«ãŸãšãŸã£ããšæã£ãŠããŸããå¿ã¿èšèã®æ¡ã¯ä»ã«ã倧éã«ãã£ãã®ã§ãããæè¡ LT ãã€çµå©ç¥ãã¹ããŒãã«ããããã«ã©ãããŠãæåŸã®ãœãŒã¹ã³ãŒããå¿
èŠã ã£ãã®ã§ãæéã®é¢ä¿äžãããã«ã¯ç ç²ãšãªã£ãŠããããŸãã (<a href="https://x.com/nsfisis/status/1862798137452327206">ããã«ãªã£ãæ¡ã®ã²ãšã€</a>)ã - </p> - <p> - ããããçµå©åŒã»æ«é²å®Žã§ã®ã¹ããŒãèªäœãåããŠã ã£ãã®ã§ãããªãã«ç·åŒµããŠããã®ã§ãããç»å£æããã®åŸã®åå¿ã䌺ãéãæŠã奜è©ã ã£ãããã§è¯ãã£ãã§ãã - </p> - </section> - </section> - <section id="congrats"> - <h>ãçµå©ããã§ãšãããããŸã</h> - <p> - https://github.com/nsfisis/cohackpp/blob/main/congrats.php - </p> - <codeblock language="php"> - <![CDATA[ - <?php - $s=<<<'Q' - <?php - % - $s=<<<'Q' - @$c=[`]; - $m="";for($k=0;$k<min(13,intdiv(__LINE__-119,80)+1);$k++){$C=str_replace("\n","", - $c[$k]);$f=!0;foreach(str_split(base64_decode($C))as$l){$L=ord($l);$m.=str_repeat - ($f?"#":chr(32),$L&127);$f=!$f;if($L&128){$m.="\n";$f=!0;continue;}}}print( - str_replace([chr(96),chr(37),chr(64)],[implode("\n",array_map(fn($C)=>"'".trim( - chunk_split(str_replace("\n","",$C),80,"\n"))."',",$c)),"\n{$m}","{$s}\nQ;\n"],$s)); - Q; - $c=['0AFOgQFOgQFOgQFOgQFOgQFEAgiBAUIECIEBQwQHgQE8AQYFBoEBOgQGBAaBAToEBwQFgQE6BQYFBIEB - OwQHBASBATwEBgUDgQE8BQYEA4EBPQQGBAOBAT0FBgEFgQERBhsIBAQMgQERKQQFC4EBESkFAQ6BAREp - FIEBESkUgQERKRSBAU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6B - AU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6BAQ4EPIEBDQY7gQENBjuBAQ0GO4EBDQU8gQENBTyBAQwG - PIEBDAY8gQEMBjyBAQwGPIEBDAY8gQEMBjyBAQwHO4EBDAc7gQENBzqBAQ0IOYEBDgg4gQEOCiUCD4EB - DwwdBw+BARAQDhEPgQERLg+BARItD4EBFCsPgQEXJRKBARsbGIEBToEBToEBToEBToEBToHQ', - '0AFOgQFOgQFOgQEPASMFFoEBDwMhBRaBAQ4FIAUWgQEOBSAFFoEBDQUhBRaBAQ0FIQUWgQEMBSIFFoEB - DAUiBRaBAQsFIwUWgQELBQgBGgUWgQEKBQkDGAUWgQEKBQgGBCoDgQEJBQkFBSoDgQEFAQMECQYFKgOB - AQQDAQUJBQYqA4EBBAgJBQcqA4EBAwkJBRkFFoEBBAcJBRoFFoEBBQYIBRsFFoEBBgYHBRsFFoEBBwYF - BRwFFoEBCAYDBR0FFoEBCQYCBR0FFoEBCgseBRaBAQsJHwUWgQEMByAFFoEBDAcFAxgFFoEBDQUFBBgF - FoEBDQQGBRYGFoEBDAUHBAcmBYEBCwUIBQYmBYEBCwQKBAYmBYEBCgQLBQUmBYEBCQUMBS+BAQgFDAYv - gQEDHC+BAQMdLoEBAx0ugQEDHi2BAQMJBAUIBC2BARAFCAQtgQEQBQgELYEBEAUJAS+BARAFESEHgQEQ - BREhB4EBBwEIBQYBCiEHgQEHBAUFBAQJIQeBAQcEBQUEBAkEGAUHgQEGBQUFBAUIBBgFB4EBBgUFBQUE - CAQYBQeBAQYFBQUFBAgEGAUHgQEGBAYFBQUHBBgFB4EBBgQGBQYEBwQYBQeBAQUFBgUGBQYEGAUHgQEF - BQYFBwQGBBgFB4EBBQQHBQcEBgQYBQeBAQUEBwUHBQUEGAUHgQEEBQcFBwUFBBgFB4EBBAUHBQgEBQQY - BQeBAQQECAUIBAUEGAUHgQEDBQgFCAEIBBgFB4EBAwUIBREEGAUHgQECBQkFEQQYBQeBAQIFCQURIQeB - AQQCCgURIQeBARAFESEHgQEQBREhB4EBEAURIQeBARAFEQQYBQeBARAFEQQYBQeBARAFEQQYBQeBARAF - EQQYBQeBAU6BAU6BAU6B0A==', - '0AFOgQFOgQFOgQEOAjEBDIEBDgUqBwqBAQ0FJwwJgQENBSETCIEBDQURAQcXDIEBDQURGxCBAQ0FERcU - gQENBBIOBAUUgQEMBRIGDAUUgQEMBRIFDQUUgQEMBRIFDgQUgQEMBRIFDgQUgQEMBBMFDgQUgQELBRMF - DgQUgQELBRMFDgUTgQELBRMFDgUTgQEDGQcFDgUTgQEDGwUoA4EBAxsFKAOBAQMbBSgDgQEDGwUoA4EB - CgUKBQUFDwUSgQEKBAsEBgUQBBKBAQkFCwQGBRAFEYEBCQULBAYFEAURgQEJBQoFBgUQBRGBAQkFCgUG - BREFEIEBCQQLBQYFEQUQgQEIBQsFBgUSBQkBBYEBCAULBQYFEgUJAwOBAQgFCwUGBQoFBAUIBAKBAQgF - CwQHBQQLBAYHAwOBAQgECwUHFAUGBQQDgQEHBQsFAxgFBwQEA4EBBwULBQMVCQ4DgQEHBQsFAw8QDQOB - AQcEDAUDCRcLBIEBBgULBQUCHwgFgQEGBQsFKAQHgQEGBQsFM4EBBgULBTOBAQYFCgUKIgiBAQUHCQUK - IgiBAQUICAUKIgiBAQUKBgUKIgiBAQULBAULBRgFCIEBBA0DBQsFGAUIgQEEBQIHAgULBRgFCIEBBgMD - DAwFGAUIgQENCwwFGAUIgQEOCgwFGAUIgQEQBw0FGAUIgQERBwwFGAUIgQERCAsiCIEBEAoKIgiBARAL - CSIIgQEPDQgiCIEBDwUCBwcFGAUIgQEOBgMHBgUYBQiBAQ0GBQcFBRgFCIEBDAcGBgUFGAUIgQELBwgE - BgUYBQiBAQoHCgMGBRgFCIEBCQcMAQcFGAUIgQEIBxUFGAUIgQEHCBUiCIEBBggWIgiBAQQJFyIIgQEF - BxgiCIEBBQUaBRgFCIEBBgMbBRgFCIEBJAUYBQiBAU6BAU6BAU6B0A==', - '0AFOgQFOgQFOgQFOgQFOgQFOgQFOgQEZBi+BARkGL4EBGgUvgQEaBS+BARoFL4EBGgUvgQEaBS+BARoF - L4EBGgUvgQEaBRkBFYEBGgUZAxOBARoFDwEIBRKBARoFCwUIBxCBARoFBgoHCg6BARoVCQkNgQEJJgsJ - C4EBCSYMCQqBAQohEgkIgQEKGxoIB4EBChUhCQWBARkFIwkEgQEZBSUGBYEBGQUmBAaBARkFKAIGgQEZ - BTCBARkFMIEBGQUwgQEZBTCBARkFMIEBGQUwgQEZBTCBARkFCRAXgQEZBQQYFIEBGSMSgQEZJBGBARkS - CAwPgQEXDhIJDoEBFQwYCA2BARMMGwcNgQESDB0HDIEBEA4eBgyBAQ8IAwQfBguBAQ4IBAQfBguBAQ0H - BgQgBQuBAQwHBwQgBQuBAQsHCAUfBQuBAQoGCgUfBQuBAQoGCgUfBQuBAQkGCwUfBQuBAQkFDAUeBguB - AQgGDAUeBguBAQgGDAUdBwuBAQgGDAUdBgyBAQgGDAUcBwyBAQkFDAUbBw2BAQkGCwUZCQ2BAQkHCgUY - CQ6BAQoIBwYVCw+BAQsIBQcSDRCBAQwSChURgQENEQoTE4EBDhAKERWBARANDA4XgQESCwwLGoEBFQYO - BSCBAU6BAU6BAU6BAU6BAU6BAU6B0A==', - '0AFOgQFOgQFOgQFOgQFOgQFOgQFOgQEuBhqBAS4FG4EBLgUbgQEuBRuBARICGQYbgQEPBRkGG4EBDgYZ - BRyBAQ8FGQUcgQEPBhgFHIEBDwYXBhyBARAFFwUdgQEQBRcFHYEBEAYNERqBAREFChcXgQERBQccFYEB - EQYEIBOBARIFAg4DExGBARIRBwYEChCBARIOCgUHCQ+BARMKDQUJCA6BARIJDgYKCA2BAREIEAUNBwyB - ARAJEAUOBgyBAQ8KDwYPBguBAQ4MDgUQBwqBAQ4MDgURBgqBAQ0GAgYMBRMFCoEBDAYEBQwFEwYJgQEM - BgQFCwYTBgmBAQsGBQYKBRUFCYEBCgYHBQkGFQYIgQEKBQgGCAYVBgiBAQkGCQUIBRcFCIEBCQUKBgYG - FwUIgQEJBQsFBgUYBQiBAQgFDAYEBhgFCIEBCAUNBQMGGQUIgQEIBQ0GAgYZBQiBAQcFDwwaBQiBAQcF - DwwaBQiBAQcFEAobBQiBAQcFEAoaBgiBAQcFEQgbBgiBAQcFEgYcBgiBAQcFEQgbBQmBAQcFEAoZBgmB - AQcFEAoZBgmBAQcFDwwXBgqBAQcFDg4VBwqBAQcGDAcCBxQGC4EBCAULBwQEFQcLgQEIBggIBgIVBwyB - AQgIBAkHARUHDYEBCRMcCQ2BAQoRHAkOgQELDhwKD4EBDAwbChGBAQ4HGwwSgQEsDxOBASgRFYEBKQ4X - gQEpDBmBASoIHIEBKwMggQFOgQFOgQFOgQFOgQFOgQFOgQFOgdA=', - '0AFOgQFOgQFOgQFOgQFOgQFOgQFOgQFOgQFOgQFOgQE1DwqBASkbCoEBHiYKgQETMQqBAQc9CoEBBjQU - gQEGIQQKGYEBBhcOBxyBAQcOFAcegQEHBhsHH4EBJwYhgQEmBiKBASUGFgEMgQEkBhUDDIEBIwYWBAuB - ASMGFwQKgQEiBg8DBgQKgQEhBg8EBwQJgQEhBhAEBwQIgQEgBhEFBgQIgQEgBRMEBwQHgQEfBhQEBgUG - gQEfBhQEBwQGgQEfBRYEBgIIgQEeBhYEEIEBHgYXBA+BAR4FGAMQgQEeBSuBAR0GK4EBHQYrgQEdBiuB - AR0GK4EBHQYrgQEdBiuBAR0GK4EBHQYrgQEdBiuBAR4FK4EBHgYqgQEeBiqBAR4HKYEBHwYpgQEfByiB - ASAHJ4EBIAcngQEhByaBASEJJIEBIgkjgQEjCiGBASQLH4EBJQwdgQEmDxmBASgTE4EBKhMRgQErEhGB - AS4PEYEBMAwSgQE0CBKBAU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6B0A==', - '0AFOgQFOgQFOgQFOgQFOgQFOgQFOgQFOgQEXATaBARQENoEBEgY2gQESBzWBARMGNYEBEwc0gQEUBjSB - ARQGNIEBFQYzgQEVBiABEoEBFgYeAxGBARYGHAYQgQEWBxoHEIEBFwYYCg+BARcHFQsQgQEYBhMLEoEB - GAYRCxSBARkGDgsWgQEZBgwLGIEBGgYJCxqBARoHBwocgQEbBgUKHoEBGwcCCiCBARwRIYEBHA8jgQEd - DCWBAR0KJ4EBHAoogQEbCSqBARoILIEBGQgtgQEXCC+BARYIMIEBFQgxgQEVBzKBARQHM4EBEwc0gQES - BzWBARIGNoEBEQY3gQERBjeBAREFOIEBEAY4gQEQBjiBARAGOIEBEAY4gQEQBjiBARAGOIEBEAY4gQEQ - BjiBARAHN4EBEAc3gQERBzaBAREINYEBEgkzgQETCiEDDYEBEw0WCw2BARQtDYEBFisNgQEXKg2BARon - DYEBHSARgQEjDxyBAU6BAU6BAU6BAU6BAU6BAU6BAU6B0A==', - '0AFOgQFOgQFOgQFOgQFOgQFOgQFOgQEXBDOBARcLLIEBFxQjgQEXIRaBARchFoEBGh4WgQEiFhaBASsN - FoEBNgEXgQFOgQFOgQFOgQFOgQFOgQFOgQFOgQFOgQFOgQEkDR2BAR4WGoEBGR0YgQEVIxaBARApFYEB - DRcLCxSBAQ4QFAkTgQEODBoIEoEBDgkeBxKBAQ4GIgcRgQEPAiYGEYEBNwcQgQE4BhCBATgGEIEBOAYQ - gQE4BhCBATkFEIEBOQUQgQE5BRCBATgGEIEBOAYQgQE4BhCBATgGEIEBNwcQgQE3BhGBATcGEYEBNgcR - gQE1BxKBATUHEoEBNAcTgQEzCBOBATIIFIEBMQgVgQEvCRaBAS4JF4EBLAoYgQEqCxmBAScMG4EBJQ0c - gQEhDx6BARwTH4EBGBQigQEZESSBARoNJ4EBGgoqgQEbBS6BAU6BAU6BAU6BAU6BAU6BAU6BAU6B0A==', - '0AFOgQFOgQFOgQFOgQFOgQFDAgmBAUEECYEBQgQIgQE7AQYFB4EBOQQGBAeBATkEBwQGgQE5BQYFBYEB - OgQHBAWBATsEBgUEgQE7BQYEBIEBPAQGBASBATwFBgEGgQEQBhsIBAQNgQEQKQQFDIEBECkFAQ+BARAp - FYEBECkVgQEQKRWBAU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6B - AU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6BAU6BAQ0EPYEBDAY8gQEMBjyBAQwGPIEBDAU9gQEMBT2BAQsG - PYEBCwY9gQELBj2BAQsGPYEBCwY9gQELBj2BAQsHPIEBCwc8gQEMBzuBAQwIOoEBDQg5gQENCiUCEIEB - DgwdBxCBAQ8QDhEQgQEQLhCBAREtEIEBEysQgQEWJROBARobGYEBToEBToEBToEBToEBToHQ', - '0AFOgQFOgQFOgQFOgQFCAwmBAUEECYEBQQUIgQE5AwYFB4EBOAQHBAeBASkCDgQGBQaBASYGDQUGBAaB - ASYGDgQHBAWBASYGDgUGBAWBAScFDwQHBASBAScGDwQGAwWBAScGDwUNgQEoBRAEDYEBKAUQAw6BASgG - IIEBKQUQAw2BASkFDAcNgQEpBgYMDYEBCgMdFw2BAQsVAh8NgQELNQ6BAQsxEoEBCysYgQELJh2BARkI - CwUdgQEsBhyBAS0FHIEBLQUcgQEuBRuBAS4FG4EBLwUagQEvBRqBATAFGYEBMAYYgQExBRiBATEGF4EB - MgUXgQEyBhaBATMGFYEBNAUVgQE0BhSBATUGE4EBEAIWCgMHEoEBEAYSFRGBAQ8GExURgQEPBRQUEoEB - DgYaDROBAQ4GIwQTgQEOBTuBAQ0GO4EBDQY7gQENBTyBAQ0FPIEBDQU8gQENBTyBAQ0FPIEBDQU8gQEN - BjuBAQ0GO4EBDgY6gQEOBzmBAQ4IOIEBDwg3gQEQCh4BFYEBEQwVBxWBARInFYEBEyYVgQEVJBWBARgh - FYEBGxoZgQFOgQFOgQFOgQFOgdA=', - '0AFOgQFOgQFOgQFOgQFOgQFOgQFOgQFOgQFOgQFOgQFOgQFOgQEJBz6BAQkGP4EBCQY/gQEJBigDFIEB - CQYlBhSBAQkGJQcTgQEJBiYHEoEBCQYnBhKBAQkGJwcRgQEJBigGEYEBCQYoBxCBAQkGKQYQgQEJBioG - D4EBCQYqBg+BAQkGKgcOgQEJBisGDoEBCgUrBg6BAQoFLAYNgQEKBSwGDYEBCgUtBgyBAQoFLQYMgQEK - BS0GDIEBCgUuBguBAQoFLgYLgQEKBS4GC4EBCgYtBguBAQoGLgYKgQEKBi4GCoEBCgYuBgqBAQoGLwYJ - gQELBS8GCYEBCwUvBgmBAQsFLwYJgQELBhMBGgYJgQELBhMCGgYIgQELBhMDGQYIgQEMBRMEGAYIgQEM - BhEGFwYIgQEMBhEGFwYIgQEMBhAGGQUIgQENBg8GGQUIgQENBg8GGQUIgQENBg4GGgILgQEOBg0GJ4EB - DgcLBiiBAQ4HCgcogQEPBwgHKYEBEAcGCCmBARAKAQkqgQEREiuBARIRK4EBEhAsgQETDi2BARULLoEB - FwcwgQFOgQFOgQFOgQFOgQFOgQFOgQFOgQFOgQFOgQFOgQFOgdA=', - '0AFOgQFOgQFOgQFOgQFOgQFOgQFOgQElBiOBASYFI4EBJgUjgQEmBSOBASYFI4EBJgUjgQEmBSOBASYF - I4EBJgUQBQ6BAQ4IEAUGDw6BAQ4yDoEBDjIOgQEOMg6BAQ4rFYEBGhIigQEmBSOBASYFI4EBJgUjgQEm - BSOBASYFI4EBJgUjgQEmBSOBASYFI4EBJgUjgQEmBRQCDYEBDQMWBQwKDYEBDQ8JHA2BAQ4zDYEBDjMN - gQEOMg6BARAnF4EBJQYjgQEmBSOBASYFI4EBJgUjgQEmBSOBASYFI4EBJgUjgQEmBSOBASYFI4EBJgUj - gQEmBSOBAR0EBQUjgQEXFCOBARQZIYEBEh4egQERIRyBARAJDBAZgQEPBxARF4EBDgYSExWBAQ4FEwYD - CxSBAQ4FEwYFCxKBAQ0FFAYHChGBAQ0FFAYJCg+BAQ0FFAYKCg6BAQ0GEwYMCQ2BAQ4FEwYNCQyBAQ4G - EQYQBg2BAQ4HDwcRBQ2BAQ8IDAgSAw6BAQ8bFAEPgQERGCWBARIWJoEBFBIogQEXDSqBAU6BAU6BAU6B - AU6BAU6BAU6B0A==', - '0AFOgQFOgQFOgQFOgQFOgQFOgQEpBh+BASkGH4EBKQYfgQEqBR+BASoFH4EBKgUfgQEqBR+BASoFH4EB - KgUfgQEqBR+BARkuB4EBBkEHgQEHQAeBAQdAB4EBB0AHgQEHDBcFH4EBKgUfgQEqBR+BASoFH4EBKgUf - gQEqBR+BASoFH4EBKgUfgQEgDx+BAR4RH4EBHBMfgQEbFB+BARoIBAkfgQEZBwkGH4EBGQYLBh6BARgG - DQUegQEYBQ4GHYEBFwYPBR2BARcFEAUdgQEXBRAFHYEBFwUQBhyBARcFEAYcgQEXBQ8HHIEBFwUPBxyB - ARcGDgccgQEXBg0IHIEBGAYMBx2BARgHCggdgQEZCAYKHYEBGhcdgQEbFh2BARwVHYEBHgsBBh6BASAG - BAYegQEpBh+BASkGH4EBKAYggQEnByCBASYHIYEBJQcigQEkCCKBASIJI4EBIAokgQEeCyWBARwLJ4EB - GQ0ogQEWDiqBARcMK4EBGAktgQEZBTCBARoCMoEBToEBToEBToEBToEBToEBToHQ',]; - $m="";for($k=0;$k<min(13,intdiv(__LINE__-119,80)+1);$k++){$C=str_replace("\n","", - $c[$k]);$f=!0;foreach(str_split(base64_decode($C))as$l){$L=ord($l);$m.=str_repeat - ($f?"#":chr(32),$L&127);$f=!$f;if($L&128){$m.="\n";$f=!0;continue;}}}print( - str_replace([chr(96),chr(37),chr(64)],[implode("\n",array_map(fn($C)=>"'".trim( - chunk_split(str_replace("\n","",$C),80,"\n"))."',",$c)),"\n{$m}","{$s}\nQ;\n"],$s)); - ]]> - </codeblock> - </section> -</article> diff --git a/vhosts/blog/content/posts/2024-12-33/2024-reflections.dj b/vhosts/blog/content/posts/2024-12-33/2024-reflections.dj new file mode 100644 index 00000000..88b6c9b9 --- /dev/null +++ b/vhosts/blog/content/posts/2024-12-33/2024-reflections.dj @@ -0,0 +1,84 @@ +--- +[article] +uuid = "d7f98354-83fc-4cf1-8769-2784f0ebb6c8" +title = "2024å¹Žã®æ¯ãè¿ã" +description = "2024幎ã«ãã£ãããšãæ¯ãè¿ã" +tags = [ +] + +[[article.revisions]] +date = "2025-01-02" +remark = "å
¬é" +--- +{#intro} +# ã¯ããã« + +ãåãã®ãšããã4 ãš 11 ãš 23 ã§å²ãåãã幎ã¯é幎ãšãããã€ã§ 12 æã 33 æ¥ãŸã§ããã +1å¹Žã®æ¯ãè¿ããæžãç¶äºã平幎ãããé·ããªãã®ã§å€§å€ã«éœåãããã + +å»å¹Žã®ãã€: [/posts/2023-12-31/2023-reflections/](/posts/2023-12-31/2023-reflections/) + +{#conference} +# ç»å£ã»ã«ã³ãã¡ã¬ã³ã¹åå + +åå ãŸãã¯ç»å£ããå匷äŒãã«ã³ãã¡ã¬ã³ã¹ã +LT çãå«ããŠèš 8 åã®ç»å£ããããªã£ãã +ãŸãã4ã€ã®ã«ã³ãã¡ã¬ã³ã¹ã§ã³ã¢ã¹ã¿ãããŸãã¯åœæ¥ã¹ã¿ãããšããŠåå ããã + +* PHP ã«ã³ãã¡ã¬ã³ã¹åæµ·é 2024 ãªã³ã©ã€ã³ã§åå +* [PHP å匷äŒ@æ±äº¬ 第 160 å ç»å£](/slides/2024-01-24/phpstudy-tokyo-160/) +* [YAPC::Hiroshima 2024 åå ](/posts/2024-02-10/yapcjapan-2024-report/) +* [PHPã«ã³ãã¡ã¬ã³ã¹é¢è¥¿ 2024 åå ](/posts/2024-02-22/phpkansai-2024-report/) +* PHPerKaigi 2024 + + * [ç»å£](/slides/2024-03-08/phperkaigi-2024/) + * ã³ã¢ã¹ã¿ãããšããŠåå + +* [Ya8 2024 ç»å£](/slides/2024-03-15/ya8-2024/) +* PHP ã«ã³ãã¡ã¬ã³ã¹å°ç°å 2024 + + * [ç»å£](/slides/2024-04-13/phpcon-odawara-2024/) + * åœæ¥ã¹ã¿ãããšããŠåå + +* [PHP å匷äŒ@æ±äº¬ 第 163 å LT ã§ç»å£](/slides/2024-04-25/phpstudy-tokyo-163/) +* [PHP ã«ã³ãã¡ã¬ã³ã¹éŠå· 2024 åå ](/posts/2024-05-11/phpconkagawa-2024-report/) +* [ScalaMatsuri 2024 åå ](/posts/2024-06-19/scalamatsuri-2024-report/) +* [PHP å匷äŒ@æ±äº¬ 第 166 å ç»å£](/slides/2024-07-18/phpstudy-tokyo-166/) +* iOSDC Japan 2024 ã³ã¢ã¹ã¿ãããšããŠåå +* Nix meetup #1 åå +* [PHP å匷äŒ@æ±äº¬ 第 169 å ç»å£](/slides/2024-10-30/phpstudy-tokyo-169/) +* [çŽ
çœãºã±åæŠ LT ã§ç»å£](/slides/2024-11-30/cohackpp/) +* PHP ã«ã³ãã¡ã¬ã³ã¹ 2024 åœæ¥ã¹ã¿ãããšããŠåå + +{#articles} +# æžããèšäº + +ä»å¹Žã¯ãã®ããã°ã«æ1èšäºä»¥äžã®èšäºãæžããšããç®æšãç«ãŠãŠãããæ¬æ°ãšããŠã¯ 12 æ¬ä»¥äžãããã10æãš11æã¯ãŒãã«ãªã£ãŠããŸã£ãã +瀟å
èšäºã瀟å€åãã«ãªã©ã€ãããäœæ¥ãäžã
é²ããããŠããªãã®ã§ã2025幎ã¯å®æçã«æ¶åããŠããããã + +* 瀟å€èšäº (ãã®ããã°): 15æ¬ +* 瀟å
èšäº: 22æ¬ + + * 幎éã§æãèšäºãæžãã人ãšããŠç€Ÿå
衚地ããã + +{#coding} +# äœã£ããã® + +ä»å¹Žã¯äž»ã« WebAssembly ã©ã³ã¿ã€ã ãšãã«ã³ãã¡ã¬ã³ã¹ã®äŒç»ã§äœ¿ãã·ã¹ãã ãäœã£ãŠããã +åŸè
ã®ã·ã¹ãã ã§ããµã³ãããã¯ã¹åã®ããã®æè¡ãšã㊠WebAssembly ãçšããŠããã®ã§ãä»å¹Žã¯ WebAssembly ãšæ¯ããäžå¹Žã ã£ããšèšããã + +* [Waddiwasi: pure PHP ã§æžããã WebAssembly ã©ã³ã¿ã€ã ](https://github.com/nsfisis/php-waddiwasi) +* [Albatross.PHP: PHPerKaigi 2024 ã®ã³ãŒããŽã«ãäŒç»ã§äœ¿ãããã·ã¹ãã ](https://github.com/nsfisis/phperkaigi-2024-albatross) +* [Albatross.swift: iOSDC Japan 2024 ã®ã³ãŒãããã«äŒç»ã§äœ¿ãããã·ã¹ãã ](https://github.com/nsfisis/iosdc-japan-2024-albatross) +* [ReparoJSON: ææ³ãšã©ãŒãçŽãã ãã® JSON ãã©ãŒããã¿](/posts/2024-07-19/reparojson-fix-only-json-formatter/) + +{#misc} +# ãã®ä» + +* [MN-Core Challenge #1 ã«åå ](/posts/2024-09-28/mncore-challenge-1/) +* ISUCON 14 ã«åå + +{#outro} +# ãããã« + +ä»å¹Žã倧å€ãäžè©±ã«ãªããŸãããããã幎ãïŒ diff --git a/vhosts/blog/content/posts/2024-12-33/2024-reflections.ndoc b/vhosts/blog/content/posts/2024-12-33/2024-reflections.ndoc deleted file mode 100644 index f28c005b..00000000 --- a/vhosts/blog/content/posts/2024-12-33/2024-reflections.ndoc +++ /dev/null @@ -1,101 +0,0 @@ ---- -[article] -uuid = "d7f98354-83fc-4cf1-8769-2784f0ebb6c8" -title = "2024å¹Žã®æ¯ãè¿ã" -description = "2024幎ã«ãã£ãããšãæ¯ãè¿ã" -tags = [ -] - -[[article.revisions]] -date = "2025-01-02" -remark = "å
¬é" ---- -<article> - <section id="intro"> - <h>ã¯ããã«</h> - <p> - ãåãã®ãšããã4 ãš 11 ãš 23 ã§å²ãåãã幎ã¯é幎ãšãããã€ã§ 12 æã 33 æ¥ãŸã§ããã - 1å¹Žã®æ¯ãè¿ããæžãç¶äºã平幎ãããé·ããªãã®ã§å€§å€ã«éœåãããã - </p> - <p> - å»å¹Žã®ãã€: <a href="/posts/2023-12-31/2023-reflections/">/posts/2023-12-31/2023-reflections/</a> - </p> - </section> - <section id="conference"> - <h>ç»å£ã»ã«ã³ãã¡ã¬ã³ã¹åå </h> - <p> - åå ãŸãã¯ç»å£ããå匷äŒãã«ã³ãã¡ã¬ã³ã¹ã - LT çãå«ããŠèš 8 åã®ç»å£ããããªã£ãã - ãŸãã4ã€ã®ã«ã³ãã¡ã¬ã³ã¹ã§ã³ã¢ã¹ã¿ãããŸãã¯åœæ¥ã¹ã¿ãããšããŠåå ããã - </p> - <ul> - <li>PHP ã«ã³ãã¡ã¬ã³ã¹åæµ·é 2024 ãªã³ã©ã€ã³ã§åå </li> - <li><a href="/slides/2024-01-24/phpstudy-tokyo-160/">PHP å匷äŒ@æ±äº¬ 第 160 å ç»å£</a></li> - <li><a href="/posts/2024-02-10/yapcjapan-2024-report/">YAPC::Hiroshima 2024 åå </a></li> - <li><a href="/posts/2024-02-22/phpkansai-2024-report/">PHPã«ã³ãã¡ã¬ã³ã¹é¢è¥¿ 2024 åå </a></li> - <li>PHPerKaigi 2024 - <ul> - <li><a href="/slides/2024-03-08/phperkaigi-2024/">ç»å£</a></li> - <li>ã³ã¢ã¹ã¿ãããšããŠåå </li> - </ul> - </li> - <li><a href="/slides/2024-03-15/ya8-2024/">Ya8 2024 ç»å£</a></li> - <li>PHP ã«ã³ãã¡ã¬ã³ã¹å°ç°å 2024 - <ul> - <li><a href="/slides/2024-04-13/phpcon-odawara-2024/">ç»å£</a></li> - <li>åœæ¥ã¹ã¿ãããšããŠåå </li> - </ul> - </li> - <li><a href="/slides/2024-04-25/phpstudy-tokyo-163/">PHP å匷äŒ@æ±äº¬ 第 163 å LT ã§ç»å£</a></li> - <li><a href="/posts/2024-05-11/phpconkagawa-2024-report/">PHP ã«ã³ãã¡ã¬ã³ã¹éŠå· 2024 åå </a></li> - <li><a href="/posts/2024-06-19/scalamatsuri-2024-report/">ScalaMatsuri 2024 åå </a></li> - <li><a href="/slides/2024-07-18/phpstudy-tokyo-166/">PHP å匷äŒ@æ±äº¬ 第 166 å ç»å£</a></li> - <li>iOSDC Japan 2024 ã³ã¢ã¹ã¿ãããšããŠåå </li> - <li>Nix meetup #1 åå </li> - <li><a href="/slides/2024-10-30/phpstudy-tokyo-169/">PHP å匷äŒ@æ±äº¬ 第 169 å ç»å£</a></li> - <li><a href="/slides/2024-11-30/cohackpp/">çŽ
çœãºã±åæŠ LT ã§ç»å£</a></li> - <li>PHP ã«ã³ãã¡ã¬ã³ã¹ 2024 åœæ¥ã¹ã¿ãããšããŠåå </li> - </ul> - </section> - <section id="articles"> - <h>æžããèšäº</h> - <p> - ä»å¹Žã¯ãã®ããã°ã«æ1èšäºä»¥äžã®èšäºãæžããšããç®æšãç«ãŠãŠãããæ¬æ°ãšããŠã¯ 12 æ¬ä»¥äžãããã10æãš11æã¯ãŒãã«ãªã£ãŠããŸã£ãã - 瀟å
èšäºã瀟å€åãã«ãªã©ã€ãããäœæ¥ãäžã
é²ããããŠããªãã®ã§ã2025幎ã¯å®æçã«æ¶åããŠããããã - </p> - <ul> - <li>瀟å€èšäº (ãã®ããã°): 15æ¬</li> - <li>瀟å
èšäº: 22æ¬ - <ul> - <li>幎éã§æãèšäºãæžãã人ãšããŠç€Ÿå
衚地ããã</li> - </ul> - </li> - </ul> - </section> - <section id="coding"> - <h>äœã£ããã®</h> - <p> - ä»å¹Žã¯äž»ã« WebAssembly ã©ã³ã¿ã€ã ãšãã«ã³ãã¡ã¬ã³ã¹ã®äŒç»ã§äœ¿ãã·ã¹ãã ãäœã£ãŠããã - åŸè
ã®ã·ã¹ãã ã§ããµã³ãããã¯ã¹åã®ããã®æè¡ãšã㊠WebAssembly ãçšããŠããã®ã§ãä»å¹Žã¯ WebAssembly ãšæ¯ããäžå¹Žã ã£ããšèšããã - </p> - <ul> - <li><a href="https://github.com/nsfisis/php-waddiwasi">Waddiwasi: pure PHP ã§æžããã WebAssembly ã©ã³ã¿ã€ã </a></li> - <li><a href="https://github.com/nsfisis/phperkaigi-2024-albatross">Albatross.PHP: PHPerKaigi 2024 ã®ã³ãŒããŽã«ãäŒç»ã§äœ¿ãããã·ã¹ãã </a></li> - <li><a href="https://github.com/nsfisis/iosdc-japan-2024-albatross">Albatross.swift: iOSDC Japan 2024 ã®ã³ãŒãããã«äŒç»ã§äœ¿ãããã·ã¹ãã </a></li> - <li><a href="/posts/2024-07-19/reparojson-fix-only-json-formatter/">ReparoJSON: ææ³ãšã©ãŒãçŽãã ãã® JSON ãã©ãŒããã¿</a></li> - </ul> - </section> - <section id="misc"> - <h>ãã®ä»</h> - <ul> - <li><a href="/posts/2024-09-28/mncore-challenge-1/">MN-Core Challenge #1 ã«åå </a></li> - <li>ISUCON 14 ã«åå </li> - </ul> - </section> - <section id="outro"> - <h>ãããã«</h> - <p> - ä»å¹Žã倧å€ãäžè©±ã«ãªããŸãããããã幎ãïŒ - </p> - </section> -</article> diff --git a/vhosts/blog/content/posts/2025-01-08/phperkaigi-2023-tokens-q1.dj b/vhosts/blog/content/posts/2025-01-08/phperkaigi-2023-tokens-q1.dj new file mode 100644 index 00000000..c3a5eb49 --- /dev/null +++ b/vhosts/blog/content/posts/2025-01-08/phperkaigi-2023-tokens-q1.dj @@ -0,0 +1,350 @@ +--- +[article] +uuid = "ce8f20e8-c79f-48f8-982d-53edd4d20483" +title = "PHPerKaigi 2023 ããŒã¯ã³åé¡è§£èª¬ (1/5)" +description = "PHPerKaigi 2023 ã§ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿããåºé¡ããåé¡ã解説ãããå
š5åäžã®ç¬¬1åã" +tags = [ + "conference", + "php", + "phperkaigi", + "piet", +] + +[[article.revisions]] +date = "2025-01-08" +remark = "å
¬é" + +[[article.revisions]] +date = "2025-01-11" +remark = "èªã¿ãããã®ããäžéšã®æèšã調æŽ" +--- +{#intro} +# ã¯ããã« + +::: note +ãã㯠PHPerKaigi 2023 ã®èšäºã§ããä»ã¯ 2025 幎ã§ãããPHPerKaigi 2023 ã®èšäºã§ãã +::: + +2023-03-23 ãã 2023-03-25 ã«ãããŠéå¬ããã [PHPerKaigi 2023](https://phperkaigi.jp/2023/) ã§ã¯ãPHPer ãã£ã¬ã³ãžãšããäŒç»ããããªãããã +PHPer ãã£ã¬ã³ãžãšã¯ãã¹ãã³ãµãŒã®ãã³ãã¬ãããã«ã³ãã¡ã¬ã³ã¹äŒå Žãªã©ããã#ãèšå·ã§å§ãŸãæååãéããæ¯åãªã©ãåŸããšããäŒç»ã§ããã +ãã®æååã¯ãPHPer ããŒã¯ã³ããšåŒã°ããŠãããåŒç€Ÿ [ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ](https://www.dgcircus.com/) ããã¯ãããŒã¯ã³åé¡ãšãã圢ã§ãPHP ã«é¢ããåé¡ãè§£ããš PHPer ããŒã¯ã³ãåŸãããããã«ãªã£ãŠããåé¡ãåºé¡ããã + +[PHPerKaigi 2023 ã®åå ã¬ã](/posts/2023-04-04/phperkaigi-2023-report/) ã§ãæžãããšããããã®å¹Žã®ããŒã¯ã³åé¡ã¯ãæšå¹Žã® PHPerKaigi 2022 ãçµãã£ã段éããäœãå§ããçŽå幎ãããŠå¶äœããããã +PHPerKaigi åœæ¥ã [PHPer ãã£ã¬ã³ãžè§£èª¬ã»ãã·ã§ã³](/slides/2023-03-25/phperkaigi-2023-tokens/) ãšãã圢ã§è§£èª¬ã®æ©äŒãé ããã®ã ãããã£ããæéããããŠäœé¡ããã®ã§èšäºã®åœ¢ã§ãæ®ããŠããããšæãã + +ãã®èšäºã§ã¯ãå
š5åããäžã®ç¬¬1åã«ã€ããŠè§£èª¬ãããä»ã®åé¡ã«ã€ããŠã¯ä»¥äžã®ãªã³ã¯ãåç
§ã®ããšã + +1. [第1å (ãã®èšäº)](/posts/2025-01-08/phperkaigi-2023-tokens-q1/) +1. 第2å (TODO: å·çäž) +1. 第3å (TODO: å·çäž) +1. 第4å (TODO: å·çäž) +1. 第5å (TODO: å·çäž) + +ããããã®åé¡ã¯ãã¡ãã® GitHub ãªããžã㪠( [nsfisis/PHPerKaigi2023-tokens](https://github.com/nsfisis/PHPerKaigi2023-tokens) ) ãããé²èЧã§ããã + +{#quiz} +# Q1: An Art of Computer Programming + +第1åãAn Art of Computer Programmingãã¯ãã¡ãã + + + +{#how-to-solve} +# è§£ãæ¹ + +ãŸãã¯ããŒã¯ã³ãåŸãæ¹æ³ã解説æãã§èª¬æãããæ¬¡ã®ããã«å®è¡ããã + +``` +$ echo "#iwillblog" | php Q1.png >/dev/null +``` + +ç¡äºã«å®è¡ã§ããŠããã°ã#ModernPHPisStaticallyTypedLanguageããšããããŒã¯ã³ãåŸãããã + +{#commentary} +# 解説 + +{#read-as-image} +## ç»åãšããŠè§£éãã + +ãŸãã¯çŽ çŽã«ç»åãšããŠèŠãŠã¿ããã +å
šäœã¯ QR ã³ãŒãã«ãªã£ãŠãããé©åœãª QR ã³ãŒããªãŒãã§èªã¿èŸŒããšã次ã®ãããªããã¹ãã衚瀺ãããã¯ãã ã + +``` +Guess password. $ echo "password" | php Q1.png >/dev/null +``` + +ã¡ãã»ãŒãžã¯ããã®ç»åã®å®è¡æ¹æ³ãšãã®åé¡ã§ããã¹ãããš (ãã¹ã¯ãŒãã®æšæž¬) ã瀺ããŠããã + +次㫠QR ã³ãŒãã®äžå€®éšã«ç®ãåãããšãå°ããªæåã§ãPassword is one of the PHPer tokens.ããšæžãããŠããã®ããããã +ä»ã® PHPer ããŒã¯ã³ã®äžããé©åãª1ã€ãèŠã€ãã ããããã¹ã¯ãŒãããšããŠæž¡ãããšã§çããšãªã PHPer ããŒã¯ã³ãåŸããããšããããã ã + +{#password} +## ãã¹ã¯ãŒã + +äžæ£ãªãã¹ã¯ãŒãã䜿ã£ãŠå®è¡ããŠã¿ããšã次ã®ãããªãšã©ãŒã¡ãã»ãŒãžã衚瀺ãããã + +``` +$ echo "foo" | php Q1.png >/dev/null +401 Unauthorized +``` + +ãã§ã« [ãè§£ãæ¹ãã®ç¯](#section--how-to-solve) ã§ç€ºããããã«ããã¹ã¯ãŒãã§ãã PHPer ããŒã¯ã³ã¯ã#iwillblogãã§ããããããäžããŠå®è¡ãããšæ£è§£ã®ããŒã¯ã³ãåŸãããã + +ãã®ãã¹ã¯ãŒãã®éžæã«ã¯ãšããäºæ
ãããã +ä»åã®åé¡ã®äœåã¯ååã®éå¬ (PHPerKaigi 2022) çŽåŸããã¹ã¿ãŒãããŠããããã®æç¹ã§ã¯ PHPerKaigi 2023 ã§ç»é²ããã PHPer ããŒã¯ã³ã«ã©ã®ãããªãã®ããããã¯ãŸã£ããããããªãç¶æ
ã§ãã£ãã +äœåäœæ¥ãæ©æã«çµããããã«ã¯ã次åéå¬ã§ã確å®ã«äœ¿ãããã§ãããå®çªã®ããŒã¯ã³ãäºæž¬ããŠéžã¶å¿
èŠããã£ãã®ã ã +ããããŠãç§ãç¥ãéãæ¯åç»å ŽããŠããããŒã¯ã³ã§ããã#iwillblogãã«çœçŸœã®ç¢ãç«ãŠãããã + +ãªããè§£ããŠãã ãã£ãæ¹ã®äžã«ã¯ãå
é ã®ã#ããå
¥åããã«äœåºŠã詊ããŠããŸãçããåŸãããããŸãã«ãªã£ãæ¹ãããã£ãããããã ã£ãã +åé¡ã眮ããŠãããªããžããªã«ãã³ããšããŠãã¹ã¯ãŒãã®ããŒã¯ã³ããiãã§å§ãŸããšæžããŠããã®ã ãããããæå³ãããã¹ãªãŒãã«ãªã£ãŠããŸã£ãã +ããã¯ç§ã®ãã¹ã§ããã + +{#png-steganography} +## PNG ã¹ãã¬ãã°ã©ã㣠+ +QR ã³ãŒããèšã£ãŠããããã«ããã®ãã¡ã€ã«ã¯ PNG ç»åã§ããã«ãããããã PHP ã§å®è¡ããããšãã§ããããªããã®ãããªããšãå¯èœãªã®ãã + +PNG ç»åã®ãã©ãŒãããã¯ã次ã®ããã«ãªã£ãŠããã + +1. ããžãã¯ãã³ããŒãªã© +1. PNG ããã (`IHDR` ãã£ã³ã¯) +1. å®éã®ç»åããŒã¿ (`IDAT` ãã£ã³ã¯) +1. PNG ããã¿ (`IEND` ãã£ã³ã¯) + +PNG ããã¿ã®åŸãã«ããããŒã¿ã¯ãç»åãã¥ãŒã¢ã«ã¯è§£éããããç»åã®è¡šç€ºã«ã¯åœ±é¿ãäžããªãããããã£ãŠãPNG ããã¿ã®åŸãã«ã¯ä»»æã®ããŒã¿ãåã蟌ãããšãã§ããã + +ããŠãPHP ã«ã¯ãPHP ããã°ã©ã ã®å§ãŸãã瀺ãããã® PHP ã¿ã° (`<?php` ãŸã㯠`<?`) ãããã +CLI ã§å®è¡ããå ŽåãPHP ã¿ã°ãããåã«ããããŒã¿ã¯æšæºåºåãžãã®ãŸãŸåºåãããã + +ãã®ç»åãã¡ã€ã«ã¯æ¬¡ã®ãããªæ§é ã«ãªã£ãŠããã + +1. ããžãã¯ãã³ããŒãªã© +1. PNG ããã (`IHDR` ãã£ã³ã¯) +1. å®éã®ç»åããŒã¿ (`IDAT` ãã£ã³ã¯) +1. PNG ããã¿ (`IEND` ãã£ã³ã¯) +1. *PHP ã¿ã° (`<?php`)* +1. *éåžžã® PHP ãœãŒã¹ã³ãŒã* + +PNG ãã¡ã€ã«ãšããŠèªããšã㯠PNG ããã¿ä»¥éã¯ç¡èŠãããPHP ã¹ã¯ãªãããšããŠèªããšã㯠PHP ã¿ã°ä»¥åãç¡èŠããããšãã仿ãã§ããã + +`strings` ã³ãã³ãã䜿ããšãé ãããããŒã¿ãç°¡åã«é²èЧã§ããã + +``` +IHDR +-HHc +<PLTE +IDATx +IEND +<?php +error_reporting(-1); +$b = unpack('C*', file_get_contents(__FILE__)); +$w = $b[20]+2; +$h = $b[24]+2; +// (以äžç¥) +``` + +`IHDR` ã `IEND` ã PNG ç»åã®äžéšã§ã`<?php` ãããå®éã®ããã°ã©ã ã«ãªã£ãŠããã +ãã¡ããããã PHP ããã°ã©ã ãšããŠåãããšãPHP ã¿ã°ããåã«ãã PNG ç»åãšããŠã®ããŒã¿ã¯ãã®ãŸãŸæšæºåºåãžãšåºåãããŠããŸãã +ãããé²ããããQR ã³ãŒããèªã¿èŸŒãã ãšãã®å®è¡æ¹æ³ + +``` +Guess password. $ echo "password" | php Q1.png >/dev/null +``` + +ã«ã¯æšæºåºåãæšãŠããã `>/dev/null` ãšæå®ãããŠããã + +ãªãããã®ããã« PNG ç»åãªã©ã«æ¬æ¥ã®ããŒã¿ãšã¯ç°ãªãå¥ã®ããŒã¿ãé ãããšããã¹ãã¬ãã°ã©ãã£ã( [Wikipediaãã¹ãã¬ãã°ã©ãã£ãŒã](https://ja.wikipedia.org/wiki/%E3%82%B9%E3%83%86%E3%82%AC%E3%83%8E%E3%82%B0%E3%83%A9%E3%83%95%E3%82%A3%E3%83%BC) ) ãšåŒã¶ã + +{#php-program} +## å®è¡ããã PHP ããã°ã©ã + +ç»åã®æ£äœãããã£ããšããã§ãç»åã«é ãããŠãã PHP ããã°ã©ã ã«ã€ããŠèŠãŠãããã +å
ã»ã©ã¯äžéšããèšèŒããªãã£ãã®ã§ãå
šäœãèŒããã +ãªããããçšåºŠãŽã«ãããªããæžããã®ã§ã空çœããæ®ããŠãããã®ã®å¯èªæ§ã¯éåžžã«äœãããšãšæãã + +```php +<?php +error_reporting(-1); +$b = unpack('C*', file_get_contents(__FILE__)); +$w = $b[20]+2; +$h = $b[24]+2; +$cs = []; +for ($y = 0; $y < $h; $y++) + for ($x = 0; $x < $w; $x++) + $cs[$y*$w + $x] = ($x*$y === 0 || $x === $w-1 || $y === $h-1) + ? 0 + : $b[122+($y-1)*($w-1)+$x-1]; +$i = stream_isatty(STDIN) + ? [] + : array_map(ord(...), str_split(trim((string) fgets(STDIN)))); +$m = []; +$pc = 1*$w+1; +$dp = 0; +$cc = 1; +$c0 = 1; +$b = 0; +$ns = 0; +$o = ''; +while (true) { + $ns++; + if ($ns > 1e5) { + echo "infinite loop detected\n"; + break; + $c1 = $cs[$pc]; + $y = (6 + intdiv($c1-2, 3) - intdiv($c0-2, 3)) % 6; + $x = (3 + $c1%3 - $c0%3) % 3; + match (($c0 !== 1) * ($c1 !== 1) * ($y*3 + $x)) { + 1 => $m[] = $b, + 2 => array_pop($m), + 3 => $m[] = array_pop($m) + array_pop($m), + 4 => $m[] = (fn($x, $y) => $y - $x)(array_pop($m), array_pop($m)), + 5 => $m[] = array_pop($m) * array_pop($m), + 8 => $m[] = array_pop($m) === 0 ? 1 : 0, + 11 => $cc *= pow(-1, array_pop($m)), + 12 => $m[] = $m[count($m)-1], + 13 => $m = (fn($n, $d, $m, $l) => [ + ...array_slice($m, 0, $l-$d), + ...array_reverse([ + ...array_reverse(array_slice($m, $l-$d, $d-$n)), + ...array_reverse(array_slice($m, $l-$n)), + ]), + ])(array_pop($m), array_pop($m), $m, count($m)), + 15 => !empty($i) and $m[] = array_shift($i), + 16 => $o .= sprintf('%d', array_pop($m)), + 17 => $o .= sprintf('%c', array_pop($m)), + default => 'nop', + }; + $c0 = $c1; + for ($j = 0; $j < 8; $j++) { + $v = []; + if ($c1 === 1) { + $x = $pc % $w; + $y = intdiv($pc, $w); + $e = [($y+1)*$w-1, ($h-1)*$w+$x, $y*$w, $x][$dp]; + $z = [1, $w, -1, -$w][$dp]; + for ($ep = $pc; $ep !== $e; $ep += $z) + if ($cs[$ep] !== 1) break; + $ep -= $z; + $pc = $ep; + } else { + $q = [$pc]; + $ep = $pc; + while (!empty($q)) { + $qq = array_pop($q); + $v[$qq] = true; + foreach ([$qq+1, $qq+$w, $qq-1, $qq-$w] as $qp) { + if ($cs[$qp] !== $c1) continue; + if (isset($v[$qp])) continue; + $q[] = $qp; + $qx = $qp % $w; + $qy = intdiv($qp, $w); + $x = $ep % $w; + $y = intdiv($ep, $w); + if ( + ($dp === 0 && ($x < $qx || ($x === $qx && ($y<=>$qy) === $cc))) + || ($dp === 1 && ($y < $qy || ($y === $qy && ($qx<=>$x) === $cc))) + || ($dp === 2 && ($qx < $x || ($qx === $x && ($qy<=>$y) === $cc))) + || ($dp === 3 && ($qy < $y || ($qy === $y && ($x<=>$qx) === $cc))) + ) + $ep = $qp; + } + } + } + $np = $ep + [1, $w, -1, -$w][$dp]; + if ($cs[$np] !== 0) { + $b = count(array_keys($v)); + $pc = $np; + break; + } + if ($j === 7) break 2; + if ($j % 2 === 0) $cc = -$cc; + if ($j % 2 === 1) $dp = ($dp+1) % 4; +// The original Piet image is wrong: it outputs 403 error for invalid passwords. +// Failure of authentication should be notified by 401, not 403. +// I noticed that one month before PHPerKaigi, but I could not read or write (paint) +// Piet any longer at that time. +fwrite(STDERR, str_replace('403 Forbidden', '401 Unauthorized', $o)); +``` + +ããã¯äžäœãªããªã®ãããã°ããé£è§£ããã°ã©ãã³ã°èšèªã®äžã€ Piet ã®ã€ã³ã¿ããªã¿ã§ããã +Piet ã¯ããšãã»ã¢ã³ããªã¢ã³ (ãèµ€ã»éã»é»ã®ã³ã³ããžã·ã§ã³ããªã©ã§ç¥ãããæœè±¡ç»å®¶) ã®äœåã«ã€ã³ã¹ãã¬ãŒã·ã§ã³ãåããŠäœããããç»åããœãŒã¹ã³ãŒããšããããã°ã©ãã³ã°èšèªã§ããã +ã€ã³ã¿ããªã¿ã¯ç»åã®åãã¯ã»ã«ã®äžãé²ã¿ãªãããè²çã«å¿ããŠç¹å®ã®åŠçããããªã£ãŠããã +ããã§ã¯è©³ããèšèªä»æ§ã«ã€ããŠã¯è§£èª¬ããªãã®ã§ãæ°ã«ãªãæ¹ã¯ [Wikipedia ã®èšäºãPietã](https://ja.wikipedia.org/wiki/Piet) ãªã©ãåç
§ããŠã»ããã + +ããã°ã©ã ã®åé ã«ãããã®ç®æ + +```php +$b = unpack('C*', file_get_contents(__FILE__)); +``` + +ã§ `__FILE__` ã€ãŸããã®ç»åãã¡ã€ã«ãèªã¿èŸŒãã§ããã +å
ã»ã© Piet ã¯ç»åããœãŒã¹ã³ãŒãã«ããŠãããšèª¬æããã +ãããä»åã®åé¡ã®ç»åãã¡ã€ã« `Q1.png` ã¯ãPHP 補 Piet ã€ã³ã¿ããªã¿ã§ãããšåæã«ãPiet ã®ãœãŒã¹ã³ãŒãç»åã§ãããã®ã ã +QR ã³ãŒãäžå€®ã®ã«ã©ãã«ãªéšåã Piet ã®åœä»€ã«ãªã£ãŠããã + +{#piet-source-code} +## Piet ã®ãœãŒã¹ã³ãŒã + +ããŠãPiet ã§ã©ã®ãããªã³ãŒããæžãã㊠(ãããæãããŠ) ããã®ãã解説ããããšããã ããä»ã®ç§ã«ã¯ã§ãããã«ãªãã +ãšããã®ãããã§ã«è¿°ã¹ãããã« Piet ã¯ãé£è§£ããã°ã©ãã³ã°èšèªãã§ããã +ããã人ãæãããèªãã ãããããã«ã¯äœãããŠããªããæ§è³ªãšããŠã¯ãããºã«ã«è¿ã代ç©ã§ããã + +ãšããããã§ãããã§ã¯ãããŸãã説æããã ãã§ã容赊ããã ãããã +ããããã®éšåã¯ããããæ¬¡ã®ãããªããšããã£ãŠãã (åæ€èšŒã»åèªè§£ã¯ããŠããªãã®ã§å€§åãããããªã)ã + +* å·Šäž: å
¥ååãä»ã + + * æšæºå
¥åãã1æåãã€èªã¿èŸŒã¿ãå
¥åããªããªããŸã§ã¹ã¿ãã¯ã«ç©ããå€åã + +* äžèŸºãå³èŸº: ãã¹ã¯ãŒãã®æ€èšŒ + + * å
¥åããã¹ã¯ãŒããšäžèŽããã (= `#iwillblog` ãã©ãã) ã調ã¹ããå€åã + +* äžèŸºã巊蟺ãäžèŸºã®3åç®ãå³èŸºã®3åç®ãäžèŸºã®2åç®: ããŒã¯ã³ã®åºå + + * ãã¹ã¯ãŒããšäžèŽããŠããã°ããã«é£ãã§ãããæ£è§£ã®ããŒã¯ã³ãåºåãããå€åã + +* å³èŸºã®2åç®ãäžèŸºã®2åç®: äžæ£è§£ã®ã¡ãã»ãŒãžåºå + + * ãã¹ã¯ãŒããšäžèŽããŠããªããã°ããã«é£ãã§ãããäžæ£è§£ã®ãšãã®ã¡ãã»ãŒãžãåºåãããå€åã + +ãšããã§ãå
ã»ã©æ²èŒãã Piet ã®ã€ã³ã¿ããªã¿ã®ãœãŒã¹ã³ãŒãæ«å°Ÿã«ã¯æ¬¡ã®ãããªç®æãããã + +```php +// The original Piet image is wrong: it outputs 403 error for invalid passwords. +// Failure of authentication should be notified by 401, not 403. +// I noticed that one month before PHPerKaigi, but I could not read or write (paint) +// Piet any longer at that time. +fwrite(STDERR, str_replace('403 Forbidden', '401 Unauthorized', $o)); +``` + +ã³ã¡ã³ãã«ãæžãããŠãããããã® Piet ã®ãœãŒã¹ã³ãŒãç»åã«ã¯èª€ãããã£ãã +æ¬æ¥ HTTP ã®ã¹ããŒã¿ã¹ã³ãŒããç䌌ãã®ãªããèªèšŒã®å€±æã«ã¯ 401 ãè¿ããªããã°ãªããªãã +ããããPiet ã®ãœãŒã¹ã¯ 403 ãè¿ãããã«æžããŠããŸã£ãŠããã +ãã®ããšã«ç§ãæ°ä»ããã®ã¯ PHPerKaigi 2023 ãéå¬ãããã²ãšæåã§ããã®æç¹ã§ç§ã¯ãã® Piet ã®ãœãŒã¹ã³ãŒãã (ã¡ããã©ãã®èšäºã§ãããªã£ãŠããã®ãšåãããã«) èªè§£ã§ããªããªã£ãŠããã +ããã«æªãããšã«ãæ£ããã¡ãã»ãŒãžã401 Unauthorizedãã¯å
ã®ã403 Forbiddenãããã3æåé·ãã +3æååºåãé·ããªããšããããšã¯ãããã ã Piet ã§å¡ãã¹ããã¯ã»ã«ãå¢ããããšãæå³ããã +ãã¯ã3æå远å ã§åºåããã ãã®äœçœã¯ãã®ç»åã«æ®ãããŠããªãã£ã (ãšæããè
ããã® Piet ããã°ã©ããªãã§ãããããããªãã®ã§ææŠããŠã¿ãŠã»ãã)ã + +ããã解決ããããã«ç§ãéžãã ã®ã¯ãã€ã³ã¿ããªã¿ãæ¹é ããæ¬æ¥ã®ã¡ãã»ãŒãžãšã¯ç°ãªãã¡ãã»ãŒãžãç¡çããåºåãããŠåž³å°»ãåãããããšã ã£ãã +ããããããã§ãã® Piet ã€ã³ã¿ããªã¿ã¯å®å
šãª Piet ã€ã³ã¿ããªã¿ã§ã¯ãªããã403 Forbiddenããšããããã¹ãã絶察ã«åºåã§ããªãã + +{#misc} +## ãã®ä»å°ãã¿ + +ãããŸã§ã§åé¡ã®æ žå¿éšåã¯èª¬æãçµããã®ã§ãããããã¯æ®ã£ãå°ãã¿ã玹ä»ããŠããã + +ãã®åé¡ã®ã¿ã€ãã«ãAn Art of Computer Programmingãã¯ãããã«ãã»ã¯ããŒã¹ã®ãThe Art of Computer Programmingãããããã£ãããã®ã§ããã + +ãã®åé¡ã§åŸãããããŒã¯ã³ã#ModernPHPisStaticallyTypedLanguageãã¯ç¹ã«å
ãã¿ãããããã§ã¯ãªããåœç¶ã®ãããªé¡ã§åã䞻匵ãããã£ãã®ã§ãããªã£ãã + +{#outro} +# ãããã« + +ãã®åé¡ã®èªå·±è©äŸ¡ã¯ãã¡ãã +åé¡ã®åºé¡é ã¯ããããäœæããé ã«ãªã£ãŠããã®ã ãããã®ããã§é£æåºŠé«ãã®åé¡ã1åç®ã«é
眮ãããŠããŸã£ãã +ããã¯åçç¹ã®äžã€ã§ããã + +* é£ãã: â
â
â
â
+* ãæ°ã«å
¥ã床: â
â
+* é®®ããã: â
â
â
â
â
â
â
diff --git a/vhosts/blog/content/posts/2025-01-08/phperkaigi-2023-tokens-q1.ndoc b/vhosts/blog/content/posts/2025-01-08/phperkaigi-2023-tokens-q1.ndoc deleted file mode 100644 index ede3fdfb..00000000 --- a/vhosts/blog/content/posts/2025-01-08/phperkaigi-2023-tokens-q1.ndoc +++ /dev/null @@ -1,406 +0,0 @@ ---- -[article] -uuid = "ce8f20e8-c79f-48f8-982d-53edd4d20483" -title = "PHPerKaigi 2023 ããŒã¯ã³åé¡è§£èª¬ (1/5)" -description = "PHPerKaigi 2023 ã§ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿããåºé¡ããåé¡ã解説ãããå
š5åäžã®ç¬¬1åã" -tags = [ - "conference", - "php", - "phperkaigi", - "piet", -] - -[[article.revisions]] -date = "2025-01-08" -remark = "å
¬é" - -[[article.revisions]] -date = "2025-01-11" -remark = "èªã¿ãããã®ããäžéšã®æèšã調æŽ" ---- -<article> - <section id="intro"> - <h>ã¯ããã«</h> - <note> - ãã㯠PHPerKaigi 2023 ã®èšäºã§ããä»ã¯ 2025 幎ã§ãããPHPerKaigi 2023 ã®èšäºã§ãã - </note> - <p> - 2023-03-23 ãã 2023-03-25 ã«ãããŠéå¬ããã <a href="https://phperkaigi.jp/2023/">PHPerKaigi 2023</a> ã§ã¯ãPHPer ãã£ã¬ã³ãžãšããäŒç»ããããªãããã - PHPer ãã£ã¬ã³ãžãšã¯ãã¹ãã³ãµãŒã®ãã³ãã¬ãããã«ã³ãã¡ã¬ã³ã¹äŒå Žãªã©ããã#ãèšå·ã§å§ãŸãæååãéããæ¯åãªã©ãåŸããšããäŒç»ã§ããã - ãã®æååã¯ãPHPer ããŒã¯ã³ããšåŒã°ããŠãããåŒç€Ÿ<a href="https://www.dgcircus.com/">ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ</a>ããã¯ãããŒã¯ã³åé¡ãšãã圢ã§ãPHP ã«é¢ããåé¡ãè§£ããš PHPer ããŒã¯ã³ãåŸãããããã«ãªã£ãŠããåé¡ãåºé¡ããã - </p> - <p> - <a href="/posts/2023-04-04/phperkaigi-2023-report/">PHPerKaigi 2023 ã®åå ã¬ã</a> ã§ãæžãããšããããã®å¹Žã®ããŒã¯ã³åé¡ã¯ãæšå¹Žã® PHPerKaigi 2022 ãçµãã£ã段éããäœãå§ããçŽå幎ãããŠå¶äœããããã - PHPerKaigi åœæ¥ã <a href="/slides/2023-03-25/phperkaigi-2023-tokens/">PHPer ãã£ã¬ã³ãžè§£èª¬ã»ãã·ã§ã³</a> ãšãã圢ã§è§£èª¬ã®æ©äŒãé ããã®ã ãããã£ããæéããããŠäœé¡ããã®ã§èšäºã®åœ¢ã§ãæ®ããŠããããšæãã - </p> - <p> - ãã®èšäºã§ã¯ãå
š5åããäžã®ç¬¬1åã«ã€ããŠè§£èª¬ãããä»ã®åé¡ã«ã€ããŠã¯ä»¥äžã®ãªã³ã¯ãåç
§ã®ããšã - </p> - <ol> - <li><a href="/posts/2025-01-08/phperkaigi-2023-tokens-q1/">第1å (ãã®èšäº)</a></li> - <li>第2å (TODO: å·çäž)</li> - <li>第3å (TODO: å·çäž)</li> - <li>第4å (TODO: å·çäž)</li> - <li>第5å (TODO: å·çäž)</li> - </ol> - <p> - ããããã®åé¡ã¯ãã¡ãã® GitHub ãªããžã㪠(<a href="https://github.com/nsfisis/PHPerKaigi2023-tokens">nsfisis/PHPerKaigi2023-tokens</a>) ãããé²èЧã§ããã - </p> - </section> - <section id="quiz"> - <h>Q1: An Art of Computer Programming</h> - <p> - 第1åãAn Art of Computer Programmingãã¯ãã¡ãã - </p> - <img src="/posts/2025-01-08/phperkaigi-2023-tokens-q1/Q1.png" alt="å
šäœãQRã³ãŒãã«ãªã£ãŠãããäžå€®ã«ã¯å°ããªæåã§ãPassword is one of the PHPer tokens.ããšæžãããŠãã"></img> - </section> - <section id="how-to-solve"> - <h>è§£ãæ¹</h> - <p> - ãŸãã¯ããŒã¯ã³ãåŸãæ¹æ³ã解説æãã§èª¬æãããæ¬¡ã®ããã«å®è¡ããã - </p> - <codeblock> - <![CDATA[ - $ echo "#iwillblog" | php Q1.png >/dev/null - ]]> - </codeblock> - <p> - ç¡äºã«å®è¡ã§ããŠããã°ã#ModernPHPisStaticallyTypedLanguageããšããããŒã¯ã³ãåŸãããã - </p> - </section> - <section id="commentary"> - <h>解説</h> - <section id="read-as-image"> - <h>ç»åãšããŠè§£éãã</h> - <p> - ãŸãã¯çŽ çŽã«ç»åãšããŠèŠãŠã¿ããã - å
šäœã¯ QR ã³ãŒãã«ãªã£ãŠãããé©åœãª QR ã³ãŒããªãŒãã§èªã¿èŸŒããšã次ã®ãããªããã¹ãã衚瀺ãããã¯ãã ã - </p> - <codeblock> - <![CDATA[ - Guess password. $ echo "password" | php Q1.png >/dev/null - ]]> - </codeblock> - <p> - ã¡ãã»ãŒãžã¯ããã®ç»åã®å®è¡æ¹æ³ãšãã®åé¡ã§ããã¹ãããš (ãã¹ã¯ãŒãã®æšæž¬) ã瀺ããŠããã - </p> - <p> - 次㫠QR ã³ãŒãã®äžå€®éšã«ç®ãåãããšãå°ããªæåã§ãPassword is one of the PHPer tokens.ããšæžãããŠããã®ããããã - ä»ã® PHPer ããŒã¯ã³ã®äžããé©åãª1ã€ãèŠã€ãã ããããã¹ã¯ãŒãããšããŠæž¡ãããšã§çããšãªã PHPer ããŒã¯ã³ãåŸããããšããããã ã - </p> - </section> - <section id="password"> - <h>ãã¹ã¯ãŒã</h> - <p> - äžæ£ãªãã¹ã¯ãŒãã䜿ã£ãŠå®è¡ããŠã¿ããšã次ã®ãããªãšã©ãŒã¡ãã»ãŒãžã衚瀺ãããã - </p> - <codeblock> - <![CDATA[ - $ echo "foo" | php Q1.png >/dev/null - 401 Unauthorized - ]]> - </codeblock> - <p> - ãã§ã«<a href="#section--how-to-solve">ãè§£ãæ¹ãã®ç¯</a>ã§ç€ºããããã«ããã¹ã¯ãŒãã§ãã PHPer ããŒã¯ã³ã¯ã#iwillblogãã§ããããããäžããŠå®è¡ãããšæ£è§£ã®ããŒã¯ã³ãåŸãããã - </p> - <p> - ãã®ãã¹ã¯ãŒãã®éžæã«ã¯ãšããäºæ
ãããã - ä»åã®åé¡ã®äœåã¯ååã®éå¬ (PHPerKaigi 2022) çŽåŸããã¹ã¿ãŒãããŠããããã®æç¹ã§ã¯ PHPerKaigi 2023 ã§ç»é²ããã PHPer ããŒã¯ã³ã«ã©ã®ãããªãã®ããããã¯ãŸã£ããããããªãç¶æ
ã§ãã£ãã - äœåäœæ¥ãæ©æã«çµããããã«ã¯ã次åéå¬ã§ã確å®ã«äœ¿ãããã§ãããå®çªã®ããŒã¯ã³ãäºæž¬ããŠéžã¶å¿
èŠããã£ãã®ã ã - ããããŠãç§ãç¥ãéãæ¯åç»å ŽããŠããããŒã¯ã³ã§ããã#iwillblogãã«çœçŸœã®ç¢ãç«ãŠãããã - </p> - <p> - ãªããè§£ããŠãã ãã£ãæ¹ã®äžã«ã¯ãå
é ã®ã#ããå
¥åããã«äœåºŠã詊ããŠããŸãçããåŸãããããŸãã«ãªã£ãæ¹ãããã£ãããããã ã£ãã - åé¡ã眮ããŠãããªããžããªã«ãã³ããšããŠãã¹ã¯ãŒãã®ããŒã¯ã³ããiãã§å§ãŸããšæžããŠããã®ã ãããããæå³ãããã¹ãªãŒãã«ãªã£ãŠããŸã£ãã - ããã¯ç§ã®ãã¹ã§ããã - </p> - </section> - <section id="png-steganography"> - <h>PNG ã¹ãã¬ãã°ã©ãã£</h> - <p> - QR ã³ãŒããèšã£ãŠããããã«ããã®ãã¡ã€ã«ã¯ PNG ç»åã§ããã«ãããããã PHP ã§å®è¡ããããšãã§ããããªããã®ãããªããšãå¯èœãªã®ãã - </p> - <p> - PNG ç»åã®ãã©ãŒãããã¯ã次ã®ããã«ãªã£ãŠããã - </p> - <ol> - <li>ããžãã¯ãã³ããŒãªã©</li> - <li>PNG ããã (<code>IHDR</code> ãã£ã³ã¯)</li> - <li>å®éã®ç»åããŒã¿ (<code>IDAT</code> ãã£ã³ã¯)</li> - <li>PNG ããã¿ (<code>IEND</code> ãã£ã³ã¯)</li> - </ol> - <p> - PNG ããã¿ã®åŸãã«ããããŒã¿ã¯ãç»åãã¥ãŒã¢ã«ã¯è§£éããããç»åã®è¡šç€ºã«ã¯åœ±é¿ãäžããªãããããã£ãŠãPNG ããã¿ã®åŸãã«ã¯ä»»æã®ããŒã¿ãåã蟌ãããšãã§ããã - </p> - <p> - ããŠãPHP ã«ã¯ãPHP ããã°ã©ã ã®å§ãŸãã瀺ãããã® PHP ã¿ã° (<code><?php</code> ãŸã㯠<code><?</code>) ãããã - CLI ã§å®è¡ããå ŽåãPHP ã¿ã°ãããåã«ããããŒã¿ã¯æšæºåºåãžãã®ãŸãŸåºåãããã - </p> - <p> - ãã®ç»åãã¡ã€ã«ã¯æ¬¡ã®ãããªæ§é ã«ãªã£ãŠããã - </p> - <ol> - <li>ããžãã¯ãã³ããŒãªã©</li> - <li>PNG ããã (<code>IHDR</code> ãã£ã³ã¯)</li> - <li>å®éã®ç»åããŒã¿ (<code>IDAT</code> ãã£ã³ã¯)</li> - <li>PNG ããã¿ (<code>IEND</code> ãã£ã³ã¯)</li> - <li><strong>PHP ã¿ã° (<code><?php</code>)</strong></li> - <li><strong>éåžžã® PHP ãœãŒã¹ã³ãŒã</strong></li> - </ol> - <p> - PNG ãã¡ã€ã«ãšããŠèªããšã㯠PNG ããã¿ä»¥éã¯ç¡èŠãããPHP ã¹ã¯ãªãããšããŠèªããšã㯠PHP ã¿ã°ä»¥åãç¡èŠããããšãã仿ãã§ããã - </p> - <p> - <code>strings</code> ã³ãã³ãã䜿ããšãé ãããããŒã¿ãç°¡åã«é²èЧã§ããã - </p> - <codeblock> - <![CDATA[ - IHDR - -HHc - <PLTE - IDATx - IEND - <?php - error_reporting(-1); - $b = unpack('C*', file_get_contents(__FILE__)); - $w = $b[20]+2; - $h = $b[24]+2; - // (以äžç¥) - ]]> - </codeblock> - <p> - <code>IHDR</code> ã <code>IEND</code> ã PNG ç»åã®äžéšã§ã<code><?php</code> ãããå®éã®ããã°ã©ã ã«ãªã£ãŠããã - ãã¡ããããã PHP ããã°ã©ã ãšããŠåãããšãPHP ã¿ã°ããåã«ãã PNG ç»åãšããŠã®ããŒã¿ã¯ãã®ãŸãŸæšæºåºåãžãšåºåãããŠããŸãã - ãããé²ããããQR ã³ãŒããèªã¿èŸŒãã ãšãã®å®è¡æ¹æ³ - </p> - <codeblock> - <![CDATA[ - Guess password. $ echo "password" | php Q1.png >/dev/null - ]]> - </codeblock> - <p> - ã«ã¯æšæºåºåãæšãŠããã <code>>/dev/null</code> ãšæå®ãããŠããã - </p> - <p> - ãªãããã®ããã« PNG ç»åãªã©ã«æ¬æ¥ã®ããŒã¿ãšã¯ç°ãªãå¥ã®ããŒã¿ãé ãããšããã¹ãã¬ãã°ã©ãã£ã(<a href="https://ja.wikipedia.org/wiki/%E3%82%B9%E3%83%86%E3%82%AC%E3%83%8E%E3%82%B0%E3%83%A9%E3%83%95%E3%82%A3%E3%83%BC">Wikipediaãã¹ãã¬ãã°ã©ãã£ãŒã</a>) ãšåŒã¶ã - </p> - </section> - <section id="php-program"> - <h>å®è¡ããã PHP ããã°ã©ã </h> - <p> - ç»åã®æ£äœãããã£ããšããã§ãç»åã«é ãããŠãã PHP ããã°ã©ã ã«ã€ããŠèŠãŠãããã - å
ã»ã©ã¯äžéšããèšèŒããªãã£ãã®ã§ãå
šäœãèŒããã - ãªããããçšåºŠãŽã«ãããªããæžããã®ã§ã空çœããæ®ããŠãããã®ã®å¯èªæ§ã¯éåžžã«äœãããšãšæãã - </p> - <codeblock language="php"> - <![CDATA[ - <?php - error_reporting(-1); - $b = unpack('C*', file_get_contents(__FILE__)); - $w = $b[20]+2; - $h = $b[24]+2; - $cs = []; - for ($y = 0; $y < $h; $y++) - for ($x = 0; $x < $w; $x++) - $cs[$y*$w + $x] = ($x*$y === 0 || $x === $w-1 || $y === $h-1) - ? 0 - : $b[122+($y-1)*($w-1)+$x-1]; - $i = stream_isatty(STDIN) - ? [] - : array_map(ord(...), str_split(trim((string) fgets(STDIN)))); - $m = []; - $pc = 1*$w+1; - $dp = 0; - $cc = 1; - $c0 = 1; - $b = 0; - $ns = 0; - $o = ''; - while (true) { - $ns++; - if ($ns > 1e5) { - echo "infinite loop detected\n"; - break; - $c1 = $cs[$pc]; - $y = (6 + intdiv($c1-2, 3) - intdiv($c0-2, 3)) % 6; - $x = (3 + $c1%3 - $c0%3) % 3; - match (($c0 !== 1) * ($c1 !== 1) * ($y*3 + $x)) { - 1 => $m[] = $b, - 2 => array_pop($m), - 3 => $m[] = array_pop($m) + array_pop($m), - 4 => $m[] = (fn($x, $y) => $y - $x)(array_pop($m), array_pop($m)), - 5 => $m[] = array_pop($m) * array_pop($m), - 8 => $m[] = array_pop($m) === 0 ? 1 : 0, - 11 => $cc *= pow(-1, array_pop($m)), - 12 => $m[] = $m[count($m)-1], - 13 => $m = (fn($n, $d, $m, $l) => [ - ...array_slice($m, 0, $l-$d), - ...array_reverse([ - ...array_reverse(array_slice($m, $l-$d, $d-$n)), - ...array_reverse(array_slice($m, $l-$n)), - ]), - ])(array_pop($m), array_pop($m), $m, count($m)), - 15 => !empty($i) and $m[] = array_shift($i), - 16 => $o .= sprintf('%d', array_pop($m)), - 17 => $o .= sprintf('%c', array_pop($m)), - default => 'nop', - }; - $c0 = $c1; - for ($j = 0; $j < 8; $j++) { - $v = []; - if ($c1 === 1) { - $x = $pc % $w; - $y = intdiv($pc, $w); - $e = [($y+1)*$w-1, ($h-1)*$w+$x, $y*$w, $x][$dp]; - $z = [1, $w, -1, -$w][$dp]; - for ($ep = $pc; $ep !== $e; $ep += $z) - if ($cs[$ep] !== 1) break; - $ep -= $z; - $pc = $ep; - } else { - $q = [$pc]; - $ep = $pc; - while (!empty($q)) { - $qq = array_pop($q); - $v[$qq] = true; - foreach ([$qq+1, $qq+$w, $qq-1, $qq-$w] as $qp) { - if ($cs[$qp] !== $c1) continue; - if (isset($v[$qp])) continue; - $q[] = $qp; - $qx = $qp % $w; - $qy = intdiv($qp, $w); - $x = $ep % $w; - $y = intdiv($ep, $w); - if ( - ($dp === 0 && ($x < $qx || ($x === $qx && ($y<=>$qy) === $cc))) - || ($dp === 1 && ($y < $qy || ($y === $qy && ($qx<=>$x) === $cc))) - || ($dp === 2 && ($qx < $x || ($qx === $x && ($qy<=>$y) === $cc))) - || ($dp === 3 && ($qy < $y || ($qy === $y && ($x<=>$qx) === $cc))) - ) - $ep = $qp; - } - } - } - $np = $ep + [1, $w, -1, -$w][$dp]; - if ($cs[$np] !== 0) { - $b = count(array_keys($v)); - $pc = $np; - break; - } - if ($j === 7) break 2; - if ($j % 2 === 0) $cc = -$cc; - if ($j % 2 === 1) $dp = ($dp+1) % 4; - // The original Piet image is wrong: it outputs 403 error for invalid passwords. - // Failure of authentication should be notified by 401, not 403. - // I noticed that one month before PHPerKaigi, but I could not read or write (paint) - // Piet any longer at that time. - fwrite(STDERR, str_replace('403 Forbidden', '401 Unauthorized', $o)); - ]]> - </codeblock> - <p> - ããã¯äžäœãªããªã®ãããã°ããé£è§£ããã°ã©ãã³ã°èšèªã®äžã€ Piet ã®ã€ã³ã¿ããªã¿ã§ããã - Piet ã¯ããšãã»ã¢ã³ããªã¢ã³ (ãèµ€ã»éã»é»ã®ã³ã³ããžã·ã§ã³ããªã©ã§ç¥ãããæœè±¡ç»å®¶) ã®äœåã«ã€ã³ã¹ãã¬ãŒã·ã§ã³ãåããŠäœããããç»åããœãŒã¹ã³ãŒããšããããã°ã©ãã³ã°èšèªã§ããã - ã€ã³ã¿ããªã¿ã¯ç»åã®åãã¯ã»ã«ã®äžãé²ã¿ãªãããè²çã«å¿ããŠç¹å®ã®åŠçããããªã£ãŠããã - ããã§ã¯è©³ããèšèªä»æ§ã«ã€ããŠã¯è§£èª¬ããªãã®ã§ãæ°ã«ãªãæ¹ã¯ <a href="https://ja.wikipedia.org/wiki/Piet">Wikipedia ã®èšäºãPietã</a> ãªã©ãåç
§ããŠã»ããã - </p> - <p> - ããã°ã©ã ã®åé ã«ãããã®ç®æ - </p> - <codeblock language="php"> - <![CDATA[ - $b = unpack('C*', file_get_contents(__FILE__)); - ]]> - </codeblock> - <p> - ã§ <code>__FILE__</code> ã€ãŸããã®ç»åãã¡ã€ã«ãèªã¿èŸŒãã§ããã - å
ã»ã© Piet ã¯ç»åããœãŒã¹ã³ãŒãã«ããŠãããšèª¬æããã - ãããä»åã®åé¡ã®ç»åãã¡ã€ã« <code>Q1.png</code> ã¯ãPHP 補 Piet ã€ã³ã¿ããªã¿ã§ãããšåæã«ãPiet ã®ãœãŒã¹ã³ãŒãç»åã§ãããã®ã ã - QR ã³ãŒãäžå€®ã®ã«ã©ãã«ãªéšåã Piet ã®åœä»€ã«ãªã£ãŠããã - </p> - </section> - <section id="piet-source-code"> - <h>Piet ã®ãœãŒã¹ã³ãŒã</h> - <p> - ããŠãPiet ã§ã©ã®ãããªã³ãŒããæžãã㊠(ãããæãããŠ) ããã®ãã解説ããããšããã ããä»ã®ç§ã«ã¯ã§ãããã«ãªãã - ãšããã®ãããã§ã«è¿°ã¹ãããã« Piet ã¯ãé£è§£ããã°ã©ãã³ã°èšèªãã§ããã - ããã人ãæãããèªãã ãããããã«ã¯äœãããŠããªããæ§è³ªãšããŠã¯ãããºã«ã«è¿ã代ç©ã§ããã - </p> - <p> - ãšããããã§ãããã§ã¯ãããŸãã説æããã ãã§ã容赊ããã ãããã - ããããã®éšåã¯ããããæ¬¡ã®ãããªããšããã£ãŠãã (åæ€èšŒã»åèªè§£ã¯ããŠããªãã®ã§å€§åãããããªã)ã - </p> - <ul> - <li>å·Šäž: å
¥ååãä»ã - <ul> - <li>æšæºå
¥åãã1æåãã€èªã¿èŸŒã¿ãå
¥åããªããªããŸã§ã¹ã¿ãã¯ã«ç©ããå€åã</li> - </ul> - </li> - <li>äžèŸºãå³èŸº: ãã¹ã¯ãŒãã®æ€èšŒ - <ul> - <li>å
¥åããã¹ã¯ãŒããšäžèŽããã (= <code>#iwillblog</code> ãã©ãã) ã調ã¹ããå€åã</li> - </ul> - </li> - <li>äžèŸºã巊蟺ãäžèŸºã®3åç®ãå³èŸºã®3åç®ãäžèŸºã®2åç®: ããŒã¯ã³ã®åºå - <ul> - <li>ãã¹ã¯ãŒããšäžèŽããŠããã°ããã«é£ãã§ãããæ£è§£ã®ããŒã¯ã³ãåºåãããå€åã</li> - </ul> - </li> - <li>å³èŸºã®2åç®ãäžèŸºã®2åç®: äžæ£è§£ã®ã¡ãã»ãŒãžåºå - <ul> - <li>ãã¹ã¯ãŒããšäžèŽããŠããªããã°ããã«é£ãã§ãããäžæ£è§£ã®ãšãã®ã¡ãã»ãŒãžãåºåãããå€åã</li> - </ul> - </li> - </ul> - <p> - ãšããã§ãå
ã»ã©æ²èŒãã Piet ã®ã€ã³ã¿ããªã¿ã®ãœãŒã¹ã³ãŒãæ«å°Ÿã«ã¯æ¬¡ã®ãããªç®æãããã - </p> - <codeblock language="php"> - <![CDATA[ - // The original Piet image is wrong: it outputs 403 error for invalid passwords. - // Failure of authentication should be notified by 401, not 403. - // I noticed that one month before PHPerKaigi, but I could not read or write (paint) - // Piet any longer at that time. - fwrite(STDERR, str_replace('403 Forbidden', '401 Unauthorized', $o)); - ]]> - </codeblock> - <p> - ã³ã¡ã³ãã«ãæžãããŠãããããã® Piet ã®ãœãŒã¹ã³ãŒãç»åã«ã¯èª€ãããã£ãã - æ¬æ¥ HTTP ã®ã¹ããŒã¿ã¹ã³ãŒããç䌌ãã®ãªããèªèšŒã®å€±æã«ã¯ 401 ãè¿ããªããã°ãªããªãã - ããããPiet ã®ãœãŒã¹ã¯ 403 ãè¿ãããã«æžããŠããŸã£ãŠããã - ãã®ããšã«ç§ãæ°ä»ããã®ã¯ PHPerKaigi 2023 ãéå¬ãããã²ãšæåã§ããã®æç¹ã§ç§ã¯ãã® Piet ã®ãœãŒã¹ã³ãŒãã (ã¡ããã©ãã®èšäºã§ãããªã£ãŠããã®ãšåãããã«) èªè§£ã§ããªããªã£ãŠããã - ããã«æªãããšã«ãæ£ããã¡ãã»ãŒãžã401 Unauthorizedãã¯å
ã®ã403 Forbiddenãããã3æåé·ãã - 3æååºåãé·ããªããšããããšã¯ãããã ã Piet ã§å¡ãã¹ããã¯ã»ã«ãå¢ããããšãæå³ããã - ãã¯ã3æå远å ã§åºåããã ãã®äœçœã¯ãã®ç»åã«æ®ãããŠããªãã£ã (ãšæããè
ããã® Piet ããã°ã©ããªãã§ãããããããªãã®ã§ææŠããŠã¿ãŠã»ãã)ã - </p> - <p> - ããã解決ããããã«ç§ãéžãã ã®ã¯ãã€ã³ã¿ããªã¿ãæ¹é ããæ¬æ¥ã®ã¡ãã»ãŒãžãšã¯ç°ãªãã¡ãã»ãŒãžãç¡çããåºåãããŠåž³å°»ãåãããããšã ã£ãã - ããããããã§ãã® Piet ã€ã³ã¿ããªã¿ã¯å®å
šãª Piet ã€ã³ã¿ããªã¿ã§ã¯ãªããã403 Forbiddenããšããããã¹ãã絶察ã«åºåã§ããªãã - </p> - </section> - <section id="misc"> - <h>ãã®ä»å°ãã¿</h> - <p> - ãããŸã§ã§åé¡ã®æ žå¿éšåã¯èª¬æãçµããã®ã§ãããããã¯æ®ã£ãå°ãã¿ã玹ä»ããŠããã - </p> - <p> - ãã®åé¡ã®ã¿ã€ãã«ãAn Art of Computer Programmingãã¯ãããã«ãã»ã¯ããŒã¹ã®ãThe Art of Computer Programmingãããããã£ãããã®ã§ããã - </p> - <p> - ãã®åé¡ã§åŸãããããŒã¯ã³ã#ModernPHPisStaticallyTypedLanguageãã¯ç¹ã«å
ãã¿ãããããã§ã¯ãªããåœç¶ã®ãããªé¡ã§åã䞻匵ãããã£ãã®ã§ãããªã£ãã - </p> - </section> - </section> - <section id="outro"> - <h>ãããã«</h> - <p> - ãã®åé¡ã®èªå·±è©äŸ¡ã¯ãã¡ãã - åé¡ã®åºé¡é ã¯ããããäœæããé ã«ãªã£ãŠããã®ã ãããã®ããã§é£æåºŠé«ãã®åé¡ã1åç®ã«é
眮ãããŠããŸã£ãã - ããã¯åçç¹ã®äžã€ã§ããã - </p> - <ul> - <li>é£ãã: â
â
â
â
</li> - <li>ãæ°ã«å
¥ã床: â
â
</li> - <li>é®®ããã: â
â
â
â
â
â
â
</li> - </ul> - </section> -</article> diff --git a/vhosts/blog/content/posts/2025-01-26/yaml-breaking-changes-between-v1-1-and-v1-2.dj b/vhosts/blog/content/posts/2025-01-26/yaml-breaking-changes-between-v1-1-and-v1-2.dj new file mode 100644 index 00000000..44e8a4f6 --- /dev/null +++ b/vhosts/blog/content/posts/2025-01-26/yaml-breaking-changes-between-v1-1-and-v1-2.dj @@ -0,0 +1,76 @@ +--- +[article] +uuid = "da2a0cec-74b3-4c5e-b2a2-47fe79ef49f9" +title = "ãYAMLãYAML 1.1 ãš YAML 1.2 ã®äž»ãªç Žå£ç倿Ž" +description = "ããŒã¿èšè¿°èšèª YAML ã«ãããããŒãžã§ã³ 1.1 ãš 1.2 ã®äž»ãªç Žå£ç倿ŽããŸãšããã" +tags = [ + "yaml", +] + +[[article.revisions]] +date = "2021-06-30" +remark = "ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿã®ç€Ÿå
èšäºãšããŠå
¬é" +isInternal = true + +[[article.revisions]] +date = "2025-01-26" +remark = "ããã°èšäºãšããŠäžè¬å
¬é" +--- +::: note +ãã®èšäºã¯ã2021-06-30 ã« [ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ](https://www.dgcircus.com/) ã®ç€Ÿå
Qiita Team ã«å
¬éãããèšäºãããŒã¹ã«ãå çä¿®æ£ããŠäžè¬å
¬éãããã®ã§ãã +::: + +{#intro} +# ã¯ããã« + +ããŒã¿èšè¿°èšèªã®äžã€ YAML ã«ã¯ 1.0ã1.1ã1.2 ã®ããŒãžã§ã³ãããã +ãããã®ãã¡ã1.1 ãš 1.2 ã®éã«ã¯ç¡èŠã§ããªãéäºæã®å€æŽãå€ãã1.2 ã«å¯Ÿå¿ããŠããªãã©ã€ãã©ãªããã (Ruby 忢±ã® `yaml` ãªã©)ã +ãã®èšäºã§ã¯ãYAML 1.1 ãš YAML 1.2 ã®äž»ãªç Žå£ç倿Žã玹ä»ãã (圱é¿ç¯å²ãåºããã®ãæç²ããŠããããã¹ãŠã®éäºæãç¶²çŸ
ããŠã¯ããªã)ã + +åç
§ãã仿§æžã¯ãã¡ã: https://yaml.org/spec/1.2.2/ext/changes/ + +{#breaking-changes} +# äž»ãªç Žå£çå€æŽ + +{#boolean-literals} +### Boolean ãšããŠããŒã¹ãããããŒã¯ã³ã `true` / `false` ãšãã®äºçš®ã®ã¿ã« + +ãã®å€æŽã®åœ±é¿ãæã倧ãããšæãããã +YAML 1.1 ã§ã¯ãboolean å€ã®ãªãã©ã«ãšã㊠`true`ã`false` ã®ã»ã `yes`ã`no`ã`y`ã`n`ã`on`ã`off`ããããã®å€§æåããŒãžã§ã³ãªã©ãèªããããŠããã +YAML 1.2 ã§ã¯ã`true` ãš `false`ããããã®å€§æåããŒãžã§ã³ (`True`ã`TRUE`ã`False`ã`FALSE`) ã®ã¿ã boolean ãšããŠããŒã¹ãããããã«ãªã£ãã + +{#octal-literals} +### å
«é²æ°ãªãã©ã«ã«ã¯ `0o` ãå¿
é ã« + +C èšèªãªã©ã§ã¯ã`0` ããå§ãŸãæ°åã®åãå
«é²æ°ãšããŠããŒã¹ããã +YAML 1.1 ãããã«æºããŠãããã1.2 ãã㯠`0o` ã®ãã¬ãã£ã¯ã¹ãå¿
é ãšãªã£ã ("o" 㯠"octal" ã® "o")ã +ããã°ã©ãã³ã°èšèªã§ã¯ãPython ã HaskellãSwiftãRust ãªã©ããã®èšæ³ãæ¡çšããŠããã + +{#merging} +### `<<` ã«ããããŒãžãäžå¯èœã« + +YAML 1.1 ã§ã¯ã`<<` ãšããæååãããŒã«æå®ããããšã§ãããããããŒãžããããšãã§ããã + +```yaml +x: &base + a: 123 +# => { "x": { "a": 123 } } + +y: + <<: *base + b: 456 +# => { "y": { "a": 123, "b": 456 } } +``` + +1.2 ããã¯ãããã§ããªããªãã + +{#number-separator} +### æ°åã `_` ã§åºåãã®ãçŠæ¢ã« + +`1234567` ã `1_234_567` ãšæžããªããªã£ãã + +{#outro} +# ãããã« + +å
šäœçã«ã_There's more than one way to do it._ ãã _There should be one - and preferably only one - obvious way to do it._ ãžç§»è¡ããŠããããã«æãããã +ããŒã¿èšè¿°èšèªãšããŠã¯æãŸããæ¹åæ§ã§ã¯ãªãããšæããã diff --git a/vhosts/blog/content/posts/2025-01-26/yaml-breaking-changes-between-v1-1-and-v1-2.ndoc b/vhosts/blog/content/posts/2025-01-26/yaml-breaking-changes-between-v1-1-and-v1-2.ndoc deleted file mode 100644 index 74c2c14e..00000000 --- a/vhosts/blog/content/posts/2025-01-26/yaml-breaking-changes-between-v1-1-and-v1-2.ndoc +++ /dev/null @@ -1,87 +0,0 @@ ---- -[article] -uuid = "da2a0cec-74b3-4c5e-b2a2-47fe79ef49f9" -title = "ãYAMLãYAML 1.1 ãš YAML 1.2 ã®äž»ãªç Žå£ç倿Ž" -description = "ããŒã¿èšè¿°èšèª YAML ã«ãããããŒãžã§ã³ 1.1 ãš 1.2 ã®äž»ãªç Žå£ç倿ŽããŸãšããã" -tags = [ - "yaml", -] - -[[article.revisions]] -date = "2021-06-30" -remark = "ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿã®ç€Ÿå
èšäºãšããŠå
¬é" -isInternal = true - -[[article.revisions]] -date = "2025-01-26" -remark = "ããã°èšäºãšããŠäžè¬å
¬é" ---- -<article> - <note> - ãã®èšäºã¯ã2021-06-30 ã«<a href="https://www.dgcircus.com/">ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ</a> ã®ç€Ÿå
Qiita Team ã«å
¬éãããèšäºãããŒã¹ã«ãå çä¿®æ£ããŠäžè¬å
¬éãããã®ã§ãã - </note> - <section id="intro"> - <h>ã¯ããã«</h> - <p> - ããŒã¿èšè¿°èšèªã®äžã€ YAML ã«ã¯ 1.0ã1.1ã1.2 ã®ããŒãžã§ã³ãããã - ãããã®ãã¡ã1.1 ãš 1.2 ã®éã«ã¯ç¡èŠã§ããªãéäºæã®å€æŽãå€ãã1.2 ã«å¯Ÿå¿ããŠããªãã©ã€ãã©ãªããã (Ruby 忢±ã® <code>yaml</code> ãªã©)ã - ãã®èšäºã§ã¯ãYAML 1.1 ãš YAML 1.2 ã®äž»ãªç Žå£ç倿Žã玹ä»ãã (圱é¿ç¯å²ãåºããã®ãæç²ããŠããããã¹ãŠã®éäºæãç¶²çŸ
ããŠã¯ããªã)ã - </p> - <p> - åç
§ãã仿§æžã¯ãã¡ã: https://yaml.org/spec/1.2.2/ext/changes/ - </p> - </section> - <section id="breaking-changes"> - <h>äž»ãªç Žå£ç倿Ž</h> - <section id="boolean-literals"> - <h>Boolean ãšããŠããŒã¹ãããããŒã¯ã³ã <code>true</code> / <code>false</code> ãšãã®äºçš®ã®ã¿ã«</h> - <p> - ãã®å€æŽã®åœ±é¿ãæã倧ãããšæãããã - YAML 1.1 ã§ã¯ãboolean å€ã®ãªãã©ã«ãšã㊠<code>true</code>ã<code>false</code> ã®ã»ã <code>yes</code>ã<code>no</code>ã<code>y</code>ã<code>n</code>ã<code>on</code>ã<code>off</code>ããããã®å€§æåããŒãžã§ã³ãªã©ãèªããããŠããã - YAML 1.2 ã§ã¯ã<code>true</code> ãš <code>false</code>ããããã®å€§æåããŒãžã§ã³ (<code>True</code>ã<code>TRUE</code>ã<code>False</code>ã<code>FALSE</code>) ã®ã¿ã boolean ãšããŠããŒã¹ãããããã«ãªã£ãã - </p> - </section> - <section id="octal-literals"> - <h>å
«é²æ°ãªãã©ã«ã«ã¯ <code>0o</code> ãå¿
é ã«</h> - <p> - C èšèªãªã©ã§ã¯ã<code>0</code> ããå§ãŸãæ°åã®åãå
«é²æ°ãšããŠããŒã¹ããã - YAML 1.1 ãããã«æºããŠãããã1.2 ãã㯠<code>0o</code> ã®ãã¬ãã£ã¯ã¹ãå¿
é ãšãªã£ã ("o" 㯠"octal" ã® "o")ã - ããã°ã©ãã³ã°èšèªã§ã¯ãPython ã HaskellãSwiftãRust ãªã©ããã®èšæ³ãæ¡çšããŠããã - </p> - </section> - <section id="merging"> - <h><code><<</code> ã«ããããŒãžãäžå¯èœã«</h> - <p> - YAML 1.1 ã§ã¯ã<code><<</code> ãšããæååãããŒã«æå®ããããšã§ãããããããŒãžããããšãã§ããã - </p> - <codeblock language="yaml"> - <![CDATA[ - x: &base - a: 123 - # => { "x": { "a": 123 } } - - y: - <<: *base - b: 456 - # => { "y": { "a": 123, "b": 456 } } - ]]> - </codeblock> - <p> - 1.2 ããã¯ãããã§ããªããªãã - </p> - </section> - <section id="number-separator"> - <h>æ°åã <code>_</code> ã§åºåãã®ãçŠæ¢ã«</h> - <p> - <code>1234567</code> ã <code>1_234_567</code> ãšæžããªããªã£ãã - </p> - </section> - </section> - <section id="outro"> - <h>ãããã«</h> - <p> - å
šäœçã«ã<i>There's more than one way to do it.</i> ãã <i>There should be one - and preferably only one - obvious way to do it.</i> ãžç§»è¡ããŠããããã«æãããã - ããŒã¿èšè¿°èšèªãšããŠã¯æãŸããæ¹åæ§ã§ã¯ãªãããšæããã - </p> - </section> -</article> diff --git a/vhosts/blog/content/posts/2025-02-24/phpcon-nagoya-2025-report.dj b/vhosts/blog/content/posts/2025-02-24/phpcon-nagoya-2025-report.dj new file mode 100644 index 00000000..cf5be3f4 --- /dev/null +++ b/vhosts/blog/content/posts/2025-02-24/phpcon-nagoya-2025-report.dj @@ -0,0 +1,49 @@ +--- +[article] +uuid = "13174dc7-c1a3-465f-9ba6-14f0bc6f5961" +title = "PHP ã«ã³ãã¡ã¬ã³ã¹åå€å± 2025 åå ã¬ã" +description = "2025-02-22 ã«éå¬ããããPHP ã«ã³ãã¡ã¬ã³ã¹åå€å± 2025 ã«åå ããã" +tags = [ + "conference", + "php", + "phpcon-nagoya", +] + +[[article.revisions]] +date = "2025-02-24" +remark = "å
¬é" +--- +{#intro} +# ã¯ããã« + +2025-02-22 ã«éå¬ããã [PHP ã«ã³ãã¡ã¬ã³ã¹åå€å±](https://phpcon.nagoya/2025/) ã«åå ããã + +{#sessions} +# ã»ãã·ã§ã³ææ³ + +ç¹ã«å°è±¡ã«æ®ã£ãã»ãã·ã§ã³ãäºã€ããã¯ã¢ãããã (ã¿ã€ãã«ãšçºè¡šè
å㯠fortee ã®ããããŒã¶ã«ããŒãžã«ãã)ã + +* [PHPã§å°å·æã«å
¥çš¿ã§ããåæããŒã¿ãäœã by é·è°·å·æºåž ãã](https://fortee.jp/phpcon-nagoya-2025/proposal/26795bcc-78dd-431e-9538-7450779fa2cf) + + * PHPerKaigi ã iOSDC ã®åæã¯å質ãé«ãã®ã§ãä»ã®å匷äŒãã«ã³ãã¡ã¬ã³ã¹ã§ãã€ãã€ã䜿ã£ãŠããŸãã®ã§ããããã®è£åŽãèŠãããšãã§ãé¢çœãã£ãã§ããã«ã³ãã¡ã¬ã³ã¹ã®1ã»ãã·ã§ã³ãšãã圢ã§ãªããã°è§Šããããšã®ãªããããªè©±ãèŽããã®ã¯ã«ã³ãã¡ã¬ã³ã¹ã«åå ããééå³ã®äžã€ã ãšæããŸãã + +* [PHP 補 OSS ã®ã¡ã¢ãªåé¡ã蟻æ¬ãããŠãã by sji ãã](https://fortee.jp/phpcon-nagoya-2025/proposal/d3ecbb68-318d-4b03-abfe-9ecccc6beb81) + + * ä»åäžçªæ¥œãã¿ã«ããŠããçºè¡šã§ãã [Reli](https://github.com/reliforp/reli-prof) ã¯ä»¥å [èªäœã® WebAssembly åŠçç³»ãé«éåããã®ã«äœ¿ã£ãã®ããã](/slides/2024-03-15/ya8-2024/) ãã®åŒ·åãã«ã€ããŠã¯ããçšåºŠç¥ã£ãŠããã€ããã§ããããå®éã«åºã䜿ãããŠããã©ã€ãã©ãªã§ã®èª¿æ»éçšãèŠããšåžãã°ããã§ããããããã¹ãŠ (FFI ãã䜿ã£ãŠãããã®ã®) pure PHP ã§å®è£
ããŠãããšã¯ä¿ã«ä¿¡ããããŸããã + +{#my-session} +# ç»å£ããã»ãã·ã§ã³ + +[ãPHP åŠç系㮠garbage collection ãçè§£ãã ãã¡ã¢ãªã¯ãã€è§£æŸãããã®ããã](https://fortee.jp/phpcon-nagoya-2025/proposal/24a2ec04-ca57-46f1-905c-52143a449eea) ãšããã¿ã€ãã«ã§ç»å£ããããªã£ããã¿ã€ãã«ã©ãããPHP ã® garbage collection (GC) ã«ã€ããŠæ±ã£ãçºè¡šã§ããã + +æè¡çãªå
容ãšããŠã¯ [PHP ã®ããã¥ã¢ã«ã® GC ã«é¢ããèšè¿°](https://www.php.net/manual/ja/features.gc.php) ãåºãŠããªããã®ã®ãPHP åŠçç³»ã®å
éšçãªçšèªã䜿ããªãããã«ããããæ¬è³ªçã§ãªãåŠçãçãããããŠãçè§£ã®ããã®åææ¡ä»¶ãæžãããã®ã§ã¯ãªãããšæãã + +ãšããã§ä»åã¹ã©ã€ãã®ãã©ã³ããµã€ãºã倧ããããããã«åã¹ã©ã€ãã®èŠåºãéšåãæ¶ããŠã¿ãã®ã ããçµå±ã»ãšãã©ã®ã¹ã©ã€ãã§èŠåºããããæèšãå¿
èŠã«ãªã£ãã®ã§ãããŸã广ã¯ãªãã£ããããããªãã + +{#outro} +# ãããã« + +ä»åãã«ã³ãã¡ã¬ã³ã¹ãããã§ããèŽããªããããªã»ãã·ã§ã³ãããã€ãèŽããŠããã£ãã +ãŸããã¡ããã©é£äŒã ã£ãã®ãããåå€å±ã楜ããããšãã§ããã +éå¶ã®ã¿ãªããŸããç²ãããŸã§ãã&ããããšãããããŸããã +次㯠PHPerKaigi 2025 ã§äŒããŸãããã diff --git a/vhosts/blog/content/posts/2025-02-24/phpcon-nagoya-2025-report.ndoc b/vhosts/blog/content/posts/2025-02-24/phpcon-nagoya-2025-report.ndoc deleted file mode 100644 index e4b64881..00000000 --- a/vhosts/blog/content/posts/2025-02-24/phpcon-nagoya-2025-report.ndoc +++ /dev/null @@ -1,64 +0,0 @@ ---- -[article] -uuid = "13174dc7-c1a3-465f-9ba6-14f0bc6f5961" -title = "PHP ã«ã³ãã¡ã¬ã³ã¹åå€å± 2025 åå ã¬ã" -description = "2025-02-22 ã«éå¬ããããPHP ã«ã³ãã¡ã¬ã³ã¹åå€å± 2025 ã«åå ããã" -tags = [ - "conference", - "php", - "phpcon-nagoya", -] - -[[article.revisions]] -date = "2025-02-24" -remark = "å
¬é" ---- -<article> - <section id="intro"> - <h>ã¯ããã«</h> - <p> - 2025-02-22 ã«éå¬ããã<a href="https://phpcon.nagoya/2025/">PHP ã«ã³ãã¡ã¬ã³ã¹åå€å±</a>ã«åå ããã - </p> - </section> - <section id="sessions"> - <h>ã»ãã·ã§ã³ææ³</h> - <p> - ç¹ã«å°è±¡ã«æ®ã£ãã»ãã·ã§ã³ãäºã€ããã¯ã¢ãããã (ã¿ã€ãã«ãšçºè¡šè
å㯠fortee ã®ããããŒã¶ã«ããŒãžã«ãã)ã - </p> - <ul> - <li> - <a href="https://fortee.jp/phpcon-nagoya-2025/proposal/26795bcc-78dd-431e-9538-7450779fa2cf">PHPã§å°å·æã«å
¥çš¿ã§ããåæããŒã¿ãäœã by é·è°·å·æºåž ãã</a> - <ul> - <li>PHPerKaigi ã iOSDC ã®åæã¯å質ãé«ãã®ã§ãä»ã®å匷äŒãã«ã³ãã¡ã¬ã³ã¹ã§ãã€ãã€ã䜿ã£ãŠããŸãã®ã§ããããã®è£åŽãèŠãããšãã§ãé¢çœãã£ãã§ããã«ã³ãã¡ã¬ã³ã¹ã®1ã»ãã·ã§ã³ãšãã圢ã§ãªããã°è§Šããããšã®ãªããããªè©±ãèŽããã®ã¯ã«ã³ãã¡ã¬ã³ã¹ã«åå ããééå³ã®äžã€ã ãšæããŸãã</li> - </ul> - </li> - <li> - <a href="https://fortee.jp/phpcon-nagoya-2025/proposal/d3ecbb68-318d-4b03-abfe-9ecccc6beb81">PHP 補 OSS ã®ã¡ã¢ãªåé¡ã蟻æ¬ãããŠãã by sji ãã</a> - <ul> - <li>ä»åäžçªæ¥œãã¿ã«ããŠããçºè¡šã§ãã<a href="https://github.com/reliforp/reli-prof">Reli</a> ã¯ä»¥å<a href="/slides/2024-03-15/ya8-2024/">èªäœã® WebAssembly åŠçç³»ãé«éåããã®ã«äœ¿ã£ãã®ããã</a>ãã®åŒ·åãã«ã€ããŠã¯ããçšåºŠç¥ã£ãŠããã€ããã§ããããå®éã«åºã䜿ãããŠããã©ã€ãã©ãªã§ã®èª¿æ»éçšãèŠããšåžãã°ããã§ããããããã¹ãŠ (FFI ãã䜿ã£ãŠãããã®ã®) pure PHP ã§å®è£
ããŠãããšã¯ä¿ã«ä¿¡ããããŸããã</li> - </ul> - </li> - </ul> - </section> - <section id="my-session"> - <h>ç»å£ããã»ãã·ã§ã³</h> - <p> - <a href="https://fortee.jp/phpcon-nagoya-2025/proposal/24a2ec04-ca57-46f1-905c-52143a449eea">ãPHP åŠç系㮠garbage collection ãçè§£ãã ãã¡ã¢ãªã¯ãã€è§£æŸãããã®ããã</a>ãšããã¿ã€ãã«ã§ç»å£ããããªã£ããã¿ã€ãã«ã©ãããPHP ã® garbage collection (GC) ã«ã€ããŠæ±ã£ãçºè¡šã§ããã - </p> - <p> - æè¡çãªå
容ãšããŠã¯<a href="https://www.php.net/manual/ja/features.gc.php">PHP ã®ããã¥ã¢ã«ã® GC ã«é¢ããèšè¿°</a>ãåºãŠããªããã®ã®ãPHP åŠçç³»ã®å
éšçãªçšèªã䜿ããªãããã«ããããæ¬è³ªçã§ãªãåŠçãçãããããŠãçè§£ã®ããã®åææ¡ä»¶ãæžãããã®ã§ã¯ãªãããšæãã - </p> - <p> - ãšããã§ä»åã¹ã©ã€ãã®ãã©ã³ããµã€ãºã倧ããããããã«åã¹ã©ã€ãã®èŠåºãéšåãæ¶ããŠã¿ãã®ã ããçµå±ã»ãšãã©ã®ã¹ã©ã€ãã§èŠåºããããæèšãå¿
èŠã«ãªã£ãã®ã§ãããŸã广ã¯ãªãã£ããããããªãã - </p> - </section> - <section id="outro"> - <h>ãããã«</h> - <p> - ä»åãã«ã³ãã¡ã¬ã³ã¹ãããã§ããèŽããªããããªã»ãã·ã§ã³ãããã€ãèŽããŠããã£ãã - ãŸããã¡ããã©é£äŒã ã£ãã®ãããåå€å±ã楜ããããšãã§ããã - éå¶ã®ã¿ãªããŸããç²ãããŸã§ãã&ããããšãããããŸããã - 次㯠PHPerKaigi 2025 ã§äŒããŸãããã - </p> - </section> -</article> diff --git a/vhosts/blog/content/posts/2025-03-27/zip-function-like-command-paste-command.dj b/vhosts/blog/content/posts/2025-03-27/zip-function-like-command-paste-command.dj new file mode 100644 index 00000000..8c9417fa --- /dev/null +++ b/vhosts/blog/content/posts/2025-03-27/zip-function-like-command-paste-command.dj @@ -0,0 +1,93 @@ +--- +[article] +uuid = "99111377-27e7-427b-9dc5-a23f621fa826" +title = "zip 颿°ã®ãããªã³ãã³ã paste" +description = "zip 颿°ã®ãããªåãããã paste ã³ãã³ãã«ã€ããŠã®ã¡ã¢ã" +tags = [ + "note-to-self", +] + +[[article.revisions]] +date = "2021-03-22" +remark = "ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿã®ç€Ÿå
èšäºãšããŠå
¬é" +isInternal = true + +[[article.revisions]] +date = "2025-03-27" +remark = "ããã°èšäºãšããŠäžè¬å
¬é" +--- +::: note +ãã®èšäºã¯ã2021-03-22 ã« [ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ](https://www.dgcircus.com/) ã®ç€Ÿå
Qiita Team ã«å
¬éãããèšäºãããŒã¹ã«ãå çä¿®æ£ããŠäžè¬å
¬éãããã®ã§ãã +::: + +{#intro} +# å®çŸãããå
容 + +次ã®2ãã¡ã€ã« `a.txt` / `b.txt` ããåºå `ab.txt` ãåŸããã + +`a.txt` + +``` +a1 +a2 +a3 +``` + +`b.txt` + +``` +b1 +b2 +b3 +``` + +`ab.txt` + +``` +a1 +b1 +a2 +b2 +a3 +b3 +``` + +ã¡ããã© Python ã Haskell ãªã©ã«ãã `zip` 颿°ã®ãããªåããããããã + +{#paste-command} +# å®çŸæ¹æ³ + +èšäºã¿ã€ãã«ã«æžããããã«ã`paste` ã³ãã³ãã䜿ããšå®çŸã§ããã + +``` +$ paste -d '\ +' a.txt b.txt > ab.txt +``` + +`paste` ã³ãã³ãã¯è€æ°ã®ãã¡ã€ã«ãåŒæ°ã«åãããããã1è¡ãã€æ¶è²»ããªãã `-d` ã§æå®ããæåã§åºåã£ãŠåºåããã +`-d` ã¯åºåãæåã®æå®ã§ãããã©ã«ãã ãšã¿ãåºåãã«ãªãã + +ãã¡ã€ã«åã«ã¯ `-` ãæå®ã§ãããã®å Žåã¯æšæºå
¥åããèªã¿èŸŒãã§åºåããã +ãã®ãšã `paste - -` ã®ããã«è€æ°å `-` ãæå®ãããšãæå®ããåæ°ã®è¡ããšã«é£çµããããšãã§ããã +äŸãã° `ab.txt` ã ãšãããªãã + +``` +$ paste - - < ab.txt +a1 b1 +a2 b2 +a3 b3 +``` + +ããã¯æšæºå
¥åã䜿ããšãç¹æã®æåã§ãåã«åããã¡ã€ã«åãæå®ããŠãããã¯ãªããªãã + +``` +$ paste ab.txt ab.txt +a1 a1 +b1 b1 +a2 a2 +b2 b2 +a3 a3 +b3 b3 +``` + +ãšãã©ã䟿å©ã diff --git a/vhosts/blog/content/posts/2025-03-27/zip-function-like-command-paste-command.ndoc b/vhosts/blog/content/posts/2025-03-27/zip-function-like-command-paste-command.ndoc deleted file mode 100644 index 3419099b..00000000 --- a/vhosts/blog/content/posts/2025-03-27/zip-function-like-command-paste-command.ndoc +++ /dev/null @@ -1,111 +0,0 @@ ---- -[article] -uuid = "99111377-27e7-427b-9dc5-a23f621fa826" -title = "zip 颿°ã®ãããªã³ãã³ã paste" -description = "zip 颿°ã®ãããªåãããã paste ã³ãã³ãã«ã€ããŠã®ã¡ã¢ã" -tags = [ - "note-to-self", -] - -[[article.revisions]] -date = "2021-03-22" -remark = "ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿã®ç€Ÿå
èšäºãšããŠå
¬é" -isInternal = true - -[[article.revisions]] -date = "2025-03-27" -remark = "ããã°èšäºãšããŠäžè¬å
¬é" ---- -<article> - <note> - ãã®èšäºã¯ã2021-03-22 ã«<a href="https://www.dgcircus.com/">ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ</a> ã®ç€Ÿå
Qiita Team ã«å
¬éãããèšäºãããŒã¹ã«ãå çä¿®æ£ããŠäžè¬å
¬éãããã®ã§ãã - </note> - <section id="intro"> - <h>å®çŸãããå
容</h> - <p> - 次ã®2ãã¡ã€ã« <code>a.txt</code> / <code>b.txt</code> ããåºå <code>ab.txt</code> ãåŸããã - </p> - <p> - <code>a.txt</code> - </p> - <codeblock> - <![CDATA[ - a1 - a2 - a3 - ]]> - </codeblock> - <p> - <code>b.txt</code> - </p> - <codeblock> - <![CDATA[ - b1 - b2 - b3 - ]]> - </codeblock> - <p> - <code>ab.txt</code> - </p> - <codeblock> - <![CDATA[ - a1 - b1 - a2 - b2 - a3 - b3 - ]]> - </codeblock> - <p> - ã¡ããã© Python ã Haskell ãªã©ã«ãã <code>zip</code> 颿°ã®ãããªåããããããã - </p> - </section> - <section id="paste-command"> - <h>å®çŸæ¹æ³</h> - <p> - èšäºã¿ã€ãã«ã«æžããããã«ã<code>paste</code> ã³ãã³ãã䜿ããšå®çŸã§ããã - </p> - <codeblock> - <![CDATA[ - $ paste -d '\ - ' a.txt b.txt > ab.txt - ]]> - </codeblock> - <p> - <code>paste</code> ã³ãã³ãã¯è€æ°ã®ãã¡ã€ã«ãåŒæ°ã«åãããããã1è¡ãã€æ¶è²»ããªãã <code>-d</code> ã§æå®ããæåã§åºåã£ãŠåºåããã - <code>-d</code> ã¯åºåãæåã®æå®ã§ãããã©ã«ãã ãšã¿ãåºåãã«ãªãã - </p> - <p> - ãã¡ã€ã«åã«ã¯ <code>-</code> ãæå®ã§ãããã®å Žåã¯æšæºå
¥åããèªã¿èŸŒãã§åºåããã - ãã®ãšã <code>paste - -</code> ã®ããã«è€æ°å <code>-</code> ãæå®ãããšãæå®ããåæ°ã®è¡ããšã«é£çµããããšãã§ããã - äŸãã° <code>ab.txt</code> ã ãšãããªãã - </p> - <codeblock> - <![CDATA[ - $ paste - - < ab.txt - a1 b1 - a2 b2 - a3 b3 - ]]> - </codeblock> - <p> - ããã¯æšæºå
¥åã䜿ããšãç¹æã®æåã§ãåã«åããã¡ã€ã«åãæå®ããŠãããã¯ãªããªãã - </p> - <codeblock> - <![CDATA[ - $ paste ab.txt ab.txt - a1 a1 - b1 b1 - a2 a2 - b2 b2 - a3 a3 - b3 b3 - ]]> - </codeblock> - <p> - ãšãã©ã䟿å©ã - </p> - </section> -</article> diff --git a/vhosts/blog/content/posts/2025-03-28/http-1-1-send-multiple-same-headers.dj b/vhosts/blog/content/posts/2025-03-28/http-1-1-send-multiple-same-headers.dj new file mode 100644 index 00000000..687ddef6 --- /dev/null +++ b/vhosts/blog/content/posts/2025-03-28/http-1-1-send-multiple-same-headers.dj @@ -0,0 +1,102 @@ +--- +[article] +uuid = "046e4412-bee8-4ffe-9876-6cbeaa0caf6b" +title = "ãHTTPãHTTP/1.1 ã§åããããã2åéããšã©ããªãã" +description = "HTTP/1.1 ã§åããããã2åéã£ããšãã®æåã«ã€ããŠä»æ§ãèªãã§ãŸãšããã" +tags = [ + "http", +] + +[[article.revisions]] +date = "2022-08-18" +remark = "ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿã®ç€Ÿå
èšäºãšããŠå
¬é" +isInternal = true + +[[article.revisions]] +date = "2025-03-28" +remark = "ããã°èšäºãšããŠäžè¬å
¬é" +--- +::: note +ãã®èšäºã¯ã2022-08-18 ã« [ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ](https://www.dgcircus.com/) ã®ç€Ÿå
Qiita Team ã«å
¬éãããèšäºãããŒã¹ã«ãå çä¿®æ£ããŠäžè¬å
¬éãããã®ã§ãã +::: + +{#intro} +# ã¯ããã« + +HTTP version 1.1 ã§åãååã®ãããã2åéããšãã©ã®ããã«è§£éãããã®ãã仿§ã確èªããã + +ä»åèªãã 仿§ã¯ RFC 7230 ã§ããã¡ãã®ãªã³ã¯ããé²èЧã§ãã: https://datatracker.ietf.org/doc/html/rfc7230 + +ãã®äžã§ããhttps://datatracker.ietf.org/doc/html/rfc7230#section-3.2.2 ãäž»ã«åŒçšããã + +ãšããã§ãHTTP åšãã®ä»æ§ãæ¢ããšãã¯ããããé£ã¶ãšäŸ¿å©: <https://developer.mozilla.org/en-US/docs/Web/HTTP/Resources_and_specifications> + +{#specification} +# 仿§ + +{#sender} +### éä¿¡åŽ + +> A sender MUST NOT generate multiple header fields with the same field +> name in a message unless either the entire field value for that +> header field is defined as a comma-separated list [i.e., #(values)] +> or the header field is a well-known exception (as noted below). + +ãæ¥æ¬èªèš³ (ç§ãèš³ãããã®ã§ãå
¬åŒãªãã®ã§ã¯ãªã)ã +éä¿¡è
ã¯ãåã field name ã® header field ãè€æ°çæããŠã¯ãªããªã (MUST NOT)ã +ãã ããheader field ã®å€ãã³ã³ãåºåãã®ãªã¹ããšããŠå®çŸ©ãããŠããããheader field ãããç¥ãããäŸå€ (åŸè¿°) ã§ããå Žåã¯ãã®éãã§ãªãã + +{#recipient} +### åä¿¡åŽ + +> A recipient MAY combine multiple header fields with the same field +> name into one "field-name: field-value" pair, without changing the +> semantics of the message, by appending each subsequent field value to +> the combined field value in order, separated by a comma. The order +> in which header fields with the same field name are received is +> therefore significant to the interpretation of the combined field +> value; a proxy MUST NOT change the order of these field values when +> forwarding a message. + +ãæ¥æ¬èªèš³ (ç§ãèš³ãããã®ã§ãå
¬åŒãªãã®ã§ã¯ãªã)ã +åä¿¡è
ã¯ãåã field name ãæã€è€æ°ã® header field ããã¡ãã»ãŒãžã®æå³ãå€ããªãããã«ãã€ã€åãé åºã§è¿œå ããŠãåäžã®ã³ã³ãã§åºåããã `"field-name: field-value"` ã®ãã¢ã«çµåããŠãã (MAY)ã +ãããã£ãŠãåã field name ãæã€ header field ãã©ã®ãããªé åºã§åä¿¡ããããã¯ãçµåãããå€ã®è§£éã«åœ±é¿ããã +ãã£ãŠããããã·ã¯ãã¡ãã»ãŒãžã転éããéãheader field ã®é åºãå€ããŠã¯ãªããªã (MUST NOT)ã + +{#exception} +### äŸå€ã±ãŒã¹: Set-Cookie + +> Note: In practice, the "Set-Cookie" header field ([[RFC6265](https://datatracker.ietf.org/doc/html/rfc6265)]) often +> appears multiple times in a response message and does not use the +> list syntax, violating the above requirements on multiple header +> fields with the same name. Since it cannot be combined into a +> single field-value, recipients ought to handle "Set-Cookie" as a +> special case while processing header fields. (See Appendix A.2.3 +> of [Kri2001] for details.) + +ãæ¥æ¬èªèš³ (ç§ãèš³ãããã®ã§ãå
¬åŒãªãã®ã§ã¯ãªã)ã +泚æ: å®éã«ã¯ã`Set-Cookie` header field ([RFC6265](https://datatracker.ietf.org/doc/html/rfc6265)) ã¯ããã°ãã°ã¬ã¹ãã³ã¹ã¡ãã»ãŒãžäžã«è€æ°åçŸããã +ããã¯ãªã¹ãã®æ§æã䜿ã£ãŠããããäžè¿°ããåã field name ãæã€ header field ã«ã€ããŠã®èŠä»¶ã«éåããŠããã +ãã®å€ã¯åäžã®å€ãžçµåã§ããªããããåä¿¡è
ã¯ãheader field ãåŠçããéã`Set-Cookie` ãç¹å¥æ±ãããæ¹ãããã + +ããããããéä¿¡åŽãã®ãšããã§æžãããŠãããããç¥ãããäŸå€ãã®äžã€ãããã ãšæãããã + +{#comma-separated-list} +### ã©ã® header field ãã³ã³ãåºåãã®ãªã¹ããªã®ã + +äžèšã®ããã«ãåã field name ãæã€ header field ãè€æ°åéãããã©ããã¯ããã® header field ãã³ã³ãåºåãã®ãªã¹ããšããŠå®çŸ©ãããŠãããã©ããã§æ±ºãŸããã§ã¯ãç¹å®ã® header field ããã®æ¡ä»¶ãæºãããŠãããã©ããç¥ããããšãã¯ãäœãèŠãã°ããã®ãã + +HTTP ã®ä»æ§ãšããŠå®çŸ©ãããŠãããã㪠header field ã§ããã°ãäžèšã®ãªã³ã¯ããããããã®å®çŸ©ãåç
§ã§ããã + +* https://datatracker.ietf.org/doc/html/rfc7231#section-5 +* https://datatracker.ietf.org/doc/html/rfc7231#section-7 + +ããã§ãªãå Žå (ããšãã° `X-` ããå§ãŸããã®ç) ã¯ãMDN ãåãã³ãã®ããã¥ã¡ã³ããæ¢ãããšã«ãªãã ããã + +{#outro} +# ãŸãšã + +* éä¿¡åŽ: åºæ¬çã«ã¯è€æ°åéããªããã³ã³ãåºåãã®ãããã¯äŸå€ +* åä¿¡åŽ: åºæ¬çã«ã¯æªèŠå®ãã³ã³ãåºåãã®ãããã¯è€æ°åæ¥ãããã®é ã«çµåãã +* ãããã·: é åºãå€ããŠã¯ãªããªã +* `Set-Cookie` ã¯äŸå€ã±ãŒã¹ diff --git a/vhosts/blog/content/posts/2025-03-28/http-1-1-send-multiple-same-headers.ndoc b/vhosts/blog/content/posts/2025-03-28/http-1-1-send-multiple-same-headers.ndoc deleted file mode 100644 index 8fe1a9b0..00000000 --- a/vhosts/blog/content/posts/2025-03-28/http-1-1-send-multiple-same-headers.ndoc +++ /dev/null @@ -1,120 +0,0 @@ ---- -[article] -uuid = "046e4412-bee8-4ffe-9876-6cbeaa0caf6b" -title = "ãHTTPãHTTP/1.1 ã§åããããã2åéããšã©ããªãã" -description = "HTTP/1.1 ã§åããããã2åéã£ããšãã®æåã«ã€ããŠä»æ§ãèªãã§ãŸãšããã" -tags = [ - "http", -] - -[[article.revisions]] -date = "2022-08-18" -remark = "ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿã®ç€Ÿå
èšäºãšããŠå
¬é" -isInternal = true - -[[article.revisions]] -date = "2025-03-28" -remark = "ããã°èšäºãšããŠäžè¬å
¬é" ---- -<article> - <note> - ãã®èšäºã¯ã2022-08-18 ã«<a href="https://www.dgcircus.com/">ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ</a> ã®ç€Ÿå
Qiita Team ã«å
¬éãããèšäºãããŒã¹ã«ãå çä¿®æ£ããŠäžè¬å
¬éãããã®ã§ãã - </note> - <section id="intro"> - <h>ã¯ããã«</h> - <p> - HTTP version 1.1 ã§åãååã®ãããã2åéããšãã©ã®ããã«è§£éãããã®ãã仿§ã確èªããã - </p> - <p> - ä»åèªãã 仿§ã¯ RFC 7230 ã§ããã¡ãã®ãªã³ã¯ããé²èЧã§ãã: https://datatracker.ietf.org/doc/html/rfc7230 - </p> - <p> - ãã®äžã§ããhttps://datatracker.ietf.org/doc/html/rfc7230#section-3.2.2 ãäž»ã«åŒçšããã - </p> - <p> - ãšããã§ãHTTP åšãã®ä»æ§ãæ¢ããšãã¯ããããé£ã¶ãšäŸ¿å©: https://developer.mozilla.org/en-US/docs/Web/HTTP/Resources_and_specifications - </p> - </section> - <section id="specification"> - <h>仿§</h> - <section id="sender"> - <h>éä¿¡åŽ</h> - <blockquote> - A sender MUST NOT generate multiple header fields with the same field - name in a message unless either the entire field value for that - header field is defined as a comma-separated list [i.e., #(values)] - or the header field is a well-known exception (as noted below). - </blockquote> - <p> - ãæ¥æ¬èªèš³ (ç§ãèš³ãããã®ã§ãå
¬åŒãªãã®ã§ã¯ãªã)ã - éä¿¡è
ã¯ãåã field name ã® header field ãè€æ°çæããŠã¯ãªããªã (MUST NOT)ã - ãã ããheader field ã®å€ãã³ã³ãåºåãã®ãªã¹ããšããŠå®çŸ©ãããŠããããheader field ãããç¥ãããäŸå€ (åŸè¿°) ã§ããå Žåã¯ãã®éãã§ãªãã - </p> - </section> - <section id="recipient"> - <h>åä¿¡åŽ</h> - <blockquote> - A recipient MAY combine multiple header fields with the same field - name into one "field-name: field-value" pair, without changing the - semantics of the message, by appending each subsequent field value to - the combined field value in order, separated by a comma. The order - in which header fields with the same field name are received is - therefore significant to the interpretation of the combined field - value; a proxy MUST NOT change the order of these field values when - forwarding a message. - </blockquote> - <p> - ãæ¥æ¬èªèš³ (ç§ãèš³ãããã®ã§ãå
¬åŒãªãã®ã§ã¯ãªã)ã - åä¿¡è
ã¯ãåã field name ãæã€è€æ°ã® header field ããã¡ãã»ãŒãžã®æå³ãå€ããªãããã«ãã€ã€åãé åºã§è¿œå ããŠãåäžã®ã³ã³ãã§åºåããã <code>"field-name: field-value"</code> ã®ãã¢ã«çµåããŠãã (MAY)ã - ãããã£ãŠãåã field name ãæã€ header field ãã©ã®ãããªé åºã§åä¿¡ããããã¯ãçµåãããå€ã®è§£éã«åœ±é¿ããã - ãã£ãŠããããã·ã¯ãã¡ãã»ãŒãžã転éããéãheader field ã®é åºãå€ããŠã¯ãªããªã (MUST NOT)ã - </p> - </section> - <section id="exception"> - <h>äŸå€ã±ãŒã¹: Set-Cookie</h> - <blockquote> - Note: In practice, the "Set-Cookie" header field ([<a href="https://datatracker.ietf.org/doc/html/rfc6265">RFC6265</a>]) often - appears multiple times in a response message and does not use the - list syntax, violating the above requirements on multiple header - fields with the same name. Since it cannot be combined into a - single field-value, recipients ought to handle "Set-Cookie" as a - special case while processing header fields. (See Appendix A.2.3 - of [Kri2001] for details.) - </blockquote> - <p> - ãæ¥æ¬èªèš³ (ç§ãèš³ãããã®ã§ãå
¬åŒãªãã®ã§ã¯ãªã)ã - 泚æ: å®éã«ã¯ã<code>Set-Cookie</code> header field (<a href="https://datatracker.ietf.org/doc/html/rfc6265">RFC6265</a>) ã¯ããã°ãã°ã¬ã¹ãã³ã¹ã¡ãã»ãŒãžäžã«è€æ°åçŸããã - ããã¯ãªã¹ãã®æ§æã䜿ã£ãŠããããäžè¿°ããåã field name ãæã€ header field ã«ã€ããŠã®èŠä»¶ã«éåããŠããã - ãã®å€ã¯åäžã®å€ãžçµåã§ããªããããåä¿¡è
ã¯ãheader field ãåŠçããéã<code>Set-Cookie</code> ãç¹å¥æ±ãããæ¹ãããã - </p> - <p> - ããããããéä¿¡åŽãã®ãšããã§æžãããŠãããããç¥ãããäŸå€ãã®äžã€ãããã ãšæãããã - </p> - </section> - <section id="comma-separated-list"> - <h>ã©ã® header field ãã³ã³ãåºåãã®ãªã¹ããªã®ã</h> - <p> - äžèšã®ããã«ãåã field name ãæã€ header field ãè€æ°åéãããã©ããã¯ããã® header field ãã³ã³ãåºåãã®ãªã¹ããšããŠå®çŸ©ãããŠãããã©ããã§æ±ºãŸããã§ã¯ãç¹å®ã® header field ããã®æ¡ä»¶ãæºãããŠãããã©ããç¥ããããšãã¯ãäœãèŠãã°ããã®ãã - </p> - <p> - HTTP ã®ä»æ§ãšããŠå®çŸ©ãããŠãããã㪠header field ã§ããã°ãäžèšã®ãªã³ã¯ããããããã®å®çŸ©ãåç
§ã§ããã - </p> - <ul> - <li>https://datatracker.ietf.org/doc/html/rfc7231#section-5</li> - <li>https://datatracker.ietf.org/doc/html/rfc7231#section-7</li> - </ul> - <p> - ããã§ãªãå Žå (ããšãã° <code>X-</code> ããå§ãŸããã®ç) ã¯ãMDN ãåãã³ãã®ããã¥ã¡ã³ããæ¢ãããšã«ãªãã ããã - </p> - </section> - </section> - <section id="outro"> - <h>ãŸãšã</h> - <ul> - <li>éä¿¡åŽ: åºæ¬çã«ã¯è€æ°åéããªããã³ã³ãåºåãã®ãããã¯äŸå€</li> - <li>åä¿¡åŽ: åºæ¬çã«ã¯æªèŠå®ãã³ã³ãåºåãã®ãããã¯è€æ°åæ¥ãããã®é ã«çµåãã</li> - <li>ãããã·: é åºãå€ããŠã¯ãªããªã</li> - <li><code>Set-Cookie</code> ã¯äŸå€ã±ãŒã¹</li> - </ul> - </section> -</article> diff --git a/vhosts/blog/deno.jsonc b/vhosts/blog/deno.jsonc index b0550a5b..55c2fc2e 100644 --- a/vhosts/blog/deno.jsonc +++ b/vhosts/blog/deno.jsonc @@ -1,5 +1,6 @@ { "imports": { + "@djot/djot": "npm:@djot/djot@^0.3.2", "@std/assert": "jsr:@std/assert@^1.0.12", "@std/cli": "jsr:@std/cli@^1.0.15", "@std/fs": "jsr:@std/fs@^1.0.15", diff --git a/vhosts/blog/deno.lock b/vhosts/blog/deno.lock index 300594ba..f9eda6fb 100644 --- a/vhosts/blog/deno.lock +++ b/vhosts/blog/deno.lock @@ -16,6 +16,7 @@ "jsr:@std/path@^1.0.8": "1.0.8", "jsr:@std/streams@^1.0.9": "1.0.9", "jsr:@std/toml@^1.0.3": "1.0.3", + "npm:@djot/djot@~0.3.2": "0.3.2", "npm:shiki@^3.2.1": "3.2.1" }, "jsr": { @@ -85,6 +86,9 @@ } }, "npm": { + "@djot/djot@0.3.2": { + "integrity": "sha512-joMKR24B8rxueyFiJbpZAqEiypjvOyzTxzkhyr0q5mM/sUBaOD3unna/9IxtOotFugViyYlkIRaiXg3xM//zxg==" + }, "@shikijs/core@3.2.1": { "integrity": "sha512-FhsdxMWYu/C11sFisEp7FMGBtX/OSSbnXZDMBhGuUDBNTdsoZlMSgQv5f90rwvzWAdWIW6VobD+G3IrazxA6dQ==", "dependencies": [ @@ -549,6 +553,7 @@ "jsr:@std/http@^1.0.13", "jsr:@std/path@^1.0.8", "jsr:@std/toml@^1.0.3", + "npm:@djot/djot@~0.3.2", "npm:shiki@^3.2.1" ] } diff --git a/vhosts/blog/nuldoc-src/commands/build.ts b/vhosts/blog/nuldoc-src/commands/build.ts index 4702fd0a..52aca1f7 100644 --- a/vhosts/blog/nuldoc-src/commands/build.ts +++ b/vhosts/blog/nuldoc-src/commands/build.ts @@ -2,7 +2,7 @@ import { dirname, join, joinGlobs } from "@std/path"; import { ensureDir, expandGlob } from "@std/fs"; import { generateFeedPageFromEntries } from "../generators/atom.ts"; import { Config, getTagLabel } from "../config.ts"; -import { parseNulDocFile } from "../ndoc/parse.ts"; +import { parseDjotFile } from "../djot/parse.ts"; import { Page } from "../page.ts"; import { render } from "../render.ts"; import { dateToString } from "../revision.ts"; @@ -49,7 +49,7 @@ async function buildPostPages(config: Config): Promise<PostPage[]> { async function collectPostFiles(sourceDir: string): Promise<string[]> { const filePaths = []; - const globPattern = joinGlobs([sourceDir, "**", "*.ndoc"]); + const globPattern = joinGlobs([sourceDir, "**", "*.dj"]); for await (const entry of expandGlob(globPattern)) { filePaths.push(entry.path); } @@ -63,7 +63,7 @@ async function parsePosts( const posts = []; for (const postFile of postFiles) { posts.push( - await generatePostPage(await parseNulDocFile(postFile, config), config), + await generatePostPage(await parseDjotFile(postFile, config), config), ); } return posts; diff --git a/vhosts/blog/nuldoc-src/commands/new.ts b/vhosts/blog/nuldoc-src/commands/new.ts index e694ce20..651c59e6 100644 --- a/vhosts/blog/nuldoc-src/commands/new.ts +++ b/vhosts/blog/nuldoc-src/commands/new.ts @@ -50,7 +50,7 @@ OPTIONS: } function getFilename(type: "post" | "slide"): string { - return type === "post" ? "TODO.ndoc" : "TODO.toml"; + return type === "post" ? "TODO.dj" : "TODO.toml"; } function getDirPath(type: "post" | "slide"): string { @@ -73,14 +73,10 @@ tags = [ date = "${date}" remark = "å
¬é" --- -<article> - <section id="TODO"> - <h>TODO</h> - <p> - TODO - </p> - </section> -</article> +{#TODO} +# TODO + +TODO `; } else { return `[slide] diff --git a/vhosts/blog/nuldoc-src/djot/djot2ndoc.ts b/vhosts/blog/nuldoc-src/djot/djot2ndoc.ts new file mode 100644 index 00000000..d1559f2f --- /dev/null +++ b/vhosts/blog/nuldoc-src/djot/djot2ndoc.ts @@ -0,0 +1,834 @@ +import { + Block as DjotBlock, + BlockQuote as DjotBlockQuote, + BulletList as DjotBulletList, + CodeBlock as DjotCodeBlock, + Definition as DjotDefinition, + DefinitionList as DjotDefinitionList, + DefinitionListItem as DjotDefinitionListItem, + Delete as DjotDelete, + DisplayMath as DjotDisplayMath, + Div as DjotDiv, + Doc as DjotDoc, + DoubleQuoted as DjotDoubleQuoted, + Email as DjotEmail, + Emph as DjotEmph, + FootnoteReference as DjotFootnoteReference, + HardBreak as DjotHardBreak, + Heading as DjotHeading, + Image as DjotImage, + Inline as DjotInline, + InlineMath as DjotInlineMath, + Insert as DjotInsert, + Link as DjotLink, + ListItem as DjotListItem, + Mark as DjotMark, + NonBreakingSpace as DjotNonBreakingSpace, + OrderedList as DjotOrderedList, + Para as DjotPara, + RawBlock as DjotRawBlock, + RawInline as DjotRawInline, + Section as DjotSection, + SingleQuoted as DjotSingleQuoted, + SmartPunctuation as DjotSmartPunctuation, + SoftBreak as DjotSoftBreak, + Span as DjotSpan, + Str as DjotStr, + Strong as DjotStrong, + Subscript as DjotSubscript, + Superscript as DjotSuperscript, + Symb as DjotSymb, + Table as DjotTable, + TaskList as DjotTaskList, + TaskListItem as DjotTaskListItem, + Term as DjotTerm, + ThematicBreak as DjotThematicBreak, + Url as DjotUrl, + Verbatim as DjotVerbatim, +} from "@djot/djot"; +import { Element, Node } from "../dom.ts"; + +function processBlock(node: DjotBlock): Element { + switch (node.tag) { + case "section": + return processSection(node); + case "para": + return processPara(node); + case "heading": + return processHeading(node); + case "thematic_break": + return processThematicBreak(node); + case "block_quote": + return processBlockQuote(node); + case "code_block": + return processCodeBlock(node); + case "bullet_list": + return processBulletList(node); + case "ordered_list": + return processOrderedList(node); + case "task_list": + return processTaskList(node); + case "definition_list": + return processDefinitionList(node); + case "table": + return processTable(node); + case "div": + return processDiv(node); + case "raw_block": + return processRawBlock(node); + } +} + +function processSection(node: DjotSection): Element { + return { + kind: "element", + name: "section", + attributes: convertAttributes(node.attributes), + children: node.children.map(processBlock), + }; +} + +function processPara(node: DjotPara): Element { + return { + kind: "element", + name: "p", + attributes: convertAttributes(node.attributes), + children: node.children.map(processInline), + }; +} + +function processHeading(node: DjotHeading): Element { + const attributes = convertAttributes(node.attributes); + return { + kind: "element", + name: "h", + attributes, + children: node.children.map(processInline), + }; +} + +function processThematicBreak(node: DjotThematicBreak): Element { + return { + kind: "element", + name: "hr", + attributes: convertAttributes(node.attributes), + children: [], + }; +} + +function processBlockQuote(node: DjotBlockQuote): Element { + return { + kind: "element", + name: "blockquote", + attributes: convertAttributes(node.attributes), + children: node.children.map(processBlock), + }; +} + +function processCodeBlock(node: DjotCodeBlock): Element { + const attributes = convertAttributes(node.attributes); + if (node.lang) { + attributes.set("language", node.lang); + } + return { + kind: "element", + name: "codeblock", + attributes, + children: [ + { + kind: "text", + content: node.text, + raw: false, + }, + ], + }; +} + +function processBulletList(node: DjotBulletList): Element { + const attributes = convertAttributes(node.attributes); + attributes.set("--tight", node.tight ? "true" : "false"); + return { + kind: "element", + name: "ul", + attributes, + children: node.children.map(processListItem), + }; +} + +function processOrderedList(node: DjotOrderedList): Element { + const attributes = convertAttributes(node.attributes); + attributes.set("--tight", node.tight ? "true" : "false"); + if (node.start !== undefined && node.start !== 1) { + attributes.set("start", node.start.toString()); + } + return { + kind: "element", + name: "ol", + attributes, + children: node.children.map(processListItem), + }; +} + +function processTaskList(node: DjotTaskList): Element { + const attributes = convertAttributes(node.attributes); + attributes.set("type", "task"); + attributes.set("--tight", node.tight ? "true" : "false"); + return { + kind: "element", + name: "ul", + attributes, + children: node.children.map(processTaskListItem), + }; +} + +function processListItem(node: DjotListItem): Element { + return { + kind: "element", + name: "li", + attributes: convertAttributes(node.attributes), + children: node.children.map(processBlock), + }; +} + +function processTaskListItem(node: DjotTaskListItem): Element { + const attributes = convertAttributes(node.attributes); + attributes.set("checked", node.checkbox === "checked" ? "true" : "false"); + return { + kind: "element", + name: "li", + attributes, + children: node.children.map(processBlock), + }; +} + +function processDefinitionList(node: DjotDefinitionList): Element { + return { + kind: "element", + name: "dl", + attributes: convertAttributes(node.attributes), + children: node.children.flatMap(processDefinitionListItem), + }; +} + +function processDefinitionListItem(node: DjotDefinitionListItem): Element[] { + return [ + processTerm(node.children[0]), + processDefinition(node.children[1]), + ]; +} + +function processTerm(node: DjotTerm): Element { + return { + kind: "element", + name: "dt", + attributes: convertAttributes(node.attributes), + children: node.children.map(processInline), + }; +} + +function processDefinition(node: DjotDefinition): Element { + return { + kind: "element", + name: "dd", + attributes: convertAttributes(node.attributes), + children: node.children.map(processBlock), + }; +} + +function processTable(node: DjotTable): Element { + // Tables in Djot have a caption as first child and then rows + // For now, we'll create a basic table structure and ignore caption + const tableElement: Element = { + kind: "element", + name: "table", + attributes: convertAttributes(node.attributes), + children: [], + }; + + // Process caption if it exists (first child) + if (node.children.length > 0 && node.children[0].tag === "caption") { + const caption: Element = { + kind: "element", + name: "caption", + attributes: new Map(), + children: node.children[0].children.map(processInline), + }; + tableElement.children.push(caption); + } + + // Group rows into thead, tbody based on head property + const headerRows: Element[] = []; + const bodyRows: Element[] = []; + + // Start from index 1 to skip caption + for (let i = 1; i < node.children.length; i++) { + const row = node.children[i]; + if (row.tag === "row") { + const rowElement: Element = { + kind: "element", + name: "tr", + attributes: convertAttributes(row.attributes), + children: row.children.map((cell) => { + const cellElement: Element = { + kind: "element", + name: cell.head ? "th" : "td", + attributes: convertAttributes(cell.attributes), + children: cell.children.map(processInline), + }; + + // Set alignment attribute if needed + if (cell.align !== "default") { + cellElement.attributes.set("align", cell.align); + } + + return cellElement; + }), + }; + + if (row.head) { + headerRows.push(rowElement); + } else { + bodyRows.push(rowElement); + } + } + } + + // Add thead and tbody if needed + if (headerRows.length > 0) { + tableElement.children.push({ + kind: "element", + name: "thead", + attributes: new Map(), + children: headerRows, + }); + } + + if (bodyRows.length > 0) { + tableElement.children.push({ + kind: "element", + name: "tbody", + attributes: new Map(), + children: bodyRows, + }); + } + + return tableElement; +} + +function processInline(node: DjotInline): Node { + switch (node.tag) { + case "str": + return processStr(node); + case "soft_break": + return processSoftBreak(node); + case "hard_break": + return processHardBreak(node); + case "verbatim": + return processVerbatim(node); + case "emph": + return processEmph(node); + case "strong": + return processStrong(node); + case "link": + return processLink(node); + case "image": + return processImage(node); + case "mark": + return processMark(node); + case "superscript": + return processSuperscript(node); + case "subscript": + return processSubscript(node); + case "insert": + return processInsert(node); + case "delete": + return processDelete(node); + case "email": + return processEmail(node); + case "footnote_reference": + return processFootnoteReference(node); + case "url": + return processUrl(node); + case "span": + return processSpan(node); + case "inline_math": + return processInlineMath(node); + case "display_math": + return processDisplayMath(node); + case "non_breaking_space": + return processNonBreakingSpace(node); + case "symb": + return processSymb(node); + case "raw_inline": + return processRawInline(node); + case "double_quoted": + return processDoubleQuoted(node); + case "single_quoted": + return processSingleQuoted(node); + case "smart_punctuation": + return processSmartPunctuation(node); + } +} + +function processStr(node: DjotStr): Node { + return { + kind: "text", + content: node.text, + raw: false, + }; +} + +function processSoftBreak(_node: DjotSoftBreak): Node { + return { + kind: "text", + content: "\n", + raw: false, + }; +} + +function processHardBreak(_node: DjotHardBreak): Node { + return { + kind: "element", + name: "br", + attributes: new Map(), + children: [], + }; +} + +function processVerbatim(node: DjotVerbatim): Element { + return { + kind: "element", + name: "code", + attributes: convertAttributes(node.attributes), + children: [ + { + kind: "text", + content: node.text, + raw: false, + }, + ], + }; +} + +function processEmph(node: DjotEmph): Element { + return { + kind: "element", + name: "em", + attributes: convertAttributes(node.attributes), + children: node.children.map(processInline), + }; +} + +function processStrong(node: DjotStrong): Element { + return { + kind: "element", + name: "strong", + attributes: convertAttributes(node.attributes), + children: node.children.map(processInline), + }; +} + +function processLink(node: DjotLink): Element { + const attributes = convertAttributes(node.attributes); + if (node.destination !== undefined) { + attributes.set("href", node.destination); + } + return { + kind: "element", + name: "a", + attributes, + children: node.children.map(processInline), + }; +} + +function processImage(node: DjotImage): Element { + const attributes = convertAttributes(node.attributes); + if (node.destination !== undefined) { + attributes.set("src", node.destination); + } + + // Alt text is derived from children in Djot + const alt = node.children + .map((child) => { + if (child.tag === "str") { + return child.text; + } + return ""; + }) + .join(""); + + if (alt) { + attributes.set("alt", alt); + } + + return { + kind: "element", + name: "img", + attributes, + children: [], + }; +} + +function processMark(node: DjotMark): Element { + return { + kind: "element", + name: "mark", + attributes: convertAttributes(node.attributes), + children: node.children.map(processInline), + }; +} + +function processSuperscript(node: DjotSuperscript): Element { + return { + kind: "element", + name: "sup", + attributes: convertAttributes(node.attributes), + children: node.children.map(processInline), + }; +} + +function processSubscript(node: DjotSubscript): Element { + return { + kind: "element", + name: "sub", + attributes: convertAttributes(node.attributes), + children: node.children.map(processInline), + }; +} + +function processInsert(node: DjotInsert): Element { + return { + kind: "element", + name: "ins", + attributes: convertAttributes(node.attributes), + children: node.children.map(processInline), + }; +} + +function processDelete(node: DjotDelete): Element { + return { + kind: "element", + name: "del", + attributes: convertAttributes(node.attributes), + children: node.children.map(processInline), + }; +} + +function processEmail(node: DjotEmail): Element { + return { + kind: "element", + name: "email", + attributes: convertAttributes(node.attributes), + children: [ + { + kind: "text", + content: node.text, + raw: false, + }, + ], + }; +} + +function processFootnoteReference(node: DjotFootnoteReference): Node { + void node; + // TODO + return { + kind: "text", + content: "", + raw: false, + }; + // return { + // kind: "element", + // name: "footnoteref", + // attributes: new Map([["reference", node.text]]), + // children: [], + // }; +} + +function processUrl(node: DjotUrl): Element { + return { + kind: "element", + name: "a", + attributes: new Map([ + ["href", node.text], + ...Object.entries(node.attributes || {}), + ]), + children: [ + { + kind: "text", + content: node.text, + raw: false, + }, + ], + }; +} + +function processSpan(node: DjotSpan): Element { + return { + kind: "element", + name: "span", + attributes: convertAttributes(node.attributes), + children: node.children.map(processInline), + }; +} + +function processInlineMath(node: DjotInlineMath): Element { + // For inline math, we'll wrap it in a span with a class + return { + kind: "element", + name: "span", + attributes: new Map([ + ["class", "math inline"], + ...Object.entries(node.attributes || {}), + ]), + children: [ + { + kind: "text", + content: node.text, + raw: false, + }, + ], + }; +} + +function processDisplayMath(node: DjotDisplayMath): Element { + // For display math, we'll wrap it in a div with a class + return { + kind: "element", + name: "div", + attributes: new Map([ + ["class", "math display"], + ...Object.entries(node.attributes || {}), + ]), + children: [ + { + kind: "text", + content: node.text, + raw: false, + }, + ], + }; +} + +function processNonBreakingSpace(_node: DjotNonBreakingSpace): Node { + return { + kind: "text", + content: "\u00A0", // Unicode non-breaking space + raw: false, + }; +} + +function processSymb(node: DjotSymb): Node { + // Map symbol aliases to their Unicode characters + const symbolMap: Record<string, string> = { + "->": "â", + "<-": "â", + "<->": "â", + "=>": "â", + "<=": "â", + "<=>": "â", + "--": "â", // en dash + "---": "â", // em dash + "...": "âŠ", // ellipsis + // Add more symbol mappings as needed + }; + + const symbolText = symbolMap[node.alias] || node.alias; + + return { + kind: "text", + content: symbolText, + raw: false, + }; +} + +function processRawInline(node: DjotRawInline): Node { + // If the format is HTML, return as raw HTML + if (node.format === "html" || node.format === "HTML") { + return { + kind: "text", + content: node.text, + raw: true, + }; + } + + // For other formats, just return as text + return { + kind: "text", + content: node.text, + raw: false, + }; +} + +function processDoubleQuoted(node: DjotDoubleQuoted): Node { + const children = node.children.map(processInline); + const attributes = convertAttributes(node.attributes); + + if ( + children.length === 1 && children[0].kind === "text" && + attributes.size === 0 + ) { + const content = children[0].content; + return { + kind: "text", + content: `\u201C${content}\u201D`, + raw: false, + }; + } else { + return { + kind: "element", + name: "span", + attributes: convertAttributes(node.attributes), + children, + }; + } +} + +function processSingleQuoted(node: DjotSingleQuoted): Node { + const children = node.children.map(processInline); + const attributes = convertAttributes(node.attributes); + + if ( + children.length === 1 && children[0].kind === "text" && + attributes.size === 0 + ) { + const content = children[0].content; + return { + kind: "text", + content: `\u2018${content}\u2019`, + raw: false, + }; + } else { + return { + kind: "element", + name: "span", + attributes: convertAttributes(node.attributes), + children, + }; + } +} + +function processSmartPunctuation(node: DjotSmartPunctuation): Node { + // Map smart punctuation types to Unicode characters + const punctuationMap: Record<string, string> = { + "left_single_quote": "\u2018", // ' + "right_single_quote": "\u2019", // ' + "left_double_quote": "\u201C", // " + "right_double_quote": "\u201D", // " + "ellipses": "\u2026", // ⊠+ "em_dash": "\u2014", // â + "en_dash": "\u2013", // â + }; + + return { + kind: "text", + content: punctuationMap[node.type] || node.text, + raw: false, + }; +} + +function processDiv(node: DjotDiv): Element { + if (node.attributes?.class === "note") { + delete node.attributes.class; + return { + kind: "element", + name: "note", + attributes: convertAttributes(node.attributes), + children: node.children.map(processBlock), + }; + } + + return { + kind: "element", + name: "div", + attributes: convertAttributes(node.attributes), + children: node.children.map(processBlock), + }; +} + +function processRawBlock(node: DjotRawBlock): Element { + // If the format is HTML, wrap the HTML content in a div + if (node.format === "html" || node.format === "HTML") { + return { + kind: "element", + name: "div", + attributes: new Map([["class", "raw-html"]]), + children: [ + { + kind: "text", + content: node.text, + raw: true, + }, + ], + }; + } + + // For other formats, wrap in a pre tag + return { + kind: "element", + name: "pre", + attributes: new Map([["data-format", node.format]]), + children: [ + { + kind: "text", + content: node.text, + raw: false, + }, + ], + }; +} + +// Helper function to convert Djot attributes to Nuldoc attributes +function convertAttributes( + attrs?: Record<string, string>, +): Map<string, string> { + const result = new Map<string, string>(); + if (attrs) { + for (const [key, value] of Object.entries(attrs)) { + result.set(key, value); + } + } + return result; +} + +export function djot2ndoc(doc: DjotDoc): Element { + const children: Node[] = []; + for (const child of doc.children) { + children.push(processBlock(child)); + } + + // Process footnotes if any exist + if (doc.footnotes && Object.keys(doc.footnotes).length > 0) { + // TODO + // const footnoteSection: Element = { + // kind: "element", + // name: "section", + // attributes: new Map([["class", "footnotes"]]), + // children: [], + // }; + // + // for (const [id, footnote] of Object.entries(doc.footnotes)) { + // const footnoteElement: Element = { + // kind: "element", + // name: "footnote", + // attributes: new Map([["id", id]]), + // children: footnote.children.map(processBlock), + // }; + // footnoteSection.children.push(footnoteElement); + // } + // + // children.push(footnoteSection); + } + + return { + kind: "element", + name: "__root__", + attributes: new Map(), + children: [{ + kind: "element", + name: "article", + attributes: new Map(), + children, + }], + }; +} diff --git a/vhosts/blog/nuldoc-src/ndoc/document.ts b/vhosts/blog/nuldoc-src/djot/document.ts index dfb6d03b..be9c08d5 100644 --- a/vhosts/blog/nuldoc-src/ndoc/document.ts +++ b/vhosts/blog/nuldoc-src/djot/document.ts @@ -1,9 +1,10 @@ +import { Doc as DjotDoc } from "@djot/djot"; import { join } from "@std/path"; +import { z } from "zod/mod.ts"; import { Config } from "../config.ts"; -import { NuldocError } from "../errors.ts"; +import { Element } from "../dom.ts"; import { Revision, stringToDate } from "../revision.ts"; -import { Element, findFirstChildElement } from "../dom.ts"; -import { z } from "zod/mod.ts"; +import { djot2ndoc } from "./djot2ndoc.ts"; export const PostMetadataSchema = z.object({ article: z.object({ @@ -32,25 +33,18 @@ export type Document = { revisions: Revision[]; }; -export function createNewDocumentFromRootElement( - root: Element, +export function createNewDocumentFromDjotDocument( + root: DjotDoc, meta: PostMetadata, sourceFilePath: string, config: Config, ): Document { - const article = findFirstChildElement(root, "article"); - if (!article) { - throw new NuldocError( - `[nuldoc.new] <article> element not found`, - ); - } - const cwd = Deno.cwd(); const contentDir = join(cwd, config.locations.contentDir); const link = sourceFilePath.replace(contentDir, "").replace(".xml", "/"); return { - root: root, - sourceFilePath: sourceFilePath, + root: djot2ndoc(root), + sourceFilePath, uuid: meta.article.uuid, link: link, title: meta.article.title, diff --git a/vhosts/blog/nuldoc-src/ndoc/parse.ts b/vhosts/blog/nuldoc-src/djot/parse.ts index 4bb96f4d..884ab154 100644 --- a/vhosts/blog/nuldoc-src/ndoc/parse.ts +++ b/vhosts/blog/nuldoc-src/djot/parse.ts @@ -1,15 +1,15 @@ +import { parse as parseDjot } from "@djot/djot"; import { parse as parseToml } from "@std/toml"; import { Config } from "../config.ts"; -import { parseXmlString } from "../xml.ts"; import { - createNewDocumentFromRootElement, + createNewDocumentFromDjotDocument, Document, PostMetadata, PostMetadataSchema, } from "./document.ts"; import toHtml from "./to_html.ts"; -export async function parseNulDocFile( +export async function parseDjotFile( filePath: string, config: Config, ): Promise<Document> { @@ -17,8 +17,8 @@ export async function parseNulDocFile( const fileContent = await Deno.readTextFile(filePath); const parts = fileContent.split(/^---$/m); const meta = parseMetadata(parts[1]); - const root = parseXmlString("<?xml ?>" + parts[2]); - const doc = createNewDocumentFromRootElement(root, meta, filePath, config); + const root = parseDjot(parts[2]); + const doc = createNewDocumentFromDjotDocument(root, meta, filePath, config); return await toHtml(doc); } catch (e) { if (e instanceof Error) { diff --git a/vhosts/blog/nuldoc-src/ndoc/to_html.ts b/vhosts/blog/nuldoc-src/djot/to_html.ts index a82f0333..5ee76023 100644 --- a/vhosts/blog/nuldoc-src/ndoc/to_html.ts +++ b/vhosts/blog/nuldoc-src/djot/to_html.ts @@ -22,6 +22,7 @@ export default async function toHtml(doc: Document): Promise<Document> { addAttributesToExternalLinkElement(doc); setDefaultLangAttribute(doc); traverseFootnotes(doc); + removeUnnecessaryParagraphNode(doc); await transformAndHighlightCodeBlockElement(doc); return doc; } @@ -266,6 +267,33 @@ function traverseFootnotes(doc: Document) { }); } +function removeUnnecessaryParagraphNode(doc: Document) { + forEachChildRecursively(doc.root, (n) => { + if (n.kind !== "element" || (n.name !== "ul" && n.name !== "ol")) { + return; + } + + const isTight = n.attributes.get("--tight") === "true"; + if (!isTight) { + return; + } + + for (const child of n.children) { + if (child.kind !== "element" || child.name !== "li") { + continue; + } + if (child.children.length !== 1) { + continue; + } + const grandChild = child.children[0]; + if (grandChild.kind !== "element" || grandChild.name !== "p") { + continue; + } + child.children = grandChild.children; + } + }); +} + async function transformAndHighlightCodeBlockElement(doc: Document) { await forEachChildRecursivelyAsync(doc.root, async (n) => { if (n.kind !== "element" || n.name !== "codeblock") { @@ -274,7 +302,7 @@ async function transformAndHighlightCodeBlockElement(doc: Document) { const language = n.attributes.get("language") || "text"; const sourceCodeNode = n.children[0] as Text | RawHTML; - const sourceCode = sourceCodeNode.content; + const sourceCode = sourceCodeNode.content.trimEnd(); const highlighted = await codeToHtml(sourceCode, { lang: language in bundledLanguages ? language as BundledLanguage : "text", diff --git a/vhosts/blog/nuldoc-src/generators/post.ts b/vhosts/blog/nuldoc-src/generators/post.ts index ae96c573..0e2a9553 100644 --- a/vhosts/blog/nuldoc-src/generators/post.ts +++ b/vhosts/blog/nuldoc-src/generators/post.ts @@ -2,7 +2,7 @@ import { join } from "@std/path"; import { renderToDOM } from "../jsx/render.ts"; import PostPage from "../pages/PostPage.tsx"; import { Config } from "../config.ts"; -import { Document } from "../ndoc/document.ts"; +import { Document } from "../djot/document.ts"; import { Page } from "../page.ts"; import { Date, Revision } from "../revision.ts"; @@ -44,7 +44,7 @@ export async function generatePostPage( const cwd = Deno.cwd(); const contentDir = join(cwd, config.locations.contentDir); const destFilePath = join( - doc.sourceFilePath.replace(contentDir, "").replace(".ndoc", ""), + doc.sourceFilePath.replace(contentDir, "").replace(".dj", ""), "index.html", ); return { diff --git a/vhosts/blog/nuldoc-src/pages/PostPage.tsx b/vhosts/blog/nuldoc-src/pages/PostPage.tsx index e6aa83aa..37755ae3 100644 --- a/vhosts/blog/nuldoc-src/pages/PostPage.tsx +++ b/vhosts/blog/nuldoc-src/pages/PostPage.tsx @@ -3,7 +3,7 @@ import GlobalHeader from "../components/GlobalHeader.tsx"; import PageLayout from "../components/PageLayout.tsx"; import { Config, getTagLabel } from "../config.ts"; import { Element } from "../dom.ts"; -import { Document } from "../ndoc/document.ts"; +import { Document } from "../djot/document.ts"; import { dateToString } from "../revision.ts"; import { getPostPublishedDate } from "../generators/post.ts"; diff --git a/vhosts/blog/nuldoc-src/renderers/html.ts b/vhosts/blog/nuldoc-src/renderers/html.ts index 19e6af08..ec77eb4d 100644 --- a/vhosts/blog/nuldoc-src/renderers/html.ts +++ b/vhosts/blog/nuldoc-src/renderers/html.ts @@ -89,6 +89,8 @@ function getDtd(name: string): Dtd { return { type: "inline" }; case "strong": return { type: "inline" }; + case "sub": + return { type: "inline" }; case "sup": return { type: "inline" }; case "table": diff --git a/vhosts/blog/nuldoc-src/xml.ts b/vhosts/blog/nuldoc-src/xml.ts deleted file mode 100644 index 9f53ef8c..00000000 --- a/vhosts/blog/nuldoc-src/xml.ts +++ /dev/null @@ -1,265 +0,0 @@ -import { Element, Node, Text } from "./dom.ts"; -import { XmlParseError } from "./errors.ts"; - -export function parseXmlString(source: string): Element { - return parse({ source: source, index: 0 }); -} - -type Parser = { - source: string; - index: number; -}; - -function parse(p: Parser): Element { - parseXmlDeclaration(p); - skipWhitespaces(p); - const e = parseXmlElement(p); - const root: Element = { - kind: "element", - name: "__root__", - attributes: new Map(), - children: [e], - }; - return root; -} - -function parseXmlDeclaration(p: Parser) { - expect(p, "<?xml "); - skipTo(p, "?>"); - next(p, 2); -} - -function parseXmlElement(p: Parser): Element { - const { name, attributes, closed } = parseStartTag(p); - if (closed) { - return { - kind: "element", - name: name, - attributes: attributes, - children: [], - }; - } - const children = parseChildNodes(p); - parseEndTag(p, name); - - const thisElement: Element = { - kind: "element", - name: name, - attributes: attributes, - children: children, - }; - return thisElement; -} - -function parseChildNodes(p: Parser): Node[] { - const nodes = []; - while (true) { - const c = peek(p); - const c2 = peekN(p, 2); - const c3 = peekN(p, 3); - if (c === "<") { - if (c2 === "/") { - break; - } else if (c2 === "!") { - if (c3 === "[") { - // <![CDATA[ - nodes.push(parseCdata(p)); - } else { - // <!-- - skipComment(p); - } - } else { - nodes.push(parseXmlElement(p)); - } - } else { - nodes.push(parseTextNode(p)); - } - } - return nodes; -} - -function parseTextNode(p: Parser): Text { - const content = skipTo(p, "<"); - return { - kind: "text", - content: replaceEntityReferences(content), - raw: false, - }; -} - -function parseCdata(p: Parser): Text { - expect(p, "<![CDATA["); - const content = skipTo(p, "]]>"); - next(p, "]]>".length); - return { - kind: "text", - content: formatCdata(content), - raw: false, - }; -} - -function skipComment(p: Parser) { - expect(p, "<!--"); - skipTo(p, "-->"); - next(p, "-->".length); -} - -function formatCdata(s: string): string { - // <![CDATA[ - // foo - // bar - // baz - // ]]> - // => "foo\n bar\nbaz" - s = s.replace(/^\n(.*)\n *$/s, "$1"); - const ls = s.split("\n"); - const n = Math.min( - ...ls.filter((l) => l !== "").map((l) => - l.match(/^( *)/)?.[0]?.length ?? 0 - ), - ); - let z = ""; - for (const p of s.split("\n")) { - z += p.slice(n) + "\n"; - } - return z.slice(0, -1); -} - -function parseStartTag( - p: Parser, -): { name: string; attributes: Map<string, string>; closed: boolean } { - expect(p, "<"); - const name = parseIdentifier(p); - skipWhitespaces(p); - if (peek(p) === "/") { - expect(p, "/>"); - return { name: name, attributes: new Map(), closed: true }; - } - if (peek(p) === ">") { - next(p); - return { name: name, attributes: new Map(), closed: false }; - } - const attributes = new Map(); - while (peek(p) !== ">" && peek(p) !== "/") { - const { name, value } = parseAttribute(p); - attributes.set(name, value); - } - let closed = false; - if (peek(p) === "/") { - next(p); - closed = true; - } - expect(p, ">"); - return { name: name, attributes: attributes, closed: closed }; -} - -function parseEndTag(p: Parser, name: string) { - expect(p, `</${name}>`); -} - -function parseAttribute(p: Parser): { name: string; value: string } { - skipWhitespaces(p); - let name = parseIdentifier(p); - if (peek(p) === ":") { - next(p); - const name2 = parseIdentifier(p); - name += ":" + name2; - } - expect(p, "="); - const value = parseQuotedString(p); - skipWhitespaces(p); - return { name: name, value: replaceEntityReferences(value) }; -} - -function parseQuotedString(p: Parser): string { - expect(p, '"'); - const content = skipTo(p, '"'); - next(p); - return content; -} - -function parseIdentifier(p: Parser): string { - let id = ""; - while (p.index < p.source.length) { - const c = peek(p); - if (!c || !/[A-Za-z]/.test(c)) { - break; - } - id += c; - next(p); - } - return id; -} - -function expect(p: Parser, expected: string) { - let actual = ""; - for (let i = 0; i < expected.length; i++) { - actual += peek(p); - next(p); - } - if (actual !== expected) { - throw new XmlParseError( - `[parse.expect] expected ${expected}, but actually got ${ - escapeForHuman(actual) - } (pos: ${p.index})`, - ); - } -} - -function skipTo(p: Parser, delimiter: string): string { - const indexStart = p.index; - let i = 0; - while (i < delimiter.length) { - if (peek(p) === delimiter[i]) { - i++; - } else { - i = 0; - } - next(p); - } - back(p, delimiter.length); - return p.source.substring(indexStart, p.index); -} - -function skipWhitespaces(p: Parser) { - while (p.index < p.source.length) { - const c = peek(p); - if (!c || !/[ \n\t]/.test(c)) { - break; - } - next(p); - } -} - -function peek(p: Parser): string | null { - return peekN(p, 1); -} - -function peekN(p: Parser, n: number): string | null { - return (p.index + n - 1 < p.source.length) ? p.source[p.index + n - 1] : null; -} - -function next(p: Parser, n = 1) { - p.index += n; -} - -function back(p: Parser, n = 1) { - p.index -= n; -} - -function replaceEntityReferences(s: string): string { - return s - .replaceAll(/&/g, "&") - .replaceAll(/</g, "<") - .replaceAll(/>/g, ">") - .replaceAll(/'/g, "'") - .replaceAll(/"/g, '"'); -} - -function escapeForHuman(s: string): string { - // support more characters? - return s - .replaceAll("\n", "\\n") - .replaceAll("\t", "\\t") - .replaceAll("\r", "\\r"); -} diff --git a/vhosts/blog/nuldoc-src/xml_test.ts b/vhosts/blog/nuldoc-src/xml_test.ts deleted file mode 100644 index c423800e..00000000 --- a/vhosts/blog/nuldoc-src/xml_test.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { assertEquals } from "@std/assert"; -import { parseXmlString } from "./xml.ts"; - -Deno.test("Parse XML", () => { - assertEquals( - "__root__", - parseXmlString( - `<?xml version="1.0" encoding="UTF-8"?> -<hoge> - <piyo> - <!-- comment --> - </piyo> -</hoge> -`, - ).name, - ); -}); diff --git a/vhosts/blog/public/posts/2021-03-05/my-first-post/index.html b/vhosts/blog/public/posts/2021-03-05/my-first-post/index.html index 9170e5f2..74c846cc 100644 --- a/vhosts/blog/public/posts/2021-03-05/my-first-post/index.html +++ b/vhosts/blog/public/posts/2021-03-05/my-first-post/index.html @@ -52,9 +52,9 @@ </ol> </section> <section id="section--test"> - <h2><a href="#section--test">Test</a></h2> + <h2><a href="#section--test">Test</a></h2> <p> - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </p> </section> </div> diff --git a/vhosts/blog/public/posts/2021-03-30/phperkaigi-2021/index.html b/vhosts/blog/public/posts/2021-03-30/phperkaigi-2021/index.html index 9f0c381d..18d88c22 100644 --- a/vhosts/blog/public/posts/2021-03-30/phperkaigi-2021/index.html +++ b/vhosts/blog/public/posts/2021-03-30/phperkaigi-2021/index.html @@ -67,171 +67,141 @@ </ol> </section> <section id="section--report"> - <h2><a href="#section--report">PHPerKaigi 2021 åå ã¬ã</a></h2> + <h2><a href="#section--report">PHPerKaigi 2021 åå ã¬ã</a></h2> <p> - 2021-03-26 ãã 2021-03-28 ã«ãããŠéå¬ãããã <a href="https://phperkaigi.jp/2021/" rel="noreferrer" target="_blank">PHPerKaigi 2021</a> ã«äžè¬åå è
ãšããŠåå ãããåŒç€Ÿ <a href="https://www.dgcircus.com/" rel="noreferrer" target="_blank">ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ</a> (ä»å¹Ž1æããå€å) ã¯ãã€ã€ã¢ã³ãã¹ãã³ãµãŒãšãªã£ãŠãããã¹ãã³ãµãŒæ ã®ãã±ããã䜿ãããŠããã ããã + 2021-03-26 ãã 2021-03-28 ã«ãããŠéå¬ãããã<a href="https://phperkaigi.jp/2021/" rel="noreferrer" target="_blank">PHPerKaigi 2021</a> ã«äžè¬åå è
ãšããŠåå ããã åŒç€Ÿ<a href="https://www.dgcircus.com/" rel="noreferrer" target="_blank">ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ</a> (ä»å¹Ž1æããå€å) ã¯ãã€ã€ã¢ã³ãã¹ãã³ãµãŒãšãªã£ãŠãããã¹ãã³ãµãŒæ ã®ãã±ããã䜿ãããŠããã ããã </p> - <p> - ãã®ãããªã«ã³ãã¡ã¬ã³ã¹ã«ã¯åããŠåå ããã®ã§ãããŠããå¿åŸ
ã¡ã«ããŠããã®ã ããçæ2æ¥ç®ããäœèª¿ã厩ããŠããŸãããã®èšäºãéäžãŸã§ãšãªã£ãŠããããŸã èŠãŠããªãã»ãã·ã§ã³ãå€ãããã²ãšãŸãçŸæç¹ã§ã®åå ã¬ããæžããŠããã + ãã®ãããªã«ã³ãã¡ã¬ã³ã¹ã«ã¯åããŠåå ããã®ã§ãããŠããå¿åŸ
ã¡ã«ããŠããã®ã ããçæ2æ¥ç®ããäœèª¿ã厩ããŠããŸãããã®èšäºãéäžãŸã§ãšãªã£ãŠããããŸã èŠãŠããªãã»ãã·ã§ã³ãå€ãããã²ãšãŸãçŸæç¹ã§ã®åå ã¬ããæžããŠããã </p> - <p> - çºè¡šã¯ãã©ã㯠AãB ã«åãããŠããã®ã ããä»åã¯ãã¹ãŠ A ãã©ãã¯ãèŠèŽããŠãã (åãæ¿ããã®ãé¢åã ã£ãã ã)ã + çºè¡šã¯ãã©ã㯠AãB ã«åãããŠããã®ã ããä»åã¯ãã¹ãŠ A ãã©ãã¯ãèŠèŽããŠãã (åãæ¿ããã®ãé¢åã ã£ãã ã)ã </p> - <section id="section--report--day-0"> - <h3><a href="#section--report--day-0">Day 0 åå€ç¥ (2021/03/27)</a></h3> + <h3><a href="#section--report--day-0">Day 0 åå€ç¥ (2021/03/27)</a></h3> <section id="section--report--day-0--1730-a"> - <h4><a href="#section--report--day-0--1730-a">17:30 [A] LAMPããããããŠãµãŒããŒã¬ã¹ã«ä¹ãé
ããPHPerãLambdaã«å
¥éããŠã¿ã</a></h4> + <h4><a href="#section--report--day-0--1730-a">17:30 [A] LAMPããããããŠãµãŒããŒã¬ã¹ã«ä¹ãé
ããPHPerãLambdaã«å
¥éããŠã¿ã</a></h4> <p> - AWS Lambda ã®ãã㪠Function as a Service ã¯ãã€ã¯ããµãŒãã¹åã«ãããäžã€ã®å°éç¹ã«æããã®ã ããããã䜿ã£ãŠå®éã« web ãµãŒãã¹ãäœãå
·äœçãªã€ã¡ãŒãžããŸã èŠããªã (泚: ãã¹ãŠ for me ãšããŠæžããŠãã)ã + AWS Lambda ã®ãã㪠Function as a Service ã¯ãã€ã¯ããµãŒãã¹åã«ãããäžã€ã®å°éç¹ã«æããã®ã ããããã䜿ã£ãŠå®éã« web ãµãŒãã¹ãäœãå
·äœçãªã€ã¡ãŒãžããŸã èŠããªã (泚: ãã¹ãŠ for me ãšããŠæžããŠãã)ã </p> - <p> - PHP on AWS Lambda ãããã ãç°¡åã«åãããã®ã«ã¯é©ããã + PHP on AWS Lambda ãããã ãç°¡åã«åãããã®ã«ã¯é©ããã </p> - <p> - åæã« AWS Lambda ã ãšãããããªã³ãã®è»œããæ±ããããã (= PHP + Laravel ãªã©ã§ã¯åããªããã) ã ãšããå
å
¥èгãæã£ãŠããã®ã ãããã®çºè¡šã®ãã¢ã«ããã°ããã§ããªããããã + åæã« AWS Lambda ã ãšãããããªã³ãã®è»œããæ±ããããã (= PHP + Laravel ãªã©ã§ã¯åããªããã) ã ãšããå
å
¥èгãæã£ãŠããã®ã ãããã®çºè¡šã®ãã¢ã«ããã°ããã§ããªããããã </p> </section> - <section id="section--report--day-0--1810-a"> - <h4><a href="#section--report--day-0--1810-a">18:10 [A] å€§èŠæš¡ãµã€ãã«ãããSEO芳ç¹ã§ã®URLèšèš</a></h4> + <h4><a href="#section--report--day-0--1810-a">18:10 [A] å€§èŠæš¡ãµã€ãã«ãããSEO芳ç¹ã§ã®URLèšèš</a></h4> <p> - SEO (Search Engine Optimization) ã¯å€§ããŠç¥ããªãã®ã§æ°é®®ãªè©±ãå€ãã£ãããã®åèªããããšãå°ãªãâŠâŠã + SEO (Search Engine Optimization) ã¯å€§ããŠç¥ããªãã®ã§æ°é®®ãªè©±ãå€ãã£ãããã®åèªããããšãå°ãªãâŠâŠã </p> </section> - <section id="section--report--day-0--1850-a"> - <h4><a href="#section--report--day-0--1850-a">18:50 [A] PHPerã§ããããïŒå®è·µWebã¢ã¯ã»ã·ããªãã£</a></h4> + <h4><a href="#section--report--day-0--1850-a">18:50 [A] PHPerã§ããããïŒå®è·µWebã¢ã¯ã»ã·ããªãã£</a></h4> <p> - ã€ãæè¿ WAI-ARIA ã«ã€ããŠã®èšäºãèªãã ã°ããã ã£ãã®ã§å人çã«ã¿ã€ã ãªãŒãªè©±é¡ã ã£ãã(ããŸããã®èšèã䜿ããããªãã®ã ã) ãããããå¥åžžè
ãã«ãšã£ãŠãããããåé¡ãæ®æ®µã®ç掻ã®äžã§æèããã®ã¯é£ãããã ããããæ
å ±ãžã®ã¢ã³ããã¯åŒµã£ãŠããããã«ãããã + ã€ãæè¿ WAI-ARIA ã«ã€ããŠã®èšäºãèªãã ã°ããã ã£ãã®ã§å人çã«ã¿ã€ã ãªãŒãªè©±é¡ã ã£ãã(ããŸããã®èšèã䜿ããããªãã®ã ã) ãããããå¥åžžè
ãã«ãšã£ãŠãããããåé¡ãæ®æ®µã®ç掻ã®äžã§æèããã®ã¯é£ãããã ããããæ
å ±ãžã®ã¢ã³ããã¯åŒµã£ãŠããããã«ãããã </p> </section> - <section id="section--report--day-0--1930-a"> - <h4><a href="#section--report--day-0--1930-a">19:30 [A] PHP ã§ãã¡ã€ã«ã·ã¹ãã ãäœãã</a></h4> + <h4><a href="#section--report--day-0--1930-a">19:30 [A] PHP ã§ãã¡ã€ã«ã·ã¹ãã ãäœãã</a></h4> <p> - PHP ã§ FUSE + PHP ã§ FUSE </p> - <p> - å人çã«æ¥œãã¿ã ã£ãçºè¡šã + å人çã«æ¥œãã¿ã ã£ãçºè¡šã </p> - <p> - æåŸ
éãã®è峿·±ãçºè¡šã ã£ããFUSE èªäœãä»åã®çºè¡šã§ç¥ã£ãã®ã ããããæ¬äœã®å®è£
ãèŠãã®ãé¢çœããã ããã®çºè¡šãèããªãããã¡ã€ã«ã·ã¹ãã ã«ããŠã³ãã§ããããªãã®ãèããŠããã®ã ãããããæšæ§é ãããŠãããã®ãã¹ãŠãšèšãããã (ãã³ããŒããæã£ãŠããªããšäºã
)ãäœãã§ãããã ããªããªãæãã€ããªãã + æåŸ
éãã®è峿·±ãçºè¡šã ã£ããFUSE èªäœãä»åã®çºè¡šã§ç¥ã£ãã®ã ããããæ¬äœã®å®è£
ãèŠãã®ãé¢çœããã ã ãã®çºè¡šãèããªãããã¡ã€ã«ã·ã¹ãã ã«ããŠã³ãã§ããããªãã®ãèããŠããã®ã ãããããæšæ§é ãããŠãããã®ãã¹ãŠãšèšãããã (ãã³ããŒããæã£ãŠããªããšäºã
)ãäœãã§ãããã ããªããªãæãã€ããªãã </p> </section> </section> - <section id="section--report--day-1"> - <h3><a href="#section--report--day-1">Day 1 (2021/03/27)</a></h3> + <h3><a href="#section--report--day-1">Day 1 (2021/03/27)</a></h3> <section id="section--report--day-1--1050-a"> - <h4><a href="#section--report--day-1--1050-a">10:50 [A] å®è·µATDD ãTDDããæŽã«æ©ã¿ãé²ãããœãããŠã§ã¢éçºãžã</a></h4> + <h4><a href="#section--report--day-1--1050-a">10:50 [A] å®è·µATDD ãTDDããæŽã«æ©ã¿ãé²ãããœãããŠã§ã¢éçºãžã</a></h4> <p> - User Acceptance Test (UAT) ãããã®èŠæš¡ã«ãªããšå人éçºã»è¶£å³éçºã§ã¯è§Šããªãé åãªã®ã§ã倧ãã«å匷ã«ãªã£ããã¹ã©ã€ãã«æ·»ä»ãããŠããè³æãçžåœã«å
å®ããŠããã®ã§ããããèªãã®ãæ¬çªãšãã£ãæ§çžããæãããé«ã¬ãã«ãã¹ãã®èªååã¯çŸåšã®ãããžã§ã¯ãã§ãæããŠãããèªååã®ãã£ã³ã¹ã¯äŒºã£ãŠããããšã¯ããã»ãã·ã§ã³ã§ãææãããŠããããã«èªååããããšã«ã³ã¹ããããããããé åãããã®ãäºå®ã§ããã®ãã©ã³ã¹ãé£ããã + User Acceptance Test (UAT) ãããã®èŠæš¡ã«ãªããšå人éçºã»è¶£å³éçºã§ã¯è§Šããªãé åãªã®ã§ã倧ãã«å匷ã«ãªã£ããã¹ã©ã€ãã«æ·»ä»ãããŠããè³æãçžåœã«å
å®ããŠããã®ã§ããããèªãã®ãæ¬çªãšãã£ãæ§çžããæããã é«ã¬ãã«ãã¹ãã®èªååã¯çŸåšã®ãããžã§ã¯ãã§ãæããŠãããèªååã®ãã£ã³ã¹ã¯äŒºã£ãŠããããšã¯ããã»ãã·ã§ã³ã§ãææãããŠããããã«èªååããããšã«ã³ã¹ããããããããé åãããã®ãäºå®ã§ããã®ãã©ã³ã¹ãé£ããã </p> </section> - <section id="section--report--day-1--1150-a"> - <h4><a href="#section--report--day-1--1150-a">11:50 [A] éçåè§£æãçšããå€§èŠæš¡ã¬ã¬ã·ãŒã³ãŒãã®ãªãã¡ã¯ã¿ãªã³ã°èšç»</a></h4> + <h4><a href="#section--report--day-1--1150-a">11:50 [A] éçåè§£æãçšããå€§èŠæš¡ã¬ã¬ã·ãŒã³ãŒãã®ãªãã¡ã¯ã¿ãªã³ã°èšç»</a></h4> <p> - åã®ããäžçã§çããŠãã身ãšããŠå€§ãã«æ¥œãã¿ã«ããŠããçºè¡šã + åã®ããäžçã§çããŠãã身ãšããŠå€§ãã«æ¥œãã¿ã«ããŠããçºè¡šã </p> - <p> - æšä»ãåçåä»ãèšèªã§ã®å宣èšã»åã¢ãããŒã·ã§ã³ã»åãã³ãã®å°å
¥ãçžæ¬¡ãã§ãããé·ããéçåä»ãèšèªãæžããŠããç§ãããããšãããããæ°ã¥ããããšãã£ããšããã ãããšãããåãå°å
¥ããèšèªãå¢ããŠãããä»ã®ãããžã§ã¯ãã§ãæ°ãã远å ããã³ãŒãã«ã¯åãã€ããããåªããŠããããã©ãããŠãå€ãã³ãŒãã«ã¯åãã€ããŠããªããå人çã«ã¯åã®ãªãã³ãŒãã«å¯ŸããŠã©ãåãèªåçã«ä»ããããšããç¹ã«èå³ãããããã®ç¹ã§ Ruby ã® typeprof ã«ã¯æ³šç®ããŠããã + æšä»ãåçåä»ãèšèªã§ã®å宣èšã»åã¢ãããŒã·ã§ã³ã»åãã³ãã®å°å
¥ãçžæ¬¡ãã§ãããé·ããéçåä»ãèšèªãæžããŠããç§ãããããšãããããæ°ã¥ããããšãã£ããšããã ãããšãããåãå°å
¥ããèšèªãå¢ããŠããã ä»ã®ãããžã§ã¯ãã§ãæ°ãã远å ããã³ãŒãã«ã¯åãã€ããããåªããŠããããã©ãããŠãå€ãã³ãŒãã«ã¯åãã€ããŠããªããå人çã«ã¯åã®ãªãã³ãŒãã«å¯ŸããŠã©ãåãèªåçã«ä»ããããšããç¹ã«èå³ãããããã®ç¹ã§ Ruby ã® typeprof ã«ã¯æ³šç®ããŠããã </p> </section> - <section id="section--report--day-1--1310-a"> - <h4><a href="#section--report--day-1--1310-a">13:10 [A] ç®çã«æ²¿ã£ãDocumentation as Codeãããã«ããŠå®çŸããŠããã</a></h4> + <h4><a href="#section--report--day-1--1310-a">13:10 [A] ç®çã«æ²¿ã£ãDocumentation as Codeãããã«ããŠå®çŸããŠããã</a></h4> <p> - ãã®çºè¡šã以åããéåžžã«æ¥œãã¿ã«ããŠããã + ãã®çºè¡šã以åããéåžžã«æ¥œãã¿ã«ããŠããã </p> - <p> - ããã¥ã¡ã³ãã®ç®¡çã¯çŸãããžã§ã¯ãã§ã課é¡ãšæããŠãããäœãããåœåã¯æ£ãããŠãã宿
ãšä¹é¢ããŠããã®ãæ¢ããã®ã¯å°é£ã極ãããå
šäœçã«è峿·±ãçºè¡šã ã£ãããç¹ã«ã¹ã¿ãã¯ãã¬ãŒã¹ããã®ããã¥ã¡ã³ãçæãšããã¢ã€ãã¢ã«æ¹ããããã®ãæãããã¹ã¿ãã¯ãã¬ãŒã¹ãšãã宿
ãšäžå¯å㪠(ä¹é¢ããªã) æ
å ±ãèµ·ç¹ã«ããã®ã¯çã«ããªã£ãŠãããåé¡ã¯ãã¬ãŒã¹ããã€ãã©ãåããã ãããããããèªååããªããã°ã宿
ãšã®ä¹é¢ãé¿ããããªãã ããã + ããã¥ã¡ã³ãã®ç®¡çã¯çŸãããžã§ã¯ãã§ã課é¡ãšæããŠãããäœãããåœåã¯æ£ãããŠãã宿
ãšä¹é¢ããŠããã®ãæ¢ããã®ã¯å°é£ã極ãããå
šäœçã«è峿·±ãçºè¡šã ã£ãããç¹ã«ã¹ã¿ãã¯ãã¬ãŒã¹ããã®ããã¥ã¡ã³ãçæãšããã¢ã€ãã¢ã«æ¹ããããã®ãæãããã¹ã¿ãã¯ãã¬ãŒã¹ãšãã宿
ãšäžå¯å㪠(ä¹é¢ããªã) æ
å ±ãèµ·ç¹ã«ããã®ã¯çã«ããªã£ãŠãããåé¡ã¯ãã¬ãŒã¹ããã€ãã©ãåããã ãããããããèªååããªããã°ã宿
ãšã®ä¹é¢ãé¿ããããªãã ããã </p> </section> - <section id="section--report--day-1--1410-a"> - <h4><a href="#section--report--day-1--1410-a">14:10 [A] PHPã§åŠã¶ãã»ãã·ã§ã³ã®åºæ¬ãšå¿çš</a></h4> + <h4><a href="#section--report--day-1--1410-a">14:10 [A] PHPã§åŠã¶ãã»ãã·ã§ã³ã®åºæ¬ãšå¿çš</a></h4> <p> - å
šäœçã«åºæ¬çãªè©±ã ã£ãã®ã§ç¹ã«è§ŠããªããCookie ãã»ãã·ã§ã³ã®è©±ãšããŠã¯éåžžã«åããããããŸãšããããŠããã®ã§ãç¥ããªã人ãåŠã¶ã«ã¯ããææã ããã + å
šäœçã«åºæ¬çãªè©±ã ã£ãã®ã§ç¹ã«è§ŠããªããCookie ãã»ãã·ã§ã³ã®è©±ãšããŠã¯éåžžã«åããããããŸãšããããŠããã®ã§ãç¥ããªã人ãåŠã¶ã«ã¯ããææã ããã </p> </section> - <section id="section--report--day-1--1450-a"> - <h4><a href="#section--report--day-1--1450-a">14:50 [A] PHP8ã«ãªã£ãä»ã®æä»£ã«ãPHPã®ããšã©ãŒããäŸå€ããããŠãErrorããããããããŠããã</a></h4> + <h4><a href="#section--report--day-1--1450-a">14:50 [A] PHP8ã«ãªã£ãä»ã®æä»£ã«ãPHPã®ããšã©ãŒããäŸå€ããããŠãErrorããããããããŠããã</a></h4> <p> - PHP ãåŠãã§ããéäžã®ç§ãšããŠã¯ãä»ãŸãã«èãããçºè¡šã ã£ã (çŸæç¹ã§ PHP ãæžãå§ããŠãã 4ã¶æã»ã©ã«ãªã)ã + PHP ãåŠãã§ããéäžã®ç§ãšããŠã¯ãä»ãŸãã«èãããçºè¡šã ã£ã (çŸæç¹ã§ PHP ãæžãå§ããŠãã 4ã¶æã»ã©ã«ãªã)ã </p> - <p> - å人çã«äŸå€ããšã©ãŒãæãããŸãæ±ã£ãŠããã®ã¯ GoãSwiftãRustãHaskell ãªã©ã®ãšã©ãŒããå€ãšããŠãæ±ãèšèªã ãšæã£ãŠãããtry-catch ã¯éåžžã®åŠçãããŒãå®å
šã«å£ããŠããŸãäžãæ§æãšããŠãéããããå€ãšããŠã®ãšã©ãŒéç¥ã¯ Cèšèªæä»£ãžã®ååž°ãšãããããããã®é ãšç°ãªãã®ã¯ãšã©ãŒãæé»ã®ãã¡ã«æ¡ã朰ãããšããªããšããããšã ããããã®èšèªã¯åãæã£ãŠãããéçã«æ€èšŒãã§ãã (C ã®ããã¯ãŸãšããªåä»ãã§ã¯ãªãã念ã®ãã)ã + å人çã«äŸå€ããšã©ãŒãæãããŸãæ±ã£ãŠããã®ã¯ GoãSwiftãRustãHaskell ãªã©ã®ãšã©ãŒããå€ãšããŠãæ±ãèšèªã ãšæã£ãŠãããtry-catch ã¯éåžžã®åŠçãããŒãå®å
šã«å£ããŠããŸãäžãæ§æãšããŠãéããããå€ãšããŠã®ãšã©ãŒéç¥ã¯ Cèšèªæä»£ãžã®ååž°ãšãããããããã®é ãšç°ãªãã®ã¯ãšã©ãŒãæé»ã®ãã¡ã«æ¡ã朰ãããšããªããšããããšã ããããã®èšèªã¯åãæã£ãŠãããéçã«æ€èšŒãã§ãã (C ã®ããã¯ãŸãšããªåä»ãã§ã¯ãªãã念ã®ãã)ã </p> - <p> - PHP ã®ããã«ããã§ã«äŸå€ãèšèªã·ã¹ãã ã«æ ¹ãããŠããèšèªã§ã¯ã©ãããã°ãããããã®å Žåãåããéçæ€èšŒã®åãåããããšã«ãªãã ããã + PHP ã®ããã«ããã§ã«äŸå€ãèšèªã·ã¹ãã ã«æ ¹ãããŠããèšèªã§ã¯ã©ãããã°ãããããã®å Žåãåããéçæ€èšŒã®åãåããããšã«ãªãã ããã </p> </section> - <section id="section--report--day-1--1530-a"> - <h4><a href="#section--report--day-1--1530-a">15:30 [A] Laravel ã®ã¡ãŒã«èªèšŒã®å
éšå®è£
ãæãäžãã</a></h4> + <h4><a href="#section--report--day-1--1530-a">15:30 [A] Laravel ã®ã¡ãŒã«èªèšŒã®å
éšå®è£
ãæãäžãã</a></h4> <p> - Laravel ã®ç¥èããªãç§ã«ã¯ãŸã£ããã€ããŠãããªãã£ãããŸããå人çã«ã¿ã€ãã«ããããã¹ãªãŒãã£ã³ã°ã«æããã + Laravel ã®ç¥èããªãç§ã«ã¯ãŸã£ããã€ããŠãããªãã£ãããŸããå人çã«ã¿ã€ãã«ããããã¹ãªãŒãã£ã³ã°ã«æããã </p> </section> - <section id="section--report--day-1--1610-a"> - <h4><a href="#section--report--day-1--1610-a">16:10 [A] ãã©ãŠã¶ããå§ããgRPC ã gRPC-Webã«PHPãæ·»ããŠ</a></h4> + <h4><a href="#section--report--day-1--1610-a">16:10 [A] ãã©ãŠã¶ããå§ããgRPC ã gRPC-Webã«PHPãæ·»ããŠ</a></h4> <p> - (çºè¡šã®äžã§ããŸãã«åãããšããã£ããã£ãŠããã) PHP 以å€ã®æ¹ãåããŠããã ããããšããã®ã第äžã®ææ³ã§ãããgRPC ã¯ããèªäœãšããããã Protobuf ãšãããšã³ã·ã¹ãã ã«ä¹ããããšã®ã¡ãªããã倧ãããšæããããã®ãšã³ã·ã¹ãã ã«ããŸãä¹ããªãæç¹ã§ãããŒããšããæãã + (çºè¡šã®äžã§ããŸãã«åãããšããã£ããã£ãŠããã) PHP 以å€ã®æ¹ãåããŠããã ããããšããã®ã第äžã®ææ³ã§ãããgRPC ã¯ããèªäœãšããããã Protobuf ãšãããšã³ã·ã¹ãã ã«ä¹ããããšã®ã¡ãªããã倧ãããšæããããã®ãšã³ã·ã¹ãã ã«ããŸãä¹ããªãæç¹ã§ãããŒããšããæãã </p> </section> </section> - <section id="section--report--day-2"> - <h3><a href="#section--report--day-2">Day 2 (2021/03/28)</a></h3> + <h3><a href="#section--report--day-2">Day 2 (2021/03/28)</a></h3> <p> - åé ã«æžããéãã2æ¥ç®ããäœèª¿ãæªããŸãšãã«èŽããŠããªããéäžãŸã§ã¯é çãææ
¢ãã€ã€èŠãŠããã®ã ãããŸãšãã«å
¥ã£ãŠããªãã£ãã + åé ã«æžããéãã2æ¥ç®ããäœèª¿ãæªããŸãšãã«èŽããŠããªããéäžãŸã§ã¯é çãææ
¢ãã€ã€èŠãŠããã®ã ãããŸãšãã«å
¥ã£ãŠããªãã£ãã </p> - <p> - æ®å¿µã§ã¯ãããããããã«ããèŠãããŠããªãçºè¡šã¯ä»ã«ãããã®ã§ãä»é±æ«ã«ã§ããŸãšããŠèŠãããšæãã + æ®å¿µã§ã¯ãããããããã«ããèŠãããŠããªãçºè¡šã¯ä»ã«ãããã®ã§ãä»é±æ«ã«ã§ããŸãšããŠèŠãããšæãã </p> </section> - <section id="section--report--comments"> - <h3><a href="#section--report--comments">å
šäœã®ææ³</a></h3> + <h3><a href="#section--report--comments">å
šäœã®ææ³</a></h3> <p> - Day 2 ã«ã»ãšãã©åå ã§ããªãã£ãã®ã¯æ®å¿µã ããã€ãã³ãèªäœã¯å€§å€æ¥œããããŸãè峿·±ããã®ã§ãã£ããèªåããŸã£ããç¥ããªãé åã®è©±ãèããã®ã¯ããããã€ãã³ããªãã§ã¯ã ãšæããããªã³ã©ã€ã³éå¬ããçŸå°ã«è¡ãå¿
èŠããªããæ°è»œã«åå ã§ããã®ã (ç¹ã«ååå è
ãšããŠ) å¬ãããã€ã³ãã ã£ãã + Day 2 ã«ã»ãšãã©åå ã§ããªãã£ãã®ã¯æ®å¿µã ããã€ãã³ãèªäœã¯å€§å€æ¥œããããŸãè峿·±ããã®ã§ãã£ããèªåããŸã£ããç¥ããªãé åã®è©±ãèããã®ã¯ããããã€ãã³ããªãã§ã¯ã ãšæããããªã³ã©ã€ã³éå¬ããçŸå°ã«è¡ãå¿
èŠããªããæ°è»œã«åå ã§ããã®ã (ç¹ã«ååå è
ãšããŠ) å¬ãããã€ã³ãã ã£ãã </p> - <p> - ä»åãéè«/ç»å£è
ãžã®è³ªåçåãã« Discord ãµãŒãããã£ãã®ã ãããã¡ãã¯åå ãããããã®ã® ROM ã®ãŸãŸã«ãªã£ãŠããŸã£ããçºè¡šã«1ãŠã£ã³ããŠãã¡ã¢ãæžãã®ã«1ãŠã£ã³ããŠãDiscord 衚瀺㫠1ãŠã£ã³ããŠã§ç§ã«ã¯ããè³ã®ãªãœãŒã¹ãšãã£ã¹ãã¬ã€ã®ã¹ããŒã¹ã远ãã€ããªãã£ã (ããã«ãããš Zoom ã§ã¢ã³ã«ã³ãã¡ã¬ã³ã¹ããã£ãŠããããã ããã¡ãã¯ãŸã£ããåå ããŠããªã)ã + ä»åãéè«/ç»å£è
ãžã®è³ªåçåãã« Discord ãµãŒãããã£ãã®ã ãããã¡ãã¯åå ãããããã®ã® ROM ã®ãŸãŸã«ãªã£ãŠããŸã£ããçºè¡šã«1ãŠã£ã³ããŠãã¡ã¢ãæžãã®ã«1ãŠã£ã³ããŠãDiscord 衚瀺㫠1ãŠã£ã³ããŠã§ç§ã«ã¯ããè³ã®ãªãœãŒã¹ãšãã£ã¹ãã¬ã€ã®ã¹ããŒã¹ã远ãã€ããªãã£ã (ããã«ãããš Zoom ã§ã¢ã³ã«ã³ãã¡ã¬ã³ã¹ããã£ãŠããããã ããã¡ãã¯ãŸã£ããåå ããŠããªã)ã </p> - <p> - 1ã€å人çãªåçç¹ãšããŠã¯ãäžã€äžã€ã®ã»ãã·ã§ã³ãçå£ã«èãéãããšãããã®ãããããã£ãšé©åœã«èããŠããã°ããã£ããããã ãã ãšå€§å€èªåŒãããã®ã ããèšãæ¹ãå€ãããšãDiscord ãããã¢ã³ã«ã³ãã¡ã¬ã³ã¹ãããããã®ã€ãã³ãã®ãã®ç¬éã«ãããªãã³ã³ãã³ããã«è§Šããã«ãåŸããèŠè¿ããçºè¡šãã¹ã©ã€ãã«æ³šåããŠããŸã£ãããšããããšã ãçºè¡šã®è©³çްãªèŠçŽãã¯ããšããã§ããã®ã ãããä»ããã§ããªãããšãèããã¹ãã ã£ãããŸãåã«ã³ãã¡ã¬ã³ã¹ã ãããšãè¶ãæ¿ããŠãããã + 1ã€å人çãªåçç¹ãšããŠã¯ãäžã€äžã€ã®ã»ãã·ã§ã³ãçå£ã«èãéãããšãããã®ãããããã£ãšé©åœã«èããŠããã°ããã£ããããã ãã ãšå€§å€èªåŒãããã®ã ããèšãæ¹ãå€ãããšãDiscord ãããã¢ã³ã«ã³ãã¡ã¬ã³ã¹ãããããã®ã€ãã³ãã®ãã®ç¬éã«ãããªãã³ã³ãã³ããã«è§Šããã«ãåŸããèŠè¿ããçºè¡šãã¹ã©ã€ãã«æ³šåããŠããŸã£ãããšããããšã ãçºè¡šã®è©³çްãªèŠçŽãã¯ããšããã§ããã®ã ãããä»ããã§ããªãããšãèããã¹ãã ã£ãã ãŸãåã«ã³ãã¡ã¬ã³ã¹ã ãããšãè¶ãæ¿ããŠãããã </p> - <p> - ããŠãã«ã³ãã¡ã¬ã³ã¹ã§äžã€æ°ã«ãªã£ãããšããããããã¯ãDiscord ãšããæžã蟌ã¿å Žæãå¢ããããšã§ãã³çã®ã³ã¡ã³ãã®æµéãåžãåãããŠããŸã£ãã®ã§ã¯ãªããããšããç¹ã ããã³ãã³ã ãèŠãŠãããšéçã£ãŠãããã®ããã«èŠããçºè¡šããDiscord ã®æ¹ã§ã¯çãäžãã£ãŠããããšããã®ãäœåºŠãèŠãããããã³ãã³ã®ã³ã¡ã³ãæ¹åŒã¯çãäžãããåŠå®ã«åæ ããããéããŸãããããDiscord ããã£ãããšèªäœã¯ãã©ã¹ã ã£ããšæããããã®ç¹ã¯ãã€ãã¹ã ã£ãã®ã§ã¯ãªãããšæããã + ããŠãã«ã³ãã¡ã¬ã³ã¹ã§äžã€æ°ã«ãªã£ãããšããããããã¯ãDiscord ãšããæžã蟌ã¿å Žæãå¢ããããšã§ãã³çã®ã³ã¡ã³ãã®æµéãåžãåãããŠããŸã£ãã®ã§ã¯ãªããããšããç¹ã ããã³ãã³ã ãèŠãŠãããšéçã£ãŠãããã®ããã«èŠããçºè¡šããDiscord ã®æ¹ã§ã¯çãäžãã£ãŠããããšããã®ãäœåºŠãèŠãããããã³ãã³ã®ã³ã¡ã³ãæ¹åŒã¯çãäžãããåŠå®ã«åæ ããããéããŸãããããDiscord ããã£ãããšèªäœã¯ãã©ã¹ã ã£ããšæããããã®ç¹ã¯ãã€ãã¹ã ã£ãã®ã§ã¯ãªãããšæããã </p> - <hr> - <p> - æåŸã«ãªããŸããããæ¯å¹Žã® PHPerKaigi éå¬ã«ãå°œåãããŠããçæ§ãã¹ããŒã«ãŒã®çæ§ã楜ãã3æ¥éã§ãããããããšãããããŸããïŒ (ãã£ãšåžžäœã§æžããŠããŸã£ãã®ã§ãããªãä»é é¢ããç¬é¡ã«ãªã£ãããã§æ°æã¡æªã) + æåŸã«ãªããŸããããæ¯å¹Žã® PHPerKaigi éå¬ã«ãå°œåãããŠããçæ§ãã¹ããŒã«ãŒã®çæ§ã楜ãã3æ¥éã§ãããããããšãããããŸããïŒ (ãã£ãšåžžäœã§æžããŠããŸã£ãã®ã§ãããªãä»é é¢ããç¬é¡ã«ãªã£ãããã§æ°æã¡æªã) </p> - <p> - ã§ã¯ãŸãæ¥å¹Žã + ã§ã¯ãŸãæ¥å¹Žã </p> </section> </section> diff --git a/vhosts/blog/public/posts/2021-10-02/cpp-you-can-use-keywords-in-attributes/index.html b/vhosts/blog/public/posts/2021-10-02/cpp-you-can-use-keywords-in-attributes/index.html index d99fc02c..fee0e109 100644 --- a/vhosts/blog/public/posts/2021-10-02/cpp-you-can-use-keywords-in-attributes/index.html +++ b/vhosts/blog/public/posts/2021-10-02/cpp-you-can-use-keywords-in-attributes/index.html @@ -65,14 +65,14 @@ NOTE </div> <div class="admonition-content"> - ãã®èšäºã¯ Qiita ããç§»æ€ããŠãããã®ã§ããå
URL: <a href="https://qiita.com/nsfisis/items/94090937bcf860cfa93b" rel="noreferrer" target="_blank">https://qiita.com/nsfisis/items/94090937bcf860cfa93b</a> + <p> + ãã®èšäºã¯ Qiita ããç§»æ€ããŠãããã®ã§ãã å
URL: <a href="https://qiita.com/nsfisis/items/94090937bcf860cfa93b" rel="noreferrer" target="_blank">https://qiita.com/nsfisis/items/94090937bcf860cfa93b</a> + </p> </div> </div> - <p> - ã¿ã€ãã«èœã¡ããŸãã¯ãã®ã³ãŒããèŠãŠæ¬²ããã + ã¿ã€ãã«èœã¡ããŸãã¯ãã®ã³ãŒããèŠãŠæ¬²ããã </p> - <div class="codeblock" language="cpp"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49">#include</span><span style="color:#032F62"> <iostream></span></span> <span class="line"></span> @@ -94,109 +94,96 @@ <span class="line"><span style="color:#6F42C1"> std</span><span style="color:#24292E">::cout </span><span style="color:#D73A49"><<</span><span style="color:#032F62"> "Hello, World!"</span><span style="color:#D73A49"> <<</span><span style="color:#6F42C1"> std</span><span style="color:#24292E">::endl;</span></span> <span class="line"><span style="color:#24292E">}</span></span></code></pre> </div> - - <blockquote> - <p> - ã³ã³ãã€ã©ã®ããŒãžã§ã³ $ clang++ âversion Apple clang version 11.0.0 (clang-1100.0.33.8) Target: x86_64-apple-darwin19.6.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin - </p> - - <p> - ã³ã³ãã€ã«ã³ãã³ã (C17æå®) $ clang âstd=c++17 hoge.cpp - </p> - </blockquote> - <p> - ãã®èšäºããåŸããããã®ã¯ãã以äžãªãã®ã§ä»¥äžã¯èè¶³ã«ãªãã + ã³ã³ãã€ã©ã®ããŒãžã§ã³ + </p> + <div class="codeblock"> + <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>$ clang++ âversion Apple clang version 11.0.0</span></span> +<span class="line"><span>(clang-1100.0.33.8) Target: x86_64-apple-darwin19.6.0 Thread model:</span></span> +<span class="line"><span>posix InstalledDir:</span></span> +<span class="line"><span>/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin</span></span></code></pre> + </div> + <p> + ã³ã³ãã€ã«ã³ãã³ã (C17æå®) + </p> + <div class="codeblock"> + <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>$ clang âstd=c++17 hoge.cpp</span></span></code></pre> + </div> + <p> + ãã®èšäºããåŸããããã®ã¯ãã以äžãªãã®ã§ä»¥äžã¯èè¶³ã«ãªãã </p> - <p> - å¥ä»¶ã§ cppreference.com ã® <a href="https://en.cppreference.com/w/cpp/language/identifiers" rel="noreferrer" target="_blank">identifier ã®ããŒãž</a> ãèªãã§ããæãæ¬¡ã®æãç®ã«æ¢ãŸã£ãã + å¥ä»¶ã§ <a href="https://en.cppreference.com/w/cpp/language/identifiers" rel="noreferrer" target="_blank">cppreference.com ã® identifier ã®ããŒãž</a>ãèªãã§ããæãæ¬¡ã®æãç®ã«æ¢ãŸã£ãã </p> - <blockquote> <ul> <li> - the identifiers that are keywords cannot be used for other purposes; + <p> + the identifiers that are keywords cannot be used for other purposes; + </p> <ul> <li> - The only place they can be used as non-keywords is in an attribute-token. (e.g. [[private]] is a valid attribute) (since C++11) + The only place they can be used as non-keywords is in an attribute-token. (e.g. [[private]] is a valid attribute) (since C++11) </li> </ul> </li> </ul> </blockquote> - <p> - ããŒã¯ãŒãã§ã屿§ãšããŠæå®ããå Žåã¯éããŒã¯ãŒããšããŠäœ¿ããããããå®éã«ãã£ãŠã¿ãã + ããŒã¯ãŒãã§ã屿§ãšããŠæå®ããå Žåã¯éããŒã¯ãŒããšããŠäœ¿ãããããã å®éã«ãã£ãŠã¿ãã </p> - <p> - åãµã€ãã® <a href="https://en.cppreference.com/w/cpp/keyword" rel="noreferrer" target="_blank">keywords ã®ããŒãž</a> ããäžèЧãæåããäžã®ã³ãŒããåºæ¥äžãã£ã (C++17 ã«ãããŠããŒã¯ãŒãã§ãªããã®ãªã©ãäžéšçããŠãã)ã 倧éã®èŠå (unknown attribute `ãã' ignored) ãã³ã³ãã€ã©ããåºåãããããã³ã³ãã€ã«ã§ããã + åãµã€ãã® <a href="https://en.cppreference.com/w/cpp/keyword" rel="noreferrer" target="_blank">keywords ã®ããŒãž</a> ããäžèЧãæåããäžã®ã³ãŒããåºæ¥äžãã£ã (C++17 ã«ãããŠããŒã¯ãŒãã§ãªããã®ãªã©ãäžéšçããŠãã)ã 倧éã®èŠå (unknown attribute `ããâ ignored) ãã³ã³ãã€ã©ããåºåãããããã³ã³ãã€ã«ã§ããã </p> - <p> - äžã®ã³ãŒãã§ã¯ <code>[[using]]</code> ãã³ã¡ã³ãã¢ãŠãããŠãããããã㯠<code>using</code> ããŒã¯ãŒãã®ã¿å±æ§æ§æã®äžã§æå³ãæã€ããã§ããããã®ã³ã¡ã³ãã¢ãŠããå€ããšã³ã³ãã€ã«ã«å€±æããã + äžã®ã³ãŒãã§ã¯ <code>[[using]]</code> ãã³ã¡ã³ãã¢ãŠãããŠãããããã㯠<code>using</code> ããŒã¯ãŒãã®ã¿å±æ§æ§æã®äžã§æå³ãæã€ããã§ããããã®ã³ã¡ã³ãã¢ãŠããå€ããšã³ã³ãã€ã«ã«å€±æããã </p> - <div class="codeblock" language="cpp"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#6A737D">// using ã®äŸ</span></span> <span class="line"><span style="color:#005CC5">[[</span><span style="color:#D73A49">using</span><span style="color:#6F42C1"> foo</span><span style="color:#005CC5">: </span><span style="color:#6F42C1">attr1</span><span style="color:#005CC5">, </span><span style="color:#6F42C1">attr2</span><span style="color:#005CC5">]]</span><span style="color:#D73A49"> int</span><span style="color:#24292E"> x;</span><span style="color:#6A737D"> // [[foo::attr1, foo::attr2]] ã®ç³è¡£æ§æ</span></span></code></pre> </div> - <p> - C++17 ã®ä»æ§ãèŠãŠã¿ã (æ£ç¢ºã«ã¯æšæºååã®ãã©ãã)ã + C++17 ã®ä»æ§ãèŠãŠã¿ã (æ£ç¢ºã«ã¯æšæºååã®ãã©ãã)ã </p> - <p> - åŒçšå
: <a href="https://timsong-cpp.github.io/cppwp/n4659/dcl.attr#grammar-4" rel="noreferrer" target="_blank">https://timsong-cpp.github.io/cppwp/n4659/dcl.attr#grammar-4</a> + åŒçšå
: <a href="https://timsong-cpp.github.io/cppwp/n4659/dcl.attr#grammar-4" rel="noreferrer" target="_blank">https://timsong-cpp.github.io/cppwp/n4659/dcl.attr#grammar-4</a> </p> - <blockquote> <p> - If a keyword or an alternative token that satisfies the syntactic requirements of an identifier is contained in an attribute-token, it is considered an identifier. + If a keyword or an alternative token that satisfies the syntactic requirements of an identifier is contained in an attribute-token, it is considered an identifier. </p> </blockquote> - <p> - ã<code>identifier</code> ã®æ§æäžã®èŠä»¶ãæºããããŒã¯ãŒããŸãã¯ä»£æ¿ããŒã¯ã³ã <code>attribute-token</code> ã«å«ãŸããŠããå Žåã<code>identifier</code> ãšã¿ãªãããããšãããã©ãããééããªãããã ã + ã<code>identifier</code> ã®æ§æäžã®èŠä»¶ãæºããããŒã¯ãŒããŸãã¯ä»£æ¿ããŒã¯ã³ã <code>attribute-token</code> ã«å«ãŸããŠããå Žåã<code>identifier</code> ãšã¿ãªãããããšãããã©ãããééããªãããã ã </p> - <p> - ãšããã§ã代æ¿ããŒã¯ã³ (alternative token) ãšã¯ <code>and</code> (<code>&</code>) ã <code>bitor</code> (<code>|</code>) ãªã©ã®ããšã ãã<code>identifier</code> ã®æ§æäžã®èŠä»¶ãæºãããªããããªä»£æ¿ããŒã¯ã³ãªã©ããã®ãïŒ çåã«æã£ãŠèª¿ã¹ããšããã代æ¿ããŒã¯ã³ãšããèªã«ã¯ãã€ã°ã©ããå«ãŸããããã (åè: <a href="https://timsong-cpp.github.io/cppwp/n4659/lex.digraph" rel="noreferrer" target="_blank">åãã©ãã</a>) + ãšããã§ã代æ¿ããŒã¯ã³ (alternative token) ãšã¯ <code>and</code> (<code>&</code>) ã <code>bitor</code> (<code>|</code>) ãªã©ã®ããšã ãã<code>identifier</code> ã®æ§æäžã®èŠä»¶ãæºãããªããããªä»£æ¿ããŒã¯ã³ãªã©ããã®ãïŒ çåã«æã£ãŠèª¿ã¹ããšããã代æ¿ããŒã¯ã³ãšããèªã«ã¯ãã€ã°ã©ããå«ãŸããããã (åè: <a href="https://timsong-cpp.github.io/cppwp/n4659/lex.digraph" rel="noreferrer" target="_blank">åãã©ãã</a> ) </p> - <ul> <li> <code><%</code> â <code>{</code> </li> - <li> <code>%></code> â <code>}</code> </li> - <li> <code><:</code> â <code>[</code> </li> - <li> <code>:></code> â <code>]</code> </li> - <li> <code>%:</code> â <code>#</code> </li> - <li> <code>%:%:</code> â <code>##</code> </li> </ul> - <p> - ã<code>identifier</code> ã®æ§æäžã®èŠä»¶ãæºãããªããããªä»£æ¿ããŒã¯ã³ãã¯ããããåœãŠã¯ãŸããšæãããã + ã<code>identifier</code> ã®æ§æäžã®èŠä»¶ãæºãããªããããªä»£æ¿ããŒã¯ã³ãã¯ããããåœãŠã¯ãŸããšæãããã </p> - <p> - 調ã¹ãææ³: åå¥è§£æåšãæ§æè§£æåšãèŸãã + 調ã¹ãææ³: åå¥è§£æåšãæ§æè§£æåšãèŸãã </p> </div> </article> diff --git a/vhosts/blog/public/posts/2021-10-02/python-unbound-local-error/index.html b/vhosts/blog/public/posts/2021-10-02/python-unbound-local-error/index.html index f3a11356..d3db5da6 100644 --- a/vhosts/blog/public/posts/2021-10-02/python-unbound-local-error/index.html +++ b/vhosts/blog/public/posts/2021-10-02/python-unbound-local-error/index.html @@ -65,18 +65,17 @@ NOTE </div> <div class="admonition-content"> - ãã®èšäºã¯ Qiita ããç§»æ€ããŠãããã®ã§ããå
URL: <a href="https://qiita.com/nsfisis/items/5d733703afcb35bbf399" rel="noreferrer" target="_blank">https://qiita.com/nsfisis/items/5d733703afcb35bbf399</a> + <p> + ãã®èšäºã¯ Qiita ããç§»æ€ããŠãããã®ã§ãã å
URL: <a href="https://qiita.com/nsfisis/items/5d733703afcb35bbf399" rel="noreferrer" target="_blank">https://qiita.com/nsfisis/items/5d733703afcb35bbf399</a> + </p> </div> </div> - <p> - æ¬èšäºã¯ Python 3.7.6 ã®åäœçµæãå
ã«ããŠæžãããŠããã + æ¬èšäºã¯ Python 3.7.6 ã®åäœçµæãå
ã«ããŠæžãããŠããã </p> - <p> - Python ã§ã¯ããŒãžã£ãäœãããšã次ã®ãããªã³ãŒããæžããã + Python ã§ã¯ããŒãžã£ãäœãããšã次ã®ãããªã³ãŒããæžããã </p> - <div class="codeblock" language="python"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49">def</span><span style="color:#6F42C1"> f</span><span style="color:#24292E">():</span></span> <span class="line"><span style="color:#24292E"> x </span><span style="color:#D73A49">=</span><span style="color:#005CC5"> 0</span></span> @@ -86,21 +85,17 @@ <span class="line"></span> <span class="line"><span style="color:#24292E">f()</span></span></code></pre> </div> - <p> - 颿° <code>g</code> ãã 颿° <code>f</code> ã®ã¹ã³ãŒãå
ã§å®çŸ©ããã倿° <code>x</code> ãåç
§ããããã« 1 ãè¶³ãããšããŠããã ãããå®è¡ãããš <code>x += 1</code> ã®ç®æã§ãšã©ãŒãçºçããã + 颿° <code>g</code> ãã 颿° <code>f</code> ã®ã¹ã³ãŒãå
ã§å®çŸ©ããã倿° <code>x</code> ãåç
§ããããã« 1 ãè¶³ãããšããŠããã ãããå®è¡ãããš <code>x += 1</code> ã®ç®æã§ãšã©ãŒãçºçããã </p> - <blockquote> <p> - UnboundLocalError: local variable `x' referenced before assignment + UnboundLocalError: local variable `xâ referenced before assignment </p> </blockquote> - <p> - local倿° <code>x</code> ã代å
¥åã«åç
§ãããããšãããããã¯ã<code>f</code> ã® <code>x</code> ãåç
§ããã®ã§ã¯ãªããæ°ããå¥ã®å€æ°ã <code>g</code> å
ã«äœã£ãŠããŸã£ãŠãããããåè¿°ã®ã³ãŒãã宣èšãšä»£å
¥ã䟿å®äžåããŠæžãçŽããšæ¬¡ã®ããã«ãªãã<code>var</code> ã倿°å®£èšã®ããã®æ§æãšããŠæ¬äŒŒçã«å©çšããŠããã + local倿° <code>x</code> ã代å
¥åã«åç
§ãããããšãããããã¯ã<code>f</code> ã® <code>x</code> ãåç
§ããã®ã§ã¯ãªããæ°ããå¥ã®å€æ°ã <code>g</code> å
ã«äœã£ãŠããŸã£ãŠããããã åè¿°ã®ã³ãŒãã宣èšãšä»£å
¥ã䟿å®äžåããŠæžãçŽããšæ¬¡ã®ããã«ãªãã<code>var</code> ã倿°å®£èšã®ããã®æ§æãšããŠæ¬äŒŒçã«å©çšããŠããã </p> - <div class="codeblock" language="python"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#6A737D"># 泚: var ã¯æ£ãã Python ã®ææ³ã§ã¯ãªããäžèšåç
§ã®ããš</span></span> <span class="line"><span style="color:#D73A49">def</span><span style="color:#6F42C1"> f</span><span style="color:#24292E">():</span></span> @@ -113,11 +108,9 @@ <span class="line"><span style="color:#6A737D"> # å ç®ããåã®å€ãåç
§ããããšãããããŸã 代å
¥ãããŠããªããããšã©ãŒ</span></span> <span class="line"><span style="color:#24292E"> g()</span></span></code></pre> </div> - <p> - åœåã®æå³ã衚çŸããã«ã¯ã次ã®ããã«æžãã°ããã + åœåã®æå³ã衚çŸããã«ã¯ã次ã®ããã«æžãã°ããã </p> - <div class="codeblock" language="python"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49">def</span><span style="color:#6F42C1"> f</span><span style="color:#24292E">():</span></span> <span class="line"><span style="color:#24292E"> x </span><span style="color:#D73A49">=</span><span style="color:#005CC5"> 0</span></span> @@ -126,7 +119,6 @@ <span class="line"><span style="color:#24292E"> x </span><span style="color:#D73A49">+=</span><span style="color:#005CC5"> 1</span></span> <span class="line"><span style="color:#24292E"> g()</span></span></code></pre> </div> - <p> <code>(*)</code> ã®ããã«ã<code>nonlocal</code> ã远å ãããããã«ããäžã€å€åŽã®ã¹ã³ãŒã (<code>g</code> ã®äžã€å€åŽ = <code>f</code>) ã§å®çŸ©ãããŠãã <code>x</code> ãæ¢ãã«è¡ãããã«ãªãã </p> diff --git a/vhosts/blog/public/posts/2021-10-02/ruby-detect-running-implementation/index.html b/vhosts/blog/public/posts/2021-10-02/ruby-detect-running-implementation/index.html index cf2eb729..d022bf8d 100644 --- a/vhosts/blog/public/posts/2021-10-02/ruby-detect-running-implementation/index.html +++ b/vhosts/blog/public/posts/2021-10-02/ruby-detect-running-implementation/index.html @@ -62,26 +62,23 @@ NOTE </div> <div class="admonition-content"> - ãã®èšäºã¯ Qiita ããç§»æ€ããŠãããã®ã§ããå
URL: <a href="https://qiita.com/nsfisis/items/74d7ffeeebc51b20d791" rel="noreferrer" target="_blank">https://qiita.com/nsfisis/items/74d7ffeeebc51b20d791</a> + <p> + ãã®èšäºã¯ Qiita ããç§»æ€ããŠãããã®ã§ãã å
URL: <a href="https://qiita.com/nsfisis/items/74d7ffeeebc51b20d791" rel="noreferrer" target="_blank">https://qiita.com/nsfisis/items/74d7ffeeebc51b20d791</a> + </p> </div> </div> - <p> - Ruby ãšããèšèªã«ã¯è€æ°ã®å®è£
ãããããããããã¹ã¯ãªããäžããã©ã®ããã«ã㊠programmatically ã«èŠåããã°ããã ãããã + Ruby ãšããèšèªã«ã¯è€æ°ã®å®è£
ãããããããããã¹ã¯ãªããäžããã©ã®ããã«ã㊠programmatically ã«èŠåããã°ããã ãããã </p> - <p> <code>Object</code> ã¯ã©ã¹ã«å®çŸ©ãããŠãã <code>RUBY_ENGINE</code> ãšãã宿°ããã®çšéã«äœ¿ããã </p> - <p> - åè: <a href="https://docs.ruby-lang.org/ja/latest/method/Object/c/RUBY_ENGINE.html" rel="noreferrer" target="_blank">Object::RUBY_ENGINE</a> + åè: <a href="https://docs.ruby-lang.org/ja/latest/method/Object/c/RUBY_ENGINE.html" rel="noreferrer" target="_blank">Object::RUBY_ENGINE</a> </p> - <p> - äžèšããŒãžã®äŸããåŒçšãã: + äžèšããŒãžã®äŸããåŒçšãã: </p> - <div class="codeblock" language="shell-session"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>$ ruby-1.9.1 -ve 'p RUBY_ENGINE'</span></span> <span class="line"><span>ruby 1.9.1p0 (2009-03-04 revision 22762) [x86_64-linux]</span></span> @@ -90,129 +87,39 @@ <span class="line"><span>jruby 1.2.0 (ruby 1.8.6 patchlevel 287) (2009-03-16 rev 9419) [i386-java]</span></span> <span class="line"><span>"jruby"</span></span></code></pre> </div> - <p> - ããããã®åŠçç³»ãã©ã®ãããªå€ãè¿ããã ããstack overflow ã«è¯ã質åãšåçããã£ãã + ããããã®åŠçç³»ãã©ã®ãããªå€ãè¿ããã ããstack overflow ã«è¯ã質åãšåçããã£ãã </p> - <p> - <a href="https://stackoverflow.com/a/9894232" rel="noreferrer" target="_blank">What values for RUBY_ENGINE correspond to which Ruby implementations?</a> ããåŒçš: + <a href="https://stackoverflow.com/a/9894232" rel="noreferrer" target="_blank">What values for RUBY_ENGINE correspond to which Ruby implementations?</a> ããåŒçš: </p> - <blockquote> - <table> - <thead> - <tr> - <td> - RUBY_ENGINE - </td> - - <td> - Implementation - </td> - </tr> - </thead> - - <tbody> - <tr> - <td> - <undefined> - </td> - - <td> - MRI < 1.9 - </td> - </tr> - - <tr> - <td> - `ruby' - </td> - - <td> - MRI >= 1.9 or REE - </td> - </tr> - - <tr> - <td> - `jruby' - </td> - - <td> - JRuby - </td> - </tr> - - <tr> - <td> - `macruby' - </td> - - <td> - MacRuby - </td> - </tr> - - <tr> - <td> - `rbx' - </td> - - <td> - Rubinius - </td> - </tr> - - <tr> - <td> - `maglev' - </td> - - <td> - MagLev - </td> - </tr> - - <tr> - <td> - `ironruby' - </td> - - <td> - IronRuby - </td> - </tr> - - <tr> - <td> - `cardinal' - </td> - - <td> - Cardinal - </td> - </tr> - </tbody> - </table> + <div class="codeblock"> + <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>| RUBY_ENGINE | Implementation |</span></span> +<span class="line"><span>|:-----------:|:------------------|</span></span> +<span class="line"><span>| <undefined> | MRI < 1.9 |</span></span> +<span class="line"><span>| 'ruby' | MRI >= 1.9 or REE |</span></span> +<span class="line"><span>| 'jruby' | JRuby |</span></span> +<span class="line"><span>| 'macruby' | MacRuby |</span></span> +<span class="line"><span>| 'rbx' | Rubinius |</span></span> +<span class="line"><span>| 'maglev' | MagLev |</span></span> +<span class="line"><span>| 'ironruby' | IronRuby |</span></span> +<span class="line"><span>| 'cardinal' | Cardinal |</span></span></code></pre> + </div> </blockquote> - <p> - ãªãããã®è³ªåã»åç㯠2014幎ã«ãªããããã®ã§ãããå€ã¯å€ãã£ãŠããå¯èœæ§ããããMRI (aka CRuby) ã«ã€ããŠã¯å·çæçŸåš (2020/12/8) ã <code>'ruby'</code> ãè¿ã£ãŠããããšãç¢ºèªæžã¿ã + ãªãããã®è³ªåã»åç㯠2014幎ã«ãªããããã®ã§ãããå€ã¯å€ãã£ãŠããå¯èœæ§ããããMRI (aka CRuby) ã«ã€ããŠã¯å·çæçŸåš (2020/12/8) ã <code>'ruby'</code> ãè¿ã£ãŠããããšãç¢ºèªæžã¿ã </p> - <p> - ãã®è¡šã«ãªãäž»èŠãªåŠçç³»ãšããŠã<a href="https://mruby.org" rel="noreferrer" target="_blank">mruby</a> 㯠<code>'mruby'</code> ãè¿ãã + ãã®è¡šã«ãªãäž»èŠãªåŠçç³»ãšããŠã <a href="https://mruby.org" rel="noreferrer" target="_blank">mruby</a> 㯠<code>'mruby'</code> ãè¿ãã </p> - <p> - <a href="https://github.com/mruby/mruby/blob/ed29d74bfd95362eaeb946fcf7e865d80346b62b/include/mruby/version.h#L32-L35" rel="noreferrer" target="_blank">mruby 該åœéšåã®ãœãŒã¹</a> ããåŒçš: + <a href="https://github.com/mruby/mruby/blob/ed29d74bfd95362eaeb946fcf7e865d80346b62b/include/mruby/version.h#L32-L35" rel="noreferrer" target="_blank">mruby 該åœéšåã®ãœãŒã¹</a> ããåŒçš: </p> - <div class="codeblock" language="c"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#6A737D">/*</span></span> -<span class="line"><span style="color:#6A737D">* Ruby engine.</span></span> -<span class="line"><span style="color:#6A737D">*/</span></span> +<span class="line"><span style="color:#6A737D"> * Ruby engine.</span></span> +<span class="line"><span style="color:#6A737D"> */</span></span> <span class="line"><span style="color:#D73A49">#define</span><span style="color:#6F42C1"> MRUBY_RUBY_ENGINE</span><span style="color:#032F62"> "mruby"</span></span></code></pre> </div> </div> diff --git a/vhosts/blog/public/posts/2021-10-02/ruby-then-keyword-and-case-in/index.html b/vhosts/blog/public/posts/2021-10-02/ruby-then-keyword-and-case-in/index.html index 76f7058c..cf80ece0 100644 --- a/vhosts/blog/public/posts/2021-10-02/ruby-then-keyword-and-case-in/index.html +++ b/vhosts/blog/public/posts/2021-10-02/ruby-then-keyword-and-case-in/index.html @@ -65,23 +65,22 @@ NOTE </div> <div class="admonition-content"> - ãã®èšäºã¯ Qiita ããç§»æ€ããŠãããã®ã§ããå
URL: <a href="https://qiita.com/nsfisis/items/787a8cf888a304497223" rel="noreferrer" target="_blank">https://qiita.com/nsfisis/items/787a8cf888a304497223</a> + <p> + ãã®èšäºã¯ Qiita ããç§»æ€ããŠãããã®ã§ãã å
URL: <a href="https://qiita.com/nsfisis/items/787a8cf888a304497223" rel="noreferrer" target="_blank">https://qiita.com/nsfisis/items/787a8cf888a304497223</a> + </p> </div> </div> - <section id="section--tl-dr"> - <h2><a href="#section--tl-dr">TL; DR</a></h2> + <h2><a href="#section--tl-dr">TL; DR</a></h2> <p> <code>case</code> - <code>in</code> ã«ãããã¿ãŒã³ãããã³ã°æ§æã§ãã<code>case</code> - <code>when</code> ãšåãããã« <code>then</code> ã䜿ãã (å Žåã«ãã£ãŠã¯äœ¿ãå¿
èŠããã)ã </p> </section> - <section id="section--what-is-then-keyword"> - <h2><a href="#section--what-is-then-keyword"><code>then</code> ãšã¯</a></h2> + <h2><a href="#section--what-is-then-keyword"><code>then</code> ãšã¯</a></h2> <p> - 䜿ãããããšã¯çšã ããRuby ã§ã¯ <code>then</code> ãããŒã¯ãŒãã«ãªã£ãŠãããæ¬¡ã®ããã«äœ¿ã: + 䜿ãããããšã¯çšã ããRuby ã§ã¯ <code>then</code> ãããŒã¯ãŒãã«ãªã£ãŠãããæ¬¡ã®ããã«äœ¿ã: </p> - <div class="codeblock" language="ruby"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49">if</span><span style="color:#24292E"> cond </span><span style="color:#D73A49">then</span></span> <span class="line"><span style="color:#005CC5"> puts</span><span style="color:#032F62"> "Y"</span></span> @@ -89,11 +88,9 @@ <span class="line"><span style="color:#005CC5"> puts</span><span style="color:#032F62"> "N"</span></span> <span class="line"><span style="color:#D73A49">end</span></span></code></pre> </div> - <p> - ãã®ããŒã¯ãŒããçŸãããå Žæã¯ããã€ãããã<code>if</code>ã<code>unless</code>ã<code>rescue</code>ã<code>case</code> æ§æãããã«åœããã äžèšã®ããã«ãäœãæ¡ä»¶ãæžããåŸ <code>then</code> ã眮ããåŒãããã§çµäºããŠããããšã瀺ãããŒã«ãŒãšããŠæ©èœããã + ãã®ããŒã¯ãŒããçŸãããå Žæã¯ããã€ãããã<code>if</code>ã<code>unless</code>ã<code>rescue</code>ã<code>case</code> æ§æãããã«åœããã äžèšã®ããã«ãäœãæ¡ä»¶ãæžããåŸ <code>then</code> ã眮ããåŒãããã§çµäºããŠããããšã瀺ãããŒã«ãŒãšããŠæ©èœããã </p> - <div class="codeblock" language="ruby"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#6A737D"># Example:</span></span> <span class="line"></span> @@ -117,21 +114,17 @@ <span class="line"><span style="color:#D73A49">end</span></span></code></pre> </div> </section> - <section id="section--why-then-is-usually-unnecessary"> - <h2><a href="#section--why-then-is-usually-unnecessary">ãªãæ®æ®µã¯æžããªããŠãããã®ã</a></h2> + <h2><a href="#section--why-then-is-usually-unnecessary">ãªãæ®æ®µã¯æžããªããŠãããã®ã</a></h2> <p> - æ®é Ruby ã®ã³ãŒãã§ <code>then</code> ãæžãããšã¯ãªãããªãããæ¬¡ã®ã³ãŒããå®è¡ããŠã¿ããšãããã + æ®é Ruby ã®ã³ãŒãã§ <code>then</code> ãæžãããšã¯ãªãããªãããæ¬¡ã®ã³ãŒããå®è¡ããŠã¿ããšãããã </p> - <div class="codeblock" language="ruby"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49">if</span><span style="color:#005CC5"> true</span><span style="color:#005CC5"> puts</span><span style="color:#032F62"> 'Hello, World!'</span><span style="color:#D73A49"> end</span></span></code></pre> </div> - <p> - 次ã®ãããªæ§æãšã©ãŒãåºåãããã + 次ã®ãããªæ§æãšã©ãŒãåºåãããã </p> - <div class="codeblock"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>20:1: syntax error, unexpected local variable or method, expecting `then' or ';' or '\n'</span></span> <span class="line"><span>if true puts 'Hello, World!' end</span></span> @@ -139,72 +132,58 @@ <span class="line"><span>20:1: syntax error, unexpected `end', expecting end-of-input</span></span> <span class="line"><span>...f true puts 'Hello, World!' end</span></span></code></pre> </div> - <p> - äºã€ç®ã®ã¡ãã»ãŒãžã¯ç¡èŠããŠäžã€ç®ãèªããšã<code>then</code> ã <code>;</code> ãæ¹è¡ãæ¥ãã¯ãã®ãšãã倿°ã ãã¡ãœããã ããçŸããããšã«ãããšã©ãŒãšãªã£ãŠããããã ã + äºã€ç®ã®ã¡ãã»ãŒãžã¯ç¡èŠããŠäžã€ç®ãèªããšã<code>then</code> ã <code>;</code> ãæ¹è¡ãæ¥ãã¯ãã®ãšãã倿°ã ãã¡ãœããã ããçŸããããšã«ãããšã©ãŒãšãªã£ãŠããããã ã </p> - <p> - ãã€ã³ãã¯æ¹è¡ã <code>then</code> (ã <code>;</code>) ã®ä»£ãããšãªãããšã§ããã<code>true</code> ã®åŸã«æ¹è¡ãå
¥ããŠã¿ãã + ãã€ã³ãã¯æ¹è¡ã <code>then</code> (ã <code>;</code>) ã®ä»£ãããšãªãããšã§ããã<code>true</code> ã®åŸã«æ¹è¡ãå
¥ããŠã¿ãã </p> - <div class="codeblock" language="ruby"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49">if</span><span style="color:#005CC5"> true</span></span> <span class="line"><span style="color:#005CC5">puts</span><span style="color:#032F62"> 'Hello, World!'</span><span style="color:#D73A49"> end</span></span></code></pre> </div> - <p> - ç¡äº Hello, World! ãšåºåãããããã«ãªã£ãã + ç¡äº Hello, World! ãšåºåãããããã«ãªã£ãã </p> </section> - <section id="section--why-then-or-linebreak-is-needed"> - <h2><a href="#section--why-then-or-linebreak-is-needed">ãªã <code>then</code> ã <code>;</code> ãæ¹è¡ãå¿
èŠã</a></h2> + <h2><a href="#section--why-then-or-linebreak-is-needed">ãªã <code>then</code> ã <code>;</code> ãæ¹è¡ãå¿
èŠã</a></h2> <p> - ãªã <code>then</code> ã <code>;</code> ãæ¹è¡ (ä»¥äž ã<code>then</code> çã) ãå¿
èŠãªã®ã ããããæ¬¡ã®äŸãèŠãŠã»ãã: + ãªã <code>then</code> ã <code>;</code> ãæ¹è¡ (ä»¥äž ã<code>then</code> çã) ãå¿
èŠãªã®ã ããããæ¬¡ã®äŸãèŠãŠã»ãã: </p> - <div class="codeblock" language="ruby"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49">if</span><span style="color:#24292E"> a b </span><span style="color:#D73A49">end</span></span></code></pre> </div> - <p> - <code>then</code> ã <code>;</code> ãæ¹è¡ããªãã®ã§ãšã©ãŒã«ãªãããããã¯æ¡ä»¶åŒãã©ããŸã§ç¶ããŠããã®ãããããªãããã ããã®äŸã¯äºéãã«è§£éã§ããã + <code>then</code> ã <code>;</code> ãæ¹è¡ããªãã®ã§ãšã©ãŒã«ãªãããããã¯æ¡ä»¶åŒãã©ããŸã§ç¶ããŠããã®ãããããªãããã ã ãã®äŸã¯äºéãã«è§£éã§ããã </p> - <div class="codeblock" language="ruby"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#6A737D"># a ãšãã倿°ãã¡ãœããã®è©äŸ¡çµæã truthy ãªã b ãšãã倿°ãã¡ãœãããè©äŸ¡</span></span> <span class="line"><span style="color:#D73A49">if</span><span style="color:#24292E"> a </span><span style="color:#D73A49">then</span></span> <span class="line"><span style="color:#24292E">b</span></span> <span class="line"><span style="color:#D73A49">end</span></span></code></pre> </div> - <div class="codeblock" language="ruby"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#6A737D"># a ãšããã¡ãœããã« b ãšãã倿°ãã¡ãœããã®è©äŸ¡çµæãæž¡ããŠåŒã³åºãã</span></span> <span class="line"><span style="color:#6A737D"># ãã®çµæã truthy ãªãäœãããªã</span></span> <span class="line"><span style="color:#D73A49">if</span><span style="color:#6F42C1"> a</span><span style="color:#24292E">(b) </span><span style="color:#D73A49">then</span></span> <span class="line"><span style="color:#D73A49">end</span></span></code></pre> </div> - <p> <code>then</code> çã¯ãã®ææ§æ§ãæé€ããããã«ãããæ¡ä»¶åŒã¯ <code>if</code> ãã <code>then</code> çãŸã§ã®éã«ããããšããããšãæç¢ºã«ããã C系㮠<code>if</code> åŸã«æ¥ã <code>(</code>/<code>)</code> ããPython ã® <code>:</code>ãRust/Go/Swift ãªã©ã® <code>{</code> ãåã圹å²ãæã€ã </p> - <p> - Ruby ã®å Žåãããã°ã©ããŒãæžããããããæ¹è¡ã§ãã£ãŠ <code>then</code> ã代çšã§ããã®ã§ãã»ãšãã©ã®å Žå <code>then</code> ã¯å¿
èŠãªãã + Ruby ã®å Žåãããã°ã©ããŒãæžããããããæ¹è¡ã§ãã£ãŠ <code>then</code> ã代çšã§ããã®ã§ãã»ãšãã©ã®å Žå <code>then</code> ã¯å¿
èŠãªãã </p> </section> - <section id="section--then-in-case-in"> - <h2><a href="#section--then-in-case-in"><code>case</code> - <code>in</code> ã«ããã <code>then</code></a></h2> + <h2><a href="#section--then-in-case-in"><code>case</code> - <code>in</code> ã«ããã <code>then</code></a></h2> <p> - ããããæ¬é¡ã«ãã©ãçãããæ¥ã Ruby 3.0 ã§ã¯ <code>case</code> ãš <code>in</code> ããŒã¯ãŒãã䜿ã£ããã¿ãŒã³ãããã³ã°ã®æ§æãå
¥ãäºå®ã§ããããã®æ§æã§ããã¿ãŒã³éšãšã®åºåããšã㊠<code>then</code> çãå¿
èŠã«ãªãã (çŸåšã®) Ruby ã«ã¯ formal ãªåœ¢åŒã§ã®ææ³ä»æ§ã¯ååšããªãã®ã§ãyacc ã®å®çŸ©ãã¡ã€ã«ãåç
§ãã (yacc ã®èª¬æã¯çç¥)ã + ããããæ¬é¡ã«ãã©ãçãããæ¥ã Ruby 3.0 ã§ã¯ <code>case</code> ãš <code>in</code> ããŒã¯ãŒãã䜿ã£ããã¿ãŒã³ãããã³ã°ã®æ§æãå
¥ãäºå®ã§ããããã®æ§æã§ããã¿ãŒã³éšãšã®åºåããšã㊠<code>then</code> çãå¿
èŠã«ãªãã (çŸåšã®) Ruby ã«ã¯ formal ãªåœ¢åŒã§ã®ææ³ä»æ§ã¯ååšããªãã®ã§ãyacc ã®å®çŸ©ãã¡ã€ã«ãåç
§ãã (yacc ã®èª¬æã¯çç¥)ã </p> - <p> - <a href="https://github.com/ruby/ruby/blob/221ca0f8281d39f0dfdfe13b2448875384bbf735/parse.y#L3961-L3986" rel="noreferrer" target="_blank">https://github.com/ruby/ruby/blob/221ca0f8281d39f0dfdfe13b2448875384bbf735/parse.y#L3961-L3986</a> + <a href="https://github.com/ruby/ruby/blob/221ca0f8281d39f0dfdfe13b2448875384bbf735/parse.y#L3961-L3986" rel="noreferrer" target="_blank">https://github.com/ruby/ruby/blob/221ca0f8281d39f0dfdfe13b2448875384bbf735/parse.y#L3961-L3986</a> </p> - <div class="codeblock" language="yacc"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>p_case_body : keyword_in</span></span> <span class="line"><span>{</span></span> @@ -233,24 +212,19 @@ <span class="line"><span>}</span></span> <span class="line"><span>;</span></span></code></pre> </div> - <p> - ç°¡ç¥ç: + ç°¡ç¥ç: </p> - <div class="codeblock" language="yacc"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>p_case_body : keyword_in p_top_expr then compstmt p_cases</span></span> <span class="line"><span>;</span></span></code></pre> </div> - <p> - ããã§ã<code>keyword_in</code> ã¯æåéã <code>in</code>ã<code>p_top_expr</code> ã¯ãããããã¿ãŒã³ã<code>then</code> 㯠<code>then</code> ããŒã¯ãŒãã®ããšã§ã¯ãªãããã®èšäºã§ <code>then</code> çãšåŒãã§ãããã®ãã€ãŸã <code>then</code> ããŒã¯ãŒãã<code>;</code>ãæ¹è¡ã®ããããã§ããã + ããã§ã<code>keyword_in</code> ã¯æåéã <code>in</code>ã<code>p_top_expr</code> ã¯ãããããã¿ãŒã³ã<code>then</code> 㯠<code>then</code> ããŒã¯ãŒãã®ããšã§ã¯ãªãããã®èšäºã§ <code>then</code> çãšåŒãã§ãããã®ãã€ãŸã <code>then</code> ããŒã¯ãŒãã<code>;</code>ãæ¹è¡ã®ããããã§ããã </p> - <p> - ããã«ããã<code>case</code> - <code>when</code> ã«ããåŸæ¥ã®æ§æãšåãããã«ã<code>then</code> çããã¿ãŒã³ã®åŸãã«æ¿å
¥ããã°ããããšãããã£ããã€ãŸã次ã®3éãã®ããããã«ãªã: + ããã«ããã<code>case</code> - <code>when</code> ã«ããåŸæ¥ã®æ§æãšåãããã«ã<code>then</code> çããã¿ãŒã³ã®åŸãã«æ¿å
¥ããã°ããããšãããã£ããã€ãŸã次ã®3éãã®ããããã«ãªã: </p> - <div class="codeblock" language="ruby"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49">case</span><span style="color:#24292E"> x</span></span> <span class="line"><span style="color:#D73A49">in</span><span style="color:#005CC5"> 1</span><span style="color:#D73A49"> then</span><span style="color:#24292E"> a</span></span> @@ -273,11 +247,9 @@ <span class="line"><span style="color:#D73A49">in</span><span style="color:#005CC5"> 3</span><span style="color:#24292E">; c</span></span> <span class="line"><span style="color:#D73A49">end</span></span></code></pre> </div> - <p> - ãšããã§ã<code>p_top_expr</code> ã«ã¯ <code>if</code> ã«ãã guard clause ãæžããã®ã§ããã®å Žå㯠<code>if</code> - <code>then</code> ãšäŒŒããããªèŠãç®ã«ãªãã + ãšããã§ã<code>p_top_expr</code> ã«ã¯ <code>if</code> ã«ãã guard clause ãæžããã®ã§ããã®å Žå㯠<code>if</code> - <code>then</code> ãšäŒŒããããªèŠãç®ã«ãªãã </p> - <div class="codeblock" language="ruby"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49">case</span><span style="color:#24292E"> x</span></span> <span class="line"><span style="color:#D73A49">in</span><span style="color:#005CC5"> 0</span><span style="color:#D73A49"> then</span><span style="color:#24292E"> a</span></span> @@ -286,23 +258,22 @@ <span class="line"><span style="color:#D73A49">end</span></span></code></pre> </div> </section> - <section id="section--outro"> - <h2><a href="#section--outro">ãŸãšã</a></h2> + <h2><a href="#section--outro">ãŸãšã</a></h2> <ul> <li> - <code>if</code> ã <code>case</code> ã®æ¡ä»¶ã®åŸãã«ã¯ <code>then</code>ã<code>;</code>ãæ¹è¡ã®ãããããå¿
èŠ + <p> + <code>if</code> ã <code>case</code> ã®æ¡ä»¶ã®åŸãã«ã¯ <code>then</code>ã<code>;</code>ãæ¹è¡ã®ãããããå¿
èŠ + </p> <ul> <li> éåžžã¯æ¹è¡ããŠããã°ãã </li> </ul> </li> - <li> 3.0 ã§å
¥ãäºå®ã® <code>case</code> - <code>in</code> ã§ã <code>then</code> çãå¿
èŠã«ãªã </li> - <li> Ruby ã®æ§æãæ£ç¢ºã«ç¥ãã«ã¯ (çŸç¶) <code>parse.y</code> ãçŽæ¥èªãã°ãã </li> diff --git a/vhosts/blog/public/posts/2021-10-02/rust-where-are-primitive-types-from/index.html b/vhosts/blog/public/posts/2021-10-02/rust-where-are-primitive-types-from/index.html index 4ae7f235..052f674a 100644 --- a/vhosts/blog/public/posts/2021-10-02/rust-where-are-primitive-types-from/index.html +++ b/vhosts/blog/public/posts/2021-10-02/rust-where-are-primitive-types-from/index.html @@ -62,16 +62,16 @@ NOTE </div> <div class="admonition-content"> - ãã®èšäºã¯ Qiita ããç§»æ€ããŠãããã®ã§ããå
URL: <a href="https://qiita.com/nsfisis/items/9a429432258bbcd6c565" rel="noreferrer" target="_blank">https://qiita.com/nsfisis/items/9a429432258bbcd6c565</a> + <p> + ãã®èšäºã¯ Qiita ããç§»æ€ããŠãããã®ã§ãã å
URL: <a href="https://qiita.com/nsfisis/items/9a429432258bbcd6c565" rel="noreferrer" target="_blank">https://qiita.com/nsfisis/items/9a429432258bbcd6c565</a> + </p> </div> </div> - <section id="section--intro"> - <h2><a href="#section--intro">å眮ã</a></h2> + <h2><a href="#section--intro">å眮ã</a></h2> <p> - Rust ã«ãããŠãããªããã£ãåã®ååã¯äºçŽèªã§ãªãããããã£ãŠã次ã®ã³ãŒãã¯åæ³ã§ããã + Rust ã«ãããŠãããªããã£ãåã®ååã¯äºçŽèªã§ãªãããããã£ãŠã次ã®ã³ãŒãã¯åæ³ã§ããã </p> - <div class="codeblock" language="rust"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#24292E">#![allow(non_camel_case_types)]</span></span> <span class="line"><span style="color:#24292E">#![allow(dead_code)]</span></span> @@ -94,40 +94,30 @@ <span class="line"><span style="color:#D73A49">struct</span><span style="color:#6F42C1"> f64</span><span style="color:#24292E">;</span></span> <span class="line"><span style="color:#D73A49">struct</span><span style="color:#6F42C1"> str</span><span style="color:#24292E">;</span></span></code></pre> </div> - <p> - ã§ã¯ãæ®æ®µåã« <code>bool</code> ãšæžãããšãããã® <code>bool</code> ã¯äžäœã©ãããæ¥ãŠããã®ããrustc ã®ãœãŒã¹ã远ã£ãŠã¿ãã + ã§ã¯ãæ®æ®µåã« <code>bool</code> ãšæžãããšãããã® <code>bool</code> ã¯äžäœã©ãããæ¥ãŠããã®ããrustc ã®ãœãŒã¹ã远ã£ãŠã¿ãã + </p> + <p> + åæç¥è: äžè¬çãªã³ã³ãã€ã©ã®æ§é ãçšèªã<code>rustc</code> ãã®ãã®ã®ç¥èã¯äžèŠ (ãšãããããçè
èªèº«ãããç¥ããªã) </p> - - <blockquote> - <p> - åæç¥è: äžè¬çãªã³ã³ãã€ã©ã®æ§é ãçšèªã<code>rustc</code> ãã®ãã®ã®ç¥èã¯äžèŠ (ãšãããããçè
èªèº«ãããç¥ããªã) - </p> - </blockquote> </section> - <section id="section--code-reading"> - <h2><a href="#section--code-reading">調æ»</a></h2> + <h2><a href="#section--code-reading">調æ»</a></h2> <p> - 調æ»ã«äœ¿çšãããœãŒã¹ (èª¿æ»æç¹ã§ã®ææ° master) + 調æ»ã«äœ¿çšãããœãŒã¹ (èª¿æ»æç¹ã§ã®ææ° master) </p> - <p> - <a href="https://github.com/rust-lang/rust/tree/511ed9f2356af365ad8affe046b3dd33f7ac3c98" rel="noreferrer" target="_blank">https://github.com/rust-lang/rust/tree/511ed9f2356af365ad8affe046b3dd33f7ac3c98</a> + <a href="https://github.com/rust-lang/rust/tree/511ed9f2356af365ad8affe046b3dd33f7ac3c98" rel="noreferrer" target="_blank">https://github.com/rust-lang/rust/tree/511ed9f2356af365ad8affe046b3dd33f7ac3c98</a> </p> - <p> - ã©ã®ããã«ããŠèª¿ã¹ãããrustc ã®æ§é ã«ã¯è©³ãããªããããããã«åœãããã€ããã®ã¯é£ããã + ã©ã®ããã«ããŠèª¿ã¹ãããrustc ã®æ§é ã«ã¯è©³ãããªããããããã«åœãããã€ããã®ã¯é£ããã </p> - <p> - 倧éæãªæ§é ãšããŠã¯ã<code>compiler</code> ãã©ã«ã以äžã« <code>rustc_*</code> ãšããååã®ã¯ã¬ãŒããæ°ååå
¥ã£ãŠããããããã©ããã <code>rustc</code> ã³ãã³ãã®å®è£
éšã®ããã ã + 倧éæãªæ§é ãšããŠã¯ã<code>compiler</code> ãã©ã«ã以äžã« <code>rustc_*</code> ãšããååã®ã¯ã¬ãŒããæ°ååå
¥ã£ãŠããããããã©ããã <code>rustc</code> ã³ãã³ãã®å®è£
éšã®ããã ã </p> - <p> - <code>rustc</code> ã¯ã»ã«ããã¹ããããŠãã (= <code>rustc</code> èªèº«ã Rust ã§æžãããŠãã) ã®ã§ã<code>bool</code> ã <code>char</code> ãªã©ã§é©åœã«æ€çŽ¢ããããŠããã€ãºãå€ãããŠè©±ã«ãªããªãããããããèªãåããªããšã« <code>i128</code>/<code>u128</code> ãšããã³ã³ãã€ã©èªèº«ã䜿ãããšããªããããªåãååšããã®ã§ããã䜿ã£ãŠ <code>git grep</code> ããŠã¿ãã + <code>rustc</code> ã¯ã»ã«ããã¹ããããŠãã (= <code>rustc</code> èªèº«ã Rust ã§æžãããŠãã) ã®ã§ã<code>bool</code> ã <code>char</code> ãªã©ã§é©åœã«æ€çŽ¢ããããŠããã€ãºãå€ãããŠè©±ã«ãªããªãã ãããããèªãåããªããšã« <code>i128</code>/<code>u128</code> ãšããã³ã³ãã€ã©èªèº«ã䜿ãããšããªããããªåãååšããã®ã§ããã䜿ã£ãŠ <code>git grep</code> ããŠã¿ãã </p> - <div class="codeblock"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>$ git grep "\bi128\b" | wc # i128</span></span> <span class="line"><span>165 1069 15790</span></span> @@ -138,22 +128,18 @@ <span class="line"><span>$ git grep "\bbool\b" | wc # cf. bool ã®çµæ</span></span> <span class="line"><span>3563 23577 294659</span></span></code></pre> </div> - <p> - 165 çšåºŠã§ããã°æ¢ãããšãã§ãããã ãä»åã¯ãã¯ã¬ãŒãåãèŠãŠããããã®åœãããã€ããã + 165 çšåºŠã§ããã°æ¢ãããšãã§ãããã ãä»åã¯ãã¯ã¬ãŒãåãèŠãŠããããã®åœãããã€ããã </p> - <div class="codeblock"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>$ git grep "\bi128\b"</span></span> <span class="line"><span>...</span></span> <span class="line"><span>rustc_resolve/src/lib.rs: table.insert(sym::i128, Int(IntTy::I128));</span></span> <span class="line"><span>...</span></span></code></pre> </div> - <p> <code>rustc_resolve</code> ãšããã®ã¯ããã«ãåå解決ãæ
ããããªã¯ã¬ãŒãåã§ããã該åœç®æãèŠãŠã¿ãã </p> - <div class="codeblock" language="rust"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#6A737D">/// Interns the names of the primitive types.</span></span> <span class="line"><span style="color:#6A737D">///</span></span> @@ -188,21 +174,17 @@ <span class="line"><span style="color:#24292E"> }</span></span> <span class="line"><span style="color:#24292E">}</span></span></code></pre> </div> - <p> - ããã¯åãã«åæããããªããã£ãåã®äžèЧãšäžèŽããŠãããdoc comment ã«ãã + ããã¯åãã«åæããããªããã£ãåã®äžèЧãšäžèŽããŠãããdoc comment ã«ãã </p> - - <blockquote> - <p> - All other types are defined somewhere and possibly imported, but the primitive ones need special handling, since they have no place of origin. - </p> - </blockquote> - + <div class="codeblock"> + <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>All other types are defined somewhere and possibly imported, but the</span></span> +<span class="line"><span>primitive ones need special handling, since they have no place of</span></span> +<span class="line"><span>origin.</span></span></code></pre> + </div> <p> - ãšãããæ¬¡ã¯ãã® struct ã®äœ¿çšç®æã远ãã远ããšèšã£ãŠã䜿ãããŠããç®æã¯æ¬¡ã®äžç®æãããªãããªã説æã«äžèŠãªç®æã¯å€§ããåã£ãŠããã + ãšãããæ¬¡ã¯ãã® struct ã®äœ¿çšç®æã远ãã远ããšèšã£ãŠã䜿ãããŠããç®æã¯æ¬¡ã®äžç®æãããªãããªã説æã«äžèŠãªç®æã¯å€§ããåã£ãŠããã </p> - <div class="codeblock" language="rust"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#6A737D">/// This resolves the identifier `ident` in the namespace `ns` in the current lexical scope.</span></span> <span class="line"><span style="color:#6A737D">/// (ç¥)</span></span> @@ -226,23 +208,18 @@ <span class="line"><span style="color:#6F42C1"> None</span></span> <span class="line"><span style="color:#24292E">}</span></span></code></pre> </div> - <p> - 颿°åã doc comment ã瀺ããŠããéãããã®é¢æ°ã¯èå¥å (identifier, ident) ãçŸåšã®ã¬ãã·ã«ã«ã¹ã³ãŒãå
ã§è§£æ±º (resolve) ããã<code>if ns == TypeNS</code> ã®ãããã¯å
ã§ã¯ã<code>primitive_type_table</code> (äžèšã® <code>PrimitiveTypeTable::new()</code> ã§äœããã倿°) ã«å«ãŸããŠããèå¥å (<code>bool</code>ã<code>i32</code> ãªã©) ãã©ããå€å®ããããã§ããã°ããã«çŽã¥ããããããªããã£ãåãè¿ããŠããã + 颿°åã doc comment ã瀺ããŠããéãããã®é¢æ°ã¯èå¥å (identifier, ident) ãçŸåšã®ã¬ãã·ã«ã«ã¹ã³ãŒãå
ã§è§£æ±º (resolve) ããã <code>if ns == TypeNS</code> ã®ãããã¯å
ã§ã¯ã<code>primitive_type_table</code> (äžèšã® <code>PrimitiveTypeTable::new()</code> ã§äœããã倿°) ã«å«ãŸããŠããèå¥å (<code>bool</code>ã<code>i32</code> ãªã©) ãã©ããå€å®ããããã§ããã°ããã«çŽã¥ããããããªããã£ãåãè¿ããŠããã </p> - <p> - ãªãã<code>ns</code> ã¯ãåå空éãã瀺ã倿°ã§ãããRust ã«ãããåå空éã¯Cèšèªã«ããããããšã»ãšãã©åãã§ã仿¢ããŠããååã颿°å/倿°åãªã®ãåãªã®ããã¯ããªã®ããåºå¥ããŠããããã® <code>if</code> ã¯ãããªããã£ãåã«è§£æ±ºãããã®ã¯åãæ¢ããŠãããšãã ãã ããšèšã£ãŠããã + ãªãã<code>ns</code> ã¯ãåå空éãã瀺ã倿°ã§ãããRust ã«ãããåå空éã¯Cèšèªã«ããããããšã»ãšãã©åãã§ã仿¢ããŠããååã颿°å/倿°åãªã®ãåãªã®ããã¯ããªã®ããåºå¥ããŠããããã® <code>if</code> ã¯ãããªããã£ãåã«è§£æ±ºãããã®ã¯åãæ¢ããŠãããšãã ãã ããšèšã£ãŠããã </p> - <p> - éèŠãªã®ã¯ãããã <code>resolve_ident_in_lexical_scope()</code> ã®æåŸã«æžãããŠããç¹ã§ãããã€ãŸããæåã«æããããªããã£ãåã®èå¥åã¯ããååè§£æ±ºã®æçµæ®µéã§ãããä»ã«ååã®åãèŠã€ãã£ãŠããªããã°ãããªããã£ãåãšããŠè§£æ±ºãããã + éèŠãªã®ã¯ãããã <code>resolve_ident_in_lexical_scope()</code> ã®æåŸã«æžãããŠããç¹ã§ãããã€ãŸããæåã«æããããªããã£ãåã®èå¥åã¯ããååè§£æ±ºã®æçµæ®µéã§ãããä»ã«ååã®åãèŠã€ãã£ãŠããªããã°ãããªããã£ãåãšããŠè§£æ±ºãããã </p> - <p> - åäœãããã£ããšããã§ãäŸãšããŠæ¬¡ã®ã³ãŒããèããã + åäœãããã£ããšããã§ãäŸãšããŠæ¬¡ã®ã³ãŒããèããã </p> - <div class="codeblock" language="rust"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#24292E">#![allow(non_camel_case_types)]</span></span> <span class="line"></span> @@ -252,16 +229,14 @@ <span class="line"><span style="color:#D73A49"> let</span><span style="color:#24292E"> _</span><span style="color:#D73A49">:</span><span style="color:#6F42C1"> bool</span><span style="color:#D73A49"> =</span><span style="color:#6F42C1"> bool</span><span style="color:#24292E">;</span></span> <span class="line"><span style="color:#24292E">}</span></span></code></pre> </div> - <p> - ããã§ <code>main()</code> ã® <code>bool</code> 㯠<code>struct bool</code> ãšããŠè§£æ±ºãããããªããªããããªããã£ãåã®å€å®ãããåã« <code>bool</code> ãšããååã®å¥ã®åãèŠã€ããããã ã + ããã§ <code>main()</code> ã® <code>bool</code> 㯠<code>struct bool</code> ãšããŠè§£æ±ºãããããªããªããããªããã£ãåã®å€å®ãããåã« <code>bool</code> ãšããååã®å¥ã®åãèŠã€ããããã ã </p> </section> - <section id="section--outro"> - <h2><a href="#section--outro">ãŸãšã</a></h2> + <h2><a href="#section--outro">ãŸãšã</a></h2> <p> - Rust ã®ããªããã£ãåã¯äºçŽèªã§ã¯ãªããååè§£æ±ºã®æçµæ®µéã§ç¹å¥æ±ããããä»ã«ååã®åãèŠã€ãã£ãŠããªããã°å¯Ÿå¿ããããªããã£ãåã«è§£æ±ºãããã + Rust ã®ããªããã£ãåã¯äºçŽèªã§ã¯ãªããååè§£æ±ºã®æçµæ®µéã§ç¹å¥æ±ããããä»ã«ååã®åãèŠã€ãã£ãŠããªããã°å¯Ÿå¿ããããªããã£ãåã«è§£æ±ºãããã </p> </section> </div> diff --git a/vhosts/blog/public/posts/2021-10-02/vim-difference-between-autocmd-bufwrite-and-bufwritepre/index.html b/vhosts/blog/public/posts/2021-10-02/vim-difference-between-autocmd-bufwrite-and-bufwritepre/index.html index ddf70cae..fa0553d5 100644 --- a/vhosts/blog/public/posts/2021-10-02/vim-difference-between-autocmd-bufwrite-and-bufwritepre/index.html +++ b/vhosts/blog/public/posts/2021-10-02/vim-difference-between-autocmd-bufwrite-and-bufwritepre/index.html @@ -62,103 +62,92 @@ NOTE </div> <div class="admonition-content"> - ãã®èšäºã¯ Qiita ããç§»æ€ããŠãããã®ã§ããå
URL: <a href="https://qiita.com/nsfisis/items/79ab4db8564032de0b25" rel="noreferrer" target="_blank">https://qiita.com/nsfisis/items/79ab4db8564032de0b25</a> + <p> + ãã®èšäºã¯ Qiita ããç§»æ€ããŠãããã®ã§ãã å
URL: <a href="https://qiita.com/nsfisis/items/79ab4db8564032de0b25" rel="noreferrer" target="_blank">https://qiita.com/nsfisis/items/79ab4db8564032de0b25</a> + </p> </div> </div> - <section id="section--tl-dr"> - <h2><a href="#section--tl-dr">TL; DR</a></h2> + <h2><a href="#section--tl-dr">TL; DR</a></h2> <p> - éãã¯ãªãããã ã®ãšã€ãªã¢ã¹ã + éãã¯ãªãããã ã®ãšã€ãªã¢ã¹ã </p> </section> - <section id="section--code-reading"> - <h2><a href="#section--code-reading">調æ»èšé²</a></h2> + <h2><a href="#section--code-reading">調æ»èšé²</a></h2> <p> - Vim ã® autocmd events ã«ã¯äŒŒéã£ãååã®ãã®ãããã€ãããã倧æµã¯ <code>:help</code> ã«èª¬æããããããã®èšäºã®ã¿ã€ãã«ã«ãã2ã€ãå«ãã以äžã®ã€ãã³ãã«ã¯ããã®éãã«ã€ããŠèª¬æããªãã + Vim ã® autocmd events ã«ã¯äŒŒéã£ãååã®ãã®ãããã€ãããã倧æµã¯ <code>:help</code> ã«èª¬æããããããã®èšäºã®ã¿ã€ãã«ã«ãã2ã€ãå«ãã以äžã®ã€ãã³ãã«ã¯ããã®éãã«ã€ããŠèª¬æããªãã </p> - <ul> <li> <code>BufRead</code>/<code>BufReadPost</code> </li> - <li> <code>BufWrite</code>/<code>BufWritePre</code> </li> - <li> <code>BufAdd</code>/<code>BufCreate</code> </li> </ul> - <p> - ãã®ãã¡ã<code>BufAdd</code>/<code>BufCreate</code> ã«é¢ããŠã¯ã<code>:help BufCreate</code> ã« + ãã®ãã¡ã<code>BufAdd</code>/<code>BufCreate</code> ã«é¢ããŠã¯ã<code>:help BufCreate</code> ã« </p> - <blockquote> <p> - The BufCreate event is for historic reasons. + The BufCreate event is for historic reasons. </p> </blockquote> - <p> - ãšããããããã㯠<code>BufAdd</code> ã®ãšã€ãªã¢ã¹ã§ããããšããããšãããããä»ã®2çµãåæ§ã§ã¯ãªãããšäºæ³ããããã確èªã®ãã vim ãš neovim ã®ãœãŒã¹ã³ãŒãã調æ»ããã + ãšããããããã㯠<code>BufAdd</code> ã®ãšã€ãªã¢ã¹ã§ããããšããããšãããããä»ã®2çµãåæ§ã§ã¯ãªãããšäºæ³ããããã確èªã®ãã vim ãš neovim ã®ãœãŒã¹ã³ãŒãã調æ»ããã </p> - - <blockquote> - <p> - ãœãŒã¹ã³ãŒããžã®ãªã³ã¯ <a href="https://github.com/vim/vim/tree/8e6be34338f13a6a625f19bcef82019c9adc65f2" rel="noreferrer" target="_blank">vim (èª¿æ»æç¹ã§ã® master branch)</a> <a href="https://github.com/neovim/neovim/tree/71d4f5851f068eeb432af34850dddda8cc1c71e3" rel="noreferrer" target="_blank">neovim (äžã«åã)</a> - </p> - </blockquote> - + <p> + ãœãŒã¹ã³ãŒããžã®ãªã³ã¯ + </p> + <ul> + <li> + <a href="https://github.com/vim/vim/tree/8e6be34338f13a6a625f19bcef82019c9adc65f2" rel="noreferrer" target="_blank">vim (èª¿æ»æç¹ã§ã® master branch)</a> + </li> + <li> + <a href="https://github.com/neovim/neovim/tree/71d4f5851f068eeb432af34850dddda8cc1c71e3" rel="noreferrer" target="_blank">neovim (äžã«åã)</a> + </li> + </ul> <section id="section--code-reading--vim"> - <h3><a href="#section--code-reading--vim">vim ã®ãœãŒã¹ã³ãŒã</a></h3> + <h3><a href="#section--code-reading--vim">vim ã®ãœãŒã¹ã³ãŒã</a></h3> <p> - 以äžã¯ãautocmd events ã®ååãšå
éšã§äœ¿ãããŠããæŽæ°å€ãšã®ãããã³ã°ãå®çŸ©ããŠããç®æã§ãããèŠãŠã®éããäžã§ãšã€ãªã¢ã¹ã§ã¯ãªãããšè¿°ã¹ã3çµã«ã¯ãããããåãå
éšå€ã䜿ãããŠããã + 以äžã¯ãautocmd events ã®ååãšå
éšã§äœ¿ãããŠããæŽæ°å€ãšã®ãããã³ã°ãå®çŸ©ããŠããç®æã§ãããèŠãŠã®éããäžã§ãšã€ãªã¢ã¹ã§ã¯ãªãããšè¿°ã¹ã3çµã«ã¯ãããããåãå
éšå€ã䜿ãããŠããã </p> - <p> - <a href="https://github.com/vim/vim/blob/8e6be34338f13a6a625f19bcef82019c9adc65f2/src/autocmd.c#L85-L86" rel="noreferrer" target="_blank">https://github.com/vim/vim/blob/8e6be34338f13a6a625f19bcef82019c9adc65f2/src/autocmd.c#L85-L86</a> + <a href="https://github.com/vim/vim/blob/8e6be34338f13a6a625f19bcef82019c9adc65f2/src/autocmd.c#L85-L86" rel="noreferrer" target="_blank">https://github.com/vim/vim/blob/8e6be34338f13a6a625f19bcef82019c9adc65f2/src/autocmd.c#L85-L86</a> </p> - <div class="codeblock" language="c"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#24292E">{</span><span style="color:#032F62">"BufAdd"</span><span style="color:#24292E">, EVENT_BUFADD},</span></span> <span class="line"><span style="color:#24292E">{</span><span style="color:#032F62">"BufCreate"</span><span style="color:#24292E">, EVENT_BUFADD},</span></span></code></pre> </div> - <p> - <a href="https://github.com/vim/vim/blob/8e6be34338f13a6a625f19bcef82019c9adc65f2/src/autocmd.c#L95-L97" rel="noreferrer" target="_blank">https://github.com/vim/vim/blob/8e6be34338f13a6a625f19bcef82019c9adc65f2/src/autocmd.c#L95-L97</a> + <a href="https://github.com/vim/vim/blob/8e6be34338f13a6a625f19bcef82019c9adc65f2/src/autocmd.c#L95-L97" rel="noreferrer" target="_blank">https://github.com/vim/vim/blob/8e6be34338f13a6a625f19bcef82019c9adc65f2/src/autocmd.c#L95-L97</a> </p> - <div class="codeblock" language="c"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#24292E">{</span><span style="color:#032F62">"BufRead"</span><span style="color:#24292E">, EVENT_BUFREADPOST},</span></span> <span class="line"><span style="color:#24292E">{</span><span style="color:#032F62">"BufReadCmd"</span><span style="color:#24292E">, EVENT_BUFREADCMD},</span></span> <span class="line"><span style="color:#24292E">{</span><span style="color:#032F62">"BufReadPost"</span><span style="color:#24292E">, EVENT_BUFREADPOST},</span></span></code></pre> </div> - <p> - <a href="https://github.com/vim/vim/blob/8e6be34338f13a6a625f19bcef82019c9adc65f2/src/autocmd.c#L103-L105" rel="noreferrer" target="_blank">https://github.com/vim/vim/blob/8e6be34338f13a6a625f19bcef82019c9adc65f2/src/autocmd.c#L103-L105</a> + <a href="https://github.com/vim/vim/blob/8e6be34338f13a6a625f19bcef82019c9adc65f2/src/autocmd.c#L103-L105" rel="noreferrer" target="_blank">https://github.com/vim/vim/blob/8e6be34338f13a6a625f19bcef82019c9adc65f2/src/autocmd.c#L103-L105</a> </p> - <div class="codeblock" language="c"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#24292E">{</span><span style="color:#032F62">"BufWrite"</span><span style="color:#24292E">, EVENT_BUFWRITEPRE},</span></span> <span class="line"><span style="color:#24292E">{</span><span style="color:#032F62">"BufWritePost"</span><span style="color:#24292E">, EVENT_BUFWRITEPOST},</span></span> <span class="line"><span style="color:#24292E">{</span><span style="color:#032F62">"BufWritePre"</span><span style="color:#24292E">, EVENT_BUFWRITEPRE},</span></span></code></pre> </div> </section> - <section id="section--code-reading--neovim"> - <h3><a href="#section--code-reading--neovim">neovim ã®ãœãŒã¹ã³ãŒã</a></h3> + <h3><a href="#section--code-reading--neovim">neovim ã®ãœãŒã¹ã³ãŒã</a></h3> <p> - neovim ã®å Žåã§ãåæ§ã®ãããã³ã°ãå®çŸ©ãããŠãããããã¡ãã®å Žå㯠Lua ã§æžãããŠããã以äžã«ããéããã¯ã£ãã <code>aliases</code> ãšæžãããŠããã + neovim ã®å Žåã§ãåæ§ã®ãããã³ã°ãå®çŸ©ãããŠãããããã¡ãã®å Žå㯠Lua ã§æžãããŠããã以äžã«ããéããã¯ã£ãã <code>aliases</code> ãšæžãããŠããã </p> - <p> - <a href="https://github.com/neovim/neovim/blob/71d4f5851f068eeb432af34850dddda8cc1c71e3/src/nvim/auevents.lua#L119-L124" rel="noreferrer" target="_blank">https://github.com/neovim/neovim/blob/71d4f5851f068eeb432af34850dddda8cc1c71e3/src/nvim/auevents.lua#L119-L124</a> + <a href="https://github.com/neovim/neovim/blob/71d4f5851f068eeb432af34850dddda8cc1c71e3/src/nvim/auevents.lua#L119-L124" rel="noreferrer" target="_blank">https://github.com/neovim/neovim/blob/71d4f5851f068eeb432af34850dddda8cc1c71e3/src/nvim/auevents.lua#L119-L124</a> </p> - <div class="codeblock" language="lua"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#24292E">aliases </span><span style="color:#D73A49">=</span><span style="color:#24292E"> {</span></span> <span class="line"><span style="color:#24292E"> BufCreate </span><span style="color:#D73A49">=</span><span style="color:#032F62"> 'BufAdd'</span><span style="color:#24292E">,</span></span> @@ -167,11 +156,9 @@ <span class="line"><span style="color:#24292E"> FileEncoding </span><span style="color:#D73A49">=</span><span style="color:#032F62"> 'EncodingChanged'</span><span style="color:#24292E">,</span></span> <span class="line"><span style="color:#24292E">},</span></span></code></pre> </div> - <p> - ãšããã§ãäžã§ã¯åãäžããªãã£ã <code>FileEncoding</code> ã ãããã㯠<code>:help FileEncoding</code> ã«ãã£ãããšæžããŠããã + ãšããã§ãäžã§ã¯åãäžããªãã£ã <code>FileEncoding</code> ã ãããã㯠<code>:help FileEncoding</code> ã«ãã£ãããšæžããŠããã </p> - <div class="codeblock"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span> *FileEncoding*</span></span> <span class="line"><span>FileEncoding Obsolete. It still works and is equivalent</span></span> @@ -179,53 +166,55 @@ </div> </section> </section> - <section id="section--outro"> - <h2><a href="#section--outro">ãŸãšã</a></h2> + <h2><a href="#section--outro">ãŸãšã</a></h2> <p> - èšäºã¿ã€ãã«ã«ã€ããŠèšãã°ãã©ã¡ããå€ãããªãã®ã§å¥œããªæ¹ã䜿ãã°ããããããŠèšãã°ã次ã®ããã«ãªãã ããã + èšäºã¿ã€ãã«ã«ã€ããŠèšãã°ãã©ã¡ããå€ãããªãã®ã§å¥œããªæ¹ã䜿ãã°ããããããŠèšãã°ã次ã®ããã«ãªãã ããã </p> - <ul> <li> - <code>BufAdd</code>/<code>BufCreate</code> + <p> + <code>BufAdd</code>/<code>BufCreate</code> + </p> <ul> <li> - â <code>BufCreate</code> ã¯æŽå²çãªçç±ã«ãã ("for historic reasons") ååšããŠãããããæ°ããæ¹ (<code>BufAdd</code>) ã䜿ã + â <code>BufCreate</code> ã¯æŽå²çãªçç±ã«ãã (âfor historic reasonsâ) ååšããŠãããããæ°ããæ¹ (<code>BufAdd</code>) ã䜿ã </li> </ul> </li> - <li> - <code>BufRead</code>/<code>BufReadPost</code> + <p> + <code>BufRead</code>/<code>BufReadPost</code> + </p> <ul> <li> â <code>BufReadPre</code> ãšã®å¯Ÿç§°æ§ã®ãããããã㯠<code>BufWritePost</code> ãšã®å¯Ÿç§°æ§ã®ãã <code>BufReadPost</code> ã䜿ã </li> </ul> </li> - <li> - <code>BufWrite</code>/<code>BufWritePre</code> + <p> + <code>BufWrite</code>/<code>BufWritePre</code> + </p> <ul> <li> â <code>BufWritePost</code> ãšã®å¯Ÿç§°æ§ã®ãããããã㯠<code>BufReadPre</code> ãšã®å¯Ÿç§°æ§ã®ãã <code>BufWritePre</code> ã䜿ã </li> </ul> </li> - <li> - <code>FileEncoding</code>/<code>EncodingChanged</code> + <p> + <code>FileEncoding</code>/<code>EncodingChanged</code> + </p> <ul> <li> - â <code>FileEncoding</code> 㯠<code>`Obsolete'' ãšæèšãããŠããã®ã§ã`EncodingChanged</code> ã䜿ã + â <code>FileEncoding</code> 㯠âObsoleteâ ãšæèšãããŠããã®ã§ã<code>EncodingChanged</code> ã䜿ã </li> </ul> </li> </ul> - <p> - ãšããã§ãã®èª¿æ»ã§ç¥ã£ãã®ã ãã<code>BufRead</code> ãš <code>BufWrite</code> ã¯äžã«ããéãçºç«ããã¿ã€ãã³ã°ããåŸããšãåãã§å¯Ÿç§°æ§ããªããå¯èœãªã <code>Pre</code>/<code>Post</code> ä»ãã®ãã®ã䜿ã£ãæ¹ãåãããããã ããã + ãšããã§ãã®èª¿æ»ã§ç¥ã£ãã®ã ãã<code>BufRead</code> ãš <code>BufWrite</code> ã¯äžã«ããéãçºç«ããã¿ã€ãã³ã°ããåŸããšãåãã§å¯Ÿç§°æ§ããªããå¯èœãªã <code>Pre</code>/<code>Post</code> ä»ãã®ãã®ã䜿ã£ãæ¹ãåãããããã ããã </p> </section> </div> diff --git a/vhosts/blog/public/posts/2021-10-02/vim-swap-order-of-selected-lines/index.html b/vhosts/blog/public/posts/2021-10-02/vim-swap-order-of-selected-lines/index.html index afee803f..ec7e5591 100644 --- a/vhosts/blog/public/posts/2021-10-02/vim-swap-order-of-selected-lines/index.html +++ b/vhosts/blog/public/posts/2021-10-02/vim-swap-order-of-selected-lines/index.html @@ -62,12 +62,13 @@ NOTE </div> <div class="admonition-content"> - ãã®èšäºã¯ Qiita ããç§»æ€ããŠãããã®ã§ããå
URL: <a href="https://qiita.com/nsfisis/items/4fefb361d9a693803520" rel="noreferrer" target="_blank">https://qiita.com/nsfisis/items/4fefb361d9a693803520</a> + <p> + ãã®èšäºã¯ Qiita ããç§»æ€ããŠãããã®ã§ãã å
URL: <a href="https://qiita.com/nsfisis/items/4fefb361d9a693803520" rel="noreferrer" target="_blank">https://qiita.com/nsfisis/items/4fefb361d9a693803520</a> + </p> </div> </div> - <section id="section--tl-dr"> - <h2><a href="#section--tl-dr">TL; DR</a></h2> + <h2><a href="#section--tl-dr">TL; DR</a></h2> <div class="codeblock" language="vim"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#6A737D">" License: Public Domain</span></span> <span class="line"></span> @@ -76,110 +77,96 @@ <span class="line"><span style="color:#D73A49"> \</span><span style="color:#24292E"> keeppatterns <line1>,<line2>g</span><span style="color:#032F62">/^/</span><span style="color:#24292E">m<line1>-</span><span style="color:#005CC5">1</span></span></code></pre> </div> </section> - <section id="section--version"> - <h2><a href="#section--version">ããŒãžã§ã³æ
å ±</a></h2> + <h2><a href="#section--version">ããŒãžã§ã³æ
å ±</a></h2> <p> - <code>:version</code> ã®äžéš + <code>:version</code> ã®äžéš </p> - <blockquote> <p> - VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Jan 26 2020 11:30:30) macOS version Included patches: 1-148 Huge version without GUI. + VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Jan 26 2020 11:30:30) macOS version Included patches: 1-148 Huge version without GUI. </p> </blockquote> </section> - <section id="section--existing-solution"> - <h2><a href="#section--existing-solution">ãã玹ä»ãããŠããææ³</a></h2> + <h2><a href="#section--existing-solution">ãã玹ä»ãããŠããææ³</a></h2> <section id="section--existing-solution--external-commands"> - <h3><a href="#section--existing-solution--external-commands"><code>tac</code> / <code>tail</code></a></h3> + <h3><a href="#section--existing-solution--external-commands"><code>tac</code> / <code>tail</code></a></h3> <p> <code>tac</code> ã <code>tail -r</code> ãªã©ã®å€éšã³ãã³ãã <code>!</code> ã䜿ã£ãŠåŒã³åºãã眮ãæããã </p> - <blockquote> <p> - :h v_! + :h v_! </p> </blockquote> - <p> - <code>tac</code> ã³ãã³ãã <code>tail</code> ã® <code>-r</code> ãªãã·ã§ã³ã¯ç°å¢ã«ãã£ãŠå©çšã§ããªãããšããããè€æ°ã®ç°å¢ãè¡ãæ¥ããå Žåã«æ¡çšãã¥ãã + <code>tac</code> ã³ãã³ãã <code>tail</code> ã® <code>-r</code> ãªãã·ã§ã³ã¯ç°å¢ã«ãã£ãŠå©çšã§ããªãããšããããè€æ°ã®ç°å¢ãè¡ãæ¥ããå Žåã«æ¡çšãã¥ãã </p> </section> - <section id="section--existing-solution--global-command"> - <h3><a href="#section--existing-solution--global-command"><code>:g/^/m0</code></a></h3> + <h3><a href="#section--existing-solution--global-command"><code>:g/^/m0</code></a></h3> <p> - ãã¡ãã¯å€éšã³ãã³ãã«é ŒãããVim ã®æ©èœã®ã¿ã䜿ãã<code>g</code> 㯠<code>:global</code> ã³ãã³ãã®ã<code>m</code> 㯠<code>:move</code> ã³ãã³ãã®ç¥ + ãã¡ãã¯å€éšã³ãã³ãã«é ŒãããVim ã®æ©èœã®ã¿ã䜿ãã<code>g</code> 㯠<code>:global</code> ã³ãã³ãã®ã<code>m</code> 㯠<code>:move</code> ã³ãã³ãã®ç¥ </p> - <p> <code>:global</code> ã³ãã³ã㯠<code>:[range]global/{pattern}/[command]</code> ã®ããã«äœ¿ãã<code>[range]</code> ã§æå®ãããç¯å²ã®è¡ã®ãã¡ã<code>{pattern}</code> ã§æå®ãããæ€çŽ¢ãã¿ãŒã³ã«ãããããè¡ã«å¯ŸããŠãé çªã« <code>[command]</code> ã§æå®ããã Ex ã³ãã³ããåŒã³åºãã </p> - <blockquote> <p> - :h :global + :h :global </p> </blockquote> - <p> <code>:move</code> ã³ãã³ã㯠<code>[range]:move {address}</code> ã®ããã«äœ¿ãã<code>[range]</code> ã§æå®ãããç¯å²ã®è¡ã <code>{address}</code> ã§æå®ãããäœçœ®ã«ç§»åãããã </p> - <blockquote> <p> - :h :move + :h :move </p> </blockquote> - <p> <code>:g/^/m0</code> ã®ããã«çµã¿åããããšãããã¹ãŠã®è¡ã1è¡ã〠0è¡ç®(1è¡ç®ã®äž)ã«åããããšããåãããããããã¯ç¢ºãã«è¡ã®å
¥ãæ¿ãã«ãªã£ãŠããã </p> - <p> - ãªãã<code>:g/^/m0</code> ã¯å
šãŠã®è¡ãå
¥ãæ¿ãããã<code>:N,Mg/^/mN-1</code> ãšããããšã§ Nè¡ç®ãã Mè¡ç®ãåŠçç¯å²ãšããããæ¡åŒµã§ãããæã§ãããå
¥åããããã«ã¯ãããªãã®ã§ã次ã®ãããªã³ãã³ããçšæããã + ãªãã<code>:g/^/m0</code> ã¯å
šãŠã®è¡ãå
¥ãæ¿ãããã<code>:N,Mg/^/mN-1</code> ãšããããšã§ Nè¡ç®ãã Mè¡ç®ãåŠçç¯å²ãšããããæ¡åŒµã§ãããæã§ãããå
¥åããããã«ã¯ãããªãã®ã§ã次ã®ãããªã³ãã³ããçšæããã </p> - <div class="codeblock" language="vim"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49">command!</span><span style="color:#24292E"> -bar -</span><span style="color:#D73A49">range=</span><span style="color:#24292E">%</span></span> <span class="line"><span style="color:#D73A49"> \</span><span style="color:#24292E"> Reverse</span></span> <span class="line"><span style="color:#D73A49"> \</span><span style="color:#24292E"> <line1>,<line2>g</span><span style="color:#032F62">/^/</span><span style="color:#24292E">m<line1>-</span><span style="color:#005CC5">1</span></span></code></pre> </div> - <p> - ããã¯æã¿ã®åäœãããããå®éã«å®è¡ããŠã¿ããšå
šè¡ããã€ã©ã€ããããŠããŸããæ¬¡ç¯ã§è©³çްãè¿°ã¹ãã + ããã¯æã¿ã®åäœãããããå®éã«å®è¡ããŠã¿ããšå
šè¡ããã€ã©ã€ããããŠããŸããæ¬¡ç¯ã§è©³çްãè¿°ã¹ãã </p> </section> </section> - <section id="section--problem-of-global-command"> - <h2><a href="#section--problem-of-global-command"><code>:g/^/m0</code> ã®åé¡ç¹</a></h2> + <h2><a href="#section--problem-of-global-command"><code>:g/^/m0</code> ã®åé¡ç¹</a></h2> <p> <code>:global</code> ã³ãã³ãã¯åè¡ã«å¯ŸããŠãããã³ã°ãè¡ãéãçŸåšã®æ€çŽ¢ãã¿ãŒã³ãäžæžãããŠããŸãã<code>^</code> ã¯è¡ã®å
é ã«ããããããããçµæãšããŠå
šãŠã®è¡ããã€ã©ã€ããããŠããŸãã<code>'hlsearch'</code> ãªãã·ã§ã³ãç¡å¹ã«ããŠããå Žåãã®éãã§ã¯ãªããããã®å Žåã§ãçŽåã®æ€çŽ¢ãã¿ãŒã³ã倱ãããŠããŸããš <code>n</code> ã³ãã³ããªã©ã®éã«äžäŸ¿ã§ããã </p> - <blockquote> <p> - :h @/ + :h @/ </p> </blockquote> </section> - <section id="section--solution"> - <h2><a href="#section--solution">解決ç</a></h2> - <blockquote> - <p> - [2020/9/28远èš] ããç°¡æœãªæ¹æ³ãèŠã€ããã®ã§æ¬¡ç¯ã«è¿œèšãã - </p> - </blockquote> - + <h2><a href="#section--solution">解決ç</a></h2> + <div class="admonition"> + <div class="admonition-label"> + NOTE + </div> + <div class="admonition-content"> + <p> + [2020/9/28远èš] ããç°¡æœãªæ¹æ³ãèŠã€ããã®ã§æ¬¡ç¯ã«è¿œèšãã + </p> + </div> + </div> <p> - åè¿°ãã <code>:Reverse</code> ã³ãã³ãã®å®çŸ©ãå°ãå€ããŠã次ã®ããã«ãã: + åè¿°ãã <code>:Reverse</code> ã³ãã³ãã®å®çŸ©ãå°ãå€ããŠã次ã®ããã«ãã: </p> - <div class="codeblock" language="vim"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49">function!</span><span style="color:#6F42C1"> s:reverse_lines</span><span style="color:#24292E">(from, </span><span style="color:#005CC5">to</span><span style="color:#24292E">) </span><span style="color:#D73A49">abort</span></span> <span class="line"><span style="color:#005CC5"> execute</span><span style="color:#6F42C1"> printf</span><span style="color:#24292E">(</span><span style="color:#032F62">"%d,%dg/^/m%d"</span><span style="color:#24292E">, a:from, a:to, a:from</span><span style="color:#D73A49"> - </span><span style="color:#005CC5">1</span><span style="color:#24292E">)</span></span> @@ -189,69 +176,61 @@ <span class="line"><span style="color:#D73A49"> \</span><span style="color:#24292E"> Reverse</span></span> <span class="line"><span style="color:#D73A49"> \</span><span style="color:#D73A49"> call</span><span style="color:#24292E"> <</span><span style="color:#005CC5">SID</span><span style="color:#24292E">></span><span style="color:#6F42C1">reverse_lines</span><span style="color:#24292E">(<line1>, <line2>)</span></span></code></pre> </div> - <p> - å®è¡ããŠããã³ãã³ããå€ãã£ãããã§ã¯ãªããã颿°åŒã³åºããçµç±ããããã«ãããããã ãã§åè¿°ã®åé¡ã解決ããã + å®è¡ããŠããã³ãã³ããå€ãã£ãããã§ã¯ãªããã颿°åŒã³åºããçµç±ããããã«ãããããã ãã§åè¿°ã®åé¡ã解決ããã </p> - <p> - ãã®çç±ã¯ããŠãŒã¶ãŒå®çŸ©é¢æ°ãå®è¡ããéã¯æ€çŽ¢ãã¿ãŒã³ãäžåºŠä¿åãããå®è¡ãçµäºããããšåŸ©å
ããããããçµæãšããŠæ€çŽ¢ãã¿ãŒã³ã <code>^</code> ã§äžæžããããããšããªããªãã + ãã®çç±ã¯ããŠãŒã¶ãŒå®çŸ©é¢æ°ãå®è¡ããéã¯æ€çŽ¢ãã¿ãŒã³ãäžåºŠä¿åãããå®è¡ãçµäºããããšåŸ©å
ããããããçµæãšããŠæ€çŽ¢ãã¿ãŒã³ã <code>^</code> ã§äžæžããããããšããªããªãã </p> - <p> - Vim ã®ãã«ããã該åœç®æãåŒçšãã (匷調ã¯çè
ã«ãã)ã + Vim ã®ãã«ããã該åœç®æãåŒçšãã (匷調ã¯çè
ã«ãã)ã </p> - <blockquote> <p> - :h autocmd-searchpat + :h autocmd-searchpat </p> - <p> - <strong>Autocommands do not change the current search patterns.</strong> Vim saves the current search patterns before executing autocommands then restores them after the autocommands finish. This means that autocommands do not affect the strings highlighted with the `hlsearch' option. + <strong>Autocommands do not change the current search patterns.</strong> Vim saves the current search patterns before executing autocommands then restores them after the autocommands finish. This means that autocommands do not affect the strings highlighted with the âhlsearchâ option. </p> </blockquote> - <p> - ãã㯠autocommand ã®å®è¡ã«é¢ããŠã®èšè¿°ã ãããããšåãããšããŠãŒã¶ãŒå®çŸ©é¢æ°ã®å®è¡æã«ãé©çšãããããã®ããšã¯ <code>:nohlsearch</code> ã®ãã«ãã«ãããåãã該åœç®æãåŒçšãã (匷調ã¯çè
ã«ãã)ã + ãã㯠autocommand ã®å®è¡ã«é¢ããŠã®èšè¿°ã ãããããšåãããšããŠãŒã¶ãŒå®çŸ©é¢æ°ã®å®è¡æã«ãé©çšãããããã®ããšã¯ <code>:nohlsearch</code> ã®ãã«ãã«ãããåãã該åœç®æãåŒçšãã (匷調ã¯çè
ã«ãã)ã </p> - <blockquote> <p> - :h :nohlsearch + :h :nohlsearch </p> - <p> - (ç¥) This command doesnât work in an autocommand, because the highlighting state is saved and restored when executing autocommands |autocmd-searchpat|. <strong>Same thing for when invoking a user function.</strong> + (ç¥) This command doesnât work in an autocommand, because the highlighting state is saved and restored when executing autocommands |autocmd-searchpat|. <strong>Same thing for when invoking a user function.</strong> </p> </blockquote> - <p> - ãã®ä»æ§ã«ããã<code>:g/^/m0</code> ã®åŒã³åºãããŠãŒã¶ãŒå®çŸ©é¢æ°ã«åãåºãããšã§äžè¿°ã®åé¡ã解決ã§ããã + ãã®ä»æ§ã«ããã<code>:g/^/m0</code> ã®åŒã³åºãããŠãŒã¶ãŒå®çŸ©é¢æ°ã«åãåºãããšã§äžè¿°ã®åé¡ã解決ã§ããã </p> </section> - <section id="section--solution-revised"> - <h2><a href="#section--solution-revised">解決ç (æ¹èšç)</a></h2> - <blockquote> - <p> - [2020/9/28远èš] ããç°¡æœãªæ¹æ³ãèŠã€ãããã远èšãã - </p> - </blockquote> - + <h2><a href="#section--solution-revised">解決ç (æ¹èšç)</a></h2> + <div class="admonition"> + <div class="admonition-label"> + NOTE + </div> + <div class="admonition-content"> + <p> + [2020/9/28远èš] ããç°¡æœãªæ¹æ³ãèŠã€ãããã远èšãã + </p> + </div> + </div> <div class="codeblock" language="vim"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49">command!</span><span style="color:#24292E"> -bar -</span><span style="color:#D73A49">range=</span><span style="color:#24292E">%</span></span> <span class="line"><span style="color:#D73A49"> \</span><span style="color:#24292E"> Reverse</span></span> <span class="line"><span style="color:#D73A49"> \</span><span style="color:#24292E"> keeppatterns <line1>,<line2>g</span><span style="color:#032F62">/^/</span><span style="color:#24292E">m<line1>-</span><span style="color:#005CC5">1</span></span></code></pre> </div> - <p> - ãŸãã«ãã®ããã® Exã³ãã³ãã<code>:keeppatterns</code> ãååšããã<code>:keeppatterns {command}</code> ã®ããã«äœ¿ããèªãã§åã®åŠããåŸãã«ç¶ã Exã³ãã³ãããçŸåšã®æ€çŽ¢ãã¿ãŒã³ãä¿ã£ããŸãŸãå®è¡ãããã¯ããã«åãããããæå³ã衚çŸã§ããã + ãŸãã«ãã®ããã® Exã³ãã³ãã<code>:keeppatterns</code> ãååšããã<code>:keeppatterns {command}</code> ã®ããã«äœ¿ããèªãã§åã®åŠããåŸãã«ç¶ã Exã³ãã³ãããçŸåšã®æ€çŽ¢ãã¿ãŒã³ãä¿ã£ããŸãŸãå®è¡ãããã¯ããã«åãããããæå³ã衚çŸã§ããã </p> - <blockquote> <p> - :h :keeppatterns + :h :keeppatterns </p> </blockquote> </section> diff --git a/vhosts/blog/public/posts/2022-04-09/phperkaigi-2022-tokens/index.html b/vhosts/blog/public/posts/2022-04-09/phperkaigi-2022-tokens/index.html index 3469e8b1..ca22ff5a 100644 --- a/vhosts/blog/public/posts/2022-04-09/phperkaigi-2022-tokens/index.html +++ b/vhosts/blog/public/posts/2022-04-09/phperkaigi-2022-tokens/index.html @@ -67,22 +67,19 @@ </ol> </section> <section id="section--intro"> - <h2><a href="#section--intro">ã¯ããã«</a></h2> + <h2><a href="#section--intro">ã¯ããã«</a></h2> <p> - æ¬æ¥éå§ããã <a href="https://phperkaigi.jp/2022/" rel="noreferrer" target="_blank">PHPerKaigi 2022</a> ã® PHPer ãã£ã¬ã³ãžã«ãããŠãåŒç€Ÿ <a href="https://www.dgcircus.com/" rel="noreferrer" target="_blank">ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ</a> ã®åé¡ã 3åäœæããããã®èšäºã§ã¯ããããã®åé¡ã®è§£èª¬ããããªãã + æ¬æ¥éå§ããã <a href="https://phperkaigi.jp/2022/" rel="noreferrer" target="_blank">PHPerKaigi 2022</a> ã® PHPer ãã£ã¬ã³ãžã«ãããŠãåŒç€Ÿ <a href="https://www.dgcircus.com/" rel="noreferrer" target="_blank">ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ</a> ã®åé¡ã 3åäœæããããã®èšäºã§ã¯ããããã®åé¡ã®è§£èª¬ããããªãã </p> - <p> - ãªããžããªã¯ãã¡ã: <a href="https://github.com/nsfisis/PHPerKaigi2022-tokens" rel="noreferrer" target="_blank">https://github.com/nsfisis/PHPerKaigi2022-tokens</a> + ãªããžããªã¯ãã¡ã: <a href="https://github.com/nsfisis/PHPerKaigi2022-tokens" rel="noreferrer" target="_blank">https://github.com/nsfisis/PHPerKaigi2022-tokens</a> </p> </section> - <section id="section--q1-brainfuck"> - <h2><a href="#section--q1-brainfuck">第1å brainf_ck.php</a></h2> + <h2><a href="#section--q1-brainfuck">第1å brainf_ck.php</a></h2> <p> - ãœãŒã¹ã³ãŒãã¯ãã¡ããå®è¡ã«ã¯ PHP 8.1 以äžãå¿
èŠãªã®ã§æ³šæã + ãœãŒã¹ã³ãŒãã¯ãã¡ããå®è¡ã«ã¯ PHP 8.1 以äžãå¿
èŠãªã®ã§æ³šæã </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49"><?</span><span style="color:#005CC5">php</span></span> <span class="line"></span> @@ -154,34 +151,28 @@ <span class="line"><span style="color:#24292E"> $ð, $ð,</span></span> <span class="line"><span style="color:#24292E">]);</span></span></code></pre> </div> - <p> - ãã®åé¡ã¯ãåã«é©åãªããŒãžã§ã³ã® PHP ã§åããã°ããŒã¯ã³ãåŸãããã + ãã®åé¡ã¯ãåã«é©åãªããŒãžã§ã³ã® PHP ã§åããã°ããŒã¯ã³ãåŸãããã </p> - <section id="section--q1-brainfuck--commentary"> - <h3><a href="#section--q1-brainfuck--commentary">解説</a></h3> + <h3><a href="#section--q1-brainfuck--commentary">解説</a></h3> <section id="section--q1-brainfuck--commentary--emoji"> - <h4><a href="#section--q1-brainfuck--commentary--emoji">çµµæå</a></h4> + <h4><a href="#section--q1-brainfuck--commentary--emoji">çµµæå</a></h4> <p> - ãŸãç®ã«ã€ãã®ã¯å€§éã®çµµæåã ããã PHP ã¯èå¥åã«äœ¿çšã§ããæåã®ç¯å²ãåºããçµµæåã䜿ãããšãã§ããã + ãŸãç®ã«ã€ãã®ã¯å€§éã®çµµæåã ããã PHP ã¯èå¥åã«äœ¿çšã§ããæåã®ç¯å²ãåºããçµµæåã䜿ãããšãã§ããã </p> </section> - <section id="section--q1-brainfuck--commentary--brainfuck"> - <h4><a href="#section--q1-brainfuck--commentary--brainfuck">ããã°ã©ã å
šäœ</a></h4> + <h4><a href="#section--q1-brainfuck--commentary--brainfuck">ããã°ã©ã å
šäœ</a></h4> <p> - Brainf*ck ã®ã€ã³ã¿ããªã¿ãšããã°ã©ã ã«ãªã£ãŠããã Brainf*ck ãšã¯ãé£è§£ããã°ã©ãã³ã°èšèªã®ã²ãšã€ã§ãããããã§èª¬æããããã Wikipedia ã®è©²åœããŒãžãèªãã æ¹ãããã + Brainf*ck ã®ã€ã³ã¿ããªã¿ãšããã°ã©ã ã«ãªã£ãŠããã Brainf*ck ãšã¯ãé£è§£ããã°ã©ãã³ã°èšèªã®ã²ãšã€ã§ãããããã§èª¬æããããã Wikipedia ã®è©²åœããŒãžãèªãã æ¹ãããã </p> - <p> - <a href="https://ja.wikipedia.org/wiki/Brainfuck" rel="noreferrer" target="_blank">https://ja.wikipedia.org/wiki/Brainfuck</a> + <a href="https://ja.wikipedia.org/wiki/Brainfuck" rel="noreferrer" target="_blank">https://ja.wikipedia.org/wiki/Brainfuck</a> </p> - <p> - ãªããbrainf*ck ããã°ã©ã ãæ®éã®æžãæ¹ã§æžããšã次ã®ããã«ãªãã + ãªããbrainf*ck ããã°ã©ã ãæ®éã®æžãæ¹ã§æžããšã次ã®ããã«ãªãã </p> - <div class="codeblock"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>+ + + + + + + + + +</span></span> <span class="line"><span>[</span></span> @@ -206,89 +197,71 @@ <span class="line"><span>> - .</span></span> <span class="line"><span>< .</span></span></code></pre> </div> - <p> - å®è¡çµæã¯ãã¡ã: <a href="https://ideone.com/22VWmb" rel="noreferrer" target="_blank">https://ideone.com/22VWmb</a> + å®è¡çµæã¯ãã¡ã: <a href="https://ideone.com/22VWmb" rel="noreferrer" target="_blank">https://ideone.com/22VWmb</a> </p> - <p> - ããããã®çµµæåã§è¡šããã颿°ããååœä»€ã«å¯Ÿå¿ããŠããã + ããããã®çµµæåã§è¡šããã颿°ããååœä»€ã«å¯Ÿå¿ããŠããã </p> - <ul> <li> <code>$ð</code>: <code>></code> </li> - <li> <code>$ð</code>: <code><</code> </li> - <li> <code>$ð</code>: <code>+</code> </li> - <li> <code>$ð</code>: <code>-</code> </li> - <li> <code>$ð</code>: <code>.</code> </li> - <li> <code>$ð€¡</code>: <code>[</code> </li> - <li> <code>$ðª</code>: <code>]</code> </li> </ul> - <p> <code>,</code> (å
¥å) ã«å¯Ÿå¿ãã颿°ã¯ãªã (ãã®ããã°ã©ã ã§ã¯äœ¿ããªãã®ã§çšæããŠããªã)ã </p> - <p> - ãªãã<code>$ð</code> ã¯ãããã main 颿°ã§ãããããã°ã©ã ã®å®è¡éšåã§ããã + ãªãã<code>$ð</code> ã¯ãããã main 颿°ã§ãããããã°ã©ã ã®å®è¡éšåã§ããã </p> </section> - <section id="section--q1-brainfuck--commentary--emoji-selection"> - <h4><a href="#section--q1-brainfuck--commentary--emoji-selection">çµµæåã®éžæ</a></h4> + <h4><a href="#section--q1-brainfuck--commentary--emoji-selection">çµµæåã®éžæ</a></h4> <p> - ããããæå³ã«åèŽããããéžãã§ãããã<code>$ð€¡</code> ãš <code>$ðª</code> ã¯åŒç€Ÿããžã¿ã«ãµãŒã«ã¹ã«ã¡ãªãã§ããã ãŸãã<code>$ð</code> 㯠PHP ã®ãã¹ã³ããã®è±¡ã«ç±æ¥ããã + ããããæå³ã«åèŽããããéžãã§ãããã<code>$ð€¡</code> ãš <code>$ðª</code> ã¯åŒç€Ÿããžã¿ã«ãµãŒã«ã¹ã«ã¡ãªãã§ããã ãŸãã<code>$ð</code> 㯠PHP ã®ãã¹ã³ããã®è±¡ã«ç±æ¥ããã </p> </section> - <section id="section--q1-brainfuck--commentary--strict-types"> - <h4><a href="#section--q1-brainfuck--commentary--strict-types">strict_types</a></h4> + <h4><a href="#section--q1-brainfuck--commentary--strict-types">strict_types</a></h4> <p> <code>declare</code> æã® <code>strict_types</code> ã«æå®ã§ããã®ã¯ã<code>0</code> ã <code>1</code> ã®æ°å€ãªãã©ã«ã ãã <code>0x0</code> ã <code>0b1</code> ã®ãããªå€ãåãä»ããã ä»åã¯ãPHP 8.1 ãã远å ãããã<code>0O</code> ãŸã㯠<code>0o</code> ããå§ãŸãå
«é²æ°ãªãã©ã«ã䜿ã£ãã </p> </section> - <section id="section--q1-brainfuck--commentary--url"> - <h4><a href="#section--q1-brainfuck--commentary--url">URL</a></h4> + <h4><a href="#section--q1-brainfuck--commentary--url">URL</a></h4> <p> - ãœãŒã¹ã³ãŒãã®ã©ã€ã»ã³ã¹ã瀺ãããã®éšåã ãã + ãœãŒã¹ã³ãŒãã®ã©ã€ã»ã³ã¹ã瀺ãããã®éšåã ãã </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#6F42C1">https</span><span style="color:#24292E">:</span><span style="color:#6A737D">//creativecommons.org/publicdomain/zero/1.0/</span></span></code></pre> </div> - <p> - å®å
šã«åæ³ãª PHP ã®ã³ãŒãã§ããã <code>https:</code> éšåã¯ã©ãã«ã<code>//</code> 以éã¯è¡ã³ã¡ã³ãã«ãªã£ãŠããã + å®å
šã«åæ³ãª PHP ã®ã³ãŒãã§ããã <code>https:</code> éšåã¯ã©ãã«ã<code>//</code> 以éã¯è¡ã³ã¡ã³ãã«ãªã£ãŠããã </p> </section> - <section id="section--q1-brainfuck--commentary--numbers"> - <h4><a href="#section--q1-brainfuck--commentary--numbers">ãªãã©ã«ãªãã§æ°å€ãçæãã</a></h4> + <h4><a href="#section--q1-brainfuck--commentary--numbers">ãªãã©ã«ãªãã§æ°å€ãçæãã</a></h4> <p> - ãœãŒã¹ã³ãŒãäžã«ãã»ãšãã©æ°å€ãªãã©ã«ãæžãããŠããªãããšã«ãæ°ã¥ãã ããããPHP ã§ã¯ãå倿ãå©çšããããšã§ä»»æã®æŽæ°ãäœãåºãããšãã§ããã + ãœãŒã¹ã³ãŒãäžã«ãã»ãšãã©æ°å€ãªãã©ã«ãæžãããŠããªãããšã«ãæ°ã¥ãã ãããã PHP ã§ã¯ãå倿ãå©çšããããšã§ä»»æã®æŽæ°ãäœãåºãããšãã§ããã </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#005CC5">assert</span><span style="color:#24292E">(</span><span style="color:#005CC5">0</span><span style="color:#D73A49"> ===</span><span style="color:#D73A49"> +!!</span><span style="color:#24292E">[]);</span></span> <span class="line"><span style="color:#005CC5">assert</span><span style="color:#24292E">(</span><span style="color:#005CC5">1</span><span style="color:#D73A49"> ===</span><span style="color:#D73A49"> +!</span><span style="color:#24292E">[]);</span></span> @@ -296,46 +269,38 @@ <span class="line"><span style="color:#005CC5">assert</span><span style="color:#24292E">(</span><span style="color:#005CC5">3</span><span style="color:#D73A49"> ===</span><span style="color:#D73A49"> !</span><span style="color:#24292E">[]</span><span style="color:#D73A49">+!</span><span style="color:#24292E">[]</span><span style="color:#D73A49">+!</span><span style="color:#24292E">[]);</span></span> <span class="line"><span style="color:#005CC5">assert</span><span style="color:#24292E">(</span><span style="color:#005CC5">10</span><span style="color:#D73A49"> ===</span><span style="color:#D73A49"> +</span><span style="color:#24292E">(</span><span style="color:#D73A49">!</span><span style="color:#24292E">[]</span><span style="color:#D73A49">.</span><span style="color:#D73A49">+!!</span><span style="color:#24292E">[]));</span></span></code></pre> </div> - <p> <code>[]</code> ã« <code>!</code> ãé©çšãããš <code>true</code> ãè¿ã£ãŠãããããã« <code>+</code> ãé©çšãããšã<code>bool</code> ãã <code>int</code> ãã®å倿ãèµ°ãã<code>1</code> ãçæãããã<code>10</code> ã¯ããã«ããªãããŒã ããŸã <code>1</code> ãš <code>0</code> ãäœãã<code>.</code> ã§æååãšããŠçµåãã (<code>'10'</code>)ãããã« <code>+</code> ãé©çšãããšã<code>string</code> ãã <code>int</code> ãžã®å倿ãèµ°ãã<code>10</code> ãçãŸãã (ã³ãŒãéã«é çããªããªãã<code>1</code> ã 10 åè¶³ãåãããŠããã¡ãã 10 ãäœãã)ã </p> - <p> - ãŸãã<code>error_reporting</code> ã«æå®ããŠããã®ã¯ <code>-1</code> ã§ããã ããã¯ã<code>!</code> ã«ãã£ãŠæååã <code>false</code> ã«ãã<code>+</code> ã«ãã£ãŠ <code>false</code> ã <code>0</code> ã«ããããã«ãããå転ã㊠<code>-1</code> ã«ããŠããã + ãŸãã<code>error_reporting</code> ã«æå®ããŠããã®ã¯ <code>-1</code> ã§ããã ããã¯ã<code>!</code> ã«ãã£ãŠæååã <code>false</code> ã«ãã<code>+</code> ã«ãã£ãŠ <code>false</code> ã <code>0</code> ã«ããããã«ãããå転ã㊠<code>-1</code> ã«ããŠããã </p> </section> - <section id="section--q1-brainfuck--commentary--conditionals"> - <h4><a href="#section--q1-brainfuck--commentary--conditionals"><code>if</code> æãªãã§æ¡ä»¶åå²</a></h4> + <h4><a href="#section--q1-brainfuck--commentary--conditionals"><code>if</code> æãªãã§æ¡ä»¶åå²</a></h4> <p> - äžé
æŒç®åãªãã <code>match</code> åŒã䜿ãããšã§ã<code>if</code> ãäžåæžããã«æ¡ä»¶åå²ãã§ããã ãŸãã<code>&&</code> / <code>||</code> ã䜿ããããšããããé
å»¶è©äŸ¡ãäžèŠãªã±ãŒã¹ã§ã¯ã<code>[$t, $f][$cond]</code> ã®ãããªåœ¢ã§åå²ããããšãã§ããã + äžé
æŒç®åãªãã <code>match</code> åŒã䜿ãããšã§ã<code>if</code> ãäžåæžããã«æ¡ä»¶åå²ãã§ããã ãŸãã<code>&&</code> / <code>||</code> ã䜿ããããšãããã é
å»¶è©äŸ¡ãäžèŠãªã±ãŒã¹ã§ã¯ã<code>[$t, $f][$cond]</code> ã®ãããªåœ¢ã§åå²ããããšãã§ããã </p> </section> - <section id="section--q1-brainfuck--commentary--loops"> - <h4><a href="#section--q1-brainfuck--commentary--loops"><code>while</code>ã<code>for</code> æãªãã§ã«ãŒã</a></h4> + <h4><a href="#section--q1-brainfuck--commentary--loops"><code>while</code>ã<code>for</code> æãªãã§ã«ãŒã</a></h4> <p> - äžåç¹ã³ã³ãããŒã¿ã䜿ã£ãŠç¡åååž°ãã (詳ãã説æã¯çç¥ããããããã®åèªã§æ€çŽ¢ããŠã»ãã)ã ããã§ã¯ãäžè¬ã« Z ã³ã³ãããŒã¿ãšããŠç¥ããããã®ã䜿ã£ã (<code>$z</code>)ã + äžåç¹ã³ã³ãããŒã¿ã䜿ã£ãŠç¡åååž°ãã (詳ãã説æã¯çç¥ããããããã®åèªã§æ€çŽ¢ããŠã»ãã)ã ããã§ã¯ãäžè¬ã« Z ã³ã³ãããŒã¿ãšããŠç¥ããããã®ã䜿ã£ã (<code>$z</code>)ã </p> - <p> - å®éã®ãšããã<code>$ð€¡</code> ã <code>$ðª</code>ã<code>$ð</code> ã¯ãäžåºŠ Scheme (Lisp ã®äžçš®) ã§æžããŠãã PHP ã«ç¿»èš³ãã圢ã§èšè¿°ããã + å®éã®ãšããã<code>$ð€¡</code> ã <code>$ðª</code>ã<code>$ð</code> ã¯ãäžåºŠ Scheme (Lisp ã®äžçš®) ã§æžããŠãã PHP ã«ç¿»èš³ãã圢ã§èšè¿°ããã </p> - <p> - ãªããPHP ã¯æ«å°Ÿååž°ã®æé©åããããªããªã (å°ãªããšãä»ã®ãšããã¯) ã®ã§ã ããŸãã«é·ã brainf*ck ããã°ã©ã ãæžããšã¹ã¿ãã¯ãªãŒããŒãããŒããã + ãªããPHP ã¯æ«å°Ÿååž°ã®æé©åããããªããªã (å°ãªããšãä»ã®ãšããã¯) ã®ã§ã ããŸãã«é·ã brainf*ck ããã°ã©ã ãæžããšã¹ã¿ãã¯ãªãŒããŒãããŒããã </p> </section> </section> </section> - <section id="section--q2-riddle"> - <h2><a href="#section--q2-riddle">第2å riddle.php</a></h2> + <h2><a href="#section--q2-riddle">第2å riddle.php</a></h2> <p> - ãœãŒã¹ã³ãŒãã¯ãã¡ããå®è¡ã«ã¯ PHP 8.0 以äžãå¿
èŠãªã®ã§æ³šæã + ãœãŒã¹ã³ãŒãã¯ãã¡ããå®è¡ã«ã¯ PHP 8.0 以äžãå¿
èŠãªã®ã§æ³šæã </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49"><?</span><span style="color:#005CC5">php</span></span> <span class="line"></span> @@ -372,111 +337,87 @@ <span class="line"><span style="color:#005CC5"> echo</span><span style="color:#032F62"> "{</span><span style="color:#24292E">$x</span><span style="color:#032F62">}</span><span style="color:#005CC5">\n\n</span><span style="color:#032F62">"</span><span style="color:#24292E">;</span></span> <span class="line"><span style="color:#24292E">}</span></span></code></pre> </div> - <p> - ããŠããã®åé¡ã¯ããã»ã©ã®ããã«åçŽã«å®è¡ããã ãã§ã¯ãè¬ã®ãããã¯ã衚瀺ãããã ãã§ããŒã¯ã³ã¯åŸãããªããããŒã¯ã³ãåŸãããã«ã¯ããœãŒã¹ã³ãŒããèªã¿ã宿° <code>N</code> ãç¹å®ããå¿
èŠãããã + ããŠããã®åé¡ã¯ããã»ã©ã®ããã«åçŽã«å®è¡ããã ãã§ã¯ãè¬ã®ãããã¯ã衚瀺ãããã ãã§ããŒã¯ã³ã¯åŸãããªãã ããŒã¯ã³ãåŸãããã«ã¯ããœãŒã¹ã³ãŒããèªã¿ã宿° <code>N</code> ãç¹å®ããå¿
èŠãããã </p> - <p> - ããã§ã¯ãç§ã®æ³å®è§£ã解説ããã + ããã§ã¯ãç§ã®æ³å®è§£ã解説ããã </p> - <section id="section--q2-riddle--code-reading"> - <h3><a href="#section--q2-riddle--code-reading">èªè§£</a></h3> + <h3><a href="#section--q2-riddle--code-reading">èªè§£</a></h3> <p> - ãŸãã¯ãœãŒã¹ã³ãŒããèªãã§ããã + ãŸãã¯ãœãŒã¹ã³ãŒããèªãã§ããã </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#24292E">$token </span><span style="color:#D73A49">=</span><span style="color:#24292E"> [</span></span> -<span class="line"><span style="color:#6A737D">// ç¥</span></span> +<span class="line"><span style="color:#6A737D"> // ç¥</span></span> <span class="line"><span style="color:#24292E">];</span></span></code></pre> </div> - <p> - æ°å€ãããªã <code>$token</code> ããããåèŠçŽ ãã«ãŒãããŠããã + æ°å€ãããªã <code>$token</code> ããããåèŠçŽ ãã«ãŒãããŠããã </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#24292E">$x </span><span style="color:#D73A49">=</span><span style="color:#24292E"> $x </span><span style="color:#D73A49">^</span><span style="color:#005CC5"> N</span><span style="color:#24292E">;</span></span></code></pre> </div> - <p> - ãŸãã¯æä»çè«çå (xor) ãåãã + ãŸãã¯æä»çè«çå (xor) ãåãã </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#24292E">$x </span><span style="color:#D73A49">=</span><span style="color:#005CC5"> sprintf</span><span style="color:#24292E">(</span><span style="color:#032F62">'%025b'</span><span style="color:#24292E">, $x);</span></span></code></pre> </div> - <p> - äºé²æ°ã«å€æããŠã + äºé²æ°ã«å€æããŠã </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#24292E">$x </span><span style="color:#D73A49">=</span><span style="color:#005CC5"> str_replace</span><span style="color:#24292E">(</span><span style="color:#6F42C1">search</span><span style="color:#24292E">: [</span><span style="color:#032F62">'0'</span><span style="color:#24292E">, </span><span style="color:#032F62">'1'</span><span style="color:#24292E">], </span><span style="color:#6F42C1">replace</span><span style="color:#24292E">: [</span><span style="color:#032F62">' '</span><span style="color:#24292E">, </span><span style="color:#032F62">'#'</span><span style="color:#24292E">], </span><span style="color:#6F42C1">subject</span><span style="color:#24292E">: $x);</span></span></code></pre> </div> - <p> - 0 ã空çœã«ã1 ã <code>#</code> ã«ãã + 0 ã空çœã«ã1 ã <code>#</code> ã«ãã </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#24292E">$x </span><span style="color:#D73A49">=</span><span style="color:#005CC5"> implode</span><span style="color:#24292E">(</span><span style="color:#032F62">"</span><span style="color:#005CC5">\n</span><span style="color:#032F62">"</span><span style="color:#24292E">, </span><span style="color:#005CC5">str_split</span><span style="color:#24292E">($x, </span><span style="color:#6F42C1">length</span><span style="color:#24292E">: </span><span style="color:#005CC5">5</span><span style="color:#24292E">));</span></span></code></pre> </div> - <p> - 5æåããšã«åºåã£ãããšãæ¹è¡ã§çµåããŠããã + 5æåããšã«åºåã£ãããšãæ¹è¡ã§çµåããŠããã </p> </section> - <section id="section--q2-riddle--hint"> - <h3><a href="#section--q2-riddle--hint">ãã³ã</a></h3> + <h3><a href="#section--q2-riddle--hint">ãã³ã</a></h3> <p> - 次ã«ããœãŒã¹ã³ãŒãã«æžããŠãããã³ããèªãã§ããã + 次ã«ããœãŒã¹ã³ãŒãã«æžããŠãããã³ããèªãã§ããã </p> - <ul> <li> <code>N</code> ããèªäœã¯ã42 ã 8128 ãšãã£ããããªç¹å¥ãªæå³ãæãããã©ã³ãã ã«æ±ºããããŠãã </li> - <li> <code>$token</code> ã®åèŠçŽ ã¯ã1æåã衚ã </li> - <li> 1æå㯠5x5 ã®ã»ã«ãããªã </li> - <li> åºåãããã®ã¯ãå®å
šãª PHPer ããŒã¯ã³ã§ãã </li> </ul> - <p> - ããã§ãPHPer ããŒã¯ã³ã¯å¿
ã <code>#</code> èšå·ããå§ãŸãããšãæãã ããšã<code>$token</code> ã®æåã®æ°å <code>0x14B499C</code> ã¯ã倿ã®çµæ <code>#</code> ã«ãªãã®ã§ã¯ãªãããšäºæ³ããã (ãªãããã®ããšã¯ããªããžããªã® README ãã¡ã€ã«ã«è¿œå ãã³ããšããŠæžãããŠãã)ã + ããã§ãPHPer ããŒã¯ã³ã¯å¿
ã <code>#</code> èšå·ããå§ãŸãããšãæãã ããšã <code>$token</code> ã®æåã®æ°å <code>0x14B499C</code> ã¯ã倿ã®çµæ <code>#</code> ã«ãªãã®ã§ã¯ãªãããšäºæ³ããã (ãªãããã®ããšã¯ããªããžããªã® README ãã¡ã€ã«ã«è¿œå ãã³ããšããŠæžãããŠãã)ã </p> </section> - <section id="section--q2-riddle--solve"> - <h3><a href="#section--q2-riddle--solve">è§£ã</a></h3> + <h3><a href="#section--q2-riddle--solve">è§£ã</a></h3> <p> - ãããŸã§ãããã°ãããšäžæ©ã§è§£ãããããªãã¡ã<code>0x14B499C</code> ã <code>#</code> ã«å€æããããã㪠<code>N</code> ãèŠã€ããã°ããã + ãããŸã§ãããã°ãããšäžæ©ã§è§£ãããããªãã¡ã<code>0x14B499C</code> ã <code>#</code> ã«å€æããããã㪠<code>N</code> ãèŠã€ããã°ããã </p> - <p> - <code>N</code> ã¯é«ã
+ <code>N</code> ã¯é«ã
</p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#005CC5">assert</span><span style="color:#24292E">(</span><span style="color:#005CC5">0</span><span style="color:#D73A49"> <=</span><span style="color:#005CC5"> N</span><span style="color:#D73A49"> &&</span><span style="color:#005CC5"> N</span><span style="color:#D73A49"> <=</span><span style="color:#005CC5"> 0b11111_11111_11111_11111_11111</span><span style="color:#24292E">);</span></span></code></pre> </div> - <p> - ãªã®ã§ãã«ãŒããã©ãŒã¹ããŠãããããããã§ã¯ãã«ãŒããã©ãŒã¹ããªãæ¹æ³ã玹ä»ããã + ãªã®ã§ãã«ãŒããã©ãŒã¹ããŠãããããããã§ã¯ãã«ãŒããã©ãŒã¹ããªãæ¹æ³ã玹ä»ããã </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49"><?</span><span style="color:#005CC5">php</span></span> <span class="line"></span> @@ -495,11 +436,9 @@ <span class="line"><span style="color:#032F62">"#####</span><span style="color:#005CC5">\n</span><span style="color:#032F62">"</span><span style="color:#D73A49"> .</span></span> <span class="line"><span style="color:#032F62">" # # "</span><span style="color:#24292E">);</span></span></code></pre> </div> - <p> - ãã®äžé£ã®å€æã«å¯Ÿããé倿ãèãããšã次ã®ããã«ãªãã + ãã®äžé£ã®å€æã«å¯Ÿããé倿ãèãããšã次ã®ããã«ãªãã </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49"><?</span><span style="color:#005CC5">php</span></span> <span class="line"></span> @@ -518,19 +457,16 @@ <span class="line"></span> <span class="line"><span style="color:#005CC5">echo</span><span style="color:#032F62"> "N = </span><span style="color:#24292E">$n</span><span style="color:#005CC5">\n</span><span style="color:#032F62">"</span><span style="color:#24292E">;</span></span></code></pre> </div> - <p> - ãããå®è¡ãããšã<code>N</code> ãåŸãããã + ãããå®è¡ãããšã<code>N</code> ãåŸãããã </p> </section> </section> - <section id="section--q3-toquine"> - <h2><a href="#section--q3-toquine">第3å toquine.php</a></h2> + <h2><a href="#section--q3-toquine">第3å toquine.php</a></h2> <p> - ãœãŒã¹ã³ãŒãã¯ãã¡ãã + ãœãŒã¹ã³ãŒãã¯ãã¡ãã </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49"><?</span><span style="color:#005CC5">php</span></span> <span class="line"></span> @@ -562,71 +498,59 @@ <span class="line"><span style="color:#24292E">$ws </span><span style="color:#D73A49">=</span><span style="color:#005CC5"> array_map</span><span style="color:#24292E">(</span><span style="color:#D73A49">fn</span><span style="color:#24292E">($w) => </span><span style="color:#005CC5">implode</span><span style="color:#24292E">(</span><span style="color:#032F62">', '</span><span style="color:#24292E">, $w), </span><span style="color:#005CC5">array_chunk</span><span style="color:#24292E">(</span><span style="color:#005CC5">array_map</span><span style="color:#24292E">(</span><span style="color:#D73A49">fn</span><span style="color:#24292E">($x) => </span><span style="color:#005CC5">sprintf</span><span style="color:#24292E">(</span><span style="color:#032F62">'0x'</span><span style="color:#D73A49"> .</span><span style="color:#005CC5"> chr</span><span style="color:#24292E">(</span><span style="color:#005CC5">37</span><span style="color:#24292E">) </span><span style="color:#D73A49">.</span><span style="color:#032F62"> '07X'</span><span style="color:#24292E">, $x), $xs), </span><span style="color:#005CC5">10</span><span style="color:#24292E">));</span></span> <span class="line"><span style="color:#005CC5">printf</span><span style="color:#24292E">($s, $t, </span><span style="color:#005CC5">str_rot13</span><span style="color:#24292E">(</span><span style="color:#032F62">"<<<'D'</span><span style="color:#005CC5">\n</span><span style="color:#032F62">{</span><span style="color:#24292E">$s</span><span style="color:#032F62">}</span><span style="color:#005CC5">\n</span><span style="color:#032F62">D"</span><span style="color:#24292E">), </span><span style="color:#005CC5">implode</span><span style="color:#24292E">(</span><span style="color:#032F62">",</span><span style="color:#005CC5">\n</span><span style="color:#032F62">"</span><span style="color:#24292E">, $ws));</span></span></code></pre> </div> - <p> - ã³ã¡ã³ãã«ããããšãããæ¬¡ã®ããã«ããŠå®è¡ããã°çããã§ãŠããã + ã³ã¡ã³ãã«ããããšãããæ¬¡ã®ããã«ããŠå®è¡ããã°çããã§ãŠããã </p> - <div class="codeblock" language="shell-session"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>$ php toquine.php | php | php | php | ...</span></span></code></pre> </div> - <p> - å®éã«ã¯ããå°ããã€ãã§ç¹ããªããã°ãªããªãã + å®éã«ã¯ããå°ããã€ãã§ç¹ããªããã°ãªããªãã </p> - <section id="section--q3-toquine--commentary"> - <h3><a href="#section--q3-toquine--commentary">解説</a></h3> + <h3><a href="#section--q3-toquine--commentary">解説</a></h3> <section id="section--q3-toquine--commentary--quine"> - <h4><a href="#section--q3-toquine--commentary--quine">ããã°ã©ã å
šäœ</a></h4> + <h4><a href="#section--q3-toquine--commentary--quine">ããã°ã©ã å
šäœ</a></h4> <p> - ã³ã¡ã³ãã«ããããšããããã㯠quine (颚) ã®ããã°ã©ã ã«ãªã£ãŠãããQuine ãšã¯ãèªåã®ãœãŒã¹ã³ãŒãããã£ãããã®ãŸãŸåºåãããããªããã°ã©ã ã®ããšã§ããã + ã³ã¡ã³ãã«ããããšããããã㯠quine (颚) ã®ããã°ã©ã ã«ãªã£ãŠããã Quine ãšã¯ãèªåã®ãœãŒã¹ã³ãŒãããã£ãããã®ãŸãŸåºåãããããªããã°ã©ã ã®ããšã§ããã </p> - <p> - ãã®ããã°ã©ã ã¯ãå®è¡ãããšèªèº«ãšã»ãšãã©åãããã°ã©ã ãåºåãããç°ãªãã®ã¯ããŒã¯ã³ã«ãªã£ãŠããéšåã®ã¿ã§ããã + ãã®ããã°ã©ã ã¯ãå®è¡ãããšèªèº«ãšã»ãšãã©åãããã°ã©ã ãåºåããã ç°ãªãã®ã¯ããŒã¯ã³ã«ãªã£ãŠããéšåã®ã¿ã§ããã </p> </section> - <section id="section--q3-toquine--commentary--tokens"> - <h4><a href="#section--q3-toquine--commentary--tokens">ããŒã¯ã³</a></h4> + <h4><a href="#section--q3-toquine--commentary--tokens">ããŒã¯ã³</a></h4> <p> <code>$xs</code> ãããŒã¯ã³ã«å¯Ÿå¿ããŠããã倿ã®ããžãã¯ã¯ <code>riddle.php</code> ãšã»ãŒåããªã®ã§çç¥ããã </p> </section> - <section id="section--q3-toquine--commentary--states"> - <h4><a href="#section--q3-toquine--commentary--states">ç¶æ
ä¿æ</a></h4> + <h4><a href="#section--q3-toquine--commentary--states">ç¶æ
ä¿æ</a></h4> <p> - ããŒã¯ã³ã®äœæåç®ãŸã§åºåããããããœãŒã¹ã³ãŒããå€ããã« (quine ãªã®ã§) èŠããŠããå¿
èŠãããããã®ããã°ã©ã ã§ã¯ãããŒã¯ã³ãåºåããããšãœãŒã¹ã³ãŒããã ãã ããšé·ããªã£ãŠããã®ãå©çšããŠã<code>__LINE__</code> ããæ
å ±ãååŸããŠããã + ããŒã¯ã³ã®äœæåç®ãŸã§åºåããããããœãŒã¹ã³ãŒããå€ããã« (quine ãªã®ã§) èŠããŠããå¿
èŠãããã ãã®ããã°ã©ã ã§ã¯ãããŒã¯ã³ãåºåããããšãœãŒã¹ã³ãŒããã ãã ããšé·ããªã£ãŠããã®ãå©çšããŠã<code>__LINE__</code> ããæ
å ±ãååŸããŠããã </p> </section> - <section id="section--q3-toquine--commentary--rot-13"> - <h4><a href="#section--q3-toquine--commentary--rot-13">ROT 13</a></h4> + <h4><a href="#section--q3-toquine--commentary--rot-13">ROT 13</a></h4> <p> - Quine ã¯ãçŽ æŽã«æžããšããã°ã©ã ã®äžéšã 2åèšè¿°ãããŠããŸãããããããŸãçŸãããªãã®ã§ã<code>toquine.php</code> ã§ã¯ãROT 13 倿ã䜿ã£ãŠé£èªåããã + Quine ã¯ãçŽ æŽã«æžããšããã°ã©ã ã®äžéšã 2åèšè¿°ãããŠããŸãã ãããããŸãçŸãããªãã®ã§ã<code>toquine.php</code> ã§ã¯ãROT 13 倿ã䜿ã£ãŠé£èªåããã </p> - <p> - ããã«ããŠããªããããªãã®ãæšæºã©ã€ãã©ãªã«âŠâŠã + ããã«ããŠããªããããªãã®ãæšæºã©ã€ãã©ãªã«âŠâŠã </p> </section> </section> </section> - <section id="section--outro"> - <h2><a href="#section--outro">ãããã«</a></h2> + <h2><a href="#section--outro">ãããã«</a></h2> <p> - è§£ããŠããã ããã¿ãªããããŸããé£æåºŠèª¿æŽã«ã€ããã£ãŠããã ãã瀟å
ã®ã¿ãªãããããããšãããããŸããã + è§£ããŠããã ããã¿ãªããããŸããé£æåºŠèª¿æŽã«ã€ããã£ãŠããã ãã瀟å
ã®ã¿ãªãããããããšãããããŸããã </p> - <p> - ä»åã¯çŽåã«äœãã¯ãããã®ãããã3åã ããã€äœ¿ãå€ããããã¿ã°ããã«ãªã£ãŠããŸããŸããããæ¥å¹Žã¯ 5åãããé¢çœãåé¡ãæã£ãŠãããŸãã + ä»åã¯çŽåã«äœãã¯ãããã®ãããã3åã ããã€äœ¿ãå€ããããã¿ã°ããã«ãªã£ãŠããŸããŸãããã æ¥å¹Žã¯ 5åãããé¢çœãåé¡ãæã£ãŠãããŸãã </p> - <p> - å®ã¯ããäœãã¯ãããŠããã®ã§ãã©ããæ¥å¹ŽããããŸãããã«âŠâŠã + å®ã¯ããäœãã¯ãããŠããã®ã§ãã©ããæ¥å¹ŽããããŸãããã«âŠâŠã </p> </section> </div> diff --git a/vhosts/blog/public/posts/2022-04-24/term-banner-write-tool-showing-banner-in-terminal/index.html b/vhosts/blog/public/posts/2022-04-24/term-banner-write-tool-showing-banner-in-terminal/index.html index ff722cda..09931f66 100644 --- a/vhosts/blog/public/posts/2022-04-24/term-banner-write-tool-showing-banner-in-terminal/index.html +++ b/vhosts/blog/public/posts/2022-04-24/term-banner-write-tool-showing-banner-in-terminal/index.html @@ -55,110 +55,90 @@ </ol> </section> <section id="section--intro"> - <h2><a href="#section--intro">ã¯ããã«</a></h2> + <h2><a href="#section--intro">ã¯ããã«</a></h2> <p> - ãããªãã®ãäœã£ãã + ãããªãã®ãäœã£ãã </p> - <div class="codeblock"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>$ term-banner 'Hello, World!' 'ããã«ã¡ã¯ã' 'äžçïŒ'</span></span></code></pre> </div> - - <img alt="term-banner ãåäœããŠããæ§åã®ã¹ã¯ãªãŒã³ã·ã§ãã" src="/posts/2022-04-24/term-banner-write-tool-showing-banner-in-terminal/screenshot.png"> - </img> - <p> - ã³ãã³ãã©ã€ã³åŒæ°ãšããŠæž¡ããæååãã¿ãŒããã«ã«å€§ãã衚瀺ããã + <img alt="term-banner ãåäœããŠããæ§åã®ã¹ã¯ãªãŒã³ã·ã§ãã" src="/posts/2022-04-24/term-banner-write-tool-showing-banner-in-terminal/screenshot.png"> + </img> </p> - <p> - ãªããžããªã¯ãã¡ã: <a href="https://github.com/nsfisis/term-banner" rel="noreferrer" target="_blank">https://github.com/nsfisis/term-banner</a> + ã³ãã³ãã©ã€ã³åŒæ°ãšããŠæž¡ããæååãã¿ãŒããã«ã«å€§ãã衚瀺ããã + </p> + <p> + ãªããžããªã¯ãã¡ã: <a href="https://github.com/nsfisis/term-banner" rel="noreferrer" target="_blank">https://github.com/nsfisis/term-banner</a> </p> </section> - <section id="section--motivation"> - <h2><a href="#section--motivation">Motivation</a></h2> + <h2><a href="#section--motivation">Motivation</a></h2> <p> - 以åã<a href="https://github.com/nsfisis/big-clock-mode" rel="noreferrer" target="_blank"><code>big-clock-mode</code></a> ãšãã䌌ããããªããã°ã©ã ãæžããã ãã㯠tmux ã® <code>:clock-mode</code> ã³ãã³ãã«çæ³ãåŸããã®ã§ã<code>:clock-mode</code> ããã倧ããçŸåšæå»ã衚瀺ããã + 以åã<a href="https://github.com/nsfisis/big-clock-mode" rel="noreferrer" target="_blank"><code>big-clock-mode</code></a> ãšãã䌌ããããªããã°ã©ã ãæžããã ãã㯠tmux ã® <code>:clock-mode</code> ã³ãã³ãã«çæ³ãåŸããã®ã§ã<code>:clock-mode</code> ããã倧ããçŸåšæå»ã衚瀺ããã </p> - <p> - <code>big-clock-mode</code> ãéçºããã®ã¯ã次ã®ãããªã·ãã¥ãšãŒã·ã§ã³ã§äœ¿ãããã§ãããåŒç€Ÿã§ã¯çŸåšãªã¢ãŒãã¯ãŒã¯ãåºæ¬ã ããweb äŒè°ãªã©ã§ç»é¢å
±æããŠãããšãã«ãäŒæ©ãæãã§ç¹å®ã®æå»ããåéããããšããããšãããããããã£ãã±ãŒã¹ã§ãç»é¢äžã«çŸåšã®æå»ã倧ããã«è¡šç€ºããŠãããšãã¢ãã¿ããé¢ããŠãé ãããæå»ããããã®ã§äŸ¿å©ã§ããã + <code>big-clock-mode</code> ãéçºããã®ã¯ã次ã®ãããªã·ãã¥ãšãŒã·ã§ã³ã§äœ¿ãããã§ããã åŒç€Ÿã§ã¯çŸåšãªã¢ãŒãã¯ãŒã¯ãåºæ¬ã ããweb äŒè°ãªã©ã§ç»é¢å
±æããŠãããšãã«ãäŒæ©ãæãã§ç¹å®ã®æå»ããåéããããšããããšãããã ãããã£ãã±ãŒã¹ã§ãç»é¢äžã«çŸåšã®æå»ã倧ããã«è¡šç€ºããŠãããšãã¢ãã¿ããé¢ããŠãé ãããæå»ããããã®ã§äŸ¿å©ã§ããã </p> - <p> - ããããã¿ã€ãã¢ããªãäœãã䜿ãã°ããã®ã ããã¿ãŒããã«ã«æ£²ããããã®ãšããŠã¯ãäœåŠããé¢ããããªãããã ã + ããããã¿ã€ãã¢ããªãäœãã䜿ãã°ããã®ã ããã¿ãŒããã«ã«æ£²ããããã®ãšããŠã¯ãäœåŠããé¢ããããªãããã ã </p> - <p> - ãã°ãã䟿å©ã«äœ¿ã£ãŠããã®ã ããã²ãšã€äžæºç¹ãåºãŠãããããã¯ãåéããæå»ããã€ã ã£ãããèŠããŠãããªããã°ãªããªããšããããšã ãã©ããã«ã¡ã¢ããŠãããŠããããããã£ãããªãçŸåšæå»ãšãšãã«è¡šç€ºãããŠããããã + ãã°ãã䟿å©ã«äœ¿ã£ãŠããã®ã ããã²ãšã€äžæºç¹ãåºãŠãããããã¯ãåéããæå»ããã€ã ã£ãããèŠããŠãããªããã°ãªããªããšããããšã ã ã©ããã«ã¡ã¢ããŠãããŠããããããã£ãããªãçŸåšæå»ãšãšãã«è¡šç€ºãããŠããããã </p> - <p> - ãããªããã§ããä»»æã®æååãã¿ãŒããã«ã«è¡šç€ºãããããã°ã©ã ãæžãéã³ãšãªã£ãããŸããäœããªããŠãæ¢ãã°ãããšæãããäœããããã®ã¯äœãããã®ã§ç¥ã£ãããšã§ã¯ãªãã + ãããªããã§ããä»»æã®æååãã¿ãŒããã«ã«è¡šç€ºãããããã°ã©ã ãæžãéã³ãšãªã£ãã ãŸããäœããªããŠãæ¢ãã°ãããšæãããäœããããã®ã¯äœãããã®ã§ç¥ã£ãããšã§ã¯ãªãã </p> </section> - <section id="section--program"> - <h2><a href="#section--program">ããã°ã©ã </a></h2> + <h2><a href="#section--program">ããã°ã©ã </a></h2> <p> - å
šäœã®æµãã¯æ¬¡ã®ããã«ãªã£ãŠããã + å
šäœã®æµãã¯æ¬¡ã®ããã«ãªã£ãŠããã </p> - - <ol numeration="arabic"> + <ol> <li> ãã©ã³ããã¡ã€ã«ãèªã¿èŸŒã </li> - <li> ã³ãã³ãã©ã€ã³åŒæ°ã Shift-JIS ã«å€æãã (ãã©ã³ãã Shift-JIS åºæºã§äžŠãã§ãããã) </li> - <li> 1æåãã€ã¬ã³ããªã³ã°ããŠãã </li> </ol> - <p> <code>big-clock-mode</code> ã Go 補ãªã®ã§ãä»åã Go ã§æžããã PNG ãæšæºã©ã€ãã©ãªã«ãã£ãããShift-JIS ã®ãšã³ã³ãŒãã£ã³ã°ãæºæšæºã©ã€ãã©ãªã«ãã£ããããã®ã¯å©ãã£ãã </p> - <p> - ãã©ã³ããã¡ã€ã«ã¯ <code>go:embed</code> ã§å®è¡ãã¡ã€ã«ã«åã蟌ãã§ããã®ã§ããã«ãåŸã¯ã¯ã³ãã€ããªã§åããä»äºã§ã¯ã¹ã¯ãªããèšèªã°ããæžããŠãããããã¯ãã³ã³ãã€ã«èšèªã¯ããã + ãã©ã³ããã¡ã€ã«ã¯ <code>go:embed</code> ã§å®è¡ãã¡ã€ã«ã«åã蟌ãã§ããã®ã§ããã«ãåŸã¯ã¯ã³ãã€ããªã§åãã ä»äºã§ã¯ã¹ã¯ãªããèšèªã°ããæžããŠãããããã¯ãã³ã³ãã€ã«èšèªã¯ããã </p> </section> - <section id="section--font"> - <h2><a href="#section--font">ãã©ã³ã</a></h2> + <h2><a href="#section--font">ãã©ã³ã</a></h2> <p> - ããªãŒã® 8x8 ãããããããã©ã³ãã§ããã<a href="https://littlelimit.net/misaki.htm" rel="noreferrer" target="_blank">çŸå²ãã©ã³ã 2021-05-05a ç</a> ã䜿ãããŠããã ããã + ããªãŒã® 8x8 ãããããããã©ã³ãã§ããã <a href="https://littlelimit.net/misaki.htm" rel="noreferrer" target="_blank">çŸå²ãã©ã³ã 2021-05-05a ç</a> ã䜿ãããŠããã ããã </p> - <p> - ã¯ããã¯èªåã§ããããæã£ãŠããã®ã ãããããããããŸã§ãã£ãŠæ«æãããåãã 8x8 ã§äœã£ãŠããã®ã ãã平仮åã§ãããããã®å°ããªãã£ã³ãã¹ã«ã¯ãšãŠãåããããªãã + ã¯ããã¯èªåã§ããããæã£ãŠããã®ã ãããããããããŸã§ãã£ãŠæ«æããã åãã 8x8 ã§äœã£ãŠããã®ã ãã平仮åã§ãããããã®å°ããªãã£ã³ãã¹ã«ã¯ãšãŠãåããããªãã </p> - <p> - çŸå²ãã©ã³ãã¯ã平仮åã»çä»®åã«çãŸãããJIS 第äžã»ç¬¬äºæ°Žæºã®æŒ¢åãŸã§ãµããŒãããŠãããç¬¬äºæ°Žæºãšããªããšäžçãç®ã«ãããããšã®ãªãåã®æ¹ãå€ããããã ããããããã®å€§ããã§æžããšããã®ã¯ããã¯ãèžè¡ã®åã§ããã + çŸå²ãã©ã³ãã¯ã平仮åã»çä»®åã«çãŸãããJIS 第äžã»ç¬¬äºæ°Žæºã®æŒ¢åãŸã§ãµããŒãããŠããã ç¬¬äºæ°Žæºãšããªããšäžçãç®ã«ãããããšã®ãªãåã®æ¹ãå€ããããã ããããããã®å€§ããã§æžããšããã®ã¯ããã¯ãèžè¡ã®åã§ããã </p> - <p> - ããã«èšããšãå®ã®ãšããçŸå²ãã©ã³ãã¯å®ãµã€ãº 7x7 ã§äœãããŠãããäœçœãèšããããŠãããããã¯ãåçŽã«ãã®ãŸãŸäžŠã¹ãŠãåéã»è¡éã確ä¿ã§ããããã«ãšããé
æ
®ã§ããããããã§ã³ãŒãã£ã³ã°ãŸã§æ¥œã«ãªã£ãã + ããã«èšããšãå®ã®ãšããçŸå²ãã©ã³ãã¯å®ãµã€ãº 7x7 ã§äœãããŠãããäœçœãèšããããŠããã ããã¯ãåçŽã«ãã®ãŸãŸäžŠã¹ãŠãåéã»è¡éã確ä¿ã§ããããã«ãšããé
æ
®ã§ããã ãããã§ã³ãŒãã£ã³ã°ãŸã§æ¥œã«ãªã£ãã </p> - <p> - ãŽã·ãã¯äœãšææäœããã£ãããç§ã®å¥œã¿ã§ææäœã®æ¹ã«ããããã ããŽã·ãã¯äœã®æ¹ãèŠãããæ°ãããã®ã§ããã©ã³ããéžã¹ãããã«åŸã»ã©æ¡åŒµãããããããªãã + ãŽã·ãã¯äœãšææäœããã£ãããç§ã®å¥œã¿ã§ææäœã®æ¹ã«ããã ãã ããŽã·ãã¯äœã®æ¹ãèŠãããæ°ãããã®ã§ããã©ã³ããéžã¹ãããã«åŸã»ã©æ¡åŒµãããããããªãã </p> - <p> - 2022-04-27 远èš: <code>-f</code> ãªãã·ã§ã³ã§éžã¹ãããã«ããã + 2022-04-27 远èš: <code>-f</code> ãªãã·ã§ã³ã§éžã¹ãããã«ããã </p> </section> - <section id="section--outro"> - <h2><a href="#section--outro">ãããã«</a></h2> + <h2><a href="#section--outro">ãããã«</a></h2> <p> - ããªããã¿ãŒããã«ã«äœãã§ã¿ãŸãããïŒ + ããªããã¿ãŒããã«ã«äœãã§ã¿ãŸãããïŒ </p> </section> </div> diff --git a/vhosts/blog/public/posts/2022-05-01/phperkaigi-2022/index.html b/vhosts/blog/public/posts/2022-05-01/phperkaigi-2022/index.html index c12be3ee..baa6e91d 100644 --- a/vhosts/blog/public/posts/2022-05-01/phperkaigi-2022/index.html +++ b/vhosts/blog/public/posts/2022-05-01/phperkaigi-2022/index.html @@ -64,199 +64,178 @@ </ol> </section> <section id="section--intro"> - <h2><a href="#section--intro">ã¯ããã«</a></h2> + <h2><a href="#section--intro">ã¯ããã«</a></h2> <p> - 2022-04-09 ãã 2022-04-11 ã«ãããŠéå¬ãããã<a href="https://phperkaigi.jp/2022/" rel="noreferrer" target="_blank">PHPerKaigi 2022</a> ã«ãäžè¬åå è
ãšããŠåå ãããåŒç€Ÿ<a href="https://www.dgcircus.com/" rel="noreferrer" target="_blank">ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ</a>ã¯ãã€ã€ã¢ã³ãã¹ãã³ãµãŒãšãªã£ãŠãããã¹ãã³ãµãŒæ ã®ãã±ããã䜿ãããŠããã ããã + 2022-04-09 ãã 2022-04-11 ã«ãããŠéå¬ãããã <a href="https://phperkaigi.jp/2022/" rel="noreferrer" target="_blank">PHPerKaigi 2022</a> ã«ã äžè¬åå è
ãšããŠåå ããã åŒç€Ÿ <a href="https://www.dgcircus.com/" rel="noreferrer" target="_blank">ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ</a> ã¯ãã€ã€ã¢ã³ãã¹ãã³ãµãŒãšãªã£ãŠããã ã¹ãã³ãµãŒæ ã®ãã±ããã䜿ãããŠããã ããã </p> - <p> - æšå¹Žã®ã¬ããŒãã¯<a href="/posts/2021-03-30/phperkaigi-2021">ãã¡ã</a>ã + æšå¹Žã®ã¬ããŒã㯠<a href="/posts/2021-03-30/phperkaigi-2021">ãã¡ã</a> ã </p> </section> - <section id="section--comments"> - <h2><a href="#section--comments">ææ³</a></h2> + <h2><a href="#section--comments">ææ³</a></h2> <section id="section--comments--great-sessions"> - <h3><a href="#section--comments--great-sessions">å³éžããããããŒã¯</a></h3> + <h3><a href="#section--comments--great-sessions">å³éžããããããŒã¯</a></h3> <p> - å€ãã®çŽ æŽãããããŒã¯ã®äžãããç¹ã«ããããã®ãã®ã 5ã€éžãã ãæ¯éèããŠã»ãããåŒçšéšåã¯ããªã³ã¯å
ããããŒã¶ã«ããåŒçšããŠããã + å€ãã®çŽ æŽãããããŒã¯ã®äžãããç¹ã«ããããã®ãã®ã 5ã€éžãã ã æ¯éèããŠã»ãããåŒçšéšåã¯ããªã³ã¯å
ããããŒã¶ã«ããåŒçšããŠããã </p> - <p> <a href="https://fortee.jp/phperkaigi-2022/proposal/ef8cf4ed-63fe-42f8-8145-b3e70054458b" rel="noreferrer" target="_blank">äºé²ã«åãé²åŸ¡ãªã - å
ç¢ãªã³ãŒããå°ãæ§ã
ãªèšèšã®ãã³ã</a> </p> - <blockquote> <p> - PHP ã¯ããŒãžã§ã³ãè¿œãæ¯ã«å宣èšãäŸå€ã衚æãåæåãªã©ã®æ©èœã倧å¹
ã«åŒ·åãããå
ç¢ãªã³ãŒããæžãããã®æ©èœãå
å®ããŠããŸããããããã®æ©èœã¯ã©ã䜿ããšå¹æçãªã®ã§ããããã + PHP ã¯ããŒãžã§ã³ãè¿œãæ¯ã«å宣èšãäŸå€ã衚æãåæåãªã©ã®æ©èœã倧å¹
ã«åŒ·åãããå
ç¢ãªã³ãŒããæžãããã®æ©èœãå
å®ããŠããŸããããããã®æ©èœã¯ã©ã䜿ããšå¹æçãªã®ã§ããããã </p> - <p> - æ¬è¬æŒã§ã¯ PHP 8.1 ãããŒã¹ã«ããŠã誀ããæ³å®ããŠãã§ãã¯ããã®ã§ã¯ãªãããããã誀ãã«ããèšèšãšã¯ã©ã®ãããªãã®ããã€ãŸããäºé²ãã®èгç¹ã軞足ã«ãå
ç¢ãªã³ãŒããå°ãããã®æ§ã
ãªèšèšã®ãã³ããã玹ä»ããŸãã + æ¬è¬æŒã§ã¯ PHP 8.1 ãããŒã¹ã«ããŠã誀ããæ³å®ããŠãã§ãã¯ããã®ã§ã¯ãªãããããã誀ãã«ããèšèšãšã¯ã©ã®ãããªãã®ããã€ãŸããäºé²ãã®èгç¹ã軞足ã«ãå
ç¢ãªã³ãŒããå°ãããã®æ§ã
ãªèšèšã®ãã³ããã玹ä»ããŸãã </p> </blockquote> - <p> <a href="https://fortee.jp/phperkaigi-2022/proposal/db00d49e-0dd6-453f-b54b-f731d112f10e" rel="noreferrer" target="_blank">PHPã®ãšã©ãŒãçè§£ããŠé©åãªãšã©ãŒãã³ããªã³ã°ãåŠãŒã</a> </p> - <blockquote> <p> - PHPã䜿ã£ãŠããšããééãã Fatal error / Parse error / Warning / Notice çè§£ããŠããŸããïŒ - <br> - ãããã®ãšã©ãŒæãçè§£ããããšã§ãããã«ãšã©ãŒã®åå ã«æ°ä»ãé©åã«å¯Ÿè±¡ã§ããæ§ã«ãªããŸãïŒ - <br> - ãŸãããããçè§£ããäžã§ã®ãšã©ãŒãã³ããªã³ã°ãåŠã³ãŸãããã + PHPã䜿ã£ãŠããšããééãã Fatal error / Parse error / Warning / Notice çè§£ããŠããŸããïŒ + </p> + <p> + ãããã®ãšã©ãŒæãçè§£ããããšã§ãããã«ãšã©ãŒã®åå ã«æ°ä»ãé©åã«å¯Ÿè±¡ã§ããæ§ã«ãªããŸãïŒ + </p> + <p> + ãŸãããããçè§£ããäžã§ã®ãšã©ãŒãã³ããªã³ã°ãåŠã³ãŸãããã </p> </blockquote> - <p> <a href="https://fortee.jp/phperkaigi-2022/proposal/4a7e3ded-9134-4919-955c-ec7bf4491c0d" rel="noreferrer" target="_blank">ãšã©ãŒç£èŠãšãã¹ãäœå¶ãžã®æ¹åäœæŠ</a> </p> - <blockquote> <p> - æ¯æ¥æµããŠãããšã©ãŒã«çããã¯ã©ãåãåã£ãŠãŸããïŒ - <br> - ãšã©ãŒãåºããªãäºãäžçªã§ãããå®å
šã«å¡ãäºã¯é£ãããšèããŸãã - <br> - ãµãŒãã¹éçšã®äžã§æ¬çªç°å¢ããçºçãããšã©ãŒïŒãµãŒããŒã»ã¯ã©ã€ã¢ã³ããµã€ãã»ãµãŒãããŒãã£èµ·å ã®ãšã©ãŒïŒãžã®ç£èŠäœå¶ãšã - <br> - ãšã©ãŒã»ãã°é²åŸ¡ã®ããããŒã ã§è¡ã£ãŠãããã¹ãã³ãŒãæåã¥ããã®è©±ãããŸãã + æ¯æ¥æµããŠãããšã©ãŒã«çããã¯ã©ãåãåã£ãŠãŸããïŒ + </p> + <p> + ãšã©ãŒãåºããªãäºãäžçªã§ãããå®å
šã«å¡ãäºã¯é£ãããšèããŸãã + </p> + <p> + ãµãŒãã¹éçšã®äžã§æ¬çªç°å¢ããçºçãããšã©ãŒïŒãµãŒããŒã»ã¯ã©ã€ã¢ã³ããµã€ãã»ãµãŒãããŒãã£èµ·å ã®ãšã©ãŒïŒãžã®ç£èŠäœå¶ãšã + </p> + <p> + ãšã©ãŒã»ãã°é²åŸ¡ã®ããããŒã ã§è¡ã£ãŠãããã¹ãã³ãŒãæåã¥ããã®è©±ãããŸãã </p> </blockquote> - <p> <a href="https://fortee.jp/phperkaigi-2022/proposal/6f47daf8-c78f-4fb1-9b99-e9656e6fe7f7" rel="noreferrer" target="_blank">ISUCON11ã®PHPå®è£
ã¯ãäœãèããã©ã®ããã«ããŠäœãããŠããã®ã</a> </p> - <blockquote> <p> - æšå¹Žéå¬ãããISUCON11ã«ãŠåé¡ïŒåèå®è£
ïŒã®PHPãžã®ç§»æ€ãæ
åœãããŠããã ããŸããã + æšå¹Žéå¬ãããISUCON11ã«ãŠåé¡ïŒåèå®è£
ïŒã®PHPãžã®ç§»æ€ãæ
åœãããŠããã ããŸããã + </p> + <p> + æçµçãªãœãŒã¹ã³ãŒãããã·ã³ãã«ãªWebã¢ããªã±ãŒã·ã§ã³ã§ã¯ãããŸããããã®è£ã«ã¯ + </p> + <ul> + <li> + ãïŒç§ã®æãïŒè¯ãèšèšããå®çŸããããã®æææ±ºå® + </li> + <li> + ãISUCONã®åé¡ããšããäœçœ®ä»ãã«ç±æ¥ããåæšéžæ + </li> + <li> + ç§»æ€äžã«ééãããã©ãã«ãšãã®è§£æ±ºç + </li> + </ul> + <p> + ãšãã£ãæèãèè€ãååšããŠããŸãã </p> - <p> - æçµçãªãœãŒã¹ã³ãŒãããã·ã³ãã«ãªWebã¢ããªã±ãŒã·ã§ã³ã§ã¯ãããŸããããã®è£ã«ã¯ - <br> - ã»ãïŒç§ã®æãïŒè¯ãèšèšããå®çŸããããã®æææ±ºå® - <br> - ã»ãISUCONã®åé¡ããšããäœçœ®ä»ãã«ç±æ¥ããåæšéžæ - <br> - ã»ç§»æ€äžã«ééãããã©ãã«ãšãã®è§£æ±ºç - <br> - ãšãã£ãæèãèè€ãååšããŠããŸãã + æ¬çºè¡šã¯ããããå
±æããããšã§ </p> - + <ul> + <li> + PHPã¢ããªã±ãŒã·ã§ã³ã®èšèšãå®è£
äºäŸãšããŠåœ¹ç«ãŠãŠããã + </li> + <li> + ISUCONã®èšèªç§»æ€ã«èå³ãæã£ãŠããã + </li> + <li> + ISUCONåé¡ç§»æ€ã®ãå®è£
ãèšèšã®ç·Žç¿ãããææããšããŠã®å¯èœæ§ãç¥ã£ãŠããã + </li> + </ul> <p> - æ¬çºè¡šã¯ããããå
±æããããšã§ - <br> - ã»PHPã¢ããªã±ãŒã·ã§ã³ã®èšèšãå®è£
äºäŸãšããŠåœ¹ç«ãŠãŠããã - <br> - ã»ISUCONã®èšèªç§»æ€ã«èå³ãæã£ãŠããã - <br> - ã»ISUCONåé¡ç§»æ€ã®ãå®è£
ãèšèšã®ç·Žç¿ãããææããšããŠã®å¯èœæ§ãç¥ã£ãŠããã - <br> - ããšãç®çãšããŸãã + ããšãç®çãšããŸãã </p> </blockquote> - <p> <a href="https://fortee.jp/phperkaigi-2022/proposal/5a260e4e-542d-4d82-849d-ef3d6cb7c854" rel="noreferrer" target="_blank">ããŒã ã®ä»äºã¯ãŸãã£ãŠãããã©ãã¡ã³ããŒã¯ããããã¢ã€ã¢ã€ãæ±ããŠãã話ââ40åã®å€§èŠæš¡éçºããŒã ã§1on1ãã°ãå
¬éããŠã¿ã</a> </p> - <blockquote> <p> - ãµã€ããŠãºã®å€§äŒæ¥åãã°ã«ãŒããŠã§ã¢ã®GaroonïŒã¬ã«ãŒã³ïŒã¯ãPHPã§éçºãããŠãã20幎ç®ã®è£œåã§ããã¬ã«ãŒã³éçºããŒã ã¯æ¥æ¬ã§40åããããã ã§50åã®èš90åã»ã©ã®ããŒã ã«ãªã£ãŠããŸãããŸããã³ããçŠã§ãã«ãªã¢ãŒãã§ã®æŽ»åããã®2幎ã»ã©ç¶ç¶ããŠããŸããã + ãµã€ããŠãºã®å€§äŒæ¥åãã°ã«ãŒããŠã§ã¢ã®GaroonïŒã¬ã«ãŒã³ïŒã¯ãPHPã§éçºãããŠãã20幎ç®ã®è£œåã§ããã¬ã«ãŒã³éçºããŒã ã¯æ¥æ¬ã§40åããããã ã§50åã®èš90åã»ã©ã®ããŒã ã«ãªã£ãŠããŸãããŸããã³ããçŠã§ãã«ãªã¢ãŒãã§ã®æŽ»åããã®2幎ã»ã©ç¶ç¶ããŠããŸããã </p> - <p> - ãã«ãªã¢ãŒãã«ãªã£ãŠãä»äºã¯ãŸãã£ãŠãããç¶ç¶çã«ãªãªãŒã¹ã¯ããŠããŸããããäžæ¹ã§ãäºãã®èããŠããããšãæããŠããå顿èãèŠãã¥ãããªããã¢ã€ã¢ã€ãæ±ããŠããã¡ã³ããŒãå¢ããŠããŸããã + ãã«ãªã¢ãŒãã«ãªã£ãŠãä»äºã¯ãŸãã£ãŠãããç¶ç¶çã«ãªãªãŒã¹ã¯ããŠããŸããããäžæ¹ã§ãäºãã®èããŠããããšãæããŠããå顿èãèŠãã¥ãããªããã¢ã€ã¢ã€ãæ±ããŠããã¡ã³ããŒãå¢ããŠããŸããã </p> - <p> - ãã®ã»ãã·ã§ã³ã§ã¯ãããããç¶æ³ã§ç§ãããŒã å€ãããžã§ã€ã³ããèŽã圹ã«åŸ¹ããªããèŠããåããããšã§ç¶æ³ãæ¹åããŠãã£ãåãçµã¿ã玹ä»ããŸããåãããã«å€§ããªããŒã ããªã¢ãŒãã¯ãŒã¯ã§é£ãããæããŠãã人ã«ãé£ããã®åå ãžã®æ°ã¥ããåãçµã¿ãžã®ãã³ããããã°å¹žãã§ãã + ãã®ã»ãã·ã§ã³ã§ã¯ãããããç¶æ³ã§ç§ãããŒã å€ãããžã§ã€ã³ããèŽã圹ã«åŸ¹ããªããèŠããåããããšã§ç¶æ³ãæ¹åããŠãã£ãåãçµã¿ã玹ä»ããŸããåãããã«å€§ããªããŒã ããªã¢ãŒãã¯ãŒã¯ã§é£ãããæããŠãã人ã«ãé£ããã®åå ãžã®æ°ã¥ããåãçµã¿ãžã®ãã³ããããã°å¹žãã§ãã </p> </blockquote> </section> - <section id="section--comments--token-quizzes"> - <h3><a href="#section--comments--token-quizzes">ããŒã¯ã³åé¡ã®äœæ</a></h3> + <h3><a href="#section--comments--token-quizzes">ããŒã¯ã³åé¡ã®äœæ</a></h3> <p> - ä»åã¯ãPHPer ãã£ã¬ã³ãžçšã«åŒç€Ÿã®ããŒã¯ã³åé¡ã 3é¡äœæããããã¡ãã«ã€ããŠã¯<a href="/posts/2022-04-09/phperkaigi-2022-tokens">å¥éèšäºã«ããŠãã</a>ã®ã§ããã¡ããåç
§ããããã + ä»åã¯ãPHPer ãã£ã¬ã³ãžçšã«åŒç€Ÿã®ããŒã¯ã³åé¡ã 3é¡äœæããã ãã¡ãã«ã€ããŠã¯ <a href="/posts/2022-04-09/phperkaigi-2022-tokens">å¥éèšäºã«ããŠãã</a> ã®ã§ããã¡ããåç
§ããããã </p> </section> - <section id="section--comments--phper-challenge"> - <h3><a href="#section--comments--phper-challenge">PHPer ãã£ã¬ã³ãž</a></h3> + <h3><a href="#section--comments--phper-challenge">PHPer ãã£ã¬ã³ãž</a></h3> <p> - <a href="https://fortee.jp/phperkaigi-2022/challenge" rel="noreferrer" target="_blank">1äœ</a>ã«ãªã£ãã - <br> - ãŸããè³åãšã㊠<a href="https://www.amazon.co.jp/dp/B08MQNJC9Z" rel="noreferrer" target="_blank">Echo Show 15</a> ãããã ããã + <a href="https://fortee.jp/phperkaigi-2022/challenge" rel="noreferrer" target="_blank">1äœ</a> ã«ãªã£ãã ãŸããè³åãšã㊠<a href="https://www.amazon.co.jp/dp/B08MQNJC9Z" rel="noreferrer" target="_blank">Echo Show 15</a> ãããã ããã </p> </section> - <section id="section--comments--conference"> - <h3><a href="#section--comments--conference">ã«ã³ãã¡ã¬ã³ã¹å
šäœãžã®ææ³</a></h3> + <h3><a href="#section--comments--conference">ã«ã³ãã¡ã¬ã³ã¹å
šäœãžã®ææ³</a></h3> <p> <a href="/posts/2021-03-30/phperkaigi-2021">å»å¹Žã®åå ã¬ã</a> ã§ã¯ããããªããšãæžããã </p> - <blockquote> <p> - 1ã€å人çãªåçç¹ãšããŠã¯ã(äžç¥) Discord ãããã¢ã³ã«ã³ãã¡ã¬ã³ã¹ãããããã®ã€ãã³ãã®ãã®ç¬éã«ãããªãã³ã³ãã³ããã«è§Šããã«ãåŸããèŠè¿ããçºè¡šãã¹ã©ã€ãã«æ³šåããŠããŸã£ãããšããããšã ãçºè¡šã®è©³çްãªèŠçŽãã¯ããšããã§ããã®ã ãããä»ããã§ããªãããšãèããã¹ãã ã£ãã - <br> - ãŸãåã«ã³ãã¡ã¬ã³ã¹ã ãããšãè¶ãæ¿ããŠãããã + 1ã€å人çãªåçç¹ãšããŠã¯ã(äžç¥) Discord ãããã¢ã³ã«ã³ãã¡ã¬ã³ã¹ãããããã®ã€ãã³ãã®ãã®ç¬éã«ãããªãã³ã³ãã³ããã«è§Šããã«ã åŸããèŠè¿ããçºè¡šãã¹ã©ã€ãã«æ³šåããŠããŸã£ãããšããããšã ã çºè¡šã®è©³çްãªèŠçŽãã¯ããšããã§ããã®ã ãããä»ããã§ããªãããšãèããã¹ãã ã£ãã ãŸãåã«ã³ãã¡ã¬ã³ã¹ã ãããšãè¶ãæ¿ããŠãããã </p> </blockquote> - <p> - ãã®åçãèžãŸããä»å¹Žã¯ç©æ¥µçã«ã»ãã®å Ž (å
¬åŒã® Discord ãµãŒãããã¢ã³ã«ã³ãã¡ã¬ã³ã¹) ã«ãåå ããã - <br> - ããã«ãããåå äœéšã®è³ªãã¯ããã«åäžãããç¹ã« Discord ã«é¢ããŠã¯ãç»å£è
ãæ¬äººã«ããè£è¶³ãã質åãžã®åçãªã©ããããªããã (ããšãå€ã) ãããç¹å¥ãªçç±ã®ãªãéããçºèšã¯ããªããŸã§ãåå ã¯ããŠãããã»ããè¯ããšæãããã + ãã®åçãèžãŸããä»å¹Žã¯ç©æ¥µçã«ã»ãã®å Ž (å
¬åŒã® Discord ãµãŒãããã¢ã³ã«ã³ãã¡ã¬ã³ã¹) ã«ãåå ããã ããã«ãããåå äœéšã®è³ªãã¯ããã«åäžãããç¹ã« Discord ã«é¢ããŠã¯ãç»å£è
ãæ¬äººã«ããè£è¶³ãã 質åãžã®åçãªã©ããããªããã (ããšãå€ã) ãããç¹å¥ãªçç±ã®ãªãéããçºèšã¯ããªããŸã§ãåå ã¯ããŠãããã»ããè¯ããšæãããã </p> - <p> - ãªããã¢ã³ã«ã³ãã¡ã¬ã³ã¹ã«ã€ããŠã¯ã1æ¥ç®ã®çµããã«<a href="https://fortee.jp/phperkaigi-2022/unconference/view/d332797a-8921-4706-a7e2-ee72640c9b5e" rel="noreferrer" target="_blank">ããŒã¯ã³åé¡ã®è§£èª¬æŸé</a>ããããªã£ãã + ãªããã¢ã³ã«ã³ãã¡ã¬ã³ã¹ã«ã€ããŠã¯ã1æ¥ç®ã®çµããã« <a href="https://fortee.jp/phperkaigi-2022/unconference/view/d332797a-8921-4706-a7e2-ee72640c9b5e" rel="noreferrer" target="_blank">ããŒã¯ã³åé¡ã®è§£èª¬æŸé</a> ããããªã£ãã </p> - <p> - ãŸããä»å¹Žã¯ãªãã©ã€ã³ãšãªã³ã©ã€ã³ã®ãã€ããªããéå¬ã§ãã£ãããå»å¹Žã®å
šãªã³ã©ã€ã³ãšæ¯ã¹ãŠããªã³ã©ã€ã³åå ã®äœéšãèœã¡ãŠããªãã£ãã®ã¯ãç¹çãã¹ãã§ããããä»å¹Žã¯ 3åç®ã®ã¯ã¯ãã³æ¥çš®ãéã«åããªãã£ãããšãããçŸå°åå ã¯èŠéã£ãã®ã ããæ¥å¹Žã¯æ¯éãªãã©ã€ã³ã§åå ãããã + ãŸããä»å¹Žã¯ãªãã©ã€ã³ãšãªã³ã©ã€ã³ã®ãã€ããªããéå¬ã§ãã£ãããå»å¹Žã®å
šãªã³ã©ã€ã³ãšæ¯ã¹ãŠããªã³ã©ã€ã³åå ã®äœéšãèœã¡ãŠããªãã£ãã®ã¯ãç¹çãã¹ãã§ãããã ä»å¹Žã¯ 3åç®ã®ã¯ã¯ãã³æ¥çš®ãéã«åããªãã£ãããšãããçŸå°åå ã¯èŠéã£ãã®ã ããæ¥å¹Žã¯æ¯éãªãã©ã€ã³ã§åå ãããã </p> </section> </section> - <section id="section--next-year"> - <h2><a href="#section--next-year">ãããŠæ¥å¹ŽãžâŠâŠ?</a></h2> + <h2><a href="#section--next-year">ãããŠæ¥å¹ŽãžâŠâŠ?</a></h2> <p> - PHPerKaigi 2023 ããããã©ããåãäžããªããããããšããã°ã次㮠4ã€ãç®æšãšãããã + PHPerKaigi 2023 ããããã©ããåãäžããªããããããšããã°ã次㮠4ã€ãç®æšãšãããã </p> - <ul> <li> ããããŒã¶ã«ãåºã </li> - <li> PHPer ãã£ã¬ã³ãžã®ããŒã¯ã³åé¡ã 5é¡äœæãã </li> - <li> çŸå°ã«è¡ã </li> - <li> PHPer ãã£ã¬ã³ãžã§å§åãã </li> </ul> - <hr> - <p> - æåŸã«ãªããŸããããPHPerKaigi ã®ã¹ã¿ãããã¹ãã³ãµãŒãã¹ããŒã«ãŒã®ã¿ãªãããçŽ æµãªæéãããããšãããããŸããã + æåŸã«ãªããŸããããPHPerKaigi ã®ã¹ã¿ãããã¹ãã³ãµãŒãã¹ããŒã«ãŒã®ã¿ãªãããçŽ æµãªæéãããããšãããããŸããã </p> - <p> - ã§ã¯ãŸãæ¥å¹Žã + ã§ã¯ãŸãæ¥å¹Žã </p> </section> </div> diff --git a/vhosts/blog/public/posts/2022-08-27/php-conference-okinawa-code-golf/index.html b/vhosts/blog/public/posts/2022-08-27/php-conference-okinawa-code-golf/index.html index ed87f02e..928d6c04 100644 --- a/vhosts/blog/public/posts/2022-08-27/php-conference-okinawa-code-golf/index.html +++ b/vhosts/blog/public/posts/2022-08-27/php-conference-okinawa-code-golf/index.html @@ -64,74 +64,59 @@ </ol> </section> <section id="section--intro"> - <h2><a href="#section--intro">ã¯ããã«</a></h2> + <h2><a href="#section--intro">ã¯ããã«</a></h2> <p> - æ¬æ¥ <a href="https://phpcon.okinawa.jp/" rel="noreferrer" target="_blank">PHP ã«ã³ãã¡ã¬ã³ã¹æ²çž 2022</a> ãéå¬ããã (ããã)ã + æ¬æ¥ <a href="https://phpcon.okinawa.jp/" rel="noreferrer" target="_blank">PHP ã«ã³ãã¡ã¬ã³ã¹æ²çž 2022</a> ãéå¬ããã (ããã)ã </p> - <p> - ã«ã³ãã¡ã¬ã³ã¹ã«ã¯åå ã§ããªãã£ããã®ã®ãæèŠªäŒã® LT ã§åºé¡ãããã³ãŒããŽã«ãã®åé¡ã Twitter ã«æµããŠããã®ã§ãè§£ããŠã¿ãã + ã«ã³ãã¡ã¬ã³ã¹ã«ã¯åå ã§ããªãã£ããã®ã®ãæèŠªäŒã® LT ã§åºé¡ãããã³ãŒããŽã«ãã®åé¡ã Twitter ã«æµããŠããã®ã§ãè§£ããŠã¿ãã </p> - <ul> <li> ãã€ãŒã: <a href="https://twitter.com/m3m0r7/status/1563397620231712772" rel="noreferrer" target="_blank">https://twitter.com/m3m0r7/status/1563397620231712772</a> </li> - <li> ã¹ã©ã€ã: <a href="https://speakerdeck.com/memory1994/php-conference-okinawa-2022-extra?slide=3" rel="noreferrer" target="_blank">https://speakerdeck.com/memory1994/php-conference-okinawa-2022-extra?slide=3</a> </li> </ul> </section> - <section id="section--solution"> - <h2><a href="#section--solution">è§£</a></h2> + <h2><a href="#section--solution">è§£</a></h2> <p> - 现ããã¬ã®ã¥ã¬ãŒã·ã§ã³ã¯äžæã ã£ãã®ã§ãåæã«å®ããã + 现ããã¬ã®ã¥ã¬ãŒã·ã§ã³ã¯äžæã ã£ãã®ã§ãåæã«å®ããã </p> - <ul> <li> ã³ãã³ãã©ã€ã³åŒæ°ã®ç¬¬1åŒæ°ã§åããšã </li> - <li> çµæã¯æšæºåºåã«åºã </li> - <li> ã³ã³ãã®çŽåŸã«ã¯ã¹ããŒã¹ã1ã€çœ®ã </li> - <li> æ«å°Ÿã³ã³ãã¯çŠæ¢ </li> - <li> æ°åã§ãªããã®ã¯å
¥ã£ãŠããªããã®ãšãã </li> - <li> è² æ°ã¯å
¥ã£ãŠããªããã®ãšãã </li> </ul> - <p> - æžãããã®ããã¡ã: + æžãããã®ããã¡ã: </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#24292E">[</span><span style="color:#D73A49"><?</span><span style="color:#005CC5">php</span><span style="color:#24292E"> $n</span><span style="color:#D73A49">=</span><span style="color:#24292E">$argv[</span><span style="color:#005CC5">1</span><span style="color:#24292E">];</span><span style="color:#D73A49">foreach</span><span style="color:#24292E">([</span><span style="color:#005CC5">1e4</span><span style="color:#24292E">,</span><span style="color:#005CC5">5e3</span><span style="color:#24292E">,</span><span style="color:#005CC5">2e3</span><span style="color:#24292E">,</span><span style="color:#005CC5">1e3</span><span style="color:#24292E">,</span><span style="color:#005CC5">500</span><span style="color:#24292E">,</span><span style="color:#005CC5">100</span><span style="color:#24292E">,</span><span style="color:#005CC5">50</span><span style="color:#24292E">,</span><span style="color:#005CC5">10</span><span style="color:#24292E">,</span><span style="color:#005CC5">5</span><span style="color:#24292E">,</span><span style="color:#005CC5">1</span><span style="color:#24292E">]</span><span style="color:#D73A49">as</span><span style="color:#24292E">$x)</span><span style="color:#D73A49">for</span><span style="color:#24292E">(;$n</span><span style="color:#D73A49">>=</span><span style="color:#24292E">$x;$n</span><span style="color:#D73A49">-=</span><span style="color:#24292E">$x)$r[]</span><span style="color:#D73A49">=</span><span style="color:#24292E">$x;</span><span style="color:#005CC5">echo</span><span style="color:#005CC5"> implode</span><span style="color:#24292E">(</span><span style="color:#032F62">', '</span><span style="color:#24292E">,$r</span><span style="color:#D73A49">??</span><span style="color:#24292E">[]);</span><span style="color:#D73A49">?></span><span style="color:#24292E">]</span></span></code></pre> </div> - <p> - ãã㊠123 ãã€ããšãªã£ã (æ«å°Ÿæ¹è¡ãå«ããã«ã«ãŠã³ã)ã + ãã㊠123 ãã€ããšãªã£ã (æ«å°Ÿæ¹è¡ãå«ããã«ã«ãŠã³ã)ã </p> - <p> - ãã¡ãã¯æ¹è¡ãšã¹ããŒã¹ã远å ããããŒãžã§ã³: + ãã¡ãã¯æ¹è¡ãšã¹ããŒã¹ã远å ããããŒãžã§ã³: </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#24292E">[</span><span style="color:#D73A49"><?</span><span style="color:#005CC5">php</span></span> <span class="line"></span> @@ -144,50 +129,43 @@ <span class="line"><span style="color:#D73A49">?></span><span style="color:#24292E">]</span></span></code></pre> </div> </section> - <section id="section--techniques"> - <h2><a href="#section--techniques">䜿çšãããã¯ããã¯</a></h2> + <h2><a href="#section--techniques">䜿çšãããã¯ããã¯</a></h2> <section id="section--techniques--exponential-notation"> - <h3><a href="#section--techniques--exponential-notation">ææ°è¡šèš</a></h3> + <h3><a href="#section--techniques--exponential-notation">ææ°è¡šèš</a></h3> <p> - å²ãšå€ãã®èšèªã®ãŽã«ãã§äœ¿ãããã¯ããã¯ã<code>e</code> ãçšããææ°è¡šèšã§ã倧ããªæ°ãçã衚ãããã®ã³ãŒãã§ã¯ <code>10000</code>ã<code>5000</code>ã<code>2000</code>ã<code>1000</code> ãææ°è¡šèšããŠããã + å²ãšå€ãã®èšèªã®ãŽã«ãã§äœ¿ãããã¯ããã¯ã <code>e</code> ãçšããææ°è¡šèšã§ã倧ããªæ°ãçã衚ãã ãã®ã³ãŒãã§ã¯ <code>10000</code>ã<code>5000</code>ã<code>2000</code>ã<code>1000</code> ãææ°è¡šèšããŠããã </p> </section> - <section id="section--techniques--shorten-loop"> - <h3><a href="#section--techniques--shorten-loop">foreach ã for ã®äžèº«ã1ã€ã®æã«</a></h3> + <h3><a href="#section--techniques--shorten-loop">foreach ã for ã®äžèº«ã1ã€ã®æã«</a></h3> <p> - <code>foreach</code>ã<code>for</code>ã<code>if</code> ãªã©ã®åŸãã«ã¯ãéåžž <code>{</code> ãç¶ããŠè€æ°ã®æãé£ããããäžèº«ã®æã1ã€ã«ããŠããŸãã°ã<code>{</code> ãš <code>}</code> ãçç¥ã§ãããCèšèªãªã©ã§ã䜿ããã + <code>foreach</code>ã<code>for</code>ã<code>if</code> ãªã©ã®åŸãã«ã¯ã éåžž <code>{</code> ãç¶ããŠè€æ°ã®æãé£ããããäžèº«ã®æã1ã€ã«ããŠããŸãã°ã<code>{</code> ãš <code>}</code> ãçç¥ã§ããã Cèšèªãªã©ã§ã䜿ããã </p> </section> - <section id="section--techniques--omit-initialization"> - <h3><a href="#section--techniques--omit-initialization">$r ã«åæå€ãå
¥ããªã</a></h3> + <h3><a href="#section--techniques--omit-initialization">$r ã«åæå€ãå
¥ããªã</a></h3> <p> - PHP ã§ã¯ã<code>$r[] = ......</code> ã®ãããªé
åã®æ«å°Ÿã«è¿œå ããåŒãå®è¡ãããšãã<code>$r</code> ãæªå®çŸ©ã ã£ãå Žå㯠<code>$r</code> ãåæã«å®çŸ©ããŠç©ºã®é
åã§åæåããŠãããããããå©çšãããšã<code>$r = [];</code> ã®ãããªåæåãäžèŠã«ãªãã + PHP ã§ã¯ã<code>$r[] = ......</code> ã®ãããªé
åã®æ«å°Ÿã«è¿œå ããåŒãå®è¡ãããšãã <code>$r</code> ãæªå®çŸ©ã ã£ãå Žå㯠<code>$r</code> ãåæã«å®çŸ©ããŠç©ºã®é
åã§åæåããŠãããã ãããå©çšãããšã<code>$r = [];</code> ã®ãããªåæåãäžèŠã«ãªãã </p> - <p> - ãã ããããã°ã©ã ã« 0 ãæž¡ããããšã«ãŒããäžåºŠãåããªãã®ã§ã<code>$r</code> ãæªå®çŸ©ã«ãªã£ãŠããŸãã<code>implode()</code> ã«æž¡ããšããã§ãšã©ãŒã«ãªãããããé²ãããã« <code>$r ?? []</code> ã䜿ã£ãŠããã + ãã ããããã°ã©ã ã« 0 ãæž¡ããããšã«ãŒããäžåºŠãåããªãã®ã§ã<code>$r</code> ãæªå®çŸ©ã«ãªã£ãŠããŸãã <code>implode()</code> ã«æž¡ããšããã§ãšã©ãŒã«ãªãã ãããé²ãããã« <code>$r ?? []</code> ã䜿ã£ãŠããã </p> - <p> - ãã 0 ãæž¡ãããã±ãŒã¹ãç¡èŠãããªãããããäžèŠã«ãªãã®ã§ 4 ãã€ãçž®ãã + ãã 0 ãæž¡ãããã±ãŒã¹ãç¡èŠãããªãããããäžèŠã«ãªãã®ã§ 4 ãã€ãçž®ãã </p> </section> - <section id="section--techniques--put-text-outside-php-tag"> - <h3><a href="#section--techniques--put-text-outside-php-tag">PHP ã¿ã°ã®å€ã«æååã眮ã</a></h3> + <h3><a href="#section--techniques--put-text-outside-php-tag">PHP ã¿ã°ã®å€ã«æååã眮ã</a></h3> <p> - PHP ã§ã¯ã<code><?php</code> <code>?></code> ã§å²ãããéšåã®å€åŽã«ããæååã¯ããã®ãŸãŸåºåããããä»åã®ã±ãŒã¹ã§ã¯ãå
é ãšæ«å°Ÿã«å¿
ã <code>[</code> ãš <code>]</code> ãåºåããã®ã§ããã®ãŸãŸæžããŠããã°ããã + PHP ã§ã¯ã<code><?php</code> <code>?></code> ã§å²ãããéšåã®å€åŽã«ããæååã¯ããã®ãŸãŸåºåãããã ä»åã®ã±ãŒã¹ã§ã¯ãå
é ãšæ«å°Ÿã«å¿
ã <code>[</code> ãš <code>]</code> ãåºåããã®ã§ããã®ãŸãŸæžããŠããã°ããã </p> </section> </section> - <section id="section--outro"> - <h2><a href="#section--outro">ãããã«</a></h2> + <h2><a href="#section--outro">ãããã«</a></h2> <p> - æåŸã«ãªããŸãããã<a href="https://twitter.com/m3m0r7" rel="noreferrer" target="_blank">ããããŒ</a>ãããæ¥œããåé¡ãããããšãããããŸããã + æåŸã«ãªããŸãããã <a href="https://twitter.com/m3m0r7" rel="noreferrer" target="_blank">ããããŒ</a> ãããæ¥œããåé¡ãããããšãããããŸããã </p> </section> </div> diff --git a/vhosts/blog/public/posts/2022-08-31/support-for-communty-is-employee-benefits/index.html b/vhosts/blog/public/posts/2022-08-31/support-for-communty-is-employee-benefits/index.html index 9409eb8d..a86a94d3 100644 --- a/vhosts/blog/public/posts/2022-08-31/support-for-communty-is-employee-benefits/index.html +++ b/vhosts/blog/public/posts/2022-08-31/support-for-communty-is-employee-benefits/index.html @@ -52,61 +52,50 @@ </ol> </section> <section id="section--intro"> - <h2><a href="#section--intro">ã¯ããã«</a></h2> + <h2><a href="#section--intro">ã¯ããã«</a></h2> <p> <strong>泚: ããã¯ç§åäººã®æèŠã§ãããæå±ããçµç¹ã代衚ãããã®ã§ã¯ãããŸããã</strong> </p> - <p> - å
æ¥ãç§ã®å€ãã <a href="https://www.dgcircus.com/" rel="noreferrer" target="_blank">ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ</a> ã <a href="https://opencollective.com/phpfoundation" rel="noreferrer" target="_blank">PHP Foundation</a> ãž $2,000 ã®å¯ä»ããããªããŸããã + å
æ¥ãç§ã®å€ãã <a href="https://www.dgcircus.com/" rel="noreferrer" target="_blank">ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ</a> ã <a href="https://opencollective.com/phpfoundation" rel="noreferrer" target="_blank">PHP Foundation</a> ãž $2,000 ã®å¯ä»ããããªããŸããã </p> - <p> - èšäº: <a href="https://www.dgcircus.com/news/581" rel="noreferrer" target="_blank">https://www.dgcircus.com/news/581</a> + èšäº: <a href="https://www.dgcircus.com/news/581" rel="noreferrer" target="_blank">https://www.dgcircus.com/news/581</a> </p> - <p> - æ¬ä»¶ã瀟å
ã§ãã€ããæšé²ãã1人ãšããŠãæšé²ã®çç±çãæžãæ®ããŠãããŸãã + æ¬ä»¶ã瀟å
ã§ãã€ããæšé²ãã1人ãšããŠãæšé²ã®çç±çãæžãæ®ããŠãããŸãã </p> </section> - <section id="section--why"> - <h2><a href="#section--why">ãªãïŒ</a></h2> + <h2><a href="#section--why">ãªãïŒ</a></h2> <p> - çµç¹ãšããŠã®å¯ä»çç±ã¯åæ²ããèšäºã«è²ããšããŠãããã§ã¯ãç§ã瀟å
ã§ãã®ä»¶ãæšé²ããçç±ã«ã€ããŠæžãããšã«ããŸãã + çµç¹ãšããŠã®å¯ä»çç±ã¯åæ²ããèšäºã«è²ããšããŠãããã§ã¯ãç§ã瀟å
ã§ãã®ä»¶ãæšé²ããçç±ã«ã€ããŠæžãããšã«ããŸãã </p> - <p> - åœæã®èãã端çã«ãŸãšãã瀟å
ãã£ããã®æçš¿ããã£ãã®ã§ããããåŒçšããŸã: + åœæã®èãã端çã«ãŸãšãã瀟å
ãã£ããã®æçš¿ããã£ãã®ã§ããããåŒçšããŸã: </p> - <blockquote> <p> - çµå±ãããéããã (ç§ã®äžã§ã®) æå€§ã®çç±ãããèªåã®å€ããäŒç€ŸãããããããäŒç€Ÿã§ãã£ãŠã»ããããšããã®ããããâã«ããŠããææ
ããŒã¹ã®çç±ããåºããŠããªããšããã®ã説åŸåã«æ¬ ããŠããçç±ãªã®ã ãšæããŸãããå¯ä»ã®å ±åãæµããŠããããOSS ã®ããªãŒã©ã€ãã®è©±ãæµããŠããããããã³ã«ãèªå°å¿ãæ¯æãããããšããã (ããã¯å€§è¢è£ããã衚çŸã§ãå®éã«ã¯ãããŸã§æç¢ºã«å·ã€ããŠããããã§ã¯ãããŸããã)ã + çµå±ãããéããã (ç§ã®äžã§ã®) æå€§ã®çç±ãããèªåã®å€ããäŒç€ŸãããããããäŒç€Ÿã§ãã£ãŠã»ããããšããã®ãããã âã«ããŠããææ
ããŒã¹ã®çç±ããåºããŠããªããšããã®ã説åŸåã«æ¬ ããŠããçç±ãªã®ã ãšæããŸããã å¯ä»ã®å ±åãæµããŠããããOSS ã®ããªãŒã©ã€ãã®è©±ãæµããŠããããããã³ã«ãèªå°å¿ãæ¯æãããããšããã (ããã¯å€§è¢è£ããã衚çŸã§ãå®éã«ã¯ãããŸã§æç¢ºã«å·ã€ããŠããããã§ã¯ãããŸããã)ã </p> - <p> - 远èš: ãè©èº«ãçããªãããšããã®ãããé©åã§ããã + 远èš: ãè©èº«ãçããªãããšããã®ãããé©åã§ããã </p> </blockquote> - <p> - â»æäžã®ãâã«ããŠããã¯ãããã«èŒããŠããªãå¥ã®æçš¿ãæããŠããŸãã + â»æäžã®ãâã«ããŠããã¯ãããã«èŒããŠããªãå¥ã®æçš¿ãæããŠããŸãã </p> - <p> - OSS ãééçã«æ¯æŽããããæè¡ã«ã³ãã¡ã¬ã³ã¹ãžåè³ããã (ããã㯠<a href="https://twitter.com/tomzoh" rel="noreferrer" target="_blank">CTO</a> ãã«ã³ãã¡ã¬ã³ã¹ã幎2ã§äž»å¬ããã: <a href="https://iosdc.jp" rel="noreferrer" target="_blank">iOSDC</a> <a href="https://phperkaigi.jp" rel="noreferrer" target="_blank">PHPerKaigi</a>) ãšãã£ãè¡çºã¯ãã³ãã¥ããã£ãžã®è²¢ç®ã§ãããšåæã«ã瀟å¡ã«å¯Ÿãã粟ç¥ççŠå©åçã§ããããšèšããã§ããã (ç¥ãããã©)ããããã¯ãæè¡ãæè¡è
ã倧åã«ããçµç¹ã§ããããšããããšã®ã察å€çã«ã察å
çã«ã匷åãªã¡ãã»ãŒãžãªã®ã§ãã + OSS ãééçã«æ¯æŽããããæè¡ã«ã³ãã¡ã¬ã³ã¹ãžåè³ããã (ããã㯠<a href="https://twitter.com/tomzoh" rel="noreferrer" target="_blank">CTO</a> ãã«ã³ãã¡ã¬ã³ã¹ã幎2ã§äž»å¬ããã: <a href="https://iosdc.jp" rel="noreferrer" target="_blank">iOSDC</a> <a href="https://phperkaigi.jp" rel="noreferrer" target="_blank">PHPerKaigi</a> ) ãšãã£ãè¡çºã¯ãã³ãã¥ããã£ãžã®è²¢ç®ã§ãããšåæã«ã瀟å¡ã«å¯Ÿãã粟ç¥ççŠå©åçã§ããããšèšããã§ããã (ç¥ãããã©)ã ãããã¯ãæè¡ãæè¡è
ã倧åã«ããçµç¹ã§ããããšããããšã®ã察å€çã«ã察å
çã«ã匷åãªã¡ãã»ãŒãžãªã®ã§ãã </p> - <p> - 以äžããç§ã瀟å
ã§å¯ä»ã®ä»¶ãé²ãã (ããªãç§çãª) çç±ã§ãã + 以äžããç§ã瀟å
ã§å¯ä»ã®ä»¶ãé²ãã (ããªãç§çãª) çç±ã§ãã </p> </section> - <section id="section--outro"> - <h2><a href="#section--outro">ãããã«</a></h2> + <h2><a href="#section--outro">ãããã«</a></h2> <p> - æçµçã«ç€ŸãšããŠã®å¯ä»ãŸã§æŒãçããããã®ã¯ããã¡ããç§ã®åã§ã¯ãªã圹å¡ã®æ¹ã
ã®æ±ºå®ã«ãããã®ã§ãããã®å ŽãåããŠæè¬ç³ãäžããŸãã + æçµçã«ç€ŸãšããŠã®å¯ä»ãŸã§æŒãçããããã®ã¯ããã¡ããç§ã®åã§ã¯ãªã圹å¡ã®æ¹ã
ã®æ±ºå®ã«ãããã®ã§ãã ãã®å ŽãåããŠæè¬ç³ãäžããŸãã </p> </section> </div> diff --git a/vhosts/blog/public/posts/2022-09-29/write-fizzbuzz-in-php-2-letters-per-line/index.html b/vhosts/blog/public/posts/2022-09-29/write-fizzbuzz-in-php-2-letters-per-line/index.html index 44e3dc2e..9b1bdde2 100644 --- a/vhosts/blog/public/posts/2022-09-29/write-fizzbuzz-in-php-2-letters-per-line/index.html +++ b/vhosts/blog/public/posts/2022-09-29/write-fizzbuzz-in-php-2-letters-per-line/index.html @@ -61,69 +61,62 @@ </ol> </section> <section id="section--intro"> - <h2><a href="#section--intro">èšäºã®æ§æã«ã€ããŠ</a></h2> + <h2><a href="#section--intro">èšäºã®æ§æã«ã€ããŠ</a></h2> <p> - ãã®èšäºã¯ãæ®éã® fizzbuzz ãåŸã
ã«å€åœ¢ããŠæçµåœ¢ã«ããŠããããšããæ§æã§æžãããŠãããæçµåœ¢ãèŠãŠã©ã®ãããªä»çµã¿ã§åããŠããã®ãè§£èªããŠãã解説ãèªã¿ããããšãããããããã°ã<a href="https://gist.github.com/nsfisis/04c227d5a419867472a0b23a83ad2919#file-fizzbuzz-php-2-letters-per-line-and-supports-php-8-x-without-warnings" rel="noreferrer" target="_blank">ãã®ããŒãž</a> ã«ãœãŒã¹ã³ãŒããããã®ã§ããã¡ããå
ã«èŠãŠã»ããã + ãã®èšäºã¯ãæ®éã® fizzbuzz ãåŸã
ã«å€åœ¢ããŠæçµåœ¢ã«ããŠããããšããæ§æã§æžãããŠããã æçµåœ¢ãèŠãŠã©ã®ãããªä»çµã¿ã§åããŠããã®ãè§£èªããŠãã解説ãèªã¿ããããšãããããããã°ã <a href="https://gist.github.com/nsfisis/04c227d5a419867472a0b23a83ad2919#file-fizzbuzz-php-2-letters-per-line-and-supports-php-8-x-without-warnings" rel="noreferrer" target="_blank">ãã®ããŒãž</a> ã«ãœãŒã¹ã³ãŒããããã®ã§ããã¡ããå
ã«èŠãŠã»ããã </p> </section> - <section id="section--regulations"> - <h2><a href="#section--regulations">ã¬ã®ã¥ã¬ãŒã·ã§ã³</a></h2> + <h2><a href="#section--regulations">ã¬ã®ã¥ã¬ãŒã·ã§ã³</a></h2> <p> - PHP ã§ã次ã®ãããªå¶çŽã®äžã« fizzbuzz ãæžããã + PHP ã§ã次ã®ãããªå¶çŽã®äžã« fizzbuzz ãæžããã </p> - <ul> <li> - 1è¡ãããã®æåæ°ã¯2æåãŸã§ã«åããããš (ãã ã <code><?php</code> ã¿ã°ã¯é€ã) + <p> + 1è¡ãããã®æåæ°ã¯2æåãŸã§ã«åããããš (ãã ã <code><?php</code> ã¿ã°ã¯é€ã) + </p> <ul> <li> - å³å¯ãªå®çŸ©: <code><?php</code> ã¿ã°ä»¥éã®ãœãŒã¹ã³ãŒããã2 byte ããšã«ã©ã€ã³ãã£ãŒã (LF) ã§åºåãããããš + å³å¯ãªå®çŸ©: <code><?php</code> ã¿ã°ä»¥éã®ãœãŒã¹ã³ãŒããã2 byte ããšã«ã©ã€ã³ãã£ãŒã (LF) ã§åºåãããããš </li> </ul> </li> - <li> ã¹ããŒã¹ãã¿ãã䜿çšããªãããš </li> - <li> - ã«ãŒãã®ã¢ã³ããŒã«ãããªãããš + <p> + ã«ãŒãã®ã¢ã³ããŒã«ãããªãããš + </p> <ul> <li> 100 åã«ãŒãã®ä»£ããã« 100 åã³ãŒããã³ããããšããã®ã¯çŠæ¢ </li> </ul> </li> - <li> PHP 7.4ã8.1 ã§åäœããããš </li> - <li> å®è¡æã« Notice ã Warning ãåºãªãããš </li> - <li> æšæºçãªã€ã³ã¹ããŒã«æ§æã® PHP ã§å®çŸã§ããããš (ããã©ã«ãã§æå¹ã«ãªã£ãŠããªãæ¡åŒµçã䜿ããªãããš) </li> </ul> - <p> - åè: PHP ã«ã¯ <code>short_open_tag</code> ãšãããªãã·ã§ã³ãããããããæå¹ã«ãããšãã¡ã€ã«åé ã® <code><?php</code> ã®ä»£ããã« <code><?</code> ã䜿ãããšãã§ããæåã©ãã1è¡2æåã§æžããããã ããã®ãªãã·ã§ã³ã¯ããã©ã«ã off ã«ãªã£ãŠããç°å¢ãå€ããããªã®ã§ãä»åã¯äœ¿ããªãããšã«ããã + åè: PHP ã«ã¯ <code>short_open_tag</code> ãšãããªãã·ã§ã³ãããã ãããæå¹ã«ãããšãã¡ã€ã«åé ã® <code><?php</code> ã®ä»£ããã« <code><?</code> ã䜿ãããšãã§ããæåã©ãã1è¡2æåã§æžããã ãã ããã®ãªãã·ã§ã³ã¯ããã©ã«ã off ã«ãªã£ãŠããç°å¢ãå€ããããªã®ã§ãä»åã¯äœ¿ããªãããšã«ããã </p> </section> - <section id="section--problems"> - <h2><a href="#section--problems">äž»ãªé害</a></h2> + <h2><a href="#section--problems">äž»ãªé害</a></h2> <p> - 1è¡ãããã®æåæ°ãªã©ãé©åœã«æ¹è¡ãæãã°ããã ãã§ã¯ãªãã®ãïŒ + 1è¡ãããã®æåæ°ãªã©ãé©åœã«æ¹è¡ãæãã°ããã ãã§ã¯ãªãã®ãïŒ </p> - <p> - ç¹ã«ãCèšèªã§ãã®ãããªè©Šã¿ããããªã£ãããšããããããªãããæãã ãããäºå®ãCã§ã®ãã®å¶çŽã¯ã»ãšãã©ç¡æå³ã«çããã + ç¹ã«ãCèšèªã§ãã®ãããªè©Šã¿ããããªã£ãããšããããããªãããæãã ãããäºå®ãCã§ã®ãã®å¶çŽã¯ã»ãšãã©ç¡æå³ã«çããã </p> - <div class="codeblock" language="c"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#24292E">#</span><span style="color:#005CC5">\</span></span> <span class="line"><span style="color:#24292E">i</span><span style="color:#005CC5">\</span></span> @@ -200,41 +193,32 @@ <span class="line"></span> <span class="line"><span style="color:#6A737D">/* ããšã¯åãããã«æ®éã®ããã°ã©ã ãå€åœ¢ããã ããªã®ã§çç¥ */</span></span></code></pre> </div> - <p> - ããã¯ã¹ã©ãã·ã¥ã䜿ã£ãè¡ç¶ç¶ãããŒã¯ã³ãåºåããªãããšããã®ããã€ã³ãã ã + ããã¯ã¹ã©ãã·ã¥ã䜿ã£ãè¡ç¶ç¶ãããŒã¯ã³ãåºåããªãããšããã®ããã€ã³ãã ã </p> - <p> - ããŠãPHP ã§ã¯ããããããã¯ã¹ã©ãã·ã¥ãè¡ç¶ç¶ã«äœ¿ãããšãã§ããªããããã«ãããã3æå以äžãããªãããŒã¯ã³ãäžå䜿ããªãããšããå¶çŽã課ããããäŸãã°ã<code>echo</code> ã§åºåããããšãã<code>for</code> ã§ã«ãŒãããããšã<code>new</code> ã§ã€ã³ã¹ã¿ã³ã¹ãçæããããšãã§ããªããç¹ã«ãåºå㯠fizzbuzz ãã©ããªã¢ã«ãŽãªãºã ã§å®è£
ããããšãããªããªããã°ãªããªãã®ã§ãã§ããªãã®ã¯èŽåœçã§ããã + ããŠãPHP ã§ã¯ããããããã¯ã¹ã©ãã·ã¥ãè¡ç¶ç¶ã«äœ¿ãããšãã§ããªãã ããã«ãããã3æå以äžãããªãããŒã¯ã³ãäžå䜿ããªãããšããå¶çŽã課ãããã äŸãã°ã<code>echo</code> ã§åºåããããšãã<code>for</code> ã§ã«ãŒãããããšã <code>new</code> ã§ã€ã³ã¹ã¿ã³ã¹ãçæããããšãã§ããªãã ç¹ã«ãåºå㯠fizzbuzz ãã©ããªã¢ã«ãŽãªãºã ã§å®è£
ããããšãããªããªããã°ãªããªãã®ã§ãã§ããªãã®ã¯èŽåœçã§ããã </p> - <p> - åœç¶ãååã3æå以äžãã颿°ã䜿ããªãããªããæšæº PHP ã®ç¯å²å
ã«ãããŠãååã 2æå以äžã®é¢æ°ã¯ä»¥äžã®ãšããã§ãã: + åœç¶ãååã3æå以äžãã颿°ã䜿ããªãããªããæšæº PHP ã®ç¯å²å
ã«ãããŠãååã 2æå以äžã®é¢æ°ã¯ä»¥äžã®ãšããã§ãã: </p> - <ul> <li> - <code>_</code>: <code>gettext</code> ã®ãšã€ãªã¢ã¹ + <code>_</code>: <code>gettext</code> ã®ãšã€ãªã¢ã¹ </li> - <li> - <code>dl</code>: æ¡åŒµã¢ãžã¥ãŒã«ãããŒããã + <code>dl</code>: æ¡åŒµã¢ãžã¥ãŒã«ãããŒããã </li> - <li> - <code>pi</code>: ååšçãè¿ã + <code>pi</code>: ååšçãè¿ã </li> </ul> - <p> - (ç°å¢ã«ãã£ãŠå€å°ã¯å€ãããã) + (ç°å¢ã«ãã£ãŠå€å°ã¯å€ãããã) </p> - <p> - 2æåã®é¢æ°ãå®çŸ©ããŸãã£ãæ¡åŒµã¢ãžã¥ãŒã«ãçšæããŠãã㊠<code>dl()</code> ã§èªã¿èŸŒãè¡çºã¯ãã¬ã®ã¥ã¬ãŒã·ã§ã³ã§å®ãã + 2æåã®é¢æ°ãå®çŸ©ããŸãã£ãæ¡åŒµã¢ãžã¥ãŒã«ãçšæããŠãã㊠<code>dl()</code> ã§èªã¿èŸŒãè¡çºã¯ãã¬ã®ã¥ã¬ãŒã·ã§ã³ã§å®ãã </p> - <blockquote> <ul> <li> @@ -242,39 +226,32 @@ </li> </ul> </blockquote> - <p> - ã«åãã (ãšããããããããã ãšãããããããªããšããªãã®ã§ããã®ã«ãŒã«ãè¶³ããããšããã®ãæ£ãã)ã + ã«åãã (ãšããããããããã ãšãããããããªããšããªãã®ã§ããã®ã«ãŒã«ãè¶³ããããšããã®ãæ£ãã)ã </p> - <p> - ãŸãã2æåã ãšæååããŸãšãã«æžããªãã®ãèŸãã<code>''</code> ã ãã§2æå䜿ãã®ã§ãã1æåã®æååãªãã©ã«ããšãããã®ãæžãããšãã§ããªããPHP ã§ã¯æååãªãã©ã«äžã«çã®æ¹è¡ãæžããã®ã§ + ãŸãã2æåã ãšæååããŸãšãã«æžããªãã®ãèŸãã<code>''</code> ã ãã§2æå䜿ãã®ã§ã ã1æåã®æååãªãã©ã«ããšãããã®ãæžãããšãã§ããªããPHP ã§ã¯æååãªãã©ã«äžã«çã®æ¹è¡ãæžããã®ã§ </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#24292E">$a</span></span> <span class="line"><span style="color:#D73A49">=</span><span style="color:#032F62">'</span></span> <span class="line"><span style="color:#032F62">a'</span></span> <span class="line"><span style="color:#24292E">;;</span></span></code></pre> </div> - <p> - ãšãããš <code>$a</code> 㯠<code>"\na"</code> ã«ãªãã®ã ããäœèšãªæ¹è¡ãå
¥ã£ãŠããŸãã + ãšãããš <code>$a</code> 㯠<code>"\na"</code> ã«ãªãã®ã ããäœèšãªæ¹è¡ãå
¥ã£ãŠããŸãã </p> - <p> - ãããã®é害ãã©ã®ããã«ä¹ãè¶ããã®ããæ¬¡ç¯ããèŠãŠããã + ãããã®é害ãã©ã®ããã«ä¹ãè¶ããã®ããæ¬¡ç¯ããèŠãŠããã </p> </section> - <section id="section--commentary"> - <h2><a href="#section--commentary">解説</a></h2> + <h2><a href="#section--commentary">解説</a></h2> <section id="section--commentary--normal-fizzbuzz"> - <h3><a href="#section--commentary--normal-fizzbuzz">æ®éã® (?) fizzbuzz</a></h3> + <h3><a href="#section--commentary--normal-fizzbuzz">æ®éã® (?) fizzbuzz</a></h3> <p> - ãŸãã¯æ®éã«æžããšãããã + ãŸãã¯æ®éã«æžããšãããã </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49"><?</span><span style="color:#005CC5">php</span></span> <span class="line"></span> @@ -282,18 +259,15 @@ <span class="line"><span style="color:#005CC5"> echo</span><span style="color:#24292E"> (($i </span><span style="color:#D73A49">%</span><span style="color:#005CC5"> 3</span><span style="color:#D73A49"> ?</span><span style="color:#032F62"> ''</span><span style="color:#D73A49"> :</span><span style="color:#032F62"> 'Fizz'</span><span style="color:#24292E">) </span><span style="color:#D73A49">.</span><span style="color:#24292E"> ($i </span><span style="color:#D73A49">%</span><span style="color:#005CC5"> 5</span><span style="color:#D73A49"> ?</span><span style="color:#032F62"> ''</span><span style="color:#D73A49"> :</span><span style="color:#032F62"> 'Buzz'</span><span style="color:#24292E">) </span><span style="color:#D73A49">?:</span><span style="color:#24292E"> $i) </span><span style="color:#D73A49">.</span><span style="color:#032F62"> "</span><span style="color:#005CC5">\n</span><span style="color:#032F62">"</span><span style="color:#24292E">;</span></span> <span class="line"><span style="color:#24292E">}</span></span></code></pre> </div> - <p> - çŽ çŽã«æžãã fizzbuzz ãšã¯èšãé£ããããã®ãããã¯æ®éã ãšããããšã«ããŠãããªããšããã®å
ããã£ãŠããããªãã®ã§èš±ããŠã»ããã + çŽ çŽã«æžãã fizzbuzz ãšã¯èšãé£ããããã®ãããã¯æ®éã ãšããããšã«ããŠãããªããšããã®å
ããã£ãŠããããªãã®ã§èš±ããŠã»ããã </p> </section> - <section id="section--commentary--remove-keywords"> - <h3><a href="#section--commentary--remove-keywords"><code>for</code> ã®æé€</a></h3> + <h3><a href="#section--commentary--remove-keywords"><code>for</code> ã®æé€</a></h3> <p> - <code>for</code> ã¯ã3æåãããé·ãããŒã¯ãŒãã§ããããããªãã®ã¯äœ¿ããªãã<code>array_</code> ç³»ã®é¢æ°ã䜿ã£ãŠãé©åœã«çœ®ãæãããšãããã + <code>for</code> ã¯ã3æåãããé·ãããŒã¯ãŒãã§ããã ãããªãã®ã¯äœ¿ããªãã<code>array_</code> ç³»ã®é¢æ°ã䜿ã£ãŠãé©åœã«çœ®ãæãããšãããã </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49"><?</span><span style="color:#005CC5">php</span></span> <span class="line"></span> @@ -304,18 +278,15 @@ <span class="line"><span style="color:#005CC5">printf</span><span style="color:#24292E">((($i </span><span style="color:#D73A49">%</span><span style="color:#005CC5"> 3</span><span style="color:#D73A49"> ?</span><span style="color:#032F62"> ''</span><span style="color:#D73A49"> :</span><span style="color:#032F62"> 'Fizz'</span><span style="color:#24292E">) </span><span style="color:#D73A49">.</span><span style="color:#24292E"> ($i </span><span style="color:#D73A49">%</span><span style="color:#005CC5"> 5</span><span style="color:#D73A49"> ?</span><span style="color:#032F62"> ''</span><span style="color:#D73A49"> :</span><span style="color:#032F62"> 'Buzz'</span><span style="color:#24292E">) </span><span style="color:#D73A49">?:</span><span style="color:#24292E"> $i) </span><span style="color:#D73A49">.</span><span style="color:#032F62"> "</span><span style="color:#005CC5">\n</span><span style="color:#032F62">"</span><span style="color:#24292E">),</span></span> <span class="line"><span style="color:#24292E">);</span></span></code></pre> </div> - <p> - <code>array_walk</code> ã <code>range</code>ã<code>printf</code> ãšãã£ã <code>for</code> ãããé·ãããŒã¯ã³ãçŸããŠããŸã£ãããããã¯æ¬¡ç¯ã§çŽãããšã«ããããªãã<code>echo</code> ã¯æ (statement) ã§ããåŒ (expression) ã§ã¯ãªãã®ã§ãåŒã§ãã <code>printf</code> ã«çœ®ãæããã + <code>array_walk</code> ã <code>range</code>ã<code>printf</code> ãšãã£ã <code>for</code> ãããé·ãããŒã¯ã³ãçŸããŠããŸã£ãããããã¯æ¬¡ç¯ã§çŽãããšã«ããã ãªãã<code>echo</code> ã¯æ (statement) ã§ããåŒ (expression) ã§ã¯ãªãã®ã§ãåŒã§ãã <code>printf</code> ã«çœ®ãæããã </p> </section> - <section id="section--commentary--shorten-function-invocation"> - <h3><a href="#section--commentary--shorten-function-invocation">颿°åŒã³åºãã®ççž®</a></h3> + <h3><a href="#section--commentary--shorten-function-invocation">颿°åŒã³åºãã®ççž®</a></h3> <p> - <code>range</code>ã<code>array_walk</code>ã<code>printf</code> ã¯é·ãããã®ã§ã©ãã«ãããã°ãªããªããããã§ãPHP ã®å¯å€é¢æ°ã䜿ããå¯å€é¢æ°ãšã¯ã颿°åãæååãšããŠå
¥ã£ã倿°ãçµç±ããŠã颿°ãåŒã³åºãæ©èœã§ããã + <code>range</code>ã<code>array_walk</code>ã<code>printf</code> ã¯é·ãããã®ã§ã©ãã«ãããã°ãªããªãã ããã§ãPHP ã®å¯å€é¢æ°ã䜿ããå¯å€é¢æ°ãšã¯ã颿°åãæååãšããŠå
¥ã£ã倿°ãçµç±ããŠã颿°ãåŒã³åºãæ©èœã§ããã </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49"><?</span><span style="color:#005CC5">php</span></span> <span class="line"></span> @@ -330,18 +301,15 @@ <span class="line"><span style="color:#24292E">$p((($i </span><span style="color:#D73A49">%</span><span style="color:#005CC5"> 3</span><span style="color:#D73A49"> ?</span><span style="color:#032F62"> ''</span><span style="color:#D73A49"> :</span><span style="color:#032F62"> 'Fizz'</span><span style="color:#24292E">) </span><span style="color:#D73A49">.</span><span style="color:#24292E"> ($i </span><span style="color:#D73A49">%</span><span style="color:#005CC5"> 5</span><span style="color:#D73A49"> ?</span><span style="color:#032F62"> ''</span><span style="color:#D73A49"> :</span><span style="color:#032F62"> 'Buzz'</span><span style="color:#24292E">) </span><span style="color:#D73A49">?:</span><span style="color:#24292E"> $i) </span><span style="color:#D73A49">.</span><span style="color:#032F62"> "</span><span style="color:#005CC5">\n</span><span style="color:#032F62">"</span><span style="color:#24292E">),</span></span> <span class="line"><span style="color:#24292E">);</span></span></code></pre> </div> - <p> - ããã§é¢æ°ãåŒã³åºããŠããæã¯çããªã£ããã§ã¯ã<code>$r</code> ã <code>$w</code> ã <code>$p</code>ããŸã <code>'Fizz'</code> ã <code>'Buzz'</code> ã¯ã©ããã£ãŠ 1 è¡ 2 æåã«åããã®ããæ¬¡ã®ãã¯ããã¯ãžç§»ããã + ããã§é¢æ°ãåŒã³åºããŠããæã¯çããªã£ãã ã§ã¯ã<code>$r</code> ã <code>$w</code> ã <code>$p</code>ã ãŸã <code>'Fizz'</code> ã <code>'Buzz'</code> ã¯ã©ããã£ãŠ 1 è¡ 2 æåã«åããã®ãã æ¬¡ã®ãã¯ããã¯ãžç§»ããã </p> </section> - <section id="section--commentary--incompatible-solution"> - <h3><a href="#section--commentary--incompatible-solution">äœè«: PHP 8.x ã§åäœããªããŠããããªã</a></h3> + <h3><a href="#section--commentary--incompatible-solution">äœè«: PHP 8.x ã§åäœããªããŠããããªã</a></h3> <p> - ä»å䜿ã£ããã¯ããã¯ã説æããåã«ãäœè«ãšããŠãæååãªãã©ã«ã®ççž®æ³ãšããŠä»åæ¡çšããªãã£ããã®ã玹ä»ããã + ä»å䜿ã£ããã¯ããã¯ã説æããåã«ãäœè«ãšããŠãæååãªãã©ã«ã®ççž®æ³ãšããŠä»åæ¡çšããªãã£ããã®ã玹ä»ããã </p> - <blockquote> <ul> <li> @@ -349,11 +317,9 @@ </li> </ul> </blockquote> - <p> - ãšããã«ãŒã«ããªãå Žåããæªå®çŸ©ã®å®æ°ãè©äŸ¡ãããå Žåããã®å®æ°ã®ååãå€ã«ãªãããšãã PHP 7.x ãŸã§ã®ä»æ§ãå©çšã§ãããäŸãã°ã <code>Fizz</code> ãšããæååãæ¬²ãããã°ã次ã®ããã«ããã + ãšããã«ãŒã«ããªãå Žåããæªå®çŸ©ã®å®æ°ãè©äŸ¡ãããå Žåããã®å®æ°ã®ååãå€ã«ãªãããšãã PHP 7.x ãŸã§ã®ä»æ§ãå©çšã§ããã äŸãã°ã <code>Fizz</code> ãšããæååãæ¬²ãããã°ã次ã®ããã«ããã </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#24292E">$f</span></span> <span class="line"><span style="color:#D73A49">=</span><span style="color:#005CC5">F</span></span> @@ -362,11 +328,9 @@ <span class="line"><span style="color:#D73A49">.</span><span style="color:#005CC5">z</span></span> <span class="line"><span style="color:#24292E">;;</span></span></code></pre> </div> - <p> - ããããŠç°¡åã«æååãäœããããªãããã®ä»æ§ã¯ 7.x æç¹ã§ãèŠåãåããã®ã§ã<code>@</code> æŒç®åã䜿ã£ãŠæå¶ããŠãããšããã + ããããŠç°¡åã«æååãäœããã ãªãããã®ä»æ§ã¯ 7.x æç¹ã§ãèŠåãåããã®ã§ã<code>@</code> æŒç®åã䜿ã£ãŠæå¶ããŠãããšããã </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#24292E">$f</span></span> <span class="line"><span style="color:#D73A49">=@</span></span> @@ -378,22 +342,18 @@ <span class="line"><span style="color:#D73A49">@</span><span style="color:#005CC5">z</span></span> <span class="line"><span style="color:#24292E">;;</span></span></code></pre> </div> - <p> - ãããããã®ããšãããã£ãŠãããããã PHP 8.x ã§ã®åäœãèŠä»¶ã«èª²ãããšãããããã + ãããããã®ããšãããã£ãŠãããããã PHP 8.x ã§ã®åäœãèŠä»¶ã«èª²ãããšãããããã </p> </section> - <section id="section--commentary--shorten-string-literals"> - <h3><a href="#section--commentary--shorten-string-literals">æååãªãã©ã«ã®ççž®</a></h3> + <h3><a href="#section--commentary--shorten-string-literals">æååãªãã©ã«ã®ççž®</a></h3> <p> - å®éã«äœ¿ã£ãææ³ã®èª¬æã«ç§»ãã + å®éã«äœ¿ã£ãææ³ã®èª¬æã«ç§»ãã </p> - <p> - ãã°ããæååå士ã®ãããæŒç®ã䜿ããPHP ã§ã¯ãæååå士ã§ãããæŒç® (<code>&</code>ã<code>|</code>ã<code>^</code>) ãããå Žåãæååã®åãã€ãããšã«æå®ãããããæŒç®ããªããããããçµåãããã®ãæŒç®çµæãšãªãã + ãã°ããæååå士ã®ãããæŒç®ã䜿ãã PHP ã§ã¯ãæååå士ã§ãããæŒç® (<code>&</code>ã<code>|</code>ã<code>^</code>) ãããå Žåã æååã®åãã€ãããšã«æå®ãããããæŒç®ããªããããããçµåãããã®ãæŒç®çµæãšãªãã </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#24292E">$a </span><span style="color:#D73A49">=</span><span style="color:#032F62"> "12345"</span><span style="color:#24292E">;</span></span> <span class="line"><span style="color:#24292E">$b </span><span style="color:#D73A49">=</span><span style="color:#032F62"> "world"</span><span style="color:#24292E">;</span></span> @@ -407,22 +367,18 @@ <span class="line"><span style="color:#005CC5">echo</span><span style="color:#24292E"> $result;</span></span> <span class="line"><span style="color:#6A737D">// => F]AXQ</span></span></code></pre> </div> - <p> - ãããèžãŸããæ¬¡ã®ã³ãŒããèŠãŠã¿ããã + ãããèžãŸããæ¬¡ã®ã³ãŒããèŠãŠã¿ããã </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#24292E">$x </span><span style="color:#D73A49">=</span><span style="color:#032F62"> "x</span><span style="color:#005CC5">\n</span><span style="color:#032F62">Om</span><span style="color:#005CC5">\n</span><span style="color:#032F62">"</span><span style="color:#24292E">;</span></span> <span class="line"><span style="color:#24292E">$y </span><span style="color:#D73A49">=</span><span style="color:#032F62"> "</span><span style="color:#005CC5">\n</span><span style="color:#032F62">k!</span><span style="color:#005CC5">\n</span><span style="color:#032F62">o"</span><span style="color:#24292E">;</span></span> <span class="line"><span style="color:#24292E">$r </span><span style="color:#D73A49">=</span><span style="color:#24292E"> $x </span><span style="color:#D73A49">^</span><span style="color:#24292E"> $y;</span></span> <span class="line"><span style="color:#005CC5">echo</span><span style="color:#032F62"> "</span><span style="color:#24292E">$r</span><span style="color:#005CC5">\n</span><span style="color:#032F62">"</span><span style="color:#24292E">;</span></span></code></pre> </div> - <p> - å®è¡ãããšã<code>range</code> ã衚瀺ããããããŠãPHP ã§ã¯æååãªãã©ã«äžã«çã®æ¹è¡ãçŽæ¥æžããŠãããã®ã ã£ã (ãäž»ãªé害ãã®ç¯ãåç
§ã®ããš)ãæžããããŠã¿ããã + å®è¡ãããšã<code>range</code> ã衚瀺ãããã ããŠãPHP ã§ã¯æååãªãã©ã«äžã«çã®æ¹è¡ãçŽæ¥æžããŠãããã®ã ã£ã (ãäž»ãªé害ãã®ç¯ãåç
§ã®ããš)ã æžããããŠã¿ããã </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#24292E">$x</span></span> <span class="line"><span style="color:#D73A49">=</span><span style="color:#032F62">'x</span></span> @@ -437,11 +393,9 @@ <span class="line"><span style="color:#24292E">$r </span><span style="color:#D73A49">=</span><span style="color:#24292E"> $x </span><span style="color:#D73A49">^</span><span style="color:#24292E"> $y;</span></span> <span class="line"><span style="color:#005CC5">echo</span><span style="color:#032F62"> "</span><span style="color:#24292E">$r</span><span style="color:#005CC5">\n</span><span style="color:#032F62">"</span><span style="color:#24292E">;</span></span></code></pre> </div> - <p> - ããã« <code>#</code> ã䜿ã£ãŠé©åœã«èª¿æŽãããšã次ã®ããã«ãªãã + ããã« <code>#</code> ã䜿ã£ãŠé©åœã«èª¿æŽãããšã次ã®ããã«ãªãã </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#24292E">$x</span></span> <span class="line"><span style="color:#D73A49">=</span><span style="color:#6A737D">#</span></span> @@ -462,23 +416,19 @@ <span class="line"></span> <span class="line"><span style="color:#005CC5">echo</span><span style="color:#032F62"> "</span><span style="color:#24292E">$r</span><span style="color:#005CC5">\n</span><span style="color:#032F62">"</span><span style="color:#24292E">;</span></span></code></pre> </div> - <p> - 1è¡ããã2æåã§ã<code>range</code> ãšããæååãçæããããšã«æåãããä»ã®å¿
èŠãªæååã«ããåæ§ã®åŠçãã»ã©ããã + 1è¡ããã2æåã§ã<code>range</code> ãšããæååãçæããããšã«æåããã ä»ã®å¿
èŠãªæååã«ããåæ§ã®åŠçãã»ã©ããã </p> - <p> - åè: <code>Buzz</code> äžã«ããå°æåã® <code>u</code> ã¯ããã®ããžãã¯ã ãš non-printable ãªæåã«ãªã£ãŠããŸãããããŸã§ã®ãã¯ããã¯ãé§äœ¿ããã°åé¿ããã®ã¯ããé£ãããªãã®ã§ãèããŠã¿ãŠã»ããã + åè: <code>Buzz</code> äžã«ããå°æåã® <code>u</code> ã¯ããã®ããžãã¯ã ãš non-printable ãªæåã«ãªã£ãŠããŸãã ãããŸã§ã®ãã¯ããã¯ãé§äœ¿ããã°åé¿ããã®ã¯ããé£ãããªãã®ã§ãèããŠã¿ãŠã»ããã </p> </section> </section> - <section id="section--stretched-fizzbuzz"> - <h2><a href="#section--stretched-fizzbuzz">å®æç³»</a></h2> + <h2><a href="#section--stretched-fizzbuzz">å®æç³»</a></h2> <p> - 宿ãããã®ããã¡ãã + 宿ãããã®ããã¡ãã </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49"><?</span><span style="color:#005CC5">php</span></span> <span class="line"></span> @@ -631,24 +581,20 @@ <span class="line"><span style="color:#24292E">);</span></span></code></pre> </div> </section> - <section id="section--outro"> - <h2><a href="#section--outro">ææ³ãªã©</a></h2> + <h2><a href="#section--outro">ææ³ãªã©</a></h2> <p> - PHP ã¯ãã¹ã¯ãªããèšèªã®äžã ãšã·ã³ã¿ãã¯ã¹ã·ã¥ã¬ãŒãå°ãªã (äœæ)ããã®ææŠã¯äžå¯èœã«æãããããPHP ããã¥ã¢ã«ãšã«ããã£ãããŠããããªããšããªã£ãã + PHP ã¯ãã¹ã¯ãªããèšèªã®äžã ãšã·ã³ã¿ãã¯ã¹ã·ã¥ã¬ãŒãå°ãªã (äœæ)ã ãã®ææŠã¯äžå¯èœã«æãããããPHP ããã¥ã¢ã«ãšã«ããã£ãããŠããããªããšããªã£ãã </p> - <p> - ã¿ããªãããã°ã©ã ã现é·ããããã + ã¿ããªãããã°ã©ã ã现é·ããããã </p> </section> - <section id="section--alternative-solution"> - <h2><a href="#section--alternative-solution">äœè«2: å¥è§£</a></h2> + <h2><a href="#section--alternative-solution">äœè«2: å¥è§£</a></h2> <p> - PHP ã§ã¯ãããã¯ã¯ã©ãŒãã䜿ã£ãŠã·ã§ã«ãåŒã³åºããããã㯠<code>shell_exec</code> 颿°ãšç䟡ã§ãããããŠãPHP ã§ã¯ããã¯ã¹ã©ãã·ã¥ã«ããè¡ç¶ç¶ã䜿ããªããšæžããããã·ã§ã«ã§ã¯äœ¿ãã (åœç¶ã ããåŒã³åºãããã·ã§ã«ã«äŸåãããBash ãªã倧äžå€«ã ãããç¥ãããã©)ã + PHP ã§ã¯ãããã¯ã¯ã©ãŒãã䜿ã£ãŠã·ã§ã«ãåŒã³åºããã ãã㯠<code>shell_exec</code> 颿°ãšç䟡ã§ããã ããŠãPHP ã§ã¯ããã¯ã¹ã©ãã·ã¥ã«ããè¡ç¶ç¶ã䜿ããªããšæžããããã·ã§ã«ã§ã¯äœ¿ãã (åœç¶ã ããåŒã³åºãããã·ã§ã«ã«äŸåãããBash ãªã倧äžå€«ã ãããç¥ãããã©)ã </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49"><?</span><span style="color:#005CC5">php</span></span> <span class="line"></span> @@ -663,15 +609,12 @@ <span class="line"><span style="color:#032F62">3\</span></span> <span class="line"><span style="color:#032F62">`</span><span style="color:#24292E">);</span></span></code></pre> </div> - <p> - ãªããããã§ã¯ç°¡åã®ããåºåã« <code>printf</code> ããã®ãŸãŸäœ¿ã£ãŠããããå®éã«ã¯ <code>printf</code> ãšããæååãåæããŠå¯å€é¢æ°ã§åŒã³åºãã + ãªããããã§ã¯ç°¡åã®ããåºåã« <code>printf</code> ããã®ãŸãŸäœ¿ã£ãŠãããã å®éã«ã¯ <code>printf</code> ãšããæååãåæããŠå¯å€é¢æ°ã§åŒã³åºãã </p> - <p> - ãã ããããã§ã¯ + ãã ããããã§ã¯ </p> - <blockquote> <ul> <li> @@ -679,15 +622,12 @@ </li> </ul> </blockquote> - <p> - ã«éåããŠããŸããã¹ããŒã¹ã䜿ããªããšåŒæ°ãšã³ãã³ããåºåããªããããã¯å°ã£ãã + ã«éåããŠããŸããã¹ããŒã¹ã䜿ããªããšåŒæ°ãšã³ãã³ããåºåããªããããã¯å°ã£ãã </p> - <p> - ãããã以äžã¯äžå¯èœã ãšæã£ãŠããã®ã ãããã®èšäºã®å·çäžã«è§£æ±ºããæ¹æ³ãæãã€ããã®ã§èŒããŠããã + ãããã以äžã¯äžå¯èœã ãšæã£ãŠããã®ã ãããã®èšäºã®å·çäžã«è§£æ±ºããæ¹æ³ãæãã€ããã®ã§èŒããŠããã </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49"><?</span><span style="color:#005CC5">php</span></span> <span class="line"></span> @@ -719,21 +659,17 @@ <span class="line"><span style="color:#032F62">3\</span></span> <span class="line"><span style="color:#032F62">`</span><span style="color:#24292E">);</span></span></code></pre> </div> - <p> - å
çšãšåããã<code>chr</code> ã <code>printf</code> ãçæããéšåã¯é·ããªãã®ã§çããã + å
çšãšåããã<code>chr</code> ã <code>printf</code> ãçæããéšåã¯é·ããªãã®ã§çããã </p> - <div class="codeblock"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>${</span></span> <span class="line"><span>'_</span></span> <span class="line"><span>'}</span></span></code></pre> </div> - <p> - ã¯å€æ°ã§ãäžã«ã¯ã¹ããŒã¹ãšãšã¹ã±ãŒããå
¥ã£ãŠãã (<code>chr(32) . chr(92)</code>)ãã·ã§ã«ã«æž¡ãããŠããæååã¯æ¬¡ã®ããã«ãªãã + ã¯å€æ°ã§ãäžã«ã¯ã¹ããŒã¹ãšãšã¹ã±ãŒããå
¥ã£ãŠãã (<code>chr(32) . chr(92)</code>)ã ã·ã§ã«ã«æž¡ãããŠããæååã¯æ¬¡ã®ããã«ãªãã </p> - <div class="codeblock"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>e\</span></span> <span class="line"><span>c\</span></span> @@ -744,27 +680,22 @@ <span class="line"><span>2\</span></span> <span class="line"><span>3\</span></span></code></pre> </div> - <p> - ããã¯ãåæ²ããã³ãã³ããšåãã ãããããŠãã¹ããŒã¹ãéœã«æžããã«ã·ã§ã«ãããããèªç±ã«æ±ããããã«ãªã£ããFizzbuzz ã®ã¯ã³ã©ã€ããŒãããããæžããã ãããããããšã¯ãªããšããªãã ãã (詊ããŠãªããã©)ã + ããã¯ãåæ²ããã³ãã³ããšåãã ã ããããŠãã¹ããŒã¹ãéœã«æžããã«ã·ã§ã«ãããããèªç±ã«æ±ããããã«ãªã£ãã Fizzbuzz ã®ã¯ã³ã©ã€ããŒãããããæžããã ãããããããšã¯ãªããšããªãã ãã (詊ããŠãªããã©)ã </p> - <p> - ãšããããšã§ããã¯å¥è§£ãšããããšã«ããŠããã + ãšããããšã§ããã¯å¥è§£ãšããããšã«ããŠããã </p> - <p> - ã¡ãªã¿ã«ãPHP 8.2 ããã¯ããã®èšæ³ã§ Warning ãåºãããã«ãªãããã ã + ã¡ãªã¿ã«ãPHP 8.2 ããã¯ããã®èšæ³ã§ Warning ãåºãããã«ãªãããã ã </p> - <div class="codeblock"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>${</span></span> <span class="line"><span>'_</span></span> <span class="line"><span>'}</span></span></code></pre> </div> - <p> - ææ°çã§èŠåãåºããšããã®ãçŸãããªãã®ã§ãç§ãšããŠã¯æ¬ç·šã®è§£æ³ãæšãã + ææ°çã§èŠåãåºããšããã®ãçŸãããªãã®ã§ãç§ãšããŠã¯æ¬ç·šã®è§£æ³ãæšãã </p> </section> </div> diff --git a/vhosts/blog/public/posts/2022-10-23/phperkaigi-2023-unused-token-quiz-1/index.html b/vhosts/blog/public/posts/2022-10-23/phperkaigi-2023-unused-token-quiz-1/index.html index efc80674..e3d5145f 100644 --- a/vhosts/blog/public/posts/2022-10-23/phperkaigi-2023-unused-token-quiz-1/index.html +++ b/vhosts/blog/public/posts/2022-10-23/phperkaigi-2023-unused-token-quiz-1/index.html @@ -61,30 +61,25 @@ </ol> </section> <section id="section--intro"> - <h2><a href="#section--intro">ã¯ããã«</a></h2> + <h2><a href="#section--intro">ã¯ããã«</a></h2> <p> - 2023 幎 3 æ 23 æ¥ãã 25 æ¥ã«ãããŠéå¬äºå® (èšäºå·çæç¹) ã®ã<a href="https://phperkaigi.jp/2023/" rel="noreferrer" target="_blank">PHPerKaigi 2023</a> ã«ãããŠãæšå¹Žãšåæ§ã«ãåŒç€Ÿ <a href="https://www.dgcircus.com/" rel="noreferrer" target="_blank">ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ</a> ãããããŒã¯ã³åé¡ãåºé¡äºå®ã§ããã + 2023 幎 3 æ 23 æ¥ãã 25 æ¥ã«ãããŠéå¬äºå® (èšäºå·çæç¹) ã®ã <a href="https://phperkaigi.jp/2023/" rel="noreferrer" target="_blank">PHPerKaigi 2023</a> ã«ãããŠã æšå¹Žãšåæ§ã«ãåŒç€Ÿ <a href="https://www.dgcircus.com/" rel="noreferrer" target="_blank">ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ</a> ããã ããŒã¯ã³åé¡ãåºé¡äºå®ã§ããã </p> - <p> - æšå¹Žã®ããŒã¯ã³åé¡ã®èšäºã¯ãã¡ã: <a href="/posts/2022-04-09/phperkaigi-2022-tokens">PHPerKaigi 2022 ããŒã¯ã³åé¡ã®è§£èª¬</a> + æšå¹Žã®ããŒã¯ã³åé¡ã®èšäºã¯ãã¡ã: <a href="/posts/2022-04-09/phperkaigi-2022-tokens">PHPerKaigi 2022 ããŒã¯ã³åé¡ã®è§£èª¬</a> </p> - <p> - ãã§ã« 2023 幎çšã®åé¡ã¯äœææžã¿ã§ãããããã®å¶äœéçšã®äžã§ããã€ãããåãã§ããããã£ãããªã®ã§ãPHPerKaigi éå¬ãåŸ
ã€éã«ç޹ä»ããããšæãã + ãã§ã« 2023 幎çšã®åé¡ã¯äœææžã¿ã§ãããããã®å¶äœéçšã®äžã§ããã€ãããåãã§ããã ãã£ãããªã®ã§ãPHPerKaigi éå¬ãåŸ
ã€éã«ç޹ä»ããããšæãã </p> - <p> - 10 æãã 2 æãŸã§ãæ¯æ 1 èšäºãã€å
¬éããŠããäºå® (å¿ããŠããªããã°)ã + 10 æãã 2 æãŸã§ãæ¯æ 1 èšäºãã€å
¬éããŠããäºå® (å¿ããŠããªããã°)ã </p> </section> - <section id="section--quiz"> - <h2><a href="#section--quiz">åé¡</a></h2> + <h2><a href="#section--quiz">åé¡</a></h2> <p> - 泚æ: ããã¯ããåãªã®ã§ãåŸãããããŒã¯ã³ã PHPerKaigi ã§å
¥åããŠããã€ã³ãã«ã¯ãªããªãã + 泚æ: ããã¯ããåãªã®ã§ãåŸãããããŒã¯ã³ã PHPerKaigi ã§å
¥åããŠããã€ã³ãã«ã¯ãªããªãã </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49"><?</span><span style="color:#005CC5">php</span></span> <span class="line"></span> @@ -109,51 +104,41 @@ <span class="line"><span style="color:#24292E">}</span></span></code></pre> </div> </section> - <section id="section--how-to-obtain-token"> - <h2><a href="#section--how-to-obtain-token">ããŒã¯ã³å
¥ææ¹æ³</a></h2> + <h2><a href="#section--how-to-obtain-token">ããŒã¯ã³å
¥ææ¹æ³</a></h2> <p> - ãœãŒã¹ãèŠããšããããšããã<code>$argv[1]</code> ãåç
§ããŠãããããã <code>$Ï</code> ãªã倿°ã«ä»£å
¥ããŠããã®ã§ãååšçãæž¡ããŠã¿ãã + ãœãŒã¹ãèŠããšããããšããã<code>$argv[1]</code> ãåç
§ããŠããã ããã <code>$Ï</code> ãªã倿°ã«ä»£å
¥ããŠããã®ã§ãååšçãæž¡ããŠã¿ãã </p> - <div class="codeblock" language="shell-session"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>$ php Q.php 3.14</span></span> <span class="line"><span>Failed.</span></span></code></pre> </div> - <p> - 倱æããŠããŸã£ãã粟床ãäžããŠã¿ãã + 倱æããŠããŸã£ãã粟床ãäžããŠã¿ãã </p> - <div class="codeblock" language="shell-session"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>$ php Q.php 3.1415</span></span> <span class="line"><span>Failed.</span></span></code></pre> </div> - <p> - ã ãã ã£ãããããæåãããŸã§ç¹°ãè¿ãã + ã ãã ã£ãããããæåãããŸã§ç¹°ãè¿ãã </p> - <p> - æåã«ããŒã¯ã³ãåŸãããã®ã¯ãå°æ°ç¹ä»¥äž 16 æ¡ç®ãŸã§å
¥åãããšãã§ããããªãã + æåã«ããŒã¯ã³ãåŸãããã®ã¯ãå°æ°ç¹ä»¥äž 16 æ¡ç®ãŸã§å
¥åãããšãã§ããããªãã </p> - <div class="codeblock" language="shell-session"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>$ php Q.php 3.1415926535897932</span></span> <span class="line"><span>Token: #YO</span></span></code></pre> </div> - <p> - ãã§ããããŒã¯ã³ã<code>#YO</code>ããæã«å
¥ã£ãã + ãã§ããããŒã¯ã³ã<code>#YO</code>ããæã«å
¥ã£ãã </p> </section> - <section id="section--commentary"> - <h2><a href="#section--commentary">解説</a></h2> + <h2><a href="#section--commentary">解説</a></h2> <p> - çãã®ã§é ãã远ã£ãŠããã + çãã®ã§é ãã远ã£ãŠããã </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#24292E">$Ï </span><span style="color:#D73A49">=</span><span style="color:#24292E"> $argv[</span><span style="color:#005CC5">1</span><span style="color:#24292E">] </span><span style="color:#D73A49">??</span><span style="color:#005CC5"> null</span><span style="color:#24292E">;</span></span> <span class="line"><span style="color:#D73A49">if</span><span style="color:#24292E"> ($Ï </span><span style="color:#D73A49">===</span><span style="color:#005CC5"> null</span><span style="color:#24292E">) {</span></span> @@ -164,43 +149,34 @@ <span class="line"><span style="color:#D73A49"> exit</span><span style="color:#24292E">(</span><span style="color:#032F62">'Invalid input.'</span><span style="color:#24292E">);</span></span> <span class="line"><span style="color:#24292E">}</span></span></code></pre> </div> - <p> - å
¥åã®ããªããŒã·ã§ã³éšåãæ°å€ã®ã¿åãä»ããã + å
¥åã®ããªããŒã·ã§ã³éšåãæ°å€ã®ã¿åãä»ããã </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#24292E">$s </span><span style="color:#D73A49">=</span><span style="color:#005CC5"> implode</span><span style="color:#24292E">(</span><span style="color:#005CC5">array_map</span><span style="color:#24292E">(</span><span style="color:#005CC5">chr</span><span style="color:#24292E">(</span><span style="color:#D73A49">...</span><span style="color:#24292E">), </span><span style="color:#005CC5">str_split</span><span style="color:#24292E">($Ï, </span><span style="color:#005CC5">2</span><span style="color:#24292E">)));</span></span></code></pre> </div> - <p> - <code>$Ï</code> ã 2 æåããšã«åºåã (<code>str_split</code>)ãæ°å€ã ASCII ã³ãŒããšèŠåããŠæåã«å€æ (<code>chr</code>) ããŠçµå (<code>implode</code>) ããŠããã + <code>$Ï</code> ã 2 æåããšã«åºåã (<code>str_split</code>)ã æ°å€ã ASCII ã³ãŒããšèŠåããŠæåã«å€æ (<code>chr</code>) ããŠçµå (<code>implode</code>) ããŠããã </p> - <p> - äŸãã°ã<code>$Ï</code> ã <code>'656667'</code> ã ã£ããšãããšã<code>65</code>ã<code>66</code>ã<code>67</code> ã«å¯Ÿå¿ãã <code>'A'</code>ã<code>'B'</code>ã<code>'C'</code> ãžãšå€æããã<code>'ABC'</code> ã«ãªãã + äŸãã°ã<code>$Ï</code> ã <code>'656667'</code> ã ã£ããšãããšã <code>65</code>ã<code>66</code>ã<code>67</code> ã«å¯Ÿå¿ãã <code>'A'</code>ã<code>'B'</code>ã<code>'C'</code> ãžãšå€æããã<code>'ABC'</code> ã«ãªãã </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#24292E">$Ï </span><span style="color:#D73A49">=</span><span style="color:#032F62"> '656667'</span><span style="color:#24292E">;</span></span> <span class="line"><span style="color:#24292E">$s </span><span style="color:#D73A49">=</span><span style="color:#005CC5"> implode</span><span style="color:#24292E">(</span><span style="color:#005CC5">array_map</span><span style="color:#24292E">(</span><span style="color:#005CC5">chr</span><span style="color:#24292E">(</span><span style="color:#D73A49">...</span><span style="color:#24292E">), </span><span style="color:#005CC5">str_split</span><span style="color:#24292E">($Ï, </span><span style="color:#005CC5">2</span><span style="color:#24292E">)));</span></span> <span class="line"><span style="color:#005CC5">echo</span><span style="color:#24292E"> $s;</span></span> <span class="line"><span style="color:#6A737D">// => ABC</span></span></code></pre> </div> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#005CC5">preg_match</span><span style="color:#24292E">(</span><span style="color:#032F62">'/(</span><span style="color:#22863A;font-weight:bold">\x</span><span style="color:#032F62">23.</span><span style="color:#D73A49">+</span><span style="color:#032F62">?) /'</span><span style="color:#24292E">, $s, $m);</span></span> <span class="line"><span style="color:#24292E">$t </span><span style="color:#D73A49">=</span><span style="color:#24292E"> $m[</span><span style="color:#005CC5">1</span><span style="color:#24292E">] </span><span style="color:#D73A49">??</span><span style="color:#032F62"> ''</span><span style="color:#24292E">;</span></span></code></pre> </div> - <p> - æ£èŠè¡šçŸã§ãããã³ã°ããŠããã<code>\x23</code> 㯠<code>#</code> ãšåãã§ããããšã«çæãããšããã®æ£èŠè¡šçŸã¯ã<code>#</code> ããå§ãŸã 2 以äžã®é·ã (å« <code>#</code>) ã®æååã§ãæåã«çŸããã¹ããŒã¹ãŸã§ãã«ããããããã€ãŸãããã¯ãPHPerKaigi ã«ãããããŒã¯ã³ã§ããã + æ£èŠè¡šçŸã§ãããã³ã°ããŠããã<code>\x23</code> 㯠<code>#</code> ãšåãã§ããããšã«çæãããšã ãã®æ£èŠè¡šçŸã¯ã<code>#</code> ããå§ãŸã 2 以äžã®é·ã (å« <code>#</code>) ã®æååã§ã æåã«çŸããã¹ããŒã¹ãŸã§ãã«ããããããã€ãŸãããã¯ãPHPerKaigi ã«ãããããŒã¯ã³ã§ããã </p> - <p> - ãªãã<code>#</code> ãçŽæ¥æžããŠããªãã®ã¯ã<code>/#.+?) /</code> ãšæžããšã<code>#.+?)</code> ãšããæå³ãã¬ããŒã¯ã³ãç»é²ãããŠããŸãããã§ããã + ãªãã<code>#</code> ãçŽæ¥æžããŠããªãã®ã¯ã<code>/#.+?) /</code> ãšæžããšã <code>#.+?)</code> ãšããæå³ãã¬ããŒã¯ã³ãç»é²ãããŠããŸãããã§ããã </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49">if</span><span style="color:#24292E"> (</span><span style="color:#005CC5">md5</span><span style="color:#24292E">($t) </span><span style="color:#D73A49">===</span><span style="color:#032F62"> '056e831a4146bf123e8ea16613303d2e'</span><span style="color:#24292E">) {</span></span> <span class="line"><span style="color:#005CC5"> echo</span><span style="color:#032F62"> "Token: {</span><span style="color:#24292E">$t</span><span style="color:#032F62">}</span><span style="color:#005CC5">\n</span><span style="color:#032F62">"</span><span style="color:#24292E">;</span></span> @@ -208,20 +184,17 @@ <span class="line"><span style="color:#005CC5"> echo</span><span style="color:#032F62"> "Failed.</span><span style="color:#005CC5">\n</span><span style="color:#032F62">"</span><span style="color:#24292E">;</span></span> <span class="line"><span style="color:#24292E">}</span></span></code></pre> </div> - <p> - æåŸã«ããŒã¯ã³ã®ããã·ã¥å€ãèŠãŠãæ³å®è§£ãã©ããã確èªããã + æåŸã«ããŒã¯ã³ã®ããã·ã¥å€ãèŠãŠãæ³å®è§£ãã©ããã確èªããã </p> </section> - <section id="section--outro"> - <h2><a href="#section--outro">ãããã«</a></h2> + <h2><a href="#section--outro">ãããã«</a></h2> <p> - ååšçãäœæ¡ãèšç®ã㊠ASCII ã³ãŒãçµç±ã§æåååããã°ãããŒã¯ã³ã£ãœããã®ãã©ããã§åºãŠããã®ã§ã¯ãªããããšèããŠçãŸããäœåã + ååšçãäœæ¡ãèšç®ã㊠ASCII ã³ãŒãçµç±ã§æåååããã°ãããŒã¯ã³ã£ãœããã®ãã©ããã§åºãŠããã®ã§ã¯ãªããããšèããŠçãŸããäœåã </p> - <p> - æåã¯çé¢ç®ã«ååšçã®èšç®ããã°ã©ã ãçµãã§ããã®ã ããããåãããŠã¿ããšããã«æµ
ããšããã«ãã£ãã®ã§é©ãã (ã¡ãªã¿ã«ãããã§ã <code>M_PI</code> ã <code>pi()</code> ã§ã¯ç²ŸåºŠãè¶³ããªã)ãèŠã€ãããšãã¯çåãããã®ã®ãå·éã«ãªã£ãŠã¿ããšå€§ããŠé¢çœããªãã£ãã®ã§ããã«ãªã£ãããããã100 äžæ¡ç®ãããã«åãŸã£ãŠããŠãããã»ããããã£ããããããªãã + æåã¯çé¢ç®ã«ååšçã®èšç®ããã°ã©ã ãçµãã§ããã®ã ããããåãããŠã¿ããšããã«æµ
ããšããã«ãã£ãã®ã§é©ãã (ã¡ãªã¿ã«ãããã§ã <code>M_PI</code> ã <code>pi()</code> ã§ã¯ç²ŸåºŠãè¶³ããªã)ã èŠã€ãããšãã¯çåãããã®ã®ãå·éã«ãªã£ãŠã¿ããšå€§ããŠé¢çœããªãã£ãã®ã§ããã«ãªã£ãã ãããã100 äžæ¡ç®ãããã«åãŸã£ãŠããŠãããã»ããããã£ããããããªãã </p> </section> </div> diff --git a/vhosts/blog/public/posts/2022-10-28/setup-server-for-this-site/index.html b/vhosts/blog/public/posts/2022-10-28/setup-server-for-this-site/index.html index cce709ac..ceba0dcd 100644 --- a/vhosts/blog/public/posts/2022-10-28/setup-server-for-this-site/index.html +++ b/vhosts/blog/public/posts/2022-10-28/setup-server-for-this-site/index.html @@ -61,54 +61,46 @@ </ol> </section> <section id="section--intro"> - <h2><a href="#section--intro">ã¯ããã«</a></h2> + <h2><a href="#section--intro">ã¯ããã«</a></h2> <p> - ãããŸã§ãã® blog 㯠GitHub Pages ã§ãã¹ãããŠããã®ã ããå
æ¥ VPS ã«ç§»è¡ããããã®ãšãã«ãããªã£ããµãŒãã®ã»ããã¢ããäœæ¥ãæžãæ®ããŠããã99 % èªåçšã®åå¿é²ãå¥ã®ãã³ãã«ç§»ãããããããªã£ããèŠã«æ¥ãã + ãããŸã§ãã® blog 㯠GitHub Pages ã§ãã¹ãããŠããã®ã ããå
æ¥ VPS ã«ç§»è¡ããã ãã®ãšãã«ãããªã£ããµãŒãã®ã»ããã¢ããäœæ¥ãæžãæ®ããŠããã 99 % èªåçšã®åå¿é²ãå¥ã®ãã³ãã«ç§»ãããããããªã£ããèŠã«æ¥ãã </p> - <p> - æªæ¥ã®èªåãž: ç¹ã«èªååããŠãªãã®ã§ãããããèŠããã§ããã + æªæ¥ã®èªåãž: ç¹ã«èªååããŠãªãã®ã§ãããããèŠããã§ããã </p> </section> - <section id="section--vps"> - <h2><a href="#section--vps">VPS</a></h2> + <h2><a href="#section--vps">VPS</a></h2> <p> - <a href="https://vps.sakura.ad.jp/" rel="noreferrer" target="_blank">ãããã® VPS</a> ã® 2 GB ãã©ã³ããããŸã§çé¢ç®ã«éžå®ããŠããªãã®ã§ãå°ã£ããç§»åããããã + <a href="https://vps.sakura.ad.jp/" rel="noreferrer" target="_blank">ãããã® VPS</a> ã® 2 GB ãã©ã³ã ãããŸã§çé¢ç®ã«éžå®ããŠããªãã®ã§ãå°ã£ããç§»åããããã </p> </section> - <section id="section--preparation"> - <h2><a href="#section--preparation">äºåæºå</a></h2> + <h2><a href="#section--preparation">äºåæºå</a></h2> <section id="section--preparation--hostname"> - <h3><a href="#section--preparation--hostname">ãµãŒãã®ãã¹ãåãæ±ºãã</a></h3> + <h3><a href="#section--preparation--hostname">ãµãŒãã®ãã¹ãåãæ±ºãã</a></h3> <p> - ã¢ãããŒã·ã§ã³ãäžãããšããå¹èœããããä»åã¯è€åå®å®¶ããåã£ãŠ <code>teika</code> ã«ããããããŠããã€ãæºæ°ç©èªã®åžãå°åçŸäººäžéŠã®æäººããéžãã§ããã + ã¢ãããŒã·ã§ã³ãäžãããšããå¹èœããããä»åã¯è€åå®å®¶ããåã£ãŠ <code>teika</code> ã«ããã ãããŠããã€ãæºæ°ç©èªã®åžãå°åçŸäººäžéŠã®æäººããéžãã§ããã </p> </section> - <section id="section--preparation--ssh-key"> - <h3><a href="#section--preparation--ssh-key">SSH ã®éµçæ</a></h3> + <h3><a href="#section--preparation--ssh-key">SSH ã®éµçæ</a></h3> <p> - ããŒã«ã«ãã·ã³ã§éµãçæããã + ããŒã«ã«ãã·ã³ã§éµãçæããã </p> - <div class="codeblock" language="shell-session"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>$ ssh-keygen -t ed25519 -b 521 -f ~/.ssh/teika.key</span></span> <span class="line"><span>$ ssh-keygen -t ed25519 -b 521 -f ~/.ssh/github2teika.key</span></span></code></pre> </div> - <p> - <code>teika.key</code> ã¯ããŒã«ã«ãããµãŒããžã®æ¥ç¶çšã<code>github2teika.key</code> ã¯ãGitHub Actions ãããµãŒããžã®ãããã€çšã + <code>teika.key</code> ã¯ããŒã«ã«ãããµãŒããžã®æ¥ç¶çšã<code>github2teika.key</code> ã¯ã GitHub Actions ãããµãŒããžã®ãããã€çšã </p> </section> - <section id="section--preparation--ssh-config"> - <h3><a href="#section--preparation--ssh-config">SSH ã®èšå®</a></h3> + <h3><a href="#section--preparation--ssh-config">SSH ã®èšå®</a></h3> <p> <code>.ssh/config</code> ã«èšå®ããŠããã </p> - <div class="codeblock" language="ssh_config"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>Host teika</span></span> <span class="line"><span> HostName **********</span></span> @@ -119,22 +111,19 @@ </div> </section> </section> - <section id="section--basic-setup"> - <h2><a href="#section--basic-setup">åºæ¬ã®ã»ããã¢ãã</a></h2> + <h2><a href="#section--basic-setup">åºæ¬ã®ã»ããã¢ãã</a></h2> <section id="section--basic-setup--login"> - <h3><a href="#section--basic-setup--login">SSH æ¥ç¶</a></h3> + <h3><a href="#section--basic-setup--login">SSH æ¥ç¶</a></h3> <p> - VPS å¥çŽæã«èšå®ãã管çè
ãŠãŒã¶ãšãã¹ã¯ãŒãã䜿ã£ãŠãã°ã€ã³ããã + VPS å¥çŽæã«èšå®ãã管çè
ãŠãŒã¶ãšãã¹ã¯ãŒãã䜿ã£ãŠãã°ã€ã³ããã </p> </section> - <section id="section--basic-setup--user"> - <h3><a href="#section--basic-setup--user">ãŠãŒã¶ãäœæãã</a></h3> + <h3><a href="#section--basic-setup--user">ãŠãŒã¶ãäœæãã</a></h3> <p> - 管çè
ãŠãŒã¶ã§äœæ¥ãããšå±ãªãã®ã§ãã¡ã€ã³ã§äœ¿ããŠãŒã¶ãäœæããã<code>sudo</code> ã°ã«ãŒãã«è¿œå ã㊠<code>sudo</code> ã§ããããã«ãã<code>su</code> ã§åãæ¿ãã + 管çè
ãŠãŒã¶ã§äœæ¥ãããšå±ãªãã®ã§ãã¡ã€ã³ã§äœ¿ããŠãŒã¶ãäœæããã <code>sudo</code> ã°ã«ãŒãã«è¿œå ã㊠<code>sudo</code> ã§ããããã«ãã<code>su</code> ã§åãæ¿ãã </p> - <div class="codeblock" language="shell-session"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>$ sudo adduser **********</span></span> <span class="line"><span>$ sudo adduser ********** sudo</span></span> @@ -142,79 +131,65 @@ <span class="line"><span>$ cd</span></span></code></pre> </div> </section> - <section id="section--basic-setup--hostname"> - <h3><a href="#section--basic-setup--hostname">ãã¹ãåãå€ãã</a></h3> + <h3><a href="#section--basic-setup--hostname">ãã¹ãåãå€ãã</a></h3> <div class="codeblock" language="shell-session"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>$ sudo hostname teika</span></span></code></pre> </div> </section> - <section id="section--basic-setup--public-key"> - <h3><a href="#section--basic-setup--public-key">å
¬ééµã眮ã</a></h3> + <h3><a href="#section--basic-setup--public-key">å
¬ééµã眮ã</a></h3> <div class="codeblock" language="shell-session"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>$ mkdir ~/.ssh</span></span> <span class="line"><span>$ chmod 700 ~/.ssh</span></span> <span class="line"><span>$ vi ~/.ssh/authorized_keys</span></span></code></pre> </div> - <p> <code>authorized_keys</code> ã«ã¯ãããŒã«ã«ã§çæãã <code>~/.ssh/teika.key.pub</code> ãš <code>~/.ssh/github2teika.key.pub</code> ã®å
容ãã³ããŒããã </p> </section> - <section id="section--basic-setup--ssh-config"> - <h3><a href="#section--basic-setup--ssh-config">SSH ã®èšå®</a></h3> + <h3><a href="#section--basic-setup--ssh-config">SSH ã®èšå®</a></h3> <p> - SSH ã®èšå®ã倿Žããå°ãã§ãå®å
šã«ããŠããã + SSH ã®èšå®ã倿Žããå°ãã§ãå®å
šã«ããŠããã </p> - <div class="codeblock" language="shell-session"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>$ sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak</span></span> <span class="line"><span>$ sudo vi /etc/ssh/sshd_config</span></span></code></pre> </div> - <ul> <li> <code>Port</code> ãå€æŽ </li> - <li> <code>PermitRootLogin</code> ã <code>no</code> ã« </li> - <li> <code>PasswordAuthentication</code> ã <code>no</code> ã« </li> </ul> - <p> - ãããŠèšå®ãåæ ã + ãããŠèšå®ãåæ ã </p> - <div class="codeblock" language="shell-session"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>$ sudo systemctl restart sshd</span></span> <span class="line"><span>$ sudo systemctl status sshd</span></span></code></pre> </div> </section> - <section id="section--basic-setup--ssh-connect"> - <h3><a href="#section--basic-setup--ssh-connect">SSH ã§æ¥ç¶ç¢ºèª</a></h3> + <h3><a href="#section--basic-setup--ssh-connect">SSH ã§æ¥ç¶ç¢ºèª</a></h3> <p> - ä»ã® SSH ã»ãã·ã§ã³ã¯éããã«ãã¿ãŒããã«ãå¥ééããŠçé確èªãããã»ãã·ã§ã³ãéããŠããŸããšãSSH ã®èšå®ã«äžåããã£ãå Žåã«ç· ãåºãããããã + ä»ã® SSH ã»ãã·ã§ã³ã¯éããã«ãã¿ãŒããã«ãå¥ééããŠçé確èªããã ã»ãã·ã§ã³ãéããŠããŸããšãSSH ã®èšå®ã«äžåããã£ãå Žåã«ç· ãåºãããããã </p> - <div class="codeblock" language="shell-session"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>$ ssh teika</span></span></code></pre> </div> </section> - <section id="section--basic-setup--close-ports"> - <h3><a href="#section--basic-setup--close-ports">ããŒãã®é®æ</a></h3> + <h3><a href="#section--basic-setup--close-ports">ããŒãã®é®æ</a></h3> <p> - ããã©ã«ãã® 22 çªãéããèšå®ããããŒãã ã空ããã + ããã©ã«ãã® 22 çªãéããèšå®ããããŒãã ã空ããã </p> - <div class="codeblock" language="shell-session"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>$ sudo ufw deny ssh</span></span> <span class="line"><span>$ sudo ufw allow *******</span></span> @@ -222,35 +197,28 @@ <span class="line"><span>$ sudo ufw reload</span></span> <span class="line"><span>$ sudo ufw status</span></span></code></pre> </div> - <p> - ããã§ããäžåºŠ SSH ã®æ¥ç¶ç¢ºèªãæãã + ããã§ããäžåºŠ SSH ã®æ¥ç¶ç¢ºèªãæãã </p> </section> - <section id="section--basic-setup--ssh-key-for-github"> - <h3><a href="#section--basic-setup--ssh-key-for-github">GitHub çšã® SSH éµ</a></h3> + <h3><a href="#section--basic-setup--ssh-key-for-github">GitHub çšã® SSH éµ</a></h3> <p> - GitHub ã«çœ®ããŠãã private ãªããžããªããµãŒããã clone ãããã®ã§ãSSH éµãçæããŠçœ®ããŠããã + GitHub ã«çœ®ããŠãã private ãªããžããªããµãŒããã clone ãããã®ã§ãSSH éµãçæããŠçœ®ããŠããã </p> - <div class="codeblock" language="shell-session"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>$ ssh-keygen -t ed25519 -b 521 -f ~/.ssh/github.key</span></span> <span class="line"><span>$ cat ~/.ssh/github.key.pub</span></span></code></pre> </div> - <p> <a href="https://github.com/settings/ssh" rel="noreferrer" target="_blank">GitHub ã®èšå®ç»é¢</a> ããããã®å
¬ééµã远å ããã </p> - <div class="codeblock" language="shell-session"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>$ vi ~/.ssh/config</span></span></code></pre> </div> - <p> - èšå®ã¯ããã + èšå®ã¯ããã </p> - <div class="codeblock" language="ssh_config"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>Host github.com</span></span> <span class="line"><span> HostName github.com</span></span> @@ -259,18 +227,15 @@ <span class="line"><span> IdentityFile ~/.ssh/github.key</span></span> <span class="line"><span> IdentitiesOnly yes</span></span></code></pre> </div> - <p> - æåŸã«æ¥ç¶ã§ããã確èªããŠããã + æåŸã«æ¥ç¶ã§ããã確èªããŠããã </p> - <div class="codeblock" language="shell-session"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>$ ssh -T github.com</span></span></code></pre> </div> </section> - <section id="section--basic-setup--upgrade-packages"> - <h3><a href="#section--basic-setup--upgrade-packages">ããã±ãŒãžã®æŽæ°</a></h3> + <h3><a href="#section--basic-setup--upgrade-packages">ããã±ãŒãžã®æŽæ°</a></h3> <div class="codeblock" language="shell-session"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>$ sudo apt update</span></span> <span class="line"><span>$ sudo apt upgrade</span></span> @@ -280,36 +245,31 @@ </div> </section> </section> - <section id="section--site-hosting-setup"> - <h2><a href="#section--site-hosting-setup">ãµã€ããã¹ãã£ã³ã°çšã®ã»ããã¢ãã</a></h2> + <h2><a href="#section--site-hosting-setup">ãµã€ããã¹ãã£ã³ã°çšã®ã»ããã¢ãã</a></h2> <section id="section--site-hosting-setup--dns"> - <h3><a href="#section--site-hosting-setup--dns">DNS ã« IP ã¢ãã¬ã¹ãç»é²ãã</a></h3> + <h3><a href="#section--site-hosting-setup--dns">DNS ã« IP ã¢ãã¬ã¹ãç»é²ãã</a></h3> <p> - ãã®ãµãŒãã¯åºå®ã® IP ã¢ãã¬ã¹ãããã®ã§ã<code>A</code> ã¬ã³ãŒãã«çŽæ¥å
¥ããã ãã§æžãã ã + ãã®ãµãŒãã¯åºå®ã® IP ã¢ãã¬ã¹ãããã®ã§ã<code>A</code> ã¬ã³ãŒãã«çŽæ¥å
¥ããã ãã§æžãã ã </p> </section> - <section id="section--site-hosting-setup--install-softwares"> - <h3><a href="#section--site-hosting-setup--install-softwares">䜿ããœãããŠã§ã¢ã®ã€ã³ã¹ããŒã«</a></h3> + <h3><a href="#section--site-hosting-setup--install-softwares">䜿ããœãããŠã§ã¢ã®ã€ã³ã¹ããŒã«</a></h3> <div class="codeblock" language="shell-session"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>$ sudo apt install docker docker-compose git make</span></span></code></pre> </div> </section> - <section id="section--site-hosting-setup--docker"> - <h3><a href="#section--site-hosting-setup--docker">ã¡ã€ã³ãŠãŒã¶ã Docker ã䜿ããããã«</a></h3> + <h3><a href="#section--site-hosting-setup--docker">ã¡ã€ã³ãŠãŒã¶ã Docker ã䜿ããããã«</a></h3> <div class="codeblock" language="shell-session"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>$ sudo adduser ********** docker</span></span></code></pre> </div> </section> - <section id="section--site-hosting-setup--open-http-ports"> - <h3><a href="#section--site-hosting-setup--open-http-ports">HTTP/HTTPS ãéã</a></h3> + <h3><a href="#section--site-hosting-setup--open-http-ports">HTTP/HTTPS ãéã</a></h3> <p> - 80 çªãš 443 çªã空ããã + 80 çªãš 443 çªã空ããã </p> - <div class="codeblock" language="shell-session"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>$ sudo ufw allow 80/tcp</span></span> <span class="line"><span>$ sudo ufw allow 443/tcp</span></span> @@ -317,9 +277,8 @@ <span class="line"><span>$ sudo ufw status</span></span></code></pre> </div> </section> - <section id="section--site-hosting-setup--clone-repositories"> - <h3><a href="#section--site-hosting-setup--clone-repositories">ãªããžããªã®ã¯ããŒã³</a></h3> + <h3><a href="#section--site-hosting-setup--clone-repositories">ãªããžããªã®ã¯ããŒã³</a></h3> <div class="codeblock" language="shell-session"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>$ cd</span></span> <span class="line"><span>$ git clone git@github.com:nsfisis/nsfisis.dev.git</span></span> @@ -327,27 +286,24 @@ <span class="line"><span>$ git submodule update --init</span></span></code></pre> </div> </section> - <section id="section--site-hosting-setup--certbot"> - <h3><a href="#section--site-hosting-setup--certbot">certbot ã§èšŒææžååŸ</a></h3> + <h3><a href="#section--site-hosting-setup--certbot">certbot ã§èšŒææžååŸ</a></h3> <div class="codeblock" language="shell-session"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>$ docker-compose up -d acme-challenge</span></span> <span class="line"><span>$ make setup</span></span></code></pre> </div> </section> - <section id="section--site-hosting-setup--run-server"> - <h3><a href="#section--site-hosting-setup--run-server">ãµãŒãã皌åããã</a></h3> + <h3><a href="#section--site-hosting-setup--run-server">ãµãŒãã皌åããã</a></h3> <div class="codeblock" language="shell-session"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>$ make serve</span></span></code></pre> </div> </section> </section> - <section id="section--outro"> - <h2><a href="#section--outro">ææ³</a></h2> + <h2><a href="#section--outro">ææ³</a></h2> <p> - (æ¥åã§ãªã) å人ã ãšæ°å¹Žã¶ãã®ãµãŒãã»ããã¢ããã§ãããã ãã§ãå²ãšæéãé£ã£ãŠããŸã£ãããšã¯ããåŒå¹Žé·å®®ã¯æ¥œããã®ã§ãããããã宿çã«ãã£ãŠãããããã³ã³ãããããã€ã«ãããæ°æã¡ãããã®ã ããè²ã
å®éšãããé¢ä¿äžãæ¬ç©ã®ãµãŒããæ¬²ããã¯ãããæ¬¡ã®åŒå¹Žé·å®®ã§ã¯ãæé ã®äžéšã ãã§ãèªååããããšããã + (æ¥åã§ãªã) å人ã ãšæ°å¹Žã¶ãã®ãµãŒãã»ããã¢ããã§ãããã ãã§ãå²ãšæéãé£ã£ãŠããŸã£ãã ãšã¯ããåŒå¹Žé·å®®ã¯æ¥œããã®ã§ãããããã宿çã«ãã£ãŠããããã ã³ã³ãããããã€ã«ãããæ°æã¡ãããã®ã ããè²ã
å®éšãããé¢ä¿äžãæ¬ç©ã®ãµãŒããæ¬²ããã¯ããã æ¬¡ã®åŒå¹Žé·å®®ã§ã¯ãæé ã®äžéšã ãã§ãèªååããããšããã </p> </section> </div> diff --git a/vhosts/blog/public/posts/2022-11-19/phperkaigi-2023-unused-token-quiz-2/index.html b/vhosts/blog/public/posts/2022-11-19/phperkaigi-2023-unused-token-quiz-2/index.html index e093f669..63c928b6 100644 --- a/vhosts/blog/public/posts/2022-11-19/phperkaigi-2023-unused-token-quiz-2/index.html +++ b/vhosts/blog/public/posts/2022-11-19/phperkaigi-2023-unused-token-quiz-2/index.html @@ -61,34 +61,28 @@ </ol> </section> <section id="section--intro"> - <h2><a href="#section--intro">ã¯ããã«</a></h2> + <h2><a href="#section--intro">ã¯ããã«</a></h2> <p> - 2023 幎 3 æ 23 æ¥ãã 25 æ¥ã«ãããŠéå¬äºå® (èšäºå·çæç¹) ã® <a href="https://phperkaigi.jp/2023/" rel="noreferrer" target="_blank">PHPerKaigi 2023</a> ã«ãããŠãæšå¹Žãšåæ§ã«ãåŒç€Ÿ <a href="https://www.dgcircus.com/" rel="noreferrer" target="_blank">ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ</a> ããããŒã¯ã³åé¡ãåºé¡äºå®ã§ããã + 2023 幎 3 æ 23 æ¥ãã 25 æ¥ã«ãããŠéå¬äºå® (èšäºå·çæç¹) ã® <a href="https://phperkaigi.jp/2023/" rel="noreferrer" target="_blank">PHPerKaigi 2023</a> ã«ãããŠã æšå¹Žãšåæ§ã«ãåŒç€Ÿ <a href="https://www.dgcircus.com/" rel="noreferrer" target="_blank">ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ</a> ããããŒã¯ã³åé¡ãåºé¡äºå®ã§ããã </p> - <p> - æšå¹Žã®ããŒã¯ã³åé¡ã®èšäºã¯ãã¡ã: <a href="/posts/2022-04-09/phperkaigi-2022-tokens/">PHPerKaigi 2022 ããŒã¯ã³åé¡ã®è§£èª¬</a> + æšå¹Žã®ããŒã¯ã³åé¡ã®èšäºã¯ãã¡ã: <a href="/posts/2022-04-09/phperkaigi-2022-tokens/">PHPerKaigi 2022 ããŒã¯ã³åé¡ã®è§£èª¬</a> </p> - <p> - ãã§ã« 2023 幎çšã®åé¡ã¯äœææžã¿ã§ãããããã®å¶äœéçšã®äžã§ããã€ãããåãã§ããããã£ãããªã®ã§ãPHPerKaigi éå¬ãåŸ
ã€éã«ç޹ä»ããããšæãã + ãã§ã« 2023 幎çšã®åé¡ã¯äœææžã¿ã§ãããããã®å¶äœéçšã®äžã§ããã€ãããåãã§ããããã£ãããªã®ã§ãPHPerKaigi éå¬ãåŸ
ã€éã«ç޹ä»ããããšæãã </p> - <p> - 10 æãã 2 æãŸã§ãæ¯æ 1 èšäºãã€å
¬éããŠããäºå® (å¿ããŠããªããã°)ã + 10 æãã 2 æãŸã§ãæ¯æ 1 èšäºãã€å
¬éããŠããäºå® (å¿ããŠããªããã°)ã </p> - <p> - ãã® 1 ã¯ãã¡ã: <a href="/posts/2022-10-23/phperkaigi-2023-unused-token-quiz-1/">PHPerKaigi 2023: ããã«ãªã£ãããŒã¯ã³åé¡ ãã® 1</a> + ãã® 1 ã¯ãã¡ã: <a href="/posts/2022-10-23/phperkaigi-2023-unused-token-quiz-1/">PHPerKaigi 2023: ããã«ãªã£ãããŒã¯ã³åé¡ ãã® 1</a> </p> </section> - <section id="section--quiz"> - <h2><a href="#section--quiz">åé¡</a></h2> + <h2><a href="#section--quiz">åé¡</a></h2> <p> - 泚æ: ããã¯ããåãªã®ã§ãåŸãããããŒã¯ã³ã PHPerKaigi ã§å
¥åããŠããã€ã³ãã«ã¯ãªããªãã + 泚æ: ããã¯ããåãªã®ã§ãåŸãããããŒã¯ã³ã PHPerKaigi ã§å
¥åããŠããã€ã³ãã«ã¯ãªããªãã </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49"><?</span><span style="color:#005CC5">php</span><span style="color:#005CC5"> printf</span><span style="color:#24292E">((</span><span style="color:#005CC5">isset</span><span style="color:#24292E">($s)</span><span style="color:#D73A49">?fn</span><span style="color:#24292E">($s)=></span><span style="color:#005CC5">trim</span><span style="color:#24292E">($s,</span><span style="color:#032F62">"â"</span><span style="color:#24292E">)</span><span style="color:#D73A49">:fn</span><span style="color:#24292E">($s)=></span><span style="color:#005CC5">chr</span><span style="color:#24292E">(</span><span style="color:#005CC5">strlen</span><span style="color:#24292E">($s)</span><span style="color:#D73A49">/</span><span style="color:#005CC5">3</span><span style="color:#24292E">))($s</span><span style="color:#D73A49">=</span><span style="color:#032F62">'â<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>'</span><span style="color:#24292E">)</span><span style="color:#D73A49">.</span><span style="color:#032F62">"</span><span style="color:#005CC5">\n</span><span style="color:#032F62">"</span><span style="color:#24292E">,</span><span style="color:#032F62">"</span><span style="color:#005CC5">\x27</span><span style="color:#24292E">$s</span><span style="color:#005CC5">\x27</span><span style="color:#032F62">"</span><span style="color:#24292E">);</span><span style="color:#D73A49">?></span></span> <span class="line"><span style="color:#D73A49"><?</span><span style="color:#005CC5">php</span><span style="color:#005CC5"> printf</span><span style="color:#24292E">((</span><span style="color:#005CC5">isset</span><span style="color:#24292E">($s)</span><span style="color:#D73A49">?fn</span><span style="color:#24292E">($s)=></span><span style="color:#005CC5">trim</span><span style="color:#24292E">($s,</span><span style="color:#032F62">"â"</span><span style="color:#24292E">)</span><span style="color:#D73A49">:fn</span><span style="color:#24292E">($s)=></span><span style="color:#005CC5">chr</span><span style="color:#24292E">(</span><span style="color:#005CC5">strlen</span><span style="color:#24292E">($s)</span><span style="color:#D73A49">/</span><span style="color:#005CC5">3</span><span style="color:#24292E">))($s</span><span style="color:#D73A49">=</span><span style="color:#032F62">'âââââââââââââââââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>'</span><span style="color:#24292E">)</span><span style="color:#D73A49">.</span><span style="color:#032F62">"</span><span style="color:#005CC5">\n</span><span style="color:#032F62">"</span><span style="color:#24292E">,</span><span style="color:#032F62">"</span><span style="color:#005CC5">\x27</span><span style="color:#24292E">$s</span><span style="color:#005CC5">\x27</span><span style="color:#032F62">"</span><span style="color:#24292E">);</span><span style="color:#D73A49">?></span></span> @@ -101,18 +95,15 @@ <span class="line"><span style="color:#D73A49"><?</span><span style="color:#005CC5">php</span><span style="color:#005CC5"> printf</span><span style="color:#24292E">((</span><span style="color:#005CC5">isset</span><span style="color:#24292E">($s)</span><span style="color:#D73A49">?fn</span><span style="color:#24292E">($s)=></span><span style="color:#005CC5">trim</span><span style="color:#24292E">($s,</span><span style="color:#032F62">"â"</span><span style="color:#24292E">)</span><span style="color:#D73A49">:fn</span><span style="color:#24292E">($s)=></span><span style="color:#005CC5">chr</span><span style="color:#24292E">(</span><span style="color:#005CC5">strlen</span><span style="color:#24292E">($s)</span><span style="color:#D73A49">/</span><span style="color:#005CC5">3</span><span style="color:#24292E">))($s</span><span style="color:#D73A49">=</span><span style="color:#032F62">'ââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>'</span><span style="color:#24292E">)</span><span style="color:#D73A49">.</span><span style="color:#032F62">"</span><span style="color:#005CC5">\n</span><span style="color:#032F62">"</span><span style="color:#24292E">,</span><span style="color:#032F62">"</span><span style="color:#005CC5">\x27</span><span style="color:#24292E">$s</span><span style="color:#005CC5">\x27</span><span style="color:#032F62">"</span><span style="color:#24292E">);</span><span style="color:#D73A49">?></span></span> <span class="line"><span style="color:#D73A49"><?</span><span style="color:#005CC5">php</span><span style="color:#005CC5"> printf</span><span style="color:#24292E">((</span><span style="color:#005CC5">isset</span><span style="color:#24292E">($s)</span><span style="color:#D73A49">?fn</span><span style="color:#24292E">($s)=></span><span style="color:#005CC5">trim</span><span style="color:#24292E">($s,</span><span style="color:#032F62">"â"</span><span style="color:#24292E">)</span><span style="color:#D73A49">:fn</span><span style="color:#24292E">($s)=></span><span style="color:#005CC5">chr</span><span style="color:#24292E">(</span><span style="color:#005CC5">strlen</span><span style="color:#24292E">($s)</span><span style="color:#D73A49">/</span><span style="color:#005CC5">3</span><span style="color:#24292E">))($s</span><span style="color:#D73A49">=</span><span style="color:#032F62">'ââââââââââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>'</span><span style="color:#24292E">)</span><span style="color:#D73A49">.</span><span style="color:#032F62">"</span><span style="color:#005CC5">\n</span><span style="color:#032F62">"</span><span style="color:#24292E">,</span><span style="color:#032F62">"</span><span style="color:#005CC5">\x27</span><span style="color:#24292E">$s</span><span style="color:#005CC5">\x27</span><span style="color:#032F62">"</span><span style="color:#24292E">);</span><span style="color:#D73A49">?></span></span></code></pre> </div> - <p> - "And Then There Were None" (ãããŠèª°ãããªããªã£ã) ãšåä»ããäœåãå€å quine (èªåèªèº«ãšåããœãŒã¹ã³ãŒããåºåããããã°ã©ã ) ã«ãªã£ãŠããã + âAnd Then There Were Noneâ (ãããŠèª°ãããªããªã£ã) ãšåä»ããäœåãå€å quine (èªåèªèº«ãšåããœãŒã¹ã³ãŒããåºåããããã°ã©ã ) ã«ãªã£ãŠããã </p> </section> - <section id="section--how-to-obtain-token"> - <h2><a href="#section--how-to-obtain-token">ããŒã¯ã³å
¥ææ¹æ³</a></h2> + <h2><a href="#section--how-to-obtain-token">ããŒã¯ã³å
¥ææ¹æ³</a></h2> <p> - å®è¡ããŠã¿ããšã次ã®ãããªåºåãåŸãããã + å®è¡ããŠã¿ããšã次ã®ãããªåºåãåŸãããã </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#6A737D">#</span></span> <span class="line"><span style="color:#D73A49"><?</span><span style="color:#005CC5">php</span><span style="color:#005CC5"> printf</span><span style="color:#24292E">((</span><span style="color:#005CC5">isset</span><span style="color:#24292E">($s)</span><span style="color:#D73A49">?fn</span><span style="color:#24292E">($s)=></span><span style="color:#005CC5">trim</span><span style="color:#24292E">($s,</span><span style="color:#032F62">"â"</span><span style="color:#24292E">)</span><span style="color:#D73A49">:fn</span><span style="color:#24292E">($s)=></span><span style="color:#005CC5">chr</span><span style="color:#24292E">(</span><span style="color:#005CC5">strlen</span><span style="color:#24292E">($s)</span><span style="color:#D73A49">/</span><span style="color:#005CC5">3</span><span style="color:#24292E">))($s</span><span style="color:#D73A49">=</span><span style="color:#032F62">'âââââââââââââââââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>'</span><span style="color:#24292E">)</span><span style="color:#D73A49">.</span><span style="color:#032F62">"</span><span style="color:#005CC5">\n</span><span style="color:#032F62">"</span><span style="color:#24292E">,</span><span style="color:#032F62">"</span><span style="color:#005CC5">\x27</span><span style="color:#24292E">$s</span><span style="color:#005CC5">\x27</span><span style="color:#032F62">"</span><span style="color:#24292E">);</span><span style="color:#D73A49">?></span></span> @@ -125,11 +116,9 @@ <span class="line"><span style="color:#D73A49"><?</span><span style="color:#005CC5">php</span><span style="color:#005CC5"> printf</span><span style="color:#24292E">((</span><span style="color:#005CC5">isset</span><span style="color:#24292E">($s)</span><span style="color:#D73A49">?fn</span><span style="color:#24292E">($s)=></span><span style="color:#005CC5">trim</span><span style="color:#24292E">($s,</span><span style="color:#032F62">"â"</span><span style="color:#24292E">)</span><span style="color:#D73A49">:fn</span><span style="color:#24292E">($s)=></span><span style="color:#005CC5">chr</span><span style="color:#24292E">(</span><span style="color:#005CC5">strlen</span><span style="color:#24292E">($s)</span><span style="color:#D73A49">/</span><span style="color:#005CC5">3</span><span style="color:#24292E">))($s</span><span style="color:#D73A49">=</span><span style="color:#032F62">'ââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>'</span><span style="color:#24292E">)</span><span style="color:#D73A49">.</span><span style="color:#032F62">"</span><span style="color:#005CC5">\n</span><span style="color:#032F62">"</span><span style="color:#24292E">,</span><span style="color:#032F62">"</span><span style="color:#005CC5">\x27</span><span style="color:#24292E">$s</span><span style="color:#005CC5">\x27</span><span style="color:#032F62">"</span><span style="color:#24292E">);</span><span style="color:#D73A49">?></span></span> <span class="line"><span style="color:#D73A49"><?</span><span style="color:#005CC5">php</span><span style="color:#005CC5"> printf</span><span style="color:#24292E">((</span><span style="color:#005CC5">isset</span><span style="color:#24292E">($s)</span><span style="color:#D73A49">?fn</span><span style="color:#24292E">($s)=></span><span style="color:#005CC5">trim</span><span style="color:#24292E">($s,</span><span style="color:#032F62">"â"</span><span style="color:#24292E">)</span><span style="color:#D73A49">:fn</span><span style="color:#24292E">($s)=></span><span style="color:#005CC5">chr</span><span style="color:#24292E">(</span><span style="color:#005CC5">strlen</span><span style="color:#24292E">($s)</span><span style="color:#D73A49">/</span><span style="color:#005CC5">3</span><span style="color:#24292E">))($s</span><span style="color:#D73A49">=</span><span style="color:#032F62">'ââââââââââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>'</span><span style="color:#24292E">)</span><span style="color:#D73A49">.</span><span style="color:#032F62">"</span><span style="color:#005CC5">\n</span><span style="color:#032F62">"</span><span style="color:#24292E">,</span><span style="color:#032F62">"</span><span style="color:#005CC5">\x27</span><span style="color:#24292E">$s</span><span style="color:#005CC5">\x27</span><span style="color:#032F62">"</span><span style="color:#24292E">);</span><span style="color:#D73A49">?></span></span></code></pre> </div> - <p> - 1 è¡ç®ãé€ããå
ã»ã©ã®ã³ãŒããšã»ãŒåããã®ãåºãŠãããããäžåºŠå®è¡ããŠã¿ãã + 1 è¡ç®ãé€ããå
ã»ã©ã®ã³ãŒããšã»ãŒåããã®ãåºãŠãããããäžåºŠå®è¡ããŠã¿ãã </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#6A737D">#</span></span> <span class="line"><span style="color:#005CC5">W</span></span> @@ -142,11 +131,9 @@ <span class="line"><span style="color:#D73A49"><?</span><span style="color:#005CC5">php</span><span style="color:#005CC5"> printf</span><span style="color:#24292E">((</span><span style="color:#005CC5">isset</span><span style="color:#24292E">($s)</span><span style="color:#D73A49">?fn</span><span style="color:#24292E">($s)=></span><span style="color:#005CC5">trim</span><span style="color:#24292E">($s,</span><span style="color:#032F62">"â"</span><span style="color:#24292E">)</span><span style="color:#D73A49">:fn</span><span style="color:#24292E">($s)=></span><span style="color:#005CC5">chr</span><span style="color:#24292E">(</span><span style="color:#005CC5">strlen</span><span style="color:#24292E">($s)</span><span style="color:#D73A49">/</span><span style="color:#005CC5">3</span><span style="color:#24292E">))($s</span><span style="color:#D73A49">=</span><span style="color:#032F62">'ââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>'</span><span style="color:#24292E">)</span><span style="color:#D73A49">.</span><span style="color:#032F62">"</span><span style="color:#005CC5">\n</span><span style="color:#032F62">"</span><span style="color:#24292E">,</span><span style="color:#032F62">"</span><span style="color:#005CC5">\x27</span><span style="color:#24292E">$s</span><span style="color:#005CC5">\x27</span><span style="color:#032F62">"</span><span style="color:#24292E">);</span><span style="color:#D73A49">?></span></span> <span class="line"><span style="color:#D73A49"><?</span><span style="color:#005CC5">php</span><span style="color:#005CC5"> printf</span><span style="color:#24292E">((</span><span style="color:#005CC5">isset</span><span style="color:#24292E">($s)</span><span style="color:#D73A49">?fn</span><span style="color:#24292E">($s)=></span><span style="color:#005CC5">trim</span><span style="color:#24292E">($s,</span><span style="color:#032F62">"â"</span><span style="color:#24292E">)</span><span style="color:#D73A49">:fn</span><span style="color:#24292E">($s)=></span><span style="color:#005CC5">chr</span><span style="color:#24292E">(</span><span style="color:#005CC5">strlen</span><span style="color:#24292E">($s)</span><span style="color:#D73A49">/</span><span style="color:#005CC5">3</span><span style="color:#24292E">))($s</span><span style="color:#D73A49">=</span><span style="color:#032F62">'ââââââââââââââââââââââââââââââââââââââââââââââ<?php printf((isset($s)?fn($s)=>trim($s,"â"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>'</span><span style="color:#24292E">)</span><span style="color:#D73A49">.</span><span style="color:#032F62">"</span><span style="color:#005CC5">\n</span><span style="color:#032F62">"</span><span style="color:#24292E">,</span><span style="color:#032F62">"</span><span style="color:#005CC5">\x27</span><span style="color:#24292E">$s</span><span style="color:#005CC5">\x27</span><span style="color:#032F62">"</span><span style="color:#24292E">);</span><span style="color:#D73A49">?></span></span></code></pre> </div> - <p> - ä»åºŠã¯ 2 è¡ç®ãæžãæããããããã¹ãŠã®è¡ãå€åãããŸã§ç¹°ãè¿ããšæ¬¡ã®ããã«ãªãã + ä»åºŠã¯ 2 è¡ç®ãæžãæããããããã¹ãŠã®è¡ãå€åãããŸã§ç¹°ãè¿ããšæ¬¡ã®ããã«ãªãã </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#6A737D">#</span></span> <span class="line"><span style="color:#005CC5">W</span></span> @@ -159,78 +146,63 @@ <span class="line"><span style="color:#005CC5">H</span></span> <span class="line"><span style="color:#005CC5">P</span></span></code></pre> </div> - <p> - ããŒã¯ã³ã#WELOVEPHPããæã«å
¥ã£ãã + ããŒã¯ã³ã#WELOVEPHPããæã«å
¥ã£ãã </p> </section> - <section id="section--commentary"> - <h2><a href="#section--commentary">解説</a></h2> + <h2><a href="#section--commentary">解説</a></h2> <p> - äžèŠãããšåãè¡ã 10 è¡äžŠãã§ããã ããªã®ã«ãé¢ãããããªãããããã®è¡ã§åºåãå€ããã®ãããœãŒã¹ã³ãŒããã³ããŒããŠãé©åœãªãšãã£ã¿ã«è²Œãä»ãããšããããããã + äžèŠãããšåãè¡ã 10 è¡äžŠãã§ããã ããªã®ã«ãé¢ãããããªãããããã®è¡ã§åºåãå€ããã®ãããœãŒã¹ã³ãŒããã³ããŒããŠãé©åœãªãšãã£ã¿ã«è²Œãä»ãããšããããããã </p> - <p> - Vim ã§éããšæ¬¡ã®ããã«ãªã (1 è¡ç®ãæç²)ã + Vim ã§éããšæ¬¡ã®ããã«ãªã (1 è¡ç®ãæç²)ã </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49"><?</span><span style="color:#005CC5">php</span><span style="color:#005CC5"> printf</span><span style="color:#24292E">((</span><span style="color:#005CC5">isset</span><span style="color:#24292E">($s)</span><span style="color:#D73A49">?fn</span><span style="color:#24292E">($s)=></span><span style="color:#005CC5">trim</span><span style="color:#24292E">($s,</span><span style="color:#032F62">"<200b>"</span><span style="color:#24292E">)</span><span style="color:#D73A49">:fn</span><span style="color:#24292E">($s)=></span><span style="color:#005CC5">chr</span><span style="color:#24292E">(</span><span style="color:#005CC5">strlen</span><span style="color:#24292E">($s)</span><span style="color:#D73A49">/</span><span style="color:#005CC5">3</span><span style="color:#24292E">))($s</span><span style="color:#D73A49">=</span><span style="color:#032F62">'<200b><?php printf((isset($s)?fn($s)=>trim($s,"<200b>"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>'</span><span style="color:#24292E">)</span><span style="color:#D73A49">.</span><span style="color:#032F62">"</span><span style="color:#005CC5">\n</span><span style="color:#032F62">"</span><span style="color:#24292E">,</span><span style="color:#032F62">"</span><span style="color:#005CC5">\x27</span><span style="color:#24292E">$s</span><span style="color:#005CC5">\x27</span><span style="color:#032F62">"</span><span style="color:#24292E">);</span><span style="color:#D73A49">?></span></span></code></pre> </div> - <p> <code><200b></code> ãšè¡šç€ºãããŠããã®ã¯ãUnicode ã® U+200b ã§ããŒãå¹
ã¹ããŒã¹ã§ããã </p> - <div class="admonition"> <div class="admonition-label"> NOTE </div> <div class="admonition-content"> <p> - ãšãã£ã¿ã«ãã£ãŠã¯ããŒãå¹
ã¹ããŒã¹ãèŠããªãããšããããVSCode ã§ã¯ãã©ãŠã¶ãšåæ§ã«äžå¯èŠã ã£ãã + ãšãã£ã¿ã«ãã£ãŠã¯ããŒãå¹
ã¹ããŒã¹ãèŠããªãããšããããVSCode ã§ã¯ãã©ãŠã¶ãšåæ§ã«äžå¯èŠã ã£ãã </p> </div> </div> - <p> - æååãªãã©ã«ã®äžã«ãŒãå¹
ã¹ããŒã¹ãä»èŸŒãããšã§ãèŠãç®ãå€ããã«æ
å ±ããšã³ã³ãŒãããããšãå¯èœãšãªãã + æååãªãã©ã«ã®äžã«ãŒãå¹
ã¹ããŒã¹ãä»èŸŒãããšã§ãèŠãç®ãå€ããã«æ
å ±ããšã³ã³ãŒãããããšãå¯èœãšãªãã </p> - <p> - ç¶ããŠãããŒã¯ã³ãžã®å€æããžãã¯ãè§£æãããæ³šç®ãã¹ãã¯ãã®éšåã ã以äžããŒãå¹
ã¹ããŒã¹ã¯ Vim ã§ã®è¡šç€ºã«åãã㊠<code><200b></code> ãšèšèŒããã + ç¶ããŠãããŒã¯ã³ãžã®å€æããžãã¯ãè§£æãããæ³šç®ãã¹ãã¯ãã®éšåã ã以äžããŒãå¹
ã¹ããŒã¹ã¯ Vim ã§ã®è¡šç€ºã«åãã㊠<code><200b></code> ãšèšèŒããã </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49">fn</span><span style="color:#24292E">($s)=></span><span style="color:#005CC5">chr</span><span style="color:#24292E">(</span><span style="color:#005CC5">strlen</span><span style="color:#24292E">($s)</span><span style="color:#D73A49">/</span><span style="color:#005CC5">3</span><span style="color:#24292E">)</span></span></code></pre> </div> - <p> - PHP ã® <code>strlen()</code> ã¯æååã®ãã€ãæ°ãè¿ãã1 è¡ç®ã® <code>$s</code> ã¯ä»¥äžã®å
容ãšãªã£ãŠããã + PHP ã® <code>strlen()</code> ã¯æååã®ãã€ãæ°ãè¿ãã1 è¡ç®ã® <code>$s</code> ã¯ä»¥äžã®å
容ãšãªã£ãŠããã </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#24292E">$s</span><span style="color:#D73A49">=</span><span style="color:#032F62">'<200b><?php printf((isset($s)?fn($s)=>trim($s,"<200b>"):fn($s)=>chr(strlen($s)/3))($s=%s)."\n","\x27$s\x27");?>'</span></span></code></pre> </div> - <p> - ãã®ãœãŒã¹ã³ãŒã㯠UTF-8 ã§æžãããŠããã®ã§ã105 ãã€ãã«ãªããããã 3 ã§å²ããš 35 ãšãªãããã㯠<code>#</code> ã® ASCII ã³ãŒããšäžèŽãããä»ã®è¡ããåæ§ã«ããŠãŒãå¹
ã¹ããŒã¹ãè©°ããããšã§æååé·ã調æŽããããŒã¯ã³ããšã³ã³ãŒãããŠããã + ãã®ãœãŒã¹ã³ãŒã㯠UTF-8 ã§æžãããŠããã®ã§ã105 ãã€ãã«ãªããããã 3 ã§å²ããš 35 ãšãªãããã㯠<code>#</code> ã® ASCII ã³ãŒããšäžèŽãããä»ã®è¡ããåæ§ã«ããŠãŒãå¹
ã¹ããŒã¹ãè©°ããããšã§æååé·ã調æŽããããŒã¯ã³ããšã³ã³ãŒãããŠããã </p> - <p> - ãã³ãŒãéšä»¥å€ã®éšåã¯ãquine ã®ããã®èšè¿°ã§ããã + ãã³ãŒãéšä»¥å€ã®éšåã¯ãquine ã®ããã®èšè¿°ã§ããã </p> </section> - <section id="section--outro"> - <h2><a href="#section--outro">ãããã«</a></h2> + <h2><a href="#section--outro">ãããã«</a></h2> <p> <a href="https://blog.rust-lang.org/2021/11/01/cve-2021-42574.html" rel="noreferrer" target="_blank">CVE-2021-42574</a> ã«çæ³ãåŸãäœåããã®è匱æ§ã¯ãUnicode ã®å¶åŸ¡æåã§ãã left-to-right mark ãš right-to-left mark ãå©çšãããœãŒã¹ã³ãŒãã®å®éã®å
å®¹ãæ¬ºãããšãããã®ãç°¡åã®ãããŒãå¹
ã¹ããŒã¹ãçšããããšãšããã€ãã§ã« quine ã«ããããšãããªã£ãã </p> - <p> - ããã«ãªã£ãçç±ã¯ããŒãå¹
ã¹ããŒã¹ã衚瀺ããŠãããšãã£ã¿ãæ³å以äžã«å€ãã£ãããããåãè¡ã䞊ãã§ããã ããªã®ã«åºåãç°ãªãããšããã¢ã€ãã¢ã®æ ¹å¹¹ã厩ãããŠããŸãã®ã§ããã®åé¡ã¯äžæ¡çšãšãªã£ãã + ããã«ãªã£ãçç±ã¯ããŒãå¹
ã¹ããŒã¹ã衚瀺ããŠãããšãã£ã¿ãæ³å以äžã«å€ãã£ãããããåãè¡ã䞊ãã§ããã ããªã®ã«åºåãç°ãªãããšããã¢ã€ãã¢ã®æ ¹å¹¹ã厩ãããŠããŸãã®ã§ããã®åé¡ã¯äžæ¡çšãšãªã£ãã </p> </section> </div> diff --git a/vhosts/blog/public/posts/2023-01-10/phperkaigi-2023-unused-token-quiz-3/index.html b/vhosts/blog/public/posts/2023-01-10/phperkaigi-2023-unused-token-quiz-3/index.html index 6cad79cb..01a08b04 100644 --- a/vhosts/blog/public/posts/2023-01-10/phperkaigi-2023-unused-token-quiz-3/index.html +++ b/vhosts/blog/public/posts/2023-01-10/phperkaigi-2023-unused-token-quiz-3/index.html @@ -61,40 +61,33 @@ </ol> </section> <section id="section--intro"> - <h2><a href="#section--intro">ã¯ããã«</a></h2> + <h2><a href="#section--intro">ã¯ããã«</a></h2> <p> - 2023 幎 3 æ 23 æ¥ãã 25 æ¥ã«ãããŠéå¬äºå® (èšäºå·çæç¹) ã® <a href="https://phperkaigi.jp/2023/" rel="noreferrer" target="_blank">PHPerKaigi 2023</a> ã«ãããŠãæšå¹Žãšåæ§ã«ãåŒç€Ÿ <a href="https://www.dgcircus.com/" rel="noreferrer" target="_blank">ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ</a> ããããŒã¯ã³åé¡ãåºé¡äºå®ã§ããã + 2023 幎 3 æ 23 æ¥ãã 25 æ¥ã«ãããŠéå¬äºå® (èšäºå·çæç¹) ã® <a href="https://phperkaigi.jp/2023/" rel="noreferrer" target="_blank">PHPerKaigi 2023</a> ã«ãããŠã æšå¹Žãšåæ§ã«ãåŒç€Ÿ <a href="https://www.dgcircus.com/" rel="noreferrer" target="_blank">ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ</a> ããããŒã¯ã³åé¡ãåºé¡äºå®ã§ããã </p> - <p> - æšå¹Žã®ããŒã¯ã³åé¡ã®èšäºã¯ãã¡ã: <a href="/posts/2022-04-09/phperkaigi-2022-tokens/">PHPerKaigi 2022 ããŒã¯ã³åé¡ã®è§£èª¬</a> + æšå¹Žã®ããŒã¯ã³åé¡ã®èšäºã¯ãã¡ã: <a href="/posts/2022-04-09/phperkaigi-2022-tokens/">PHPerKaigi 2022 ããŒã¯ã³åé¡ã®è§£èª¬</a> </p> - <p> - ãã§ã« 2023 幎çšã®åé¡ã¯äœææžã¿ã§ãããããã®å¶äœéçšã®äžã§ããã€ãããåãã§ããããã£ãããªã®ã§ãPHPerKaigi éå¬ãåŸ
ã€éã«ç޹ä»ããããšæãã + ãã§ã« 2023 幎çšã®åé¡ã¯äœææžã¿ã§ãããããã®å¶äœéçšã®äžã§ããã€ãããåãã§ããã ãã£ãããªã®ã§ãPHPerKaigi éå¬ãåŸ
ã€éã«ç޹ä»ããããšæãã </p> - <p> - 10 æãã 2 æãŸã§ãæ¯æ 1 èšäºãã€å
¬éããŠããäºå® (å¿ããŠããªããã° â å¿ããŠããã®ã§ 12 æå
¬éäºå®ã ã£ãèšäºã仿žããŠãã)ã + 10 æãã 2 æãŸã§ãæ¯æ 1 èšäºãã€å
¬éããŠããäºå® (å¿ããŠããªããã° â å¿ããŠããã®ã§ 12 æå
¬éäºå®ã ã£ãèšäºã仿žããŠãã)ã </p> - <ul> <li> ãã® 1 ã¯ãã¡ã: <a href="/posts/2022-10-23/phperkaigi-2023-unused-token-quiz-1/">PHPerKaigi 2023: ããã«ãªã£ãããŒã¯ã³åé¡ ãã® 1</a> </li> - <li> ãã® 2 ã¯ãã¡ã: <a href="/posts/2022-11-19/phperkaigi-2023-unused-token-quiz-2/">PHPerKaigi 2023: ããã«ãªã£ãããŒã¯ã³åé¡ ãã® 2</a> </li> </ul> </section> - <section id="section--quiz"> - <h2><a href="#section--quiz">åé¡</a></h2> + <h2><a href="#section--quiz">åé¡</a></h2> <p> - 泚æ: ããã¯ããåãªã®ã§ãåŸãããããŒã¯ã³ã PHPerKaigi ã§å
¥åããŠããã€ã³ãã«ã¯ãªããªãã + 泚æ: ããã¯ããåãªã®ã§ãåŸãããããŒã¯ã³ã PHPerKaigi ã§å
¥åããŠããã€ã³ãã«ã¯ãªããªãã </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49"><?</span><span style="color:#005CC5">php</span></span> <span class="line"><span style="color:#D73A49">try</span><span style="color:#24292E"> {</span></span> @@ -209,45 +202,37 @@ <span class="line"><span style="color:#D73A49"> return</span><span style="color:#005CC5"> __LINE__</span><span style="color:#24292E">;</span></span> <span class="line"><span style="color:#24292E">}</span></span></code></pre> </div> - <p> - "Catchline" ãšåä»ããäœåãå®è¡ãããšããŒã¯ã³ <code>#base64_decode('SGVsbG8sIFdvcmxkIQ==')</code> ãåŸãããã + âCatchlineâ ãšåä»ããäœåãå®è¡ãããšããŒã¯ã³ <code>#base64_decode('SGVsbG8sIFdvcmxkIQ==')</code> ãåŸãããã </p> - <p> - ããŒã¯ã³ã¯ PHP ã®åŒã«ãªã£ãŠããŠãè©äŸ¡ãããš <code>Hello, World!</code> ãšããæååã«ãªããPHPer ãã£ã¬ã³ãžã®ããŒã¯ã³ã«ã¯ç©ºçœãå«ããããªããšããå¶çŽããããããããã£ã圢ã§ããŒã¯ã³ã«ããã°åé¿ã§ããã + ããŒã¯ã³ã¯ PHP ã®åŒã«ãªã£ãŠããŠãè©äŸ¡ãããš <code>Hello, World!</code> ãšããæååã«ãªããPHPer ãã£ã¬ã³ãžã®ããŒã¯ã³ã«ã¯ç©ºçœãå«ããããªããšããå¶çŽããããããããã£ã圢ã§ããŒã¯ã³ã«ããã°åé¿ã§ããã </p> </section> - <section id="section--commentary"> - <h2><a href="#section--commentary">解説</a></h2> + <h2><a href="#section--commentary">解説</a></h2> <section id="section--commentary--summary"> - <h3><a href="#section--commentary--summary">æŠèŠ</a></h3> + <h3><a href="#section--commentary--summary">æŠèŠ</a></h3> <p> - äŸå€ãçºçããè¡æ°ã«ããŒã¿ããšã³ã³ãŒãããããã <code>catch</code> ã§æãŸããŠè¡šç€ºããŠããã + äŸå€ãçºçããè¡æ°ã«ããŒã¿ããšã³ã³ãŒãããããã <code>catch</code> ã§æãŸããŠè¡šç€ºããŠããã </p> </section> - <section id="section--commentary--chain-of-exceptions"> - <h3><a href="#section--commentary--chain-of-exceptions">äŸå€ãªããžã§ã¯ãã®é£é</a></h3> + <h3><a href="#section--commentary--chain-of-exceptions">äŸå€ãªããžã§ã¯ãã®é£é</a></h3> <p> - <a href="https://www.php.net/class.Exception" rel="noreferrer" target="_blank"><code>Exception</code></a> ã <a href="https://www.php.net/class.Error" rel="noreferrer" target="_blank"><code>Error</code></a> ã«ã¯ <code>$previous</code> ãšããããããã£ããããã³ã³ã¹ãã©ã¯ã¿ã®ç¬¬3åŒæ°ããæž¡ãããšãã§ããã䞻㫠2ã€ã®çšæ³ããã: + <a href="https://www.php.net/class.Exception" rel="noreferrer" target="_blank"><code>Exception</code></a> ã <a href="https://www.php.net/class.Error" rel="noreferrer" target="_blank"><code>Error</code></a> ã«ã¯ <code>$previous</code> ãšããããããã£ããããã³ã³ã¹ãã©ã¯ã¿ã®ç¬¬3åŒæ°ããæž¡ãããšãã§ããã䞻㫠2ã€ã®çšæ³ããã: </p> - <ul> <li> ãšã©ãŒãåŠçããŠããéäžã«èµ·ãã£ãå¥ã®ãšã©ãŒã«ãå
ã®ãšã©ãŒæ
å ±ãå«ãã </li> - <li> å
éšãšã©ãŒãã©ããããŠäœããããšã©ãŒã«ãå
éšãšã©ãŒã®æ
å ±ãå«ãã </li> </ul> - <p> - ãã®ãã¡ 1ã€ç®ã®ã±ãŒã¹ã¯ã <code>finally</code> ç¯ã®äžã§ãšã©ãŒãæãããš PHP åŠçç³»ãåæã« <code>$previous</code> ãèšå®ããŠãããã + ãã®ãã¡ 1ã€ç®ã®ã±ãŒã¹ã¯ã <code>finally</code> ç¯ã®äžã§ãšã©ãŒãæãããš PHP åŠçç³»ãåæã« <code>$previous</code> ãèšå®ããŠãããã </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49"><?</span><span style="color:#005CC5">php</span></span> <span class="line"></span> @@ -264,18 +249,15 @@ <span class="line"><span style="color:#6A737D"> // => Error 1</span></span> <span class="line"><span style="color:#24292E">}</span></span></code></pre> </div> - <p> - ãã®ç¥èãå
ã«ãããŒã¯ã³ã®åºåéšãè§£æããŠã¿ãã + ãã®ç¥èãå
ã«ãããŒã¯ã³ã®åºåéšãè§£æããŠã¿ãã </p> </section> - <section id="section--commentary--output"> - <h3><a href="#section--commentary--output">åºåéšã®è§£æ</a></h3> + <h3><a href="#section--commentary--output">åºåéšã®è§£æ</a></h3> <p> - åºåéšãã³ã¡ã³ããæ¹è¡ã远å ããŠåæ²ãã: + åºåéšãã³ã¡ã³ããæ¹è¡ã远å ããŠåæ²ãã: </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49"><?</span><span style="color:#005CC5">php</span></span> <span class="line"><span style="color:#D73A49">try</span><span style="color:#24292E"> {</span></span> @@ -287,34 +269,27 @@ <span class="line"><span style="color:#005CC5"> echo</span><span style="color:#032F62"> "</span><span style="color:#005CC5">\n</span><span style="color:#032F62">"</span><span style="color:#24292E">;</span></span> <span class="line"><span style="color:#24292E">}</span></span></code></pre> </div> - <p> - åºåããããªã <code>catch</code> ç¯ãèŠãŠã¿ããšã <code>Throwable::getPrevious()</code> ãåŒã³åºããŠãšã©ãŒãã§ã€ã³ã蟿ãã <code>Throwable::getLine()</code> ã§ãšã©ãŒãçºçããè¡æ°ãååŸããŠããããã®è¡æ°ã« <code>23</code> ãªãããžãã¯ãã³ããŒãè¶³ãããã©ãŒãããæå®å <code>%c</code> ã§åºåããŠããã + åºåããããªã <code>catch</code> ç¯ãèŠãŠã¿ããšã <code>Throwable::getPrevious()</code> ãåŒã³åºããŠãšã©ãŒãã§ã€ã³ã蟿ãã <code>Throwable::getLine()</code> ã§ãšã©ãŒãçºçããè¡æ°ãååŸããŠããããã®è¡æ°ã« <code>23</code> ãªãããžãã¯ãã³ããŒãè¶³ãããã©ãŒãããæå®å <code>%c</code> ã§åºåããŠããã </p> - <p> - ãã©ãŒãããæå®å <code>%c</code> ã¯ãæŽæ°ã ASCII ã³ãŒã<span></span> ãšèŠåããŠå°åãããããŒã¯ã³ <code>#base64_decode('SGVsbG8sIFdvcmxkIQ==')</code> ã® <code>b</code> ã§ããã°ãASCII ã³ãŒã <code>98</code> ãªã®ã§ã75 è¡ç®ã§çºçãããšã©ãŒã + ãã©ãŒãããæå®å <code>%c</code> ã¯ãæŽæ°ã ASCII ã³ãŒã ãšèŠåããŠå°åãããããŒã¯ã³ <code>#base64_decode('SGVsbG8sIFdvcmxkIQ==')</code> ã® <code>b</code> ã§ããã°ãASCII ã³ãŒã <code>98</code> ãªã®ã§ã75 è¡ç®ã§çºçãããšã©ãŒã </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#005CC5">1</span><span style="color:#24292E">, </span><span style="color:#005CC5">20</span><span style="color:#D73A49"> =></span><span style="color:#005CC5"> 0</span><span style="color:#D73A49"> /</span><span style="color:#005CC5"> 0</span><span style="color:#24292E">,</span></span></code></pre> </div> - <p> - ã«ãã£ãŠè¡šçŸãããŠããããšã©ãŒãèµ·ããæ¹æ³ã¯ãããããšèããããããä»åã¯ãŒãé€ç®ã䜿ã£ãã + ã«ãã£ãŠè¡šçŸãããŠããããšã©ãŒãèµ·ããæ¹æ³ã¯ãããããšèããããããä»åã¯ãŒãé€ç®ã䜿ã£ãã </p> - <p> - ããã§ã¯ããšã©ãŒãã§ã€ã³ãäœãç®æã颿° <code>f()</code> ãèŠãŠããã + ããã§ã¯ããšã©ãŒãã§ã€ã³ãäœãç®æã颿° <code>f()</code> ãèŠãŠããã </p> </section> - <section id="section--commentary--data-construction"> - <h3><a href="#section--commentary--data-construction">ããŒã¿æ§æéšã®è§£æ</a></h3> + <h3><a href="#section--commentary--data-construction">ããŒã¿æ§æéšã®è§£æ</a></h3> <p> - <code>f()</code> ã®å®çŸ©ãåæ²ãã (ãšã©ãŒãªããžã§ã¯ãã®è¡æ°ãå©çšããŠããã®ã§ãäžéšåã ãæãåºããšå€ãå€ããããšã«æ³šæ): + <code>f()</code> ã®å®çŸ©ãåæ²ãã (ãšã©ãŒãªããžã§ã¯ãã®è¡æ°ãå©çšããŠããã®ã§ãäžéšåã ãæãåºããšå€ãå€ããããšã«æ³šæ): </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49">function</span><span style="color:#6F42C1"> f</span><span style="color:#24292E">(</span><span style="color:#D73A49">int</span><span style="color:#24292E"> $i) {</span></span> <span class="line"><span style="color:#D73A49"> if</span><span style="color:#24292E"> ($i </span><span style="color:#D73A49"><</span><span style="color:#005CC5"> 0</span><span style="color:#24292E">) </span><span style="color:#6F42C1">f</span><span style="color:#24292E">();</span></span> @@ -337,85 +312,68 @@ <span class="line"><span style="color:#24292E"> }</span></span> <span class="line"><span style="color:#24292E">}</span></span></code></pre> </div> - <p> - åè¿°ã®ããã«ã <code>finally</code> ç¯ã§ãšã©ãŒãæãããš PHP åŠçç³»ã <code>$previous</code> ãèšå®ãããããã§ã¯ããšã©ãŒãç¹ããããã« <code>f()</code> ãååž°åŒã³åºãããŠãããæåã« <code>f()</code> ãåŒã³åºããŠããç®æã確èªãããšã + åè¿°ã®ããã«ã <code>finally</code> ç¯ã§ãšã©ãŒãæãããš PHP åŠçç³»ã <code>$previous</code> ãèšå®ãããããã§ã¯ããšã©ãŒãç¹ããããã« <code>f()</code> ãååž°åŒã³åºãããŠãããæåã« <code>f()</code> ãåŒã³åºããŠããç®æã確èªãããšã </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49"><?</span><span style="color:#005CC5">php</span></span> <span class="line"><span style="color:#D73A49">try</span><span style="color:#24292E"> {</span></span> <span class="line"><span style="color:#6F42C1"> f</span><span style="color:#24292E">(</span><span style="color:#6F42C1">g</span><span style="color:#24292E">() </span><span style="color:#D73A49">/</span><span style="color:#005CC5"> __LINE__</span><span style="color:#24292E">); </span><span style="color:#6A737D">// 3 è¡ç®</span></span></code></pre> </div> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49">function</span><span style="color:#6F42C1"> g</span><span style="color:#24292E">() {</span></span> <span class="line"><span style="color:#D73A49"> return</span><span style="color:#005CC5"> __LINE__</span><span style="color:#24292E">; </span><span style="color:#6A737D">// 111 è¡ç®</span></span> <span class="line"><span style="color:#24292E">}</span></span></code></pre> </div> - <p> <code>f()</code> ã«ã¯ <code>111 / 3</code> ã§ <code>37</code> ãæž¡ãããããšããããããããã 1 ãã€æžãããŠååž°åŒã³åºãããŠããã0 ããå°ãããªã£ãã <code>f()</code> ãåŒæ°ãªãã§åŒã³åºããåŒæ°ã®æ°ãè¶³ããªããšåŒã³åºãã«å€±æããã®ã§ãååž°ã¯ããã§æ¢ãŸãã </p> - <p> - ãšã©ãŒãã§ã€ã³ã¯ãæåŸã«çºçãããšã©ãŒãå
é ãšããåæ¹åé£çµãªã¹ãã«ãªã£ãŠããã®ã§ãé ã« + ãšã©ãŒãã§ã€ã³ã¯ãæåŸã«çºçãããšã©ãŒãå
é ãšããåæ¹åé£çµãªã¹ãã«ãªã£ãŠããã®ã§ãé ã« </p> - - <ol numeration="arabic"> + <ol> <li> <code>f()</code> ã®åŒæ°ãè¶³ããªãããšã«ããåŒã³åºã倱æ </li> - <li> <code>f(0)</code> ã®åŒã³åºãã§çºçãããŒãé€ç® </li> - <li> <code>f(1)</code> ã®åŒã³åºãã§çºçãããŒãé€ç® </li> - <li> ⊠</li> - <li> <code>f(37)</code> ã®åŒã³åºãã§çºçãããŒãé€ç® </li> </ol> - <p> - ãšãªã£ãŠãããåºåã®é㯠<code>catch</code> ãããšã©ãŒã® <code>getPrevious()</code> ããåŠçãå§ããã®ã§ã1 çªç®ã® <code>f()</code> ã«ãããšã©ãŒã¯ç¡èŠããã <code>f(0)</code> ã«ãããšã©ãŒã <code>f(1)</code> ã«ãããšã©ãŒã <code>f(2)</code> ã«ãããšã©ãŒããšåºåãé²ãã + ãšãªã£ãŠãããåºåã®é㯠<code>catch</code> ãããšã©ãŒã® <code>getPrevious()</code> ããåŠçãå§ããã®ã§ã1 çªç®ã® <code>f()</code> ã«ãããšã©ãŒã¯ç¡èŠããã <code>f(0)</code> ã«ãããšã©ãŒã <code>f(1)</code> ã«ãããšã©ãŒã <code>f(2)</code> ã«ãããšã©ãŒããšåºåãé²ãã </p> - <p> <code>f()</code> ã« <code>0</code> ãæž¡ãããšã㯠12 è¡ç®ã«ãã <code>match</code> ã® <code>0</code> ã§ãŒãé€ç®ãèµ·ããã®ã§ãè¡æ°ã 12 ãšãªã£ããšã©ãŒãæãããããåºåéšã§ã¯ããã« 23 ãè¶³ããæ°ã ASCII ã³ãŒããšããŠè¡šç€ºããŠããã®ã ã£ãã <code>12 + 23</code> 㯠<code>35</code>ãASCII ã³ãŒãã§ã¯ <code>#</code> ã§ããããããããŒã¯ã³ã® 1æåç®ã«ãããã </p> </section> </section> - <section id="section--outro"> - <h2><a href="#section--outro">ãããã«</a></h2> + <h2><a href="#section--outro">ãããã«</a></h2> <p> - ãè¡æ°ããšããã®ã¯ããŒã¯ã³æååããã³ãŒããã察象ãšããŠåªããŠããã + ãè¡æ°ããšããã®ã¯ããŒã¯ã³æååããã³ãŒããã察象ãšããŠåªããŠããã </p> - <ul> <li> ããŒã¯ã³ã®äžéšãå
šéšãéœã«çŸããªã </li> - <li> <code>__LINE__</code> ã§å®¹æã«ååŸã§ãã </li> </ul> - <p> - ãããããããã£ããå€ãªãããã°ã©ã ãäœåºŠãèªãã ãæžãããããŠãããšã <code>__LINE__</code> ã䜿ãã®ã¯ããŸãã«ãããããã§éå±ã«ãªããã§ã¯ãä»ã«è¡æ°ãååŸããææ®µã¯ãªãããããã㊠<code>Throwable</code> ãæãã€ããç¶ããŠãšã©ãŒãªããžã§ã¯ãã«ã¯ <code>$previous</code> ãããããšãæãåºããã + ãããããããã£ããå€ãªãããã°ã©ã ãäœåºŠãèªãã ãæžãããããŠãããšã <code>__LINE__</code> ã䜿ãã®ã¯ããŸãã«ãããããã§éå±ã«ãªããã§ã¯ãä»ã«è¡æ°ãååŸããææ®µã¯ãªãããããã㊠<code>Throwable</code> ãæãã€ããç¶ããŠãšã©ãŒãªããžã§ã¯ãã«ã¯ <code>$previous</code> ãããããšãæãåºããã </p> - <p> - ä»åãšã©ãŒãæããã®ã«ãŒãé€ç®ãçšããã®ã¯ãããããšã©ãŒãæããæãçãã³ãŒãã ãšèããããã§ããããã 3ãã€ãæªæºã§ <code>Throwable</code> ãªãªããžã§ã¯ããæããææ®µããåãã®ãããããã£ãããã°ããã²ãæç€ºããã ããããâŠâŠãšç· ããäºå®ã ã£ãã®ã ãã<code>0/0</code> ã®ãšãããååšããªã宿°ã«ããã°ãç°¡åã« 1ãã€ããéæã§ããããŒãé€ç®ããŠããç®æã¯ã¡ããã© 26 ç®æããã®ã§ãã¢ã«ãã¡ãããã«ã§ãããŠããã°æå³ãããã§è¯ãã£ããããããªãã + ä»åãšã©ãŒãæããã®ã«ãŒãé€ç®ãçšããã®ã¯ãããããšã©ãŒãæããæãçãã³ãŒãã ãšèããããã§ããããã 3ãã€ãæªæºã§ <code>Throwable</code> ãªãªããžã§ã¯ããæããææ®µããåãã®ãããããã£ãããã°ããã²ãæç€ºããã ããããâŠâŠãšç· ããäºå®ã ã£ãã®ã ãã<code>0/0</code> ã®ãšãããååšããªã宿°ã«ããã°ãç°¡åã« 1ãã€ããéæã§ããããŒãé€ç®ããŠããç®æã¯ã¡ããã© 26 ç®æããã®ã§ãã¢ã«ãã¡ãããã«ã§ãããŠããã°æå³ãããã§è¯ãã£ããããããªãã </p> </section> </div> diff --git a/vhosts/blog/public/posts/2023-03-10/rewrite-this-blog-generator/index.html b/vhosts/blog/public/posts/2023-03-10/rewrite-this-blog-generator/index.html index f3eb6ae2..0749a217 100644 --- a/vhosts/blog/public/posts/2023-03-10/rewrite-this-blog-generator/index.html +++ b/vhosts/blog/public/posts/2023-03-10/rewrite-this-blog-generator/index.html @@ -52,112 +52,90 @@ </ol> </section> <section id="section--intro"> - <h2><a href="#section--intro">ã¯ããã«</a></h2> + <h2><a href="#section--intro">ã¯ããã«</a></h2> <p> - ãã®ããã°ãæ§ç¯ããã·ã¹ãã ãæžãçŽããã®ã¯ 2床ç®ã§ãããå
ã
ç«ã¡äžããåœåã¯ãéçãµã€ããžã§ãã¬ãŒã¿ã§ãã <a href="https://gohugo.io/" rel="noreferrer" target="_blank">Hugo</a> ã䜿ã£ãŠãããããã <a href="https://asciidoctor.org/" rel="noreferrer" target="_blank">Asciidoctor</a> ã«ããã€ãã®ã«ã¹ã¿ã ãå ããèªåã®ãžã§ãã¬ãŒã¿ã«ç§»è¡ããã®ã 2022幎ã®11æããã ããããŠä»åãã¹ã¯ã©ããããæžãã <a href="https://deno.land/" rel="noreferrer" target="_blank">Deno</a> 補ã®ãžã§ãã¬ãŒã¿ã«ç§»è¡ããã + ãã®ããã°ãæ§ç¯ããã·ã¹ãã ãæžãçŽããã®ã¯ 2床ç®ã§ããã å
ã
ç«ã¡äžããåœåã¯ãéçãµã€ããžã§ãã¬ãŒã¿ã§ãã <a href="https://gohugo.io/" rel="noreferrer" target="_blank">Hugo</a> ã䜿ã£ãŠããã ããã <a href="https://asciidoctor.org/" rel="noreferrer" target="_blank">Asciidoctor</a> ã«ããã€ãã®ã«ã¹ã¿ã ãå ããèªåã®ãžã§ãã¬ãŒã¿ã«ç§»è¡ããã®ã 2022幎ã®11æããã ã ãããŠä»åãã¹ã¯ã©ããããæžãã <a href="https://deno.land/" rel="noreferrer" target="_blank">Deno</a> 補ã®ãžã§ãã¬ãŒã¿ã«ç§»è¡ããã </p> - <p> - ãã®èšäºã§ã¯ãç§»è¡ã®çç±ãªã©ã (äž»ã«å°æ¥ã®ç§ãžåããŠ) æžãèšããŠããã + ãã®èšäºã§ã¯ãç§»è¡ã®çç±ãªã©ã (äž»ã«å°æ¥ã®ç§ãžåããŠ) æžãèšããŠããã </p> </section> - <section id="section--from-hugo-to-asciidoctor"> - <h2><a href="#section--from-hugo-to-asciidoctor">Hugo ãã Asciidoctor ãž</a></h2> + <h2><a href="#section--from-hugo-to-asciidoctor">Hugo ãã Asciidoctor ãž</a></h2> <p> - æåã«æã£ãŠãããšãHugo ã¯å€§å€ã«åªããéçãµã€ããžã§ãã¬ãŒã¿ã§ãããç§»è¡ã®çç±ã®å€§åã¯ãèªåã§ãžã§ãã¬ãŒã¿ãæžãããã£ãããã«ä»ãªããªããå®ã®ãšããããã®èšäºãå·çããŠããçŸåšãèªäœãžã§ãã¬ãŒã¿ã¯ Hugo ãããæ©èœãå£ã£ãŠãããäŸãã°ãHugo ã䜿ã£ãŠããããã¯ãµããŒãããŠãã RSS ãã£ãŒãã®çæã¯ããŸã å®è£
ã§ããŠããªãã + æåã«æã£ãŠãããšãHugo ã¯å€§å€ã«åªããéçãµã€ããžã§ãã¬ãŒã¿ã§ãããç§»è¡ã®çç±ã®å€§åã¯ãèªåã§ãžã§ãã¬ãŒã¿ãæžãããã£ãããã«ä»ãªããªãã å®ã®ãšããããã®èšäºãå·çããŠããçŸåšãèªäœãžã§ãã¬ãŒã¿ã¯ Hugo ãããæ©èœãå£ã£ãŠããã äŸãã°ãHugo ã䜿ã£ãŠããããã¯ãµããŒãããŠãã RSS ãã£ãŒãã®çæã¯ããŸã å®è£
ã§ããŠããªãã </p> - <p> - ç§»è¡å
ã®ãã©ãŒããããšã㊠AsciiDoc ãéžãã ã®ã¯ãMarkdown ããã衚çŸåã«åªããããã§ãããMarkdown ã¯åºã䜿ãããŠãã軜éããŒã¯ã¢ããèšèªã ãã以äžã®ãããªæ¬ ç¹ãæã€ã + ç§»è¡å
ã®ãã©ãŒããããšã㊠AsciiDoc ãéžãã ã®ã¯ãMarkdown ããã衚çŸåã«åªããããã§ãããMarkdown ã¯åºã䜿ãããŠãã軜éããŒã¯ã¢ããèšèªã ãã以äžã®ãããªæ¬ ç¹ãæã€ã </p> - - <p> - <ul> - <li> - CommonMark ã§ã¯æ©èœã貧匱ã§ãã (äŸ: èæ³šã<code>id</code> 屿§ã®ä»äž) - </li> - - <li> - æ¡åŒµèšæ³ã«å®è£
éã§äºææ§ããªã - </li> - - <li> - ã¡ã¿ããŒã¿ (å
¬éæ¥ãªã©) ãåã蟌ãçµ±äžãããæ¹æ³ããªã - </li> - </ul> - </p> - - <p> - AsciiDoc 㯠Markdown ã«æ¯ã¹ããšæ®åããŠããªãããäžèšã®æ¬ ç¹ã¯å
æããŠããã - </p> - + <ul> + <li> + CommonMark ã§ã¯æ©èœã貧匱ã§ãã (äŸ: èæ³šã<code>id</code> 屿§ã®ä»äž) + </li> + <li> + æ¡åŒµèšæ³ã«å®è£
éã§äºææ§ããªã + </li> + <li> + ã¡ã¿ããŒã¿ (å
¬éæ¥ãªã©) ãåã蟌ãçµ±äžãããæ¹æ³ããªã + </li> + </ul> <p> - <ul> - <li> - ããã°ãæžãã®ã«ååãªè¡šçŸåããã - </li> - - <li> - ãã©ãŒããããæ¡åŒµãããšãã®èšæ³ããããããå®ããããŠãã - </li> - - <li> - ã¡ã¿ããŒã¿ãåã蟌ãçµ±äžãããæ¹æ³ããã - </li> - </ul> + AsciiDoc 㯠Markdown ã«æ¯ã¹ããšæ®åããŠããªãããäžèšã®æ¬ ç¹ã¯å
æããŠããã </p> - + <ul> + <li> + ããã°ãæžãã®ã«ååãªè¡šçŸåããã + </li> + <li> + ãã©ãŒããããæ¡åŒµãããšãã®èšæ³ããããããå®ããããŠãã + </li> + <li> + ã¡ã¿ããŒã¿ãåã蟌ãçµ±äžãããæ¹æ³ããã + </li> + </ul> <p> - ãªããHugo 㯠AsciiDoc ããµããŒãããŠããã®ã ããAsciiDoc ã䜿ãå Žå Asciidoctor ãå¥éã€ã³ã¹ããŒã«ããå¿
èŠãããããããªãã°æåãã Asciidoctor ã§ãããããšç§»è¡ã決ããã + ãªããHugo 㯠AsciiDoc ããµããŒãããŠããã®ã ããAsciiDoc ã䜿ãå Žå Asciidoctor ãå¥éã€ã³ã¹ããŒã«ããå¿
èŠãããããããªãã°æåãã Asciidoctor ã§ãããããšç§»è¡ã決ããã </p> </section> - <section id="section--from-asciidoctor-to-my-own-generator"> - <h2><a href="#section--from-asciidoctor-to-my-own-generator">Asciidoctor ããèªåã®ãžã§ãã¬ãŒã¿ãž</a></h2> + <h2><a href="#section--from-asciidoctor-to-my-own-generator">Asciidoctor ããèªåã®ãžã§ãã¬ãŒã¿ãž</a></h2> + <p> + AsciiDoc ã¯è¯ããã©ãŒãããã ããç§ã«ã¯ 1ç¹äžæºããã£ããããã¯ãé«ã衚çŸåãæ
ä¿ããããã«èšå·ã䜿ãåãããŠããããšã¹ã±ãŒããé£ãããšããç¹ã (å
·äœäŸãæãããã®ã ããäœã ã£ããèŠããŠããªã)ãããã¯ãå€çš®å€æ§ãªèšå·é¡ãå
¥åããå¿
èŠã®ããæè¡ããã°ã«ãšã£ãŠã¯èŸãåé¡ã§ããããã®åé¡ã解決ããããã + </p> + <ul> + <li> + 衚çŸåãé«ãã + </li> + <li> + ææ³ãå³å¯ã§ããã + </li> + <li> + ç°¡åã«å®è£
ã§ãã + </li> + </ul> <p> - AsciiDoc ã¯è¯ããã©ãŒãããã ããç§ã«ã¯ 1ç¹äžæºããã£ããããã¯ãé«ã衚çŸåãæ
ä¿ããããã«èšå·ã䜿ãåãããŠããããšã¹ã±ãŒããé£ãããšããç¹ã (å
·äœäŸãæãããã®ã ããäœã ã£ããèŠããŠããªã)ãããã¯ãå€çš®å€æ§ãªèšå·é¡ãå
¥åããå¿
èŠã®ããæè¡ããã°ã«ãšã£ãŠã¯èŸãåé¡ã§ããããã®åé¡ã解決ããããã - <ul> - <li> - 衚çŸåãé«ãã - </li> - - <li> - ææ³ãå³å¯ã§ããã - </li> - - <li> - ç°¡åã«å®è£
ã§ãã - </li> - </ul> - ãã©ãŒããããæ±ãããããããã«åèŽããã®ããXML ãããŒã¹ãšãã <a href="https://docbook.org/" rel="noreferrer" target="_blank">DocBook</a> (ä»å䜿ã£ãŠããã®ã¯ããã®ãµãã»ããã§ãã <a href="https://tdg.docbook.org/tdg/sdocbook/5.1/" rel="noreferrer" target="_blank">Simplified DocBook</a>) ã§ããã + ãã©ãŒããããæ±ãããããããã«åèŽããã®ããXML ãããŒã¹ãšãã <a href="https://docbook.org/" rel="noreferrer" target="_blank">DocBook</a> (ä»å䜿ã£ãŠããã®ã¯ããã®ãµãã»ããã§ãã <a href="https://tdg.docbook.org/tdg/sdocbook/5.1/" rel="noreferrer" target="_blank">Simplified DocBook</a> ) ã§ããã </p> - <p> - å®ã¯ãAsciiDoc ãš DocBook ã¯ããããäºææ§ããããAsciiDoc ã§æžãããææžã¯ (ã»ãŒ) æ
å ±ãã¹ãªãã« DocBook ãžå€æã§ããéããŸããããã§ããããã£ãŠãDocBook ã«ã¯ãAsciiDoc ãšåçã®è¡šçŸåãããã + å®ã¯ãAsciiDoc ãš DocBook ã¯ããããäºææ§ããããAsciiDoc ã§æžãããææžã¯ (ã»ãŒ) æ
å ±ãã¹ãªãã« DocBook ãžå€æã§ããéããŸããããã§ããã ãã£ãŠãDocBook ã«ã¯ãAsciiDoc ãšåçã®è¡šçŸåãããã </p> - <p> - XML ã®ææ³ã®å³å¯ãã«ã€ããŠã¯ã説æãããŸã§ããªãã ããããŸããåçŽãªææ³ã§ããããšããå®è£
ã容æã§ãããäºå®äž Asciidoctor ãžããã¯ã€ã³ããã AsciiDoc ãšã¯ç°ãªããããŸããŸãªèšèªã§å€ãã®ã©ã€ãã©ãªãååšããã + XML ã®ææ³ã®å³å¯ãã«ã€ããŠã¯ã説æãããŸã§ããªãã ããããŸããåçŽãªææ³ã§ããããšããå®è£
ã容æã§ãããäºå®äž Asciidoctor ãžããã¯ã€ã³ããã AsciiDoc ãšã¯ç°ãªããããŸããŸãªèšèªã§å€ãã®ã©ã€ãã©ãªãååšããã </p> - <p> - ä»åã¯ãXML ã®ããŒã¹èªäœãèªåã§æžããŠãã (ããã¯äœãšãªãæžãããã£ãããã§ãããåççãªçç±ãããããã§ã¯ãªããå®è£
ã¯ãµãããŸãã£ãŠããã®ã§ XML ã®ã³ã¡ã³ãã䜿ããªããšãã£ãå¶éããã)ã + ä»åã¯ãXML ã®ããŒã¹èªäœãèªåã§æžããŠãã (ããã¯äœãšãªãæžãããã£ãããã§ãããåççãªçç±ãããããã§ã¯ãªããå®è£
ã¯ãµãããŸãã£ãŠããã®ã§ XML ã®ã³ã¡ã³ãã䜿ããªããšãã£ãå¶éããã)ã </p> - <p> - XML ãšããæ©æ¢°åŠçãããããã©ãŒããããéžã¶ããšã«ã¯ãæ©æ¢°çãªå€æãæ€æ»ãšãã£ãåŠçããããªãããããªããšãã£ãå©ç¹ããããæ¬ ç¹ã¯è»œéããŒã¯ã¢ããèšèªãšæ¯ã¹ãŠåé·ã§ããããšã ããæžãéã¯è£å®ãªã©ãçšããã®ã§ããã»ã©æ°ã«ãªããªããçµå±ã®ãšãããæè¡ããã°ã®å·çãåŸéããã®ã¯èª¿æ»ãšæç« ã®èšè¿°ã§ãããããŒã¯ã¢ããã®ææ®µã¯å·çæéã«å€§ãã圱é¿ãäžããªãã + XML ãšããæ©æ¢°åŠçãããããã©ãŒããããéžã¶ããšã«ã¯ãæ©æ¢°çãªå€æãæ€æ»ãšãã£ãåŠçããããªãããããªããšãã£ãå©ç¹ãããã æ¬ ç¹ã¯è»œéããŒã¯ã¢ããèšèªãšæ¯ã¹ãŠåé·ã§ããããšã ããæžãéã¯è£å®ãªã©ãçšããã®ã§ããã»ã©æ°ã«ãªããªãã çµå±ã®ãšãããæè¡ããã°ã®å·çãåŸéããã®ã¯èª¿æ»ãšæç« ã®èšè¿°ã§ãããããŒã¯ã¢ããã®ææ®µã¯å·çæéã«å€§ãã圱é¿ãäžããªãã </p> </section> - <section id="section--outro"> - <h2><a href="#section--outro">ãããã«</a></h2> + <h2><a href="#section--outro">ãããã«</a></h2> <p> - 2床ã®ãªã©ã€ããçµãŠãèšäºã®ãã©ãŒããããšãµã€ããžã§ãã¬ãŒã¿ãäžããäžãŸã§ææ¡ãããä»åŸãæ¹åã®ã¢ã€ãã¢ã¯å€æ°ããã®ã§ããããããšé²ããŠãããããšããã ã + 2床ã®ãªã©ã€ããçµãŠãèšäºã®ãã©ãŒããããšãµã€ããžã§ãã¬ãŒã¿ãäžããäžãŸã§ææ¡ããã ä»åŸãæ¹åã®ã¢ã€ãã¢ã¯å€æ°ããã®ã§ããããããšé²ããŠãããããšããã ã </p> - <p> - æåŸã«ããäžåºŠæžãã®ã ããHugo ã¯å€§å€ã«åªããéçãµã€ããžã§ãã¬ãŒã¿ã§ãããç¡é§ãªæãããªããã°ããã䜿ããšãããç§ã¯ç¡é§ã«æã£ãã®ã§ãããã°ã®èšäºãæžãæéãæœ°ããŠããã°ã·ã¹ãã ãäœã£ãŠããŸã£ãã + æåŸã«ããäžåºŠæžãã®ã ããHugo ã¯å€§å€ã«åªããéçãµã€ããžã§ãã¬ãŒã¿ã§ããã ç¡é§ãªæãããªããã°ããã䜿ããšããã ç§ã¯ç¡é§ã«æã£ãã®ã§ãããã°ã®èšäºãæžãæéãæœ°ããŠããã°ã·ã¹ãã ãäœã£ãŠããŸã£ãã </p> </section> </div> diff --git a/vhosts/blog/public/posts/2023-04-01/implementation-of-minimal-png-image-encoder/index.html b/vhosts/blog/public/posts/2023-04-01/implementation-of-minimal-png-image-encoder/index.html index 11831bdf..502a7e3a 100644 --- a/vhosts/blog/public/posts/2023-04-01/implementation-of-minimal-png-image-encoder/index.html +++ b/vhosts/blog/public/posts/2023-04-01/implementation-of-minimal-png-image-encoder/index.html @@ -52,51 +52,42 @@ </ol> </section> <section id="section--intro"> - <h2><a href="#section--intro">ã¯ããã«</a></h2> + <h2><a href="#section--intro">ã¯ããã«</a></h2> <p> - ãã®èšäºã§ã¯ãPNG ç»åãšã㊠valid ãªç¯å²ã§æå€§éææããããšã³ã³ãŒããæžããPNG ç»åã«å¯Ÿå¿ãããã¥ãŒã¢ã§ããã°èªã¿èŸŒããããå§çž®å¹çã«ã€ããŠã¯äžåèããªãããŸããå®è£
ã«ã¯ Go èšèªã䜿ãããGo ã®æšæºã©ã€ãã©ãªã«ããããŸããŸãªã¢ã«ãŽãªãºã (PNG ç»åã«é¢ä¿ããç¯å²ã ãšãzlib ã CRC32ãAdler-32 ãªã©) ã¯äœ¿ããªãã + ãã®èšäºã§ã¯ãPNG ç»åãšã㊠valid ãªç¯å²ã§æå€§éææããããšã³ã³ãŒããæžãã PNG ç»åã«å¯Ÿå¿ãããã¥ãŒã¢ã§ããã°èªã¿èŸŒããããå§çž®å¹çã«ã€ããŠã¯äžåèããªãã ãŸããå®è£
ã«ã¯ Go èšèªã䜿ãããGo ã®æšæºã©ã€ãã©ãªã«ããããŸããŸãªã¢ã«ãŽãªãºã (PNG ç»åã«é¢ä¿ããç¯å²ã ãšãzlib ã CRC32ãAdler-32 ãªã©) ã¯äœ¿ããªãã </p> </section> - <section id="section--basic-structure-of-png"> - <h2><a href="#section--basic-structure-of-png">PNG ãã¡ã€ã«ã®åºæ¬æ§é </a></h2> + <h2><a href="#section--basic-structure-of-png">PNG ãã¡ã€ã«ã®åºæ¬æ§é </a></h2> <p> - PNG ãã¡ã€ã«ã®åºæ¬æ§é ã¯æ¬¡ã®ããã«ãªã£ãŠããã + PNG ãã¡ã€ã«ã®åºæ¬æ§é ã¯æ¬¡ã®ããã«ãªã£ãŠããã </p> - <ol> <li> PNG signature </li> - <li> IHDR chunk </li> - <li> ä»»æåã® chunk </li> - <li> IEND chunk </li> </ol> - <p> - Chunk ã«ã¯ç»åããŒã¿ãå
¥ãã IDAT chunkããã¬ããããŒã¿ãå
¥ãã PLTE chunkãããã¹ãããŒã¿ãå
¥ãã tEXt chunk ãªã©ãããããä»åã¯æå°æ§æãšããããšã§ IDAT chunk (ãš IHDR chunk ãš IEND chunk) ã®ã¿ãçšããã + Chunk ã«ã¯ç»åããŒã¿ãå
¥ãã IDAT chunkããã¬ããããŒã¿ãå
¥ãã PLTE chunkãããã¹ãããŒã¿ãå
¥ãã tEXt chunk ãªã©ããããã ä»åã¯æå°æ§æãšããããšã§ IDAT chunk (ãš IHDR chunk ãš IEND chunk) ã®ã¿ãçšããã </p> - <p> - 次ç¯ã§ãããããã®å
·äœçãªæ§é ã確èªãã€ã€å®è£
ããŠããã + 次ç¯ã§ãããããã®å
·äœçãªæ§é ã確èªãã€ã€å®è£
ããŠããã </p> </section> - <section id="section--implement-png-encoder"> - <h2><a href="#section--implement-png-encoder">PNG ã®ãšã³ã³ãŒããå®è£
ãã</a></h2> + <h2><a href="#section--implement-png-encoder">PNG ã®ãšã³ã³ãŒããå®è£
ãã</a></h2> <p> - 以äžã®ãœãŒã¹ã³ãŒããããŒã¹ã«ãããä»å PNG ã®ãã³ãŒãã¯æ±ããªãã®ã§ãèªã¿èŸŒã¿ã«ã¯ Go ã®æšæºã©ã€ãã©ãª <code>image/png</code> ãçšããã + 以äžã®ãœãŒã¹ã³ãŒããããŒã¹ã«ããã ä»å PNG ã®ãã³ãŒãã¯æ±ããªãã®ã§ãèªã¿èŸŒã¿ã«ã¯ Go ã®æšæºã©ã€ãã©ãª <code>image/png</code> ãçšããã </p> - <div class="codeblock" language="go"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49">package</span><span style="color:#6F42C1"> main</span></span> <span class="line"></span> @@ -137,59 +128,46 @@ <span class="line"><span style="color:#6F42C1"> writeChunkIend</span><span style="color:#24292E">(w)</span></span> <span class="line"><span style="color:#24292E">}</span></span></code></pre> </div> - <p> - 以éã¯ã<code>writeSignature</code> ã <code>writeChunkIhdr</code> ãªã©ãå®è£
ããŠããã + 以éã¯ã<code>writeSignature</code> ã <code>writeChunkIhdr</code> ãªã©ãå®è£
ããŠããã </p> - <section id="section--implement-png-encoder--png-signature"> - <h3><a href="#section--implement-png-encoder--png-signature">PNG signature</a></h3> + <h3><a href="#section--implement-png-encoder--png-signature">PNG signature</a></h3> <p> - PNG signature ã¯ãPNG ç»åã®å
é ã«åºå®ã§ä»äžããããã€ãåã§ã8 ãã€ããããªãã + PNG signature ã¯ãPNG ç»åã®å
é ã«åºå®ã§ä»äžããããã€ãåã§ã8 ãã€ããããªãã </p> - <ol> <li> 0x89 </li> - <li> 0x50 (ASCII ã³ãŒãã§ãPã) </li> - <li> 0x4E (ASCII ã³ãŒãã§ãNã) </li> - <li> 0x47 (ASCII ã³ãŒãã§ãGã) </li> - <li> 0x0D (ASCII ã³ãŒãã§ CR) </li> - <li> 0x0A (ASCII ã³ãŒãã§ LF) </li> - <li> 0x1A (ASCII ã³ãŒãã§ EOF) </li> - <li> 0x0A (ASCII ã³ãŒãã§ LF) </li> </ol> - <p> - CRLF ã LF ã¯ãéä¿¡äžã«æ¹è¡ã³ãŒãã®å€æã誀ã£ãŠãããªãããŠããªããã©ãããæ€ç¥ããã®ã«äœ¿ãããã + CRLF ã LF ã¯ãéä¿¡äžã«æ¹è¡ã³ãŒãã®å€æã誀ã£ãŠãããªãããŠããªããã©ãããæ€ç¥ããã®ã«äœ¿ãããã </p> - <p> - <code>writeSignature</code> ã®å®è£
ã¯ãã¡ã: + <code>writeSignature</code> ã®å®è£
ã¯ãã¡ã: </p> - <div class="codeblock" language="go"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49">import</span><span style="color:#032F62"> "</span><span style="color:#6F42C1">encoding/binary</span><span style="color:#032F62">"</span></span> <span class="line"></span> @@ -207,40 +185,32 @@ <span class="line"><span style="color:#24292E"> binary.</span><span style="color:#6F42C1">Write</span><span style="color:#24292E">(w, binary.BigEndian, sig)</span></span> <span class="line"><span style="color:#24292E">}</span></span></code></pre> </div> - <p> <code>encoding/binary</code> ããã±ãŒãžã® <code>binary.Write</code> ã䜿ããåºå®ã® 8 ãã€ããæžã蟌ãã </p> </section> - <section id="section--implement-png-encoder--structure-of-chunk"> - <h3><a href="#section--implement-png-encoder--structure-of-chunk">Chunk ã®æ§é </a></h3> + <h3><a href="#section--implement-png-encoder--structure-of-chunk">Chunk ã®æ§é </a></h3> <p> - IHDR chunk ã«é²ãåã«ãchunk äžè¬ã®æ§é ã確èªããã + IHDR chunk ã«é²ãåã«ãchunk äžè¬ã®æ§é ã確èªããã </p> - <ol> <li> Length: chunk data ã®ãã€ãé· (笊å·ãªã 4 ãã€ãæŽæ°) </li> - <li> Chunk type: chunk ã®çš®é¡ã瀺ã 4 ãã€ããããªãåå </li> - <li> Chunk data: å®éã®ããŒã¿ã0 ãã€ãã§ããã </li> - <li> CRC: chunk type ãš chunk data ã® CRC (笊å·ãªã 4 ãã€ãæŽæ°) </li> </ol> - <p> - CRC (Cyclic Redundancy Check) ã¯èª€ãæ€åºç¬Šå·ã®äžçš®ãGo èšèªã§ã¯ <code>hash/crc32</code> ããã±ãŒãžã«ããããä»åã¯ãããèªåã§å®è£
ãããPNG ã®ä»æ§æžã« C èšèªã®ãµã³ãã«ã³ãŒããèŒã£ãŠãã (<a href="https://www.w3.org/TR/png/#D-CRCAppendix" rel="noreferrer" target="_blank">D. Sample CRC implementation</a>) ã®ã§ãããã Go ã«ç§»æ€ããã + CRC (Cyclic Redundancy Check) ã¯èª€ãæ€åºç¬Šå·ã®äžçš®ãGo èšèªã§ã¯ <code>hash/crc32</code> ããã±ãŒãžã«ããããä»åã¯ãããèªåã§å®è£
ãããPNG ã®ä»æ§æžã« C èšèªã®ãµã³ãã«ã³ãŒããèŒã£ãŠãã ( <a href="https://www.w3.org/TR/png/#D-CRCAppendix" rel="noreferrer" target="_blank">D. Sample CRC implementation</a> ) ã®ã§ãããã Go ã«ç§»æ€ããã </p> - <div class="codeblock" language="go"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49">var</span><span style="color:#24292E"> (</span></span> <span class="line"><span style="color:#24292E"> crcTable [</span><span style="color:#005CC5">256</span><span style="color:#24292E">]</span><span style="color:#D73A49">uint32</span></span> @@ -278,11 +248,9 @@ <span class="line"><span style="color:#D73A49"> return</span><span style="color:#6F42C1"> updateCrc</span><span style="color:#24292E">(</span><span style="color:#D73A49">0x</span><span style="color:#005CC5">FFFFFFFF</span><span style="color:#24292E">, buf) </span><span style="color:#D73A49">^</span><span style="color:#D73A49"> 0x</span><span style="color:#005CC5">FFFFFFFF</span></span> <span class="line"><span style="color:#24292E">}</span></span></code></pre> </div> - <p> - ã§ãã <code>crc</code> 颿°ã䜿ã£ãŠãchunk äžè¬ãæžã蟌ã颿°ãçšæããŠãããã + ã§ãã <code>crc</code> 颿°ã䜿ã£ãŠãchunk äžè¬ãæžã蟌ã颿°ãçšæããŠãããã </p> - <div class="codeblock" language="go"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49">func</span><span style="color:#6F42C1"> writeChunk</span><span style="color:#24292E">(</span><span style="color:#E36209">w</span><span style="color:#6F42C1"> io</span><span style="color:#24292E">.</span><span style="color:#6F42C1">Writer</span><span style="color:#24292E">, </span><span style="color:#E36209">chunkType</span><span style="color:#D73A49"> string</span><span style="color:#24292E">, </span><span style="color:#E36209">data</span><span style="color:#24292E"> []</span><span style="color:#D73A49">byte</span><span style="color:#24292E">) {</span></span> <span class="line"><span style="color:#24292E"> typeAndData </span><span style="color:#D73A49">:=</span><span style="color:#6F42C1"> make</span><span style="color:#24292E">([]</span><span style="color:#D73A49">byte</span><span style="color:#24292E">, </span><span style="color:#005CC5">0</span><span style="color:#24292E">, </span><span style="color:#6F42C1">len</span><span style="color:#24292E">(chunkType)</span><span style="color:#D73A49">+</span><span style="color:#6F42C1">len</span><span style="color:#24292E">(data))</span></span> @@ -294,91 +262,91 @@ <span class="line"><span style="color:#24292E"> binary.</span><span style="color:#6F42C1">Write</span><span style="color:#24292E">(w, binary.BigEndian, </span><span style="color:#6F42C1">crc</span><span style="color:#24292E">(typeAndData))</span></span> <span class="line"><span style="color:#24292E">}</span></span></code></pre> </div> - <p> - 仿§ã©ããã<code>chunkType</code> ãš <code>data</code> ãã CRC ãèšç®ãã<code>data</code> ã®é·ããšåãããŠæžã蟌ãã§ãããPNG ã§ã¯åºæ¬çã« big endian ã䜿ãããšã«æ³šæããã + 仿§ã©ããã<code>chunkType</code> ãš <code>data</code> ãã CRC ãèšç®ãã<code>data</code> ã®é·ããšåãããŠæžã蟌ãã§ããã PNG ã§ã¯åºæ¬çã« big endian ã䜿ãããšã«æ³šæããã </p> - <p> - æºåãã§ãããšããã§ãå
·äœç㪠chunk ããšã³ã³ãŒãããŠããã + æºåãã§ãããšããã§ãå
·äœç㪠chunk ããšã³ã³ãŒãããŠããã </p> </section> - <section id="section--implement-png-encoder--ihdr-chunk"> - <h3><a href="#section--implement-png-encoder--ihdr-chunk">IHDR chunk</a></h3> + <h3><a href="#section--implement-png-encoder--ihdr-chunk">IHDR chunk</a></h3> <p> - IHDR chunk ã¯æåã«é
眮ããã chunk ã§ãããæ¬¡ã®ãããªããŒã¿ãããªãã + IHDR chunk ã¯æåã«é
眮ããã chunk ã§ãããæ¬¡ã®ãããªããŒã¿ãããªãã </p> - <ol> <li> ç»åã®å¹
(笊å·ãªã 4 ãã€ãæŽæ°) </li> - <li> ç»åã®é«ã (笊å·ãªã 4 ãã€ãæŽæ°) </li> - <li> - ãããæ·±åºŠ (笊å·ãªã 1 ãã€ãæŽæ°) + <p> + ãããæ·±åºŠ (笊å·ãªã 1 ãã€ãæŽæ°) + </p> <ul> <li> 1 è²ã«äœ¿ããããæ°ã1 ãã¯ã»ã«ã« 24 bit 䜿ã truecolor ç»åã§ã¯ 8 ã«ãªã </li> </ul> </li> - <li> - è²ã¿ã€ã (笊å·ãªã 1 ãã€ãæŽæ°) + <p> + è²ã¿ã€ã (笊å·ãªã 1 ãã€ãæŽæ°) + </p> <ul> <li> 0: ã°ã¬ãŒã¹ã±ãŒã« </li> - <li> 2: Truecolor (ä»åã¯ããã«æ±ºãæã¡) </li> - <li> 3: ãã¬ããã®ã€ã³ããã¯ã¹ </li> - <li> 4: ã°ã¬ãŒã¹ã±ãŒã« + ã¢ã«ãã¡ </li> - <li> 6: Truecolor + ã¢ã«ãã¡ </li> </ul> </li> - <li> - å§çž®æ¹åŒ (笊å·ãªã 1 ãã€ãæŽæ°) + <p> + å§çž®æ¹åŒ (笊å·ãªã 1 ãã€ãæŽæ°) + </p> <ul> - PNG ã®ä»æ§æžã« 0 ããå®çŸ©ãããŠããªãã®ã§ 0 ã§åºå® + <li> + PNG ã®ä»æ§æžã« 0 ããå®çŸ©ãããŠããªãã®ã§ 0 ã§åºå® + </li> </ul> </li> - <li> - ãã£ã«ã¿æ¹åŒ (笊å·ãªã 1 ãã€ãæŽæ°) + <p> + ãã£ã«ã¿æ¹åŒ (笊å·ãªã 1 ãã€ãæŽæ°) + </p> <ul> - PNG ã®ä»æ§æžã« 0 ããå®çŸ©ãããŠããªãã®ã§ 0 ã§åºå® + <li> + PNG ã®ä»æ§æžã« 0 ããå®çŸ©ãããŠããªãã®ã§ 0 ã§åºå® + </li> </ul> </li> - <li> - ã€ã³ã¿ãŒã¬ãŒã¹æ¹åŒ (笊å·ãªã 1 ãã€ãæŽæ°) + <p> + ã€ã³ã¿ãŒã¬ãŒã¹æ¹åŒ (笊å·ãªã 1 ãã€ãæŽæ°) + </p> <ul> - ä»åã¯ã€ã³ã¿ãŒã¬ãŒã¹ããªãã®ã§ 0 + <li> + ä»åã¯ã€ã³ã¿ãŒã¬ãŒã¹ããªãã®ã§ 0 + </li> </ul> </li> </ol> - <p> - ä»åã»ãšãã©ã®ããŒã¿ã¯æ±ºãæã¡ããã®ã§ãããŒã¿ã«å¿ããŠå€ããã®ã¯ width ãš height ã ãã«ãªããã³ãŒãã¯æ¬¡ã®ããã«ãªãã + ä»åã»ãšãã©ã®ããŒã¿ã¯æ±ºãæã¡ããã®ã§ãããŒã¿ã«å¿ããŠå€ããã®ã¯ width ãš height ã ãã«ãªããã³ãŒãã¯æ¬¡ã®ããã«ãªãã </p> - <div class="codeblock" language="go"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49">import</span><span style="color:#032F62"> "</span><span style="color:#6F42C1">bytes</span><span style="color:#032F62">"</span></span> <span class="line"></span> @@ -396,45 +364,36 @@ <span class="line"><span style="color:#24292E">}</span></span></code></pre> </div> </section> - <section id="section--implement-png-encoder--idat-chunk"> - <h3><a href="#section--implement-png-encoder--idat-chunk">IDAT chunk</a></h3> + <h3><a href="#section--implement-png-encoder--idat-chunk">IDAT chunk</a></h3> <p> - IDAT chunk ã¯ãå®éã®ç»åããŒã¿ãæ ŒçŽããã chunk ã§ãããIDAT chunk 㯠deflate ã¢ã«ãŽãªãºã ã«ããå§çž®ãããzlib 圢åŒã§æ ŒçŽãããã + IDAT chunk ã¯ãå®éã®ç»åããŒã¿ãæ ŒçŽããã chunk ã§ãããIDAT chunk 㯠deflate ã¢ã«ãŽãªãºã ã«ããå§çž®ãããzlib 圢åŒã§æ ŒçŽãããã </p> - <section id="section--implement-png-encoder--idat-chunk--zlib"> - <h4><a href="#section--implement-png-encoder--idat-chunk--zlib">Zlib</a></h4> + <h4><a href="#section--implement-png-encoder--idat-chunk--zlib">Zlib</a></h4> <p> - ãŸã㯠zlib ã«ã€ããŠç¢ºèªãããããããæ¬¡ã®ãããªæ§é ã«ãªã£ãŠããã + ãŸã㯠zlib ã«ã€ããŠç¢ºèªãããããããæ¬¡ã®ãããªæ§é ã«ãªã£ãŠããã </p> - <ol> <li> åºå®ã§ 0x78 (笊å·ãªã 1 ãã€ãæŽæ°) </li> - <li> åºå®ã§ 0x01 (笊å·ãªã 1 ãã€ãæŽæ°) </li> - <li> ããŒã¿ </li> - <li> ããŒã¿ã® Adler-32 </li> </ol> - <p> - æåã® 2 ãã€ãã«ãæå³ã¯ããããPNG ã§ã¯åºå®ã§æ§ããªãã + æåã® 2 ãã€ãã«ãæå³ã¯ããããPNG ã§ã¯åºå®ã§æ§ããªãã </p> - <p> - Adler-32 ã CRC ãšåããèª€ãæ€åºç¬Šå·ã§ããããã¡ãã zlib ã®ä»æ§æžã« C èšèªã§ãµã³ãã«ã³ãŒããèšèŒãããŠãã (<a href="https://www.rfc-editor.org/rfc/rfc1950#section-9" rel="noreferrer" target="_blank">9. Appendix: Sample code</a>) ã®ã§ãGo ã«ç§»æ€ããã + Adler-32 ã CRC ãšåããèª€ãæ€åºç¬Šå·ã§ããããã¡ãã zlib ã®ä»æ§æžã« C èšèªã§ãµã³ãã«ã³ãŒããèšèŒãããŠãã ( <a href="https://www.rfc-editor.org/rfc/rfc1950#section-9" rel="noreferrer" target="_blank">9. Appendix: Sample code</a> ) ã®ã§ãGo ã«ç§»æ€ããã </p> - <div class="codeblock" language="go"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49">const</span><span style="color:#005CC5"> adler32Base</span><span style="color:#D73A49"> =</span><span style="color:#005CC5"> 65521</span></span> <span class="line"></span> @@ -453,37 +412,29 @@ <span class="line"><span style="color:#D73A49"> return</span><span style="color:#6F42C1"> updateAdler32</span><span style="color:#24292E">(</span><span style="color:#005CC5">1</span><span style="color:#24292E">, buf)</span></span> <span class="line"><span style="color:#24292E">}</span></span></code></pre> </div> - <p> - ãããŒã¿ãã®éšåã«ã¯å§çž®ããããŒã¿ãå
¥ãã®ã ããçé¢ç®ã« deflate ã¢ã«ãŽãªãºã ãå®è£
ããå¿
èŠã¯ãªããZlib ã«ã¯ç¡å§çž®ã®ããŒã¿ãããã¯ãæ ŒçŽããããšãã§ããã®ã§ãããã䜿ããæ¬æ¥ã¯ãããŒã¿ã®å§çž®å¹çã®æªãã©ã³ãã ãªããŒã¿ããã®ãŸãŸæ ŒçŽããããã®ãã®ã ããä»å㯠deflate ã®å®è£
ããµããããã«äœ¿ãã + ãããŒã¿ãã®éšåã«ã¯å§çž®ããããŒã¿ãå
¥ãã®ã ããçé¢ç®ã« deflate ã¢ã«ãŽãªãºã ãå®è£
ããå¿
èŠã¯ãªããZlib ã«ã¯ç¡å§çž®ã®ããŒã¿ãããã¯ãæ ŒçŽããããšãã§ããã®ã§ãããã䜿ããæ¬æ¥ã¯ãããŒã¿ã®å§çž®å¹çã®æªãã©ã³ãã ãªããŒã¿ããã®ãŸãŸæ ŒçŽããããã®ãã®ã ããä»å㯠deflate ã®å®è£
ããµããããã«äœ¿ãã </p> - <p> - 1 ã€ã®ç¡å§çž®ãããã¯ã«ã¯ 65535 (2<sup>16</sup> - 1) ãã€ããŸã§æ ŒçŽã§ãããããããã®ãããã¯ã¯æ¬¡ã®ãããªæ§æã«ãªã£ãŠããã + 1 ã€ã®ç¡å§çž®ãããã¯ã«ã¯ 65535 (2<sup>16</sup> - 1) ãã€ããŸã§æ ŒçŽã§ãããããããã®ãããã¯ã¯æ¬¡ã®ãããªæ§æã«ãªã£ãŠããã </p> - <ol> <li> æçµãããã¯ãªã 1ãããã§ãªããã° 0 (笊å·ãªã 1 ãã€ãæŽæ°) </li> - <li> ãããã¯ã®ãã€ãé· (笊å·ãªã 2 ãã€ãæŽæ°) </li> - <li> ãããã¯ã®ãã€ãé·ã® 1 ã®è£æ°ããããã¯ãããå転 (笊å·ãªã 2 ãã€ãæŽæ°) </li> - <li> ããŒã¿ (æå€§ 65535 ãã€ã) </li> </ol> - <p> - å®éã«ãã®ææã zlib ãå®è£
ãããã®ããã¡ã: + å®éã«ãã®ææã zlib ãå®è£
ãããã®ããã¡ã: </p> - <div class="codeblock" language="go"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49">func</span><span style="color:#6F42C1"> encodeZlib</span><span style="color:#24292E">(</span><span style="color:#E36209">data</span><span style="color:#24292E"> []</span><span style="color:#D73A49">byte</span><span style="color:#24292E">) []</span><span style="color:#D73A49">byte</span><span style="color:#24292E"> {</span></span> <span class="line"><span style="color:#D73A49"> var</span><span style="color:#24292E"> buf </span><span style="color:#6F42C1">bytes</span><span style="color:#24292E">.</span><span style="color:#6F42C1">Buffer</span></span> @@ -511,21 +462,17 @@ <span class="line"><span style="color:#24292E">}</span></span></code></pre> </div> </section> - <section id="section--implement-png-encoder--idat-chunk--image-data"> - <h4><a href="#section--implement-png-encoder--idat-chunk--image-data">ç»åããŒã¿</a></h4> + <h4><a href="#section--implement-png-encoder--idat-chunk--image-data">ç»åããŒã¿</a></h4> <p> - ã§ã¯æ¬¡ã«ãzlib 圢åŒã§æ ŒçŽããããŒã¿ãçšæãããPNG ç»åã¯æ¬¡ã®ãããªé ã«ã¹ãã£ã³ãããç»åã®å·Šäžã®ãã¯ã»ã«ããåãè¡ã暪ã«ã¹ãã£ã³ããŠãããäžçªå³ãŸã§å°éãããæ¬¡ã®è¡ã®å·Šã«åãããå³äžã®ãã¯ã»ã«ãŸã§è¡ãã°çµãããèŠã¯ Z ååã«é²ãã§ããã + ã§ã¯æ¬¡ã«ãzlib 圢åŒã§æ ŒçŽããããŒã¿ãçšæãããPNG ç»åã¯æ¬¡ã®ãããªé ã«ã¹ãã£ã³ããã ç»åã®å·Šäžã®ãã¯ã»ã«ããåãè¡ã暪ã«ã¹ãã£ã³ããŠãããäžçªå³ãŸã§å°éãããæ¬¡ã®è¡ã®å·Šã«åããã å³äžã®ãã¯ã»ã«ãŸã§è¡ãã°çµãããèŠã¯ Z ååã«é²ãã§ããã </p> - <p> - ãŸããããããã®è¡ã®å
é ã«ã¯ãå§çž®ã®ããã®ãã£ã«ã¿ã¿ã€ããæå®ããããã ãä»åã¯ãã®å®è£
ãçç¥ããããã«ãåžžã«ãã£ã«ã¿ 0 (äœãå å·¥ããªã) ã䜿ãã + ãŸããããããã®è¡ã®å
é ã«ã¯ãå§çž®ã®ããã®ãã£ã«ã¿ã¿ã€ããæå®ããã ãã ãä»åã¯ãã®å®è£
ãçç¥ããããã«ãåžžã«ãã£ã«ã¿ 0 (äœãå å·¥ããªã) ã䜿ãã </p> - <p> - å
ã»ã©ã® <code>encodeZlib</code> ã䜿ã£ãŠå®éã«å®è£
ãããã®ããã¡ã: + å
ã»ã©ã® <code>encodeZlib</code> ã䜿ã£ãŠå®éã«å®è£
ãããã®ããã¡ã: </p> - <div class="codeblock" language="go"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49">func</span><span style="color:#6F42C1"> writeChunkIdat</span><span style="color:#24292E">(</span><span style="color:#E36209">w</span><span style="color:#6F42C1"> io</span><span style="color:#24292E">.</span><span style="color:#6F42C1">Writer</span><span style="color:#24292E">, </span><span style="color:#E36209">width</span><span style="color:#24292E">, </span><span style="color:#E36209">height</span><span style="color:#D73A49"> uint32</span><span style="color:#24292E">, </span><span style="color:#E36209">img</span><span style="color:#6F42C1"> image</span><span style="color:#24292E">.</span><span style="color:#6F42C1">Image</span><span style="color:#24292E">) {</span></span> <span class="line"><span style="color:#D73A49"> var</span><span style="color:#24292E"> pixels </span><span style="color:#6F42C1">bytes</span><span style="color:#24292E">.</span><span style="color:#6F42C1">Buffer</span></span> @@ -544,17 +491,14 @@ </div> </section> </section> - <section id="section--implement-png-encoder--iend-chunk"> - <h3><a href="#section--implement-png-encoder--iend-chunk">IEND chunk</a></h3> + <h3><a href="#section--implement-png-encoder--iend-chunk">IEND chunk</a></h3> <p> - æåŸã« IEND chunk ãæžã蟌ãããã㯠PNG ç»åã®æåŸã«é
眮ããã chunk ã§ãPNG ã®ãã³ãŒãã¯ãã® chunk ã«åºäŒããšããã§ãã³ãŒãã忢ããã + æåŸã« IEND chunk ãæžã蟌ãããã㯠PNG ç»åã®æåŸã«é
眮ããã chunk ã§ãPNG ã®ãã³ãŒãã¯ãã® chunk ã«åºäŒããšããã§ãã³ãŒãã忢ããã </p> - <p> - ç¹ã«è¿œå ã®ããŒã¿ã¯ãªããå¿
èŠãªã®ã¯ chunk type ã® <code>IEND</code> ããããªã®ã§å®è£
ã¯ç°¡å: + ç¹ã«è¿œå ã®ããŒã¿ã¯ãªããå¿
èŠãªã®ã¯ chunk type ã® <code>IEND</code> ããããªã®ã§å®è£
ã¯ç°¡å: </p> - <div class="codeblock" language="go"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49">func</span><span style="color:#6F42C1"> writeChunkIend</span><span style="color:#24292E">(</span><span style="color:#E36209">w</span><span style="color:#6F42C1"> io</span><span style="color:#24292E">.</span><span style="color:#6F42C1">Writer</span><span style="color:#24292E">) {</span></span> <span class="line"><span style="color:#6F42C1"> writeChunk</span><span style="color:#24292E">(w, </span><span style="color:#032F62">"IEND"</span><span style="color:#24292E">, </span><span style="color:#005CC5">nil</span><span style="color:#24292E">)</span></span> @@ -562,13 +506,11 @@ </div> </section> </section> - <section id="section--outro"> - <h2><a href="#section--outro">ãããã«</a></h2> + <h2><a href="#section--outro">ãããã«</a></h2> <p> - æåŸã«å
šãœãŒã¹ã³ãŒããåæ²ããŠããã + æåŸã«å
šãœãŒã¹ã³ãŒããåæ²ããŠããã </p> - <div class="codeblock" language="go"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49">package</span><span style="color:#6F42C1"> main</span></span> <span class="line"></span> @@ -746,14 +688,12 @@ <span class="line"><span style="color:#24292E">}</span></span></code></pre> </div> </section> - <section id="section--references"> - <h2><a href="#section--references">åè</a></h2> + <h2><a href="#section--references">åè</a></h2> <ul> <li> <a href="https://www.w3.org/TR/png" rel="noreferrer" target="_blank">Portable Network Graphics (PNG) Specification (Third Edition)</a> </li> - <li> <a href="https://www.rfc-editor.org/rfc/rfc1950" rel="noreferrer" target="_blank">ZLIB Compressed Data Format Specification version 3.3</a> </li> diff --git a/vhosts/blog/public/posts/2023-04-04/phperkaigi-2023-report/index.html b/vhosts/blog/public/posts/2023-04-04/phperkaigi-2023-report/index.html index 5f6c6bec..17aa5a69 100644 --- a/vhosts/blog/public/posts/2023-04-04/phperkaigi-2023-report/index.html +++ b/vhosts/blog/public/posts/2023-04-04/phperkaigi-2023-report/index.html @@ -67,238 +67,195 @@ </ol> </section> <section id="section--intro"> - <h2><a href="#section--intro">ã¯ããã«</a></h2> + <h2><a href="#section--intro">ã¯ããã«</a></h2> <p> - 2023-03-23 ãã 2023-03-25 ã«ãããŠéå¬ãããã<a href="https://phperkaigi.jp/2023/" rel="noreferrer" target="_blank">PHPerKaigi 2023</a> ã«åå ãããä»å¹Žã¯ 2ã€ã®ã»ãã·ã§ã³ã®ã¹ããŒã«ãŒãšããŠããŸããåœæ¥ã¹ã¿ãããšããŠåå ããã + 2023-03-23 ãã 2023-03-25 ã«ãããŠéå¬ãããã <a href="https://phperkaigi.jp/2023/" rel="noreferrer" target="_blank">PHPerKaigi 2023</a> ã«åå ããã ä»å¹Žã¯ 2ã€ã®ã»ãã·ã§ã³ã®ã¹ããŒã«ãŒãšããŠããŸããåœæ¥ã¹ã¿ãããšããŠåå ããã </p> - <p> - æšå¹Žãäžæšå¹Žã®åå ã¬ãã¯ãã¡ã: + æšå¹Žãäžæšå¹Žã®åå ã¬ãã¯ãã¡ã: </p> - <ul> <li> <a href="/posts/2022-05-01/phperkaigi-2022/">PHPerKaigi 2022</a> </li> - <li> <a href="/posts/2021-03-30/phperkaigi-2021/">PHPerKaigi 2021</a> </li> </ul> </section> - <section id="section--as-speaker"> - <h2><a href="#section--as-speaker">ã¹ããŒã«ãŒãšããŠ</a></h2> + <h2><a href="#section--as-speaker">ã¹ããŒã«ãŒãšããŠ</a></h2> <p> - ãããŸã§ãšã®æå€§ã®éããšããŠãä»åã¯ã¹ããŒã«ãŒãšããŠç»å£ããããŸãã¯ããã«ã€ããŠæžãã2ã€ã®ã»ãã·ã§ã³ã§ç»å£ããã + ãããŸã§ãšã®æå€§ã®éããšããŠãä»åã¯ã¹ããŒã«ãŒãšããŠç»å£ããããŸãã¯ããã«ã€ããŠæžãã2ã€ã®ã»ãã·ã§ã³ã§ç»å£ããã </p> - <ul> <li> - 詳説ãåç
§ãïŒPHP åŠçç³»ã®å®è£
ããåç
§ãçè§£ãã + <p> + 詳説ãåç
§ãïŒPHP åŠçç³»ã®å®è£
ããåç
§ãçè§£ãã + </p> <ul> <li> <a href="https://fortee.jp/phperkaigi-2023/proposal/95e4dd94-5fc7-40fe-9e1a-230e36404cbe" rel="noreferrer" target="_blank">ããããŒã¶ã«</a> </li> - <li> <a href="/slides/2023-03-24/phperkaigi-2023/">ã¹ã©ã€ã</a> </li> - <li> 解説èšäº (å·çäž) â 远èš: èšäºçã®å·çã¯è«Šãã </li> </ul> </li> - <li> - PHPerãã£ã¬ã³ãžè§£èª¬ã»ãã·ã§ã³ - ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ + <p> + PHPerãã£ã¬ã³ãžè§£èª¬ã»ãã·ã§ã³ - ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ + </p> <ul> <li> <a href="https://fortee.jp/phperkaigi-2023/proposal/524c9dca-1d70-4b32-a939-9c73ffe5cb48" rel="noreferrer" target="_blank">ããããŒã¶ã«</a> </li> - <li> <a href="/slides/2023-03-25/phperkaigi-2023-tokens/">ã¹ã©ã€ã</a> </li> - <li> 解説èšäº (å·çäž) â 远èš: èšäºçã®å·çã¯è«Šãã </li> </ul> </li> </ul> - <p> - PHPer ãã£ã¬ã³ãžã®è©±ã«ã€ããŠã¯åŸè¿°ãããåç
§ã«ã€ããŠã¯ãPHP ãæžãå§ããé ãããã£ãšçåã«æã£ãŠããã®ã§ãä»çµã¿ãçè§£ããè¯ãæ©äŒãšãªã£ãã + PHPer ãã£ã¬ã³ãžã®è©±ã«ã€ããŠã¯åŸè¿°ããã åç
§ã«ã€ããŠã¯ãPHP ãæžãå§ããé ãããã£ãšçåã«æã£ãŠããã®ã§ãä»çµã¿ãçè§£ããè¯ãæ©äŒãšãªã£ãã </p> </section> - <section id="section--as-staff"> - <h2><a href="#section--as-staff">åœæ¥ã¹ã¿ãããšããŠ</a></h2> + <h2><a href="#section--as-staff">åœæ¥ã¹ã¿ãããšããŠ</a></h2> <p> - ä»åã¯ã¹ããŒã«ãŒã®ã¿ãªããåœæ¥ã¹ã¿ãããšããŠãåå ãããã«ã³ãã¡ã¬ã³ã¹ã®ã¹ã¿ãããšããŠã®åå ã¯åããŠã ã£ãããååå ã®ã¹ã¿ããã§ãã¹ã ãŒãºã«äœæ¥ãã§ãããããªä»çµã¿ãæŽããããŠããã + ä»åã¯ã¹ããŒã«ãŒã®ã¿ãªããåœæ¥ã¹ã¿ãããšããŠãåå ããã ã«ã³ãã¡ã¬ã³ã¹ã®ã¹ã¿ãããšããŠã®åå ã¯åããŠã ã£ãããååå ã®ã¹ã¿ããã§ãã¹ã ãŒãºã«äœæ¥ãã§ãããããªä»çµã¿ãæŽããããŠããã </p> - <p> - PHPerKaigi ã¯äžè¬åå è
ã®ç®ç·ã§ãããã§ããã«ã³ãã¡ã¬ã³ã¹ã ãªããšããå°è±¡ã ã£ãã®ã ãããããã®æãã匷ãããããªããšã¹ã¿ããã«ãšã£ãŠãããã§ããã«ã³ãã¡ã¬ã³ã¹ãªã®ã§ããã + PHPerKaigi ã¯äžè¬åå è
ã®ç®ç·ã§ãããã§ããã«ã³ãã¡ã¬ã³ã¹ã ãªããšããå°è±¡ã ã£ãã®ã ãããããã®æãã匷ãããã ãªããšã¹ã¿ããã«ãšã£ãŠãããã§ããã«ã³ãã¡ã¬ã³ã¹ãªã®ã§ããã </p> - <p> - åçç¹ã¯ç§èªèº«ã®æå€§ HP ããŸã£ããè¶³ããŠããªãã£ãããšã§ãæ¬¡ã®æ©äŒã«ã¯æåŸãŸã§åããããã«ããããšããã§ããã + åçç¹ã¯ç§èªèº«ã®æå€§ HP ããŸã£ããè¶³ããŠããªãã£ãããšã§ãæ¬¡ã®æ©äŒã«ã¯æåŸãŸã§åããããã«ããããšããã§ããã </p> </section> - <section id="section--as-attendee"> - <h2><a href="#section--as-attendee">åå è
ãšããŠ</a></h2> + <h2><a href="#section--as-attendee">åå è
ãšããŠ</a></h2> <section id="section--as-attendee--recommended-sessions"> - <h3><a href="#section--as-attendee--recommended-sessions">ããããã»ãã·ã§ã³</a></h3> + <h3><a href="#section--as-attendee--recommended-sessions">ããããã»ãã·ã§ã³</a></h3> <p> - 5ã€ã®ã»ãã·ã§ã³ãå³éžããã + 5ã€ã®ã»ãã·ã§ã³ãå³éžããã </p> - <p> <a href="https://fortee.jp/phperkaigi-2023/proposal/f7f2f18a-e6b0-47e4-ade0-e324f72428ae" rel="noreferrer" target="_blank">ãã©ãŠã¶ã®åããåŽã§ã200 OKããè¿ããŸã§ã«äœãèµ·ããŠããã®ã調ã¹ãŠã¿ã</a> </p> - <p> - Web ã«é¢ãããªããããã¯ãšã³ãã§ãããã³ããšã³ãã§ãç¥ã£ãŠãããŠã»ããç¥èãã¿ã€ãã«ãèŠãŠããããªè©±ã ãããªããšæ³åãã€ãã¬ãã«ãªãèŠãªããŠãããããã + Web ã«é¢ãããªããããã¯ãšã³ãã§ãããã³ããšã³ãã§ãç¥ã£ãŠãããŠã»ããç¥èã ã¿ã€ãã«ãèŠãŠããããªè©±ã ãããªããšæ³åãã€ãã¬ãã«ãªãèŠãªããŠãããããã </p> - <p> - <a href="https://fortee.jp/phperkaigi-2023/proposal/280706e0-7158-4237-8202-c9d64330b96f" rel="noreferrer" target="_blank">PHPã§åŠã¶ "Cacheã®è·é¢" ã®è©±</a> + <a href="https://fortee.jp/phperkaigi-2023/proposal/280706e0-7158-4237-8202-c9d64330b96f" rel="noreferrer" target="_blank">PHPã§åŠã¶ âCacheã®è·é¢â ã®è©±</a> </p> - <p> - ãããäžã»ãã·ã§ã³ãšåæ§ã«ãåºç€ãæããããè¯ãã»ãã·ã§ã³ã + ãããäžã»ãã·ã§ã³ãšåæ§ã«ãåºç€ãæããããè¯ãã»ãã·ã§ã³ã </p> - <p> <a href="https://fortee.jp/phperkaigi-2023/proposal/ad3ba31c-0214-4557-a0df-3755db8ed8cc" rel="noreferrer" target="_blank">é²è¡ç PHP: 倿§æ§ãçãæãããã® PHP å
¥é</a> </p> - <p> - éçè§£æããŒã«ã®è©±ãéçè§£æã¯ PHP ã®ã¿ãªããæè¿ã®åçèšèªã®äžå€§æœ®æµãªã®ã§ãéããããªãã + éçè§£æããŒã«ã®è©±ãéçè§£æã¯ PHP ã®ã¿ãªããæè¿ã®åçèšèªã®äžå€§æœ®æµãªã®ã§ãéããããªãã </p> - <p> <a href="https://fortee.jp/phperkaigi-2023/proposal/e00788a4-ef25-49ee-b254-9d2b53e19633" rel="noreferrer" target="_blank">PHPã®æé«æ©èœãé
åãæšãŠããïŒïŒ</a> </p> - <p> - å®ã¯ãããäžã®ã»ãã·ã§ã³ãšåæ§ã®è©±ãPHP ã®éçè§£æããŒã«ã¯é
åã«ã (ç¡çç¢ç) åãä»ãããããã®ãå€ãããå®è¡æã«ãæ€æ»ã§ãããšããç¹ã«ãããŠå°çšã®ã¯ã©ã¹ãäœãæ¹ãåªããŠããã + å®ã¯ãããäžã®ã»ãã·ã§ã³ãšåæ§ã®è©±ã PHP ã®éçè§£æããŒã«ã¯é
åã«ã (ç¡çç¢ç) åãä»ãããããã®ãå€ãããå®è¡æã«ãæ€æ»ã§ãããšããç¹ã«ãããŠå°çšã®ã¯ã©ã¹ãäœãæ¹ãåªããŠããã </p> - <p> <a href="https://fortee.jp/phperkaigi-2023/proposal/7e212cb2-be37-43e8-b6ee-5236d259fcbf" rel="noreferrer" target="_blank">æéãæ°ã«ããæ®éã«ã«ã³ãã³ã°ããã€ã€ ISUCON12 æ¬éžåé¡ã PHP ã§ãã£ãŠã¿ã</a> </p> - <p> - å人çã«æãæ¥œãã¿ã«ããŠããã»ãã·ã§ã³ã§ãããä»åã®ã¢ãªã¢ã¬ãªããŒã¯è³ (çãäžãã£ãã»ãã·ã§ã³ã«éå¶åŽããèŽãããè³) ã§ãããããã¿ãã¬ã«ãªãããæçµçã« (Go ã§å®è£
ããã) æ¬æŠåªåã¹ã³ã¢ãè¶
ããŠããã + å人çã«æãæ¥œãã¿ã«ããŠããã»ãã·ã§ã³ã§ãããä»åã®ã¢ãªã¢ã¬ãªããŒã¯è³ (çãäžãã£ãã»ãã·ã§ã³ã«éå¶åŽããèŽãããè³) ã§ãããã ãã¿ãã¬ã«ãªãããæçµçã« (Go ã§å®è£
ããã) æ¬æŠåªåã¹ã³ã¢ãè¶
ããŠããã </p> </section> - <section id="section--as-attendee--phper-challenge"> - <h3><a href="#section--as-attendee--phper-challenge">PHPer ãã£ã¬ã³ãž</a></h3> + <h3><a href="#section--as-attendee--phper-challenge">PHPer ãã£ã¬ã³ãž</a></h3> <p> - æšå¹Žã«åŒãç¶ããåŒç€Ÿããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿããã®ããŒã¯ã³åé¡ã®äœé¡ãæ
åœããããŸããä»å¹Žã¯ããã«äœæããåé¡ã解説ããã»ãã·ã§ã³ã«ãç»å£ãããä»å¹Žã®ããŒã¯ã³ã¯ãæšå¹Žã® PHPerKaigi 2022 ãçµãã£ã段éããäœãå§ããçŽå幎ãããŠå¶äœããã + æšå¹Žã«åŒãç¶ããåŒç€Ÿããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿããã®ããŒã¯ã³åé¡ã®äœé¡ãæ
åœããã ãŸããä»å¹Žã¯ããã«äœæããåé¡ã解説ããã»ãã·ã§ã³ã«ãç»å£ããã ä»å¹Žã®ããŒã¯ã³ã¯ãæšå¹Žã® PHPerKaigi 2022 ãçµãã£ã段éããäœãå§ããçŽå幎ãããŠå¶äœããã </p> - <p> - åé¡ã®å¶äœäžã¯å€§å€æ¥œããã£ããããŸãããããããããã«è¶
çµ¶æå·§ãåãããã«æ³šåããŠããŸããè§£ãæ¥œãããšãã芳ç¹ã倱ã£ãŠããŸã£ãããããããã + åé¡ã®å¶äœäžã¯å€§å€æ¥œããã£ããããŸããããããã ããã«è¶
çµ¶æå·§ãåãããã«æ³šåããŠããŸããè§£ãæ¥œãããšãã芳ç¹ã倱ã£ãŠããŸã£ãããããããã </p> - <p> - (WIP: 解説ããã°èšäºå·çäžãçµãã£ããããã«ãªã³ã¯) + (WIP: 解説ããã°èšäºå·çäžãçµãã£ããããã«ãªã³ã¯) </p> </section> - <section id="section--as-attendee--random-thoughts"> - <h3><a href="#section--as-attendee--random-thoughts">éå€ãªææ³</a></h3> + <h3><a href="#section--as-attendee--random-thoughts">éå€ãªææ³</a></h3> <p> - ãªããããããã + ãªããããããã </p> - <ul> <li> ãã«ãã³ããããã£ã </li> - <li> \ïŸïŸïŸïŸïŸïœ°/ </li> - <li> åæäŸ¿å© </li> - <li> \ïŸïŸïŸïŸïŸïœ°/ </li> - <li> åè¢äŸ¿å© </li> - <li> \ïŸïŸïŸïŸïŸïœ°/ </li> - <li> ããŒã«ãŒã®ãã¶ã€ã³è¯ã </li> </ul> - <p> - (ããšããèŠè¿ããŠèªåã§ããããããããªããªããããªã®ã§æžããŠãããšãäŒå Žã«å
¥å Žããéã«åæãã¿ãããããšå°æ¡ãšãã³ããã®å£°ã§ãããããŒããšããé³å£°ãæµããã®ããã¯ããã£ã) + (ããšããèŠè¿ããŠèªåã§ããããããããªããªããããªã®ã§æžããŠãããšãäŒå Žã«å
¥å Žããéã«åæãã¿ãããããšå°æ¡ãšãã³ããã®å£°ã§ãããããŒããšããé³å£°ãæµããã®ããã¯ããã£ã) </p> </section> </section> - <section id="section--outro"> - <h2><a href="#section--outro">ãããã«</a></h2> + <h2><a href="#section--outro">ãããã«</a></h2> <p> - <a href="/posts/2022-05-01/phperkaigi-2022/#section--next-year">å»å¹Žã®åå ã¬ã</a>ã§ã¯ãæ¥å¹Žã®ç®æšãšããŠæ¬¡ãæããã + <a href="/posts/2022-05-01/phperkaigi-2022/#section--next-year">å»å¹Žã®åå ã¬ã</a> ã§ã¯ãæ¥å¹Žã®ç®æšãšããŠæ¬¡ãæããã </p> - <blockquote> <ul> <li> ããããŒã¶ã«ãåºã </li> - <li> PHPer ãã£ã¬ã³ãžã®ããŒã¯ã³åé¡ã 5é¡äœæãã </li> - <li> çŸå°ã«è¡ã </li> - <li> PHPer ãã£ã¬ã³ãžã§å§åãã </li> </ul> </blockquote> - <p> - ããããŒã¶ã«ã«é¢ããŠã¯æ¡æãããŠç»å£ã§ããããPHPer ãã£ã¬ã³ãžã¯è§£èª¬ããããªã£ãããŸããçŸå°ã«è¡ãã ãã§ãªããåœæ¥ã¹ã¿ãããšããŠåå ããã4ã€ç®ã® PHPer ãã£ã¬ã³ãžã«é¢ããŠã¯ãä»å¹Žã¯åå ããŠããªããã¹ã¿ããããããªããã ãšå
¥åããæéãæ¢ãæéãåãããã«ãªãã£ãã®ãšãã¹ã¿ããããã£ãŠããé¢ä¿ã§å°ãã ãæ©ãå
¥æããŠããŸãããŒã¯ã³ãããã€ãååšããŠããããã + ããããŒã¶ã«ã«é¢ããŠã¯æ¡æãããŠç»å£ã§ããããPHPer ãã£ã¬ã³ãžã¯è§£èª¬ããããªã£ãããŸããçŸå°ã«è¡ãã ãã§ãªããåœæ¥ã¹ã¿ãããšããŠåå ããã 4ã€ç®ã® PHPer ãã£ã¬ã³ãžã«é¢ããŠã¯ãä»å¹Žã¯åå ããŠããªãã ã¹ã¿ããããããªããã ãšå
¥åããæéãæ¢ãæéãåãããã«ãªãã£ãã®ãšãã¹ã¿ããããã£ãŠããé¢ä¿ã§å°ãã ãæ©ãå
¥æããŠããŸãããŒã¯ã³ãããã€ãååšããŠããããã </p> - <p> - ã«ã³ãã¡ã¬ã³ã¹å
šäœã®ææ³ã«ã€ããŠã ããå€§èŠæš¡ãªã«ã³ãã¡ã¬ã³ã¹ã«ãªãã©ã€ã³ã§åå ããã®ã¯ä»åãåããŠã ã£ãã®ã§ããã®è©±ããããã + ã«ã³ãã¡ã¬ã³ã¹å
šäœã®ææ³ã«ã€ããŠã ããå€§èŠæš¡ãªã«ã³ãã¡ã¬ã³ã¹ã«ãªãã©ã€ã³ã§åå ããã®ã¯ä»åãåããŠã ã£ãã®ã§ããã®è©±ããããã </p> - <p> - ãªã³ã©ã€ã³ãšãªãã©ã€ã³ã ãšäœéšãå¥ç©ã«ãªããããããã䌌ãŠéãªããã®ãªã®ã ãåãäžåãã¯ããã ãããããªã³ã©ã€ã³ããåå ããããšã®ãªããšããæ¹ã¯ãäžåºŠçŸå°åå ããŠã¿ãŠã¯ãããã ãããã + ãªã³ã©ã€ã³ãšãªãã©ã€ã³ã ãšäœéšãå¥ç©ã«ãªããããããã䌌ãŠéãªããã®ãªã®ã ã åãäžåãã¯ããã ãããããªã³ã©ã€ã³ããåå ããããšã®ãªããšããæ¹ã¯ãäžåºŠçŸå°åå ããŠã¿ãŠã¯ãããã ãããã </p> - <p> - ããŠãåå ã¬ãã¯å»å¹Žãäžæšå¹Žããã®èšèã§ç· ãæ¬ã£ãŠããã®ã§ãä»å¹Žãããã§çµããããšæãã + ããŠãåå ã¬ãã¯å»å¹Žãäžæšå¹Žããã®èšèã§ç· ãæ¬ã£ãŠããã®ã§ãä»å¹Žãããã§çµããããšæãã </p> - <p> - ã§ã¯ãŸãæ¥å¹Žã + ã§ã¯ãŸãæ¥å¹Žã </p> </section> </div> diff --git a/vhosts/blog/public/posts/2023-06-25/phpconfuk-2023-report/index.html b/vhosts/blog/public/posts/2023-06-25/phpconfuk-2023-report/index.html index 8e2d179f..3a60d442 100644 --- a/vhosts/blog/public/posts/2023-06-25/phpconfuk-2023-report/index.html +++ b/vhosts/blog/public/posts/2023-06-25/phpconfuk-2023-report/index.html @@ -64,95 +64,97 @@ </ol> </section> <section id="section--intro"> - <h2><a href="#section--intro">ã¯ããã«</a></h2> + <h2><a href="#section--intro">ã¯ããã«</a></h2> <p> - 2023-06-24 ã«éå¬ãããã<a href="https://phpcon.fukuoka.jp/2023/" rel="noreferrer" target="_blank">PHP ã«ã³ãã¡ã¬ã³ã¹çŠå²¡ 2023</a>ã«åå ããããŸãããã®åæ¥ã«å¬ãããã<a href="https://connpass.com/event/282285/" rel="noreferrer" target="_blank">éå
¬åŒã®åå€ç¥</a>ã«ãåå ãããåå€ç¥ã§ã¯ã15åã®ç»å£ããããªã£ãã<a href="/slides/2023-06-23/phpconfuk-2023-eve/">ç»å£ã®æ¹ã®è³æã¯ãã¡ãã</a> + 2023-06-24 ã«éå¬ãããã <a href="https://phpcon.fukuoka.jp/2023/" rel="noreferrer" target="_blank">PHP ã«ã³ãã¡ã¬ã³ã¹çŠå²¡ 2023</a> ã«åå ããã ãŸãããã®åæ¥ã«å¬ãããã <a href="https://connpass.com/event/282285/" rel="noreferrer" target="_blank">éå
¬åŒã®åå€ç¥</a> ã«ãåå ããã åå€ç¥ã§ã¯ã15åã®ç»å£ããããªã£ãã <a href="/slides/2023-06-23/phpconfuk-2023-eve/">ç»å£ã®æ¹ã®è³æã¯ãã¡ãã</a> </p> </section> - <section id="section--sessions-thoughts"> - <h2><a href="#section--sessions-thoughts">ã»ãã·ã§ã³ã®ææ³</a></h2> + <h2><a href="#section--sessions-thoughts">ã»ãã·ã§ã³ã®ææ³</a></h2> <section id="section--sessions-thoughts--eve"> - <h3><a href="#section--sessions-thoughts--eve">åå€ç¥</a></h3> + <h3><a href="#section--sessions-thoughts--eve">åå€ç¥</a></h3> <p> - â»ã»ãã·ã§ã³ã®é¡åãšçºè¡šè
åã¯ã<a href="https://connpass.com/event/282285/" rel="noreferrer" target="_blank">åå€ç¥ã€ãã³ãã® connpass ããŒãž</a>ããåŒçšã + â»ã»ãã·ã§ã³ã®é¡åãšçºè¡šè
åã¯ã <a href="https://connpass.com/event/282285/" rel="noreferrer" target="_blank">åå€ç¥ã€ãã³ãã® connpass ããŒãž</a> ããåŒçšã </p> - <ul> <li> - ã¹ã¯ã©ã ïŒã®äžéšïŒãå°å
¥ããŠãããªã£ãããš (asumikam ãã) + <p> + ã¹ã¯ã©ã ïŒã®äžéšïŒãå°å
¥ããŠãããªã£ãããš (asumikam ãã) + </p> <ul> <li> - ã¹ã¯ã©ã ã®ãäžéšããå°å
¥ããããšããããšã§ããããçæ³çãªåœ¢ã§æ¹åãé²ãã§ããããã«èŠåããããŸãããç¹ã«ããã©ã³ãéçšããããã€é »åºŠããã£ãŒãããã¯ãµã€ã¯ã«ã«å€§ããå€åãèµ·ããŠããã®ã¯é©ãã¹ãææã ãšæããŸããã + ã¹ã¯ã©ã ã®ãäžéšããå°å
¥ããããšããããšã§ããããçæ³çãªåœ¢ã§æ¹åãé²ãã§ããããã«èŠåããããŸãããç¹ã«ããã©ã³ãéçšããããã€é »åºŠããã£ãŒãããã¯ãµã€ã¯ã«ã«å€§ããå€åãèµ·ããŠããã®ã¯é©ãã¹ãææã ãšæããŸããã </li> </ul> </li> - <li> - å°æ¹ã®å°ããªå匷äŒãäžçªã®æŽ»åèå°ã«ãã (tomio ãã) + <p> + å°æ¹ã®å°ããªå匷äŒãäžçªã®æŽ»åèå°ã«ãã (tomio ãã) + </p> <ul> <li> - ãããŸããã»ã©ã®ãç±ããæããŸãããç§èªèº«ãæè¿ã«ãªã£ãŠã«ã³ãã¡ã¬ã³ã¹ãå匷äŒãžã®åå ã»ç»å£ã掻çºã«ãããªãããã«ãªã£ãããšã§ãé ·ãç¹ãå€ãã£ãã§ãã + ãããŸããã»ã©ã®ãç±ããæããŸãããç§èªèº«ãæè¿ã«ãªã£ãŠã«ã³ãã¡ã¬ã³ã¹ãå匷äŒãžã®åå ã»ç»å£ã掻çºã«ãããªãããã«ãªã£ãããšã§ãé ·ãç¹ãå€ãã£ãã§ãã </li> </ul> </li> </ul> </section> - <section id="section--sessions-thoughts--conference"> - <h3><a href="#section--sessions-thoughts--conference">ã«ã³ãã¡ã¬ã³ã¹</a></h3> + <h3><a href="#section--sessions-thoughts--conference">ã«ã³ãã¡ã¬ã³ã¹</a></h3> <p> - â»ã»ãã·ã§ã³ã®é¡åãšçºè¡šè
åã¯ã<a href="https://fortee.jp/phpconfukuoka-2023/proposal/accepted" rel="noreferrer" target="_blank">ã«ã³ãã¡ã¬ã³ã¹ã® fortee ããŒãž</a>ããåŒçšã + â»ã»ãã·ã§ã³ã®é¡åãšçºè¡šè
åã¯ã <a href="https://fortee.jp/phpconfukuoka-2023/proposal/accepted" rel="noreferrer" target="_blank">ã«ã³ãã¡ã¬ã³ã¹ã® fortee ããŒãž</a> ããåŒçšã </p> - <ul> <li> - <a href="https://fortee.jp/phpconfukuoka-2023/proposal/df5f06e8-900e-4e71-94d7-d0c3cc57a0ac" rel="noreferrer" target="_blank">è²æå - ãšã³ãžãã¢ã®æèœãåŒãåºãç°å¢ãšãã¥ãŒã¿ãŒã®ç«ã¡åã - (å²¡åµ éå¹³ ãã)</a> + <p> + <a href="https://fortee.jp/phpconfukuoka-2023/proposal/df5f06e8-900e-4e71-94d7-d0c3cc57a0ac" rel="noreferrer" target="_blank">è²æå - ãšã³ãžãã¢ã®æèœãåŒãåºãç°å¢ãšãã¥ãŒã¿ãŒã®ç«ã¡åã - (å²¡åµ éå¹³ ãã)</a> + </p> <ul> <li> - ã¡ããã©åŒããŒã ã«æ°èŠã¡ã³ãããžã§ã€ã³ããã°ããã§ããªã³ããŒãã£ã³ã°ããã»ã¹ã«ã€ããŠèããŠãããšããã®çºè¡šã§ãããããã«ãã¹ãŠãåãå
¥ãããšããããã«ã¯ãããŸããããåŒç€Ÿã§ã®æ°äººè²æããã»ã¹ã®æ¹åã«ã€ãªãããã³ããããã€ãåŸããããšæããŸãã + ã¡ããã©åŒããŒã ã«æ°èŠã¡ã³ãããžã§ã€ã³ããã°ããã§ããªã³ããŒãã£ã³ã°ããã»ã¹ã«ã€ããŠèããŠãããšããã®çºè¡šã§ãããããã«ãã¹ãŠãåãå
¥ãããšããããã«ã¯ãããŸããããåŒç€Ÿã§ã®æ°äººè²æããã»ã¹ã®æ¹åã«ã€ãªãããã³ããããã€ãåŸããããšæããŸãã </li> </ul> </li> - <li> - ãªããžã§ã¯ãæåã¯æ¬åœã«å¿
èŠãïŒ (ããªãã²ããŠã ãããããã»ã ãã) + <p> + ãªããžã§ã¯ãæåã¯æ¬åœã«å¿
èŠãïŒ (ããªãã²ããŠã ãããããã»ã ãã) + </p> <ul> <li> - â»åœæ¥ D ããŒã«ã§ãããªãããã¢ã³ã«ã³ãã¡ã¬ã³ã¹ã»ãã·ã§ã³ã®ãããæ£åŒã¿ã€ãã«ã»ãªã³ã¯ãªã + â»åœæ¥ D ããŒã«ã§ãããªãããã¢ã³ã«ã³ãã¡ã¬ã³ã¹ã»ãã·ã§ã³ã®ãããæ£åŒã¿ã€ãã«ã»ãªã³ã¯ãªã </li> - <li> - ç§èªèº«ãããªããžã§ã¯ãæåãã«ã€ããŠã¯è²ã
ãšèšãããããšãããã®ã§ãããã ããããã€ãŒããããããšããã§ãã + <p> + ç§èªèº«ãããªããžã§ã¯ãæåãã«ã€ããŠã¯è²ã
ãšèšãããããšãããã®ã§ãããã ããããã€ãŒããããããšããã§ãã + </p> <ul> <li> - ããªããžã§ã¯ãæåã®è©±ã¯ããã©ãã€ã ã®ç°ãªãè€æ°ã®èšèªã«è§ŠããŠãããã©ããã§èŠãæ¹ããŸã£ããç°ãªãå°è±¡ããããOOPã¯ã©ãã§ãããã§ã (â»åäººã®ææ³ã§ã)ã (<a href="https://twitter.com/nsfisis/status/1672502935983656960" rel="noreferrer" target="_blank">Twitter ã®ãã€ãŒããžã®ãªã³ã¯</a>) + ããªããžã§ã¯ãæåã®è©±ã¯ããã©ãã€ã ã®ç°ãªãè€æ°ã®èšèªã«è§ŠããŠãããã©ããã§èŠãæ¹ããŸã£ããç°ãªãå°è±¡ããããOOPã¯ã©ãã§ãããã§ã (â»åäººã®ææ³ã§ã)ã ( <a href="https://twitter.com/nsfisis/status/1672502935983656960" rel="noreferrer" target="_blank">Twitter ã®ãã€ãŒããžã®ãªã³ã¯</a> ) </li> - <li> - ãOOPã¯çŸä»£ã®èšèªã§èããæå³ã¯ã»ãŒãªãå€ããã©ãã€ã ã ããšããç«å Žã§ãããOOPã«ã€ããŠããŸã倧ã£ãŽãã«è©±ããŠããšè²ããªãšããããåºãããããªãã§ããã (Twitterã¯å€§ã£ãŽããããªããã§ããïŒ)ã (<a href="https://twitter.com/nsfisis/status/1672504892244787201" rel="noreferrer" target="_blank">Twitter ã®ãã€ãŒããžã®ãªã³ã¯</a>) + ãOOPã¯çŸä»£ã®èšèªã§èããæå³ã¯ã»ãŒãªãå€ããã©ãã€ã ã ããšããç«å Žã§ãããOOPã«ã€ããŠããŸã倧ã£ãŽãã«è©±ããŠããšè²ããªãšããããåºãããããªãã§ããã (Twitterã¯å€§ã£ãŽããããªããã§ããïŒ)ã ( <a href="https://twitter.com/nsfisis/status/1672504892244787201" rel="noreferrer" target="_blank">Twitter ã®ãã€ãŒããžã®ãªã³ã¯</a> ) </li> </ul> </li> </ul> </li> - <li> - <a href="https://fortee.jp/phpconfukuoka-2023/proposal/ae71f3a7-4c3c-4c87-8816-8426bcc8d325" rel="noreferrer" target="_blank">ãã®èª¬æãã³ãŒãã³ã¡ã³ãã«æžãïŒã³ãããã¡ãã»ãŒãžã«æžãïŒãã«ãªã¯ãšã¹ãã«æžãïŒ (ãããããïŒå²¡ç°æ£å¹³ ãã)</a> + <p> + <a href="https://fortee.jp/phpconfukuoka-2023/proposal/ae71f3a7-4c3c-4c87-8816-8426bcc8d325" rel="noreferrer" target="_blank">ãã®èª¬æãã³ãŒãã³ã¡ã³ãã«æžãïŒã³ãããã¡ãã»ãŒãžã«æžãïŒãã«ãªã¯ãšã¹ãã«æžãïŒ (ãããããïŒå²¡ç°æ£å¹³ ãã)</a> + </p> <ul> <li> - Twitter ã«ããã€ãŒãããŸããããå®å
šã«èªåã®æèŠãšäžèŽããŠããã®ã§ããšãŠãå
±æã§ããŸãããä»åŸã¯ç€Ÿå
ã®ã³ãŒãã¬ãã¥ãŒæã«ããã¡ãã®è³æã貌ãã€ããããšã«ããŸãã + Twitter ã«ããã€ãŒãããŸããããå®å
šã«èªåã®æèŠãšäžèŽããŠããã®ã§ããšãŠãå
±æã§ããŸãããä»åŸã¯ç€Ÿå
ã®ã³ãŒãã¬ãã¥ãŒæã«ããã¡ãã®è³æã貌ãã€ããããšã«ããŸãã </li> </ul> </li> </ul> </section> </section> - <section id="section--outro"> - <h2><a href="#section--outro">ãããã«</a></h2> + <h2><a href="#section--outro">ãããã«</a></h2> <p> - å±
äœå°åããé¢ããå Žæãžã®é åŸåå ã¯åããŠã ã£ããã倧倿¥œãã (ãããå匷ã«ããªãïŒ) äœéšã ã£ããåãåã£ããç±ããå·ããåã«ãèªãã®æãåãããŠããããã + å±
äœå°åããé¢ããå Žæãžã®é åŸåå ã¯åããŠã ã£ããã倧倿¥œãã (ãããå匷ã«ããªãïŒ) äœéšã ã£ãã åãåã£ããç±ããå·ããåã«ãèªãã®æãåãããŠããããã </p> </section> </div> diff --git a/vhosts/blog/public/posts/2023-10-02/compile-php-runtime-to-wasm/index.html b/vhosts/blog/public/posts/2023-10-02/compile-php-runtime-to-wasm/index.html index 35252f62..7fa0ebe4 100644 --- a/vhosts/blog/public/posts/2023-10-02/compile-php-runtime-to-wasm/index.html +++ b/vhosts/blog/public/posts/2023-10-02/compile-php-runtime-to-wasm/index.html @@ -61,55 +61,45 @@ </ol> </section> <section id="section--intro"> - <h2><a href="#section--intro">ã¯ããã«</a></h2> + <h2><a href="#section--intro">ã¯ããã«</a></h2> <p> - <a href="https://emscripten.org/" rel="noreferrer" target="_blank">Emscripten</a> ãçšã㊠<a href="https://github.com/php/php-src" rel="noreferrer" target="_blank">PHP ã®åŠçç³»</a>ã <a href="https://developer.mozilla.org/docs/WebAssembly" rel="noreferrer" target="_blank">WebAssembly</a> ã«ã³ã³ãã€ã«ãããæ©èœãããçšåºŠçµãããšã§ãæã£ããããç°¡åã«å®çŸã§ããã®ã§ãåå¿é²ãšããŠèšããŠããã + <a href="https://emscripten.org/" rel="noreferrer" target="_blank">Emscripten</a> ãçšã㊠<a href="https://github.com/php/php-src" rel="noreferrer" target="_blank">PHP ã®åŠçç³»</a> ã <a href="https://developer.mozilla.org/docs/WebAssembly" rel="noreferrer" target="_blank">WebAssembly</a> ã«ã³ã³ãã€ã«ãããæ©èœãããçšåºŠçµãããšã§ãæã£ããããç°¡åã«å®çŸã§ããã®ã§ãåå¿é²ãšããŠèšããŠããã </p> - <p> - ãªãããã®èšäºã§ã¯ Emscripten ã WebAssembly ãšã¯äœãç¥ã£ãŠããããšãåæãšããã + ãªãããã®èšäºã§ã¯ Emscripten ã WebAssembly ãšã¯äœãç¥ã£ãŠããããšãåæãšããã </p> </section> - <section id="section--version"> - <h2><a href="#section--version">ããŒãžã§ã³æ
å ±</a></h2> + <h2><a href="#section--version">ããŒãžã§ã³æ
å ±</a></h2> <p> - ãã®èšäºäžã§äœ¿çšãããœãããŠã§ã¢çã®ããŒãžã§ã³ãèšèŒããã + ãã®èšäºäžã§äœ¿çšãããœãããŠã§ã¢çã®ããŒãžã§ã³ãèšèŒããã </p> - <ul> <li> Ubuntu 22.04 on WSL2 </li> - <li> Docker version 24.0.6 </li> - <li> Emscripten 3.1.46 </li> - <li> Node.js 20.7.0 </li> - <li> PHP 8.2.10 </li> </ul> - <p> - ãªããDocker ããäžã¯ Docker äžã§å°å
¥ããã®ã§ããã¹ããã·ã³ã«ã¯ã€ã³ã¹ããŒã«ããªããŠããã + ãªããDocker ããäžã¯ Docker äžã§å°å
¥ããã®ã§ããã¹ããã·ã³ã«ã¯ã€ã³ã¹ããŒã«ããªããŠããã </p> </section> - <section id="section--goal"> - <h2><a href="#section--goal">æ¬èšäºã®ãŽãŒã«</a></h2> + <h2><a href="#section--goal">æ¬èšäºã®ãŽãŒã«</a></h2> <p> - å
ã«ãã®èšäºã®ãŽãŒã«ã瀺ããŠããããããã瀺ãæé ã®ãšããã«é²ãããšã次ã®ãããªã³ãŒããåãããã«ãªãããã®ã³ãŒãã¯ãã®ããšäœ¿ãã®ã§ã<code>index.mjs</code> ã®ååã§ä¿åããŠããããšã + å
ã«ãã®èšäºã®ãŽãŒã«ã瀺ããŠããããããã瀺ãæé ã®ãšããã«é²ãããšã次ã®ãããªã³ãŒããåãããã«ãªãã ãã®ã³ãŒãã¯ãã®ããšäœ¿ãã®ã§ã<code>index.mjs</code> ã®ååã§ä¿åããŠããããšã </p> - <div class="codeblock" language="javascript"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49">import</span><span style="color:#24292E"> { readFile } </span><span style="color:#D73A49">from</span><span style="color:#032F62"> 'node:fs/promises'</span><span style="color:#24292E">;</span></span> <span class="line"><span style="color:#D73A49">import</span><span style="color:#24292E"> PHPWasm </span><span style="color:#D73A49">from</span><span style="color:#032F62"> './php-wasm.mjs'</span></span> @@ -124,20 +114,17 @@ <span class="line"><span style="color:#24292E">);</span></span> <span class="line"><span style="color:#24292E">console.</span><span style="color:#6F42C1">log</span><span style="color:#24292E">(</span><span style="color:#032F62">`exit code: ${</span><span style="color:#24292E">result</span><span style="color:#032F62">}`</span><span style="color:#24292E">);</span></span></code></pre> </div> - <p> - æšæºå
¥åããäžããã³ãŒãã WebAssembly ã«ã³ã³ãã€ã«ããã PHP åŠçç³»ã®äžã§å®è¡ããŠããããã®ãã㪠<code>php-wasm.mjs</code> (ãšããããåŒã³åºããã <code>php-wasm.wasm</code>) ãäœæããã + æšæºå
¥åããäžããã³ãŒãã WebAssembly ã«ã³ã³ãã€ã«ããã PHP åŠçç³»ã®äžã§å®è¡ããŠããããã®ãã㪠<code>php-wasm.mjs</code> (ãšããããåŒã³åºããã <code>php-wasm.wasm</code>) ãäœæããã </p> </section> - <section id="section--build"> - <h2><a href="#section--build">ãã«ã</a></h2> + <h2><a href="#section--build">ãã«ã</a></h2> <section id="section--build--write-c-entrypoint"> - <h3><a href="#section--build--write-c-entrypoint">C ã®ãšã³ããªãã€ã³ããæžã</a></h3> + <h3><a href="#section--build--write-c-entrypoint">C ã®ãšã³ããªãã€ã³ããæžã</a></h3> <p> - å
ã»ã©ã®ã³ãŒãã§ã䜿ã£ãŠãããšã³ããªãã€ã³ãã§ãã <code>php_wasm_run</code> ãçšæããã + å
ã»ã©ã®ã³ãŒãã§ã䜿ã£ãŠãããšã³ããªãã€ã³ãã§ãã <code>php_wasm_run</code> ãçšæããã </p> - <div class="codeblock" language="c"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49">#include</span><span style="color:#032F62"> <stdio.h></span></span> <span class="line"><span style="color:#D73A49">#include</span><span style="color:#032F62"> <emscripten.h></span></span> @@ -164,38 +151,30 @@ <span class="line"><span style="color:#D73A49"> return</span><span style="color:#24292E"> result </span><span style="color:#D73A49">==</span><span style="color:#24292E"> SUCCESS </span><span style="color:#D73A49">?</span><span style="color:#005CC5"> 0</span><span style="color:#D73A49"> :</span><span style="color:#005CC5"> 1</span><span style="color:#24292E">;</span></span> <span class="line"><span style="color:#24292E">}</span></span></code></pre> </div> - <p> - ã»ãšãã©ã¯ãã ã® PHP ã®å
¬é API ã䜿ã£ãã³ãŒãã ããEmscripten åãã®æ³šæç¹ã 2ç¹ããã + ã»ãšãã©ã¯ãã ã® PHP ã®å
¬é API ã䜿ã£ãã³ãŒãã ããEmscripten åãã®æ³šæç¹ã 2ç¹ããã </p> - <p> - ãŸã㯠<code>EMSCRIPTEN_KEEPALIVE</code> ã«ã€ããŠããã㯠Emscripten ãçšæããŠããç¹æ®ãªãã¯ãã§ããããã®ãã¯ããä»äžãããŠãã颿°ã¯ãã©ãããã䜿çšãããŠããªããšãã³ã³ãã€ã«åŸã® WebAssembly ãã€ããªããåé€ãããªãããããããä»ãå¿ãããšãæªäœ¿çšã®é¢æ°ãšã¿ãªããåé€ãããã + ãŸã㯠<code>EMSCRIPTEN_KEEPALIVE</code> ã«ã€ããŠã ãã㯠Emscripten ãçšæããŠããç¹æ®ãªãã¯ãã§ããã ãã®ãã¯ããä»äžãããŠãã颿°ã¯ãã©ãããã䜿çšãããŠããªããšãã³ã³ãã€ã«åŸã® WebAssembly ãã€ããªããåé€ãããªãã ãããããä»ãå¿ãããšãæªäœ¿çšã®é¢æ°ãšã¿ãªããåé€ãããã </p> - <p> - 次ã«ãã³ãŒããè©äŸ¡ããããšã«åŒãã§ããæšæºåºåãšæšæºãšã©ãŒåºåã«å¯Ÿããæ¹è¡ã®åºåã«ã€ããŠãåºåãããã¡ããåºåãããããã ããªãæ¹è¡ãåºåãããªããšã <code>fflush()</code> ã ãã§äºè¶³ãããšèããã®ã ãããªããšåããªãã£ãã®ã§è¿œå ãããããã«ãããPHP ã³ãŒãã®åºåã®åŸãã«äœåãªæ¹è¡ã远å ãããŠããŸããæ¹è¡ãåºåãããšããããã¡ãæ¶è²»ãããææ®µããåç¥ã®ããã¯ãæç€ºé¡ãããã + 次ã«ãã³ãŒããè©äŸ¡ããããšã«åŒãã§ããæšæºåºåãšæšæºãšã©ãŒåºåã«å¯Ÿããæ¹è¡ã®åºåã«ã€ããŠã åºåãããã¡ããåºåãããããã ããªãæ¹è¡ãåºåãããªããšã <code>fflush()</code> ã ãã§äºè¶³ãããšèããã®ã ãããªããšåããªãã£ãã®ã§è¿œå ããã ããã«ãããPHP ã³ãŒãã®åºåã®åŸãã«äœåãªæ¹è¡ã远å ãããŠããŸãã æ¹è¡ãåºåãããšããããã¡ãæ¶è²»ãããææ®µããåç¥ã®ããã¯ãæç€ºé¡ãããã </p> </section> - <section id="section--build--compile-to-wasm"> - <h3><a href="#section--build--compile-to-wasm">WebAssembly ã«ã³ã³ãã€ã«ãã</a></h3> + <h3><a href="#section--build--compile-to-wasm">WebAssembly ã«ã³ã³ãã€ã«ãã</a></h3> <p> - ããã§ã¯ WebAssembly ã«ã³ã³ãã€ã«ããŠãããããããã㯠<code>Dockerfile</code> äžã®ã³ãã³ããšããŠæäœã瀺ãã + ããã§ã¯ WebAssembly ã«ã³ã³ãã€ã«ããŠãããããããã㯠<code>Dockerfile</code> äžã®ã³ãã³ããšããŠæäœã瀺ãã </p> - <p> - ãŸã㯠<a href="https://hub.docker.com/r/emscripten/emsdk" rel="noreferrer" target="_blank">Emscripten å
¬åŒãæäŸããŠãã Docker ã€ã¡ãŒãž</a>ã䜿ã£ãŠãPHP åŠçç³»ãšå
ã»ã©ç€ºãã C èšèªã®ãœãŒã¹ã³ãŒãã WebAssembly ã«ã³ã³ãã€ã«ããã + ãŸã㯠<a href="https://hub.docker.com/r/emscripten/emsdk" rel="noreferrer" target="_blank">Emscripten å
¬åŒãæäŸããŠãã Docker ã€ã¡ãŒãž</a> ã䜿ã£ãŠãPHP åŠçç³»ãšå
ã»ã©ç€ºãã C èšèªã®ãœãŒã¹ã³ãŒãã WebAssembly ã«ã³ã³ãã€ã«ããã </p> - <div class="codeblock" language="dockerfile"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49">FROM</span><span style="color:#24292E"> emscripten/emsdk:3.1.46 </span><span style="color:#D73A49">AS</span><span style="color:#24292E"> wasm-builder</span></span></code></pre> </div> - <p> - 次ã«ã<a href="https://github.com/php/php-src" rel="noreferrer" target="_blank">php/php-src</a> ãã PHP åŠçç³»ã®ãœãŒã¹ã³ãŒããååŸãããã«ãã«å¿
èŠãª apt ããã±ãŒãžãåã£ãŠãããæå¹ã«ããæ¡åŒµãå¢ãããããªããããã§ã€ã³ã¹ããŒã«ããããã±ãŒãžãå¢ããããšã«ãªãã ããã + 次ã«ã <a href="https://github.com/php/php-src" rel="noreferrer" target="_blank">php/php-src</a> ãã PHP åŠçç³»ã®ãœãŒã¹ã³ãŒããååŸãããã«ãã«å¿
èŠãª apt ããã±ãŒãžãåã£ãŠããã æå¹ã«ããæ¡åŒµãå¢ãããããªããããã§ã€ã³ã¹ããŒã«ããããã±ãŒãžãå¢ããããšã«ãªãã ããã </p> - <div class="codeblock" language="dockerfile"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49">RUN</span><span style="color:#24292E"> git clone --depth=1 --branch=php-8.2.10 https://github.com/php/php-src</span></span> <span class="line"></span> @@ -208,11 +187,9 @@ <span class="line"><span style="color:#24292E"> && \</span></span> <span class="line"><span style="color:#24292E"> :</span></span></code></pre> </div> - <p> - ç¶ããŠãEmscripten ã®ããŒã«ãã§ã€ã³ãçšã㊠PHP åŠçç³»ããã«ãããã + ç¶ããŠãEmscripten ã®ããŒã«ãã§ã€ã³ãçšã㊠PHP åŠçç³»ããã«ãããã </p> - <div class="codeblock" language="dockerfile"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49">RUN</span><span style="color:#24292E"> cd php-src && \</span></span> <span class="line"><span style="color:#24292E"> ./buildconf --force && \</span></span> @@ -237,35 +214,27 @@ <span class="line"><span style="color:#24292E"> git clean -fd && \</span></span> <span class="line"><span style="color:#24292E"> :</span></span></code></pre> </div> - <p> - ãããŸã§ãšæ¯ã¹ããšå°ãè€éãªã®ã§ããããã詳ããèŠãŠãããã + ãããŸã§ãšæ¯ã¹ããšå°ãè€éãªã®ã§ããããã詳ããèŠãŠãããã </p> - <p> - ãŸãã<code>buildconf</code> 㯠PHP åŠçç³»ããã«ããããšãã« (Emscripten ãšã¯é¢ä¿ãªã) 䜿ãããŒã«ã§ããããã®ããŒã«ã®æãéèŠãªä»äºã¯ã<code>configure</code> ã®çæã§ããã + ãŸãã<code>buildconf</code> 㯠PHP åŠçç³»ããã«ããããšãã« (Emscripten ãšã¯é¢ä¿ãªã) 䜿ãããŒã«ã§ããã ãã®ããŒã«ã®æãéèŠãªä»äºã¯ã<code>configure</code> ã®çæã§ããã </p> - <p> - 次㫠<code>configure</code> ããããã ããããã§ <code>emconfigure</code> ã䜿ããããã䜿ãããšã§ãEmscripten ãäžæã諞ã
ã®ããŒã«ãã§ã€ã³ã WebAssembly ã®ãã«ãåãã«èª¿æŽããªãã <code>configure</code> ããŠãããã + 次㫠<code>configure</code> ããããã ããããã§ <code>emconfigure</code> ã䜿ãã ããã䜿ãããšã§ãEmscripten ãäžæã諞ã
ã®ããŒã«ãã§ã€ã³ã WebAssembly ã®ãã«ãåãã«èª¿æŽããªãã <code>configure</code> ããŠãããã </p> - <p> - <code>configure</code> ã®åŸãã«æå®ããŠãããã©ã°ã¯ãéåžžã® PHP åŠçç³»ã®ãã«ãã§äœ¿ã <code>configure</code> ãšåããªã®ã§ã詳ããã¯ãã¡ãã® <code>cofigure --help</code> ãåç
§ããŠããã ããããã»ãšãã©ã¯ãæ©èœã®ç¡å¹åã®ããã«æå®ããŠãã (äŸåããã©ã€ãã©ãªãæžããããã«ããããç°¡åã«ãããã)ã + <code>configure</code> ã®åŸãã«æå®ããŠãããã©ã°ã¯ãéåžžã® PHP åŠçç³»ã®ãã«ãã§äœ¿ã <code>configure</code> ãšåããªã®ã§ã詳ããã¯ãã¡ãã® <code>cofigure --help</code> ãåç
§ããŠããã ãããã ã»ãšãã©ã¯ãæ©èœã®ç¡å¹åã®ããã«æå®ããŠãã (äŸåããã©ã€ãã©ãªãæžããããã«ããããç°¡åã«ãããã)ã </p> - <p> - éåžžã® C ã®ãã«ããªãã<code>configure</code> ã®æ¬¡ã¯ <code>make</code> ãããšããã ããããã§ã <code>emmake</code> ã䜿ãã圹å²ã¯ã»ãšãã© <code>emconfigure</code> ãšåæ§ã§ãããæå®ããŠãã <code>EMCC_CFLAGS</code> ãšããç°å¢å€æ°ã¯ãEmscripten ã® C ã³ã³ãã€ã©ãžã®ãã©ã°ã§ãããã§ã¯ <code>ERROR_ON_UNDEFINED_SYMBOLS</code> ãç¡å¹åããŠãããããã«ãããã³ã³ãã€ã«äžã«åºçŸãã解決ã§ããªãã£ãã·ã³ãã«ãç¡èŠããããã«ãªã (代ããã«ããã®ã·ã³ãã«ãåŒãŒããšããã¿ã€ãã³ã°ã§å®è¡æãšã©ãŒã«ãªã)ããã¹ãŠã®äŸåãå®å
šã«è§£æ±ºããã®ã¯é¢åãªã®ã§ãããŸã䜿ããªãæ©èœã«ã€ããŠã¯ç¡èŠããŠãããã ããã + éåžžã® C ã®ãã«ããªãã<code>configure</code> ã®æ¬¡ã¯ <code>make</code> ãããšããã ããããã§ã <code>emmake</code> ã䜿ãã 圹å²ã¯ã»ãšãã© <code>emconfigure</code> ãšåæ§ã§ããã æå®ããŠãã <code>EMCC_CFLAGS</code> ãšããç°å¢å€æ°ã¯ãEmscripten ã® C ã³ã³ãã€ã©ãžã®ãã©ã°ã§ãããã§ã¯ <code>ERROR_ON_UNDEFINED_SYMBOLS</code> ãç¡å¹åããŠããã ããã«ãããã³ã³ãã€ã«äžã«åºçŸãã解決ã§ããªãã£ãã·ã³ãã«ãç¡èŠããããã«ãªã (代ããã«ããã®ã·ã³ãã«ãåŒãŒããšããã¿ã€ãã³ã°ã§å®è¡æãšã©ãŒã«ãªã)ã ãã¹ãŠã®äŸåãå®å
šã«è§£æ±ºããã®ã¯é¢åãªã®ã§ãããŸã䜿ããªãæ©èœã«ã€ããŠã¯ç¡èŠããŠãããã ããã </p> - <p> - ãããŸã§ãå®è¡ãããš <code>libs/libphp.a</code> ãçæããããããã¯åŸã§äœ¿ãã®ã§ç§»åãããŠããã + ãããŸã§ãå®è¡ãããš <code>libs/libphp.a</code> ãçæããããããã¯åŸã§äœ¿ãã®ã§ç§»åãããŠããã </p> - <p> - ããŠãPHP åŠçç³»ãã©ã€ãã©ãªåã§ããã®ã§ã次ã«å
ã»ã©èŒãã C ã®ãœãŒã¹ã³ãŒãããã«ãããŠãããã<code>Dockerfile</code> ãšåãå Žæã« <code>php-wasm.c</code> ãšããååã§ä¿åããæ¬¡ã®ããã«ããã + ããŠãPHP åŠçç³»ãã©ã€ãã©ãªåã§ããã®ã§ã次ã«å
ã»ã©èŒãã C ã®ãœãŒã¹ã³ãŒãããã«ãããŠãããã <code>Dockerfile</code> ãšåãå Žæã« <code>php-wasm.c</code> ãšããååã§ä¿åããæ¬¡ã®ããã«ããã </p> - <div class="codeblock" language="dockerfile"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49">COPY</span><span style="color:#24292E"> php-wasm.c /src/</span></span> <span class="line"></span> @@ -284,15 +253,12 @@ <span class="line"><span style="color:#24292E"> git clean -fd && \</span></span> <span class="line"><span style="color:#24292E"> :</span></span></code></pre> </div> - <p> - <code>emcc</code> 㯠<code>cc</code> (C ã³ã³ãã€ã©/ãªã³ã«) ã® Emscripten çã§ã<code>-c</code> ã¯ãã³ã³ãã€ã«ãã®æã<code>-o</code> ã <code>-I</code> ã¯æ®éã® C ã³ã³ãã€ã©ãšåæ§ãåºåãã¡ã€ã«ã®æå®ãšã€ã³ã¯ã«ãŒããã¹ã®æå®ã§ããã + <code>emcc</code> 㯠<code>cc</code> (C ã³ã³ãã€ã©/ãªã³ã«) ã® Emscripten çã§ã<code>-c</code> ã¯ãã³ã³ãã€ã«ãã®æã <code>-o</code> ã <code>-I</code> ã¯æ®éã® C ã³ã³ãã€ã©ãšåæ§ãåºåãã¡ã€ã«ã®æå®ãšã€ã³ã¯ã«ãŒããã¹ã®æå®ã§ããã </p> - <p> - <code>libphp.a</code> ãš <code>php-wasm.o</code> ãæã«å
¥ã£ãã®ã§ããããããªã³ã¯ã㊠WebAssembly ã®ãã€ããªãšãã®ã©ããã§ãã JavaScript ãã¡ã€ã«ãçæãããããã«ã <code>emcc</code> ã³ãã³ãã䜿ãã + <code>libphp.a</code> ãš <code>php-wasm.o</code> ãæã«å
¥ã£ãã®ã§ããããããªã³ã¯ã㊠WebAssembly ã®ãã€ããªãšãã®ã©ããã§ãã JavaScript ãã¡ã€ã«ãçæããã ããã«ã <code>emcc</code> ã³ãã³ãã䜿ãã </p> - <div class="codeblock" language="dockerfile"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49">RUN</span><span style="color:#24292E"> emcc \</span></span> <span class="line"><span style="color:#24292E"> -s ENVIRONMENT=node \</span></span> @@ -307,47 +273,36 @@ <span class="line"><span style="color:#24292E"> libphp.a \</span></span> <span class="line"><span style="color:#24292E"> ;</span></span></code></pre> </div> - <p> - ããããã®ãã©ã°ã«ã€ããŠè§£èª¬ããã + ããããã®ãã©ã°ã«ã€ããŠè§£èª¬ããã </p> - <p> - <code>-s ENVIRONMENT=node</code> ã¯ãçæãã WebAssembly/JavaScript ã®å®è¡ç°å¢ãæå®ãããä»å㯠<code>node</code> ãæå®ããŠããã®ã§ãNode.js åãã®ãã¡ã€ã«ãçæãããã + <code>-s ENVIRONMENT=node</code> ã¯ãçæãã WebAssembly/JavaScript ã®å®è¡ç°å¢ãæå®ããã ä»å㯠<code>node</code> ãæå®ããŠããã®ã§ãNode.js åãã®ãã¡ã€ã«ãçæãããã </p> - <p> <code>-s ERROR_ON_UNDEFINED_SYMBOLS=0</code> ã«ã€ããŠã¯ãã§ã«è¿°ã¹ãã®ã§çç¥ããã </p> - <p> - <code>-s EXPORTED_RUNTIME_METHODS='["ccall"]'</code> ã¯ãçæããã JavaScript ããå
¬éããã API ã§ããããã§ã« <code>index.mjs</code> ã§äœ¿çšããŠãããã<code>ccall('颿°å', 'è¿ãå€ã®å', ['ä»®åŒæ°ã®å', ...], ['å®åŒæ°', ...])</code> ã®ããã«äœ¿ãã + <code>-s EXPORTED_RUNTIME_METHODS='["ccall"]'</code> ã¯ãçæããã JavaScript ããå
¬éããã API ã§ããã ãã§ã« <code>index.mjs</code> ã§äœ¿çšããŠãããã<code>ccall('颿°å', 'è¿ãå€ã®å', ['ä»®åŒæ°ã®å', ...], ['å®åŒæ°', ...])</code> ã®ããã«äœ¿ãã </p> - <p> - <code>-s EXPORT_ES6=1</code> ã¯ãJavaScript ã³ãŒãã ECMAScript 6 ã«æºæ ãã module ãšããŠçæããããããæå®ããããšã§ã<code>require()</code> ã§ã¯ãªã <code>import</code> ã§ãã JavaScript ãçæãããããã + <code>-s EXPORT_ES6=1</code> ã¯ãJavaScript ã³ãŒãã ECMAScript 6 ã«æºæ ãã module ãšããŠçæããã ãããæå®ããããšã§ã<code>require()</code> ã§ã¯ãªã <code>import</code> ã§ãã JavaScript ãçæãããããã </p> - <p> <code>-s INITIAL_MEMORY=16777216</code> ã¯åŒãã§åã®ããšããçšéã«åãããŠé©åœã«æ±ºããŠã»ããã </p> - <p> - <code>-s INVOKE_RUN=0</code> ã¯ãmodule ãããŒããããšãã«åæã« <code>main()</code> ãåŒã¶ãã©ãã (ã ãšæã)ãä»å㯠<code>php_wasm_run()</code> ãã䜿ãã€ããããªãã®ã§åã£ãŠããã + <code>-s INVOKE_RUN=0</code> ã¯ãmodule ãããŒããããšãã«åæã« <code>main()</code> ãåŒã¶ãã©ãã (ã ãšæã)ã ä»å㯠<code>php_wasm_run()</code> ãã䜿ãã€ããããªãã®ã§åã£ãŠããã </p> - <p> - <code>-s MODULARIZE=1</code> ã¯ãå®è³ªçã«ã»ãŒå¿
é ã®ãªãã·ã§ã³ã§ããã1 ãæå®ããããšã§ãWebAssembly module ãã€ã³ã¹ã¿ã³ã¹åãã颿°ãããšã¯ã¹ããŒããããã㪠JavaScript ãã¡ã€ã«ãçæããããã«ãªãããããæå®ããªããšãçæç©ã® JavaScript ãã¡ã€ã«ãèªã¿èŸŒããš WebAssembly module ãå³åº§ã«ã€ã³ã¹ã¿ã³ã¹åãããŠããŸããèµ·åã®ã¿ã€ãã³ã°ãå¶åŸ¡ã§ããªãã + <code>-s MODULARIZE=1</code> ã¯ãå®è³ªçã«ã»ãŒå¿
é ã®ãªãã·ã§ã³ã§ããã1 ãæå®ããããšã§ãWebAssembly module ãã€ã³ã¹ã¿ã³ã¹åãã颿°ãããšã¯ã¹ããŒããããã㪠JavaScript ãã¡ã€ã«ãçæããããã«ãªãã ãããæå®ããªããšãçæç©ã® JavaScript ãã¡ã€ã«ãèªã¿èŸŒããš WebAssembly module ãå³åº§ã«ã€ã³ã¹ã¿ã³ã¹åãããŠããŸããèµ·åã®ã¿ã€ãã³ã°ãå¶åŸ¡ã§ããªãã </p> - <p> - ãããŸã§å®è¡ãããšã<code>php-wasm.js</code> ãš <code>php-wasm.wasm</code> ãäœããããã§ã¯ãããããã¯ãããã®å®è¡ç°å¢ãäœã£ãŠãããã + ãããŸã§å®è¡ãããšã<code>php-wasm.js</code> ãš <code>php-wasm.wasm</code> ãäœãããã ã§ã¯ãããããã¯ãããã®å®è¡ç°å¢ãäœã£ãŠãããã </p> - <p> - ãšãã£ãŠããNode.js ã¯ãã«ãã€ã³ã§ WebAssembly ããµããŒãããŠããã®ã§ãã»ãšãã©ããããšã¯ãªããå
ã»ã©æ²èŒãã JavaScript ã®ã³ãŒãã¯ã<code>Dockerfile</code> ãšåããã£ã¬ã¯ããªã« <code>index.mjs</code> ã§é
眮ããããšã + ãšãã£ãŠããNode.js ã¯ãã«ãã€ã³ã§ WebAssembly ããµããŒãããŠããã®ã§ãã»ãšãã©ããããšã¯ãªãã å
ã»ã©æ²èŒãã JavaScript ã®ã³ãŒãã¯ã<code>Dockerfile</code> ãšåããã£ã¬ã¯ããªã« <code>index.mjs</code> ã§é
眮ããããšã </p> - <div class="codeblock" language="dockerfile"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49">FROM</span><span style="color:#24292E"> node:20.7</span></span> <span class="line"></span> @@ -360,13 +315,11 @@ </div> </section> </section> - <section id="section--run"> - <h2><a href="#section--run">å®è¡</a></h2> + <h2><a href="#section--run">å®è¡</a></h2> <p> <code>Dockerfile</code>ã<code>php-wasm.c</code>ã<code>index.mjs</code> ãçšæããããDocker ã³ã³ããããã«ãããŠå®è¡ããã </p> - <div class="codeblock" language="dockerfile"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#24292E">$ docker build -t php-wasm .</span></span> <span class="line"><span style="color:#24292E">$ echo </span><span style="color:#032F62">'echo "Hello, World!", PHP_EOL;'</span><span style="color:#24292E"> | docker run --rm -i php-wasm</span></span> @@ -376,33 +329,27 @@ <span class="line"><span style="color:#24292E">exit code: 0</span></span></code></pre> </div> </section> - <section id="section--outro"> - <h2><a href="#section--outro">ãŸãšã</a></h2> + <h2><a href="#section--outro">ãŸãšã</a></h2> <p> - <a href="https://github.com/nsfisis/tiny-php.wasm" rel="noreferrer" target="_blank">ãããŸã§ããŸãšãã Git ãªããžããª</a>ãçšæãããç°¡åã«ã³ã³ãã€ã«ã§ããã®ã§ãèå³ãããã°è©ŠããŠã¿ãŠã»ããã + <a href="https://github.com/nsfisis/tiny-php.wasm" rel="noreferrer" target="_blank">ãããŸã§ããŸãšãã Git ãªããžããª</a> ãçšæããã ç°¡åã«ã³ã³ãã€ã«ã§ããã®ã§ãèå³ãããã°è©ŠããŠã¿ãŠã»ããã </p> </section> - <section id="section--references"> - <h2><a href="#section--references">åèãªã³ã¯</a></h2> + <h2><a href="#section--references">åèãªã³ã¯</a></h2> <ul> <li> <a href="https://github.com/php/php-src" rel="noreferrer" target="_blank">php/php-src: ãã«ãã®æ¹æ³ã«ã€ããŠ</a> </li> - <li> <a href="https://emscripten.org/docs/getting_started/Tutorial.html" rel="noreferrer" target="_blank">Emscripten: ãã¥ãŒããªã¢ã«</a> </li> - <li> <a href="https://emscripten.org/docs/compiling/Building-Projects.html#building-projects" rel="noreferrer" target="_blank">Emscripten: ãã«ãã®åºæ¬</a> </li> - <li> <a href="https://emscripten.org/docs/tools_reference/emcc.html#emccdoc" rel="noreferrer" target="_blank">Emscripten: <code>emcc</code> ãªã©ã®ãªãã¡ã¬ã³ã¹</a> </li> - <li> <a href="https://emscripten.org/docs/api_reference/module.html#module" rel="noreferrer" target="_blank">Emscripten: çæããã JavaScript ã® API</a> </li> diff --git a/vhosts/blog/public/posts/2023-10-13/i-entered-the-open-university-of-japan/index.html b/vhosts/blog/public/posts/2023-10-13/i-entered-the-open-university-of-japan/index.html index 2ce30e71..5abdcafa 100644 --- a/vhosts/blog/public/posts/2023-10-13/i-entered-the-open-university-of-japan/index.html +++ b/vhosts/blog/public/posts/2023-10-13/i-entered-the-open-university-of-japan/index.html @@ -58,17 +58,15 @@ </ol> </section> <section id="section--i-entered-ouj"> - <h2><a href="#section--i-entered-ouj">æŸé倧åŠã«å
¥åŠããŸãã</a></h2> + <h2><a href="#section--i-entered-ouj">æŸé倧åŠã«å
¥åŠããŸãã</a></h2> <p> - ãšãããã£ããããããããäžåºŠå€§åŠçãããããšã«ããŸãããä»äºã®ã»ããããããŸã§ã©ãããã«ã¿ã€ã ã§ç¶ããŠãããŸãã + ãšãããã£ããããããããäžåºŠå€§åŠçãããããšã«ããŸããã ä»äºã®ã»ããããããŸã§ã©ãããã«ã¿ã€ã ã§ç¶ããŠãããŸãã </p> - <p> - é»ã£ãŠãããããå
¬è¡šããã»ããã¢ãããŒã·ã§ã³ã®åäžã«ç¹ããã ãããšæãããã®ããã°ã«èšäºãšããŠèŒããŸããã + é»ã£ãŠãããããå
¬è¡šããã»ããã¢ãããŒã·ã§ã³ã®åäžã«ç¹ããã ãããšæãããã®ããã°ã«èšäºãšããŠèŒããŸããã </p> - <p> - 以äžãçãã§ããå ±åã§ããã + 以äžãçãã§ããå ±åã§ããã </p> </section> </div> diff --git a/vhosts/blog/public/posts/2023-12-03/isucon-13/index.html b/vhosts/blog/public/posts/2023-12-03/isucon-13/index.html index 63f6e8f4..f2cc9533 100644 --- a/vhosts/blog/public/posts/2023-12-03/isucon-13/index.html +++ b/vhosts/blog/public/posts/2023-12-03/isucon-13/index.html @@ -58,39 +58,41 @@ </ol> </section> <section id="section--intro"> - <h2><a href="#section--intro">ã¯ããã«</a></h2> + <h2><a href="#section--intro">ã¯ããã«</a></h2> <p> - å
æ¥ 11æ25æ¥ã<a href="https://isucon.net/archives/57801192.html" rel="noreferrer" target="_blank">ISUCON 13</a> ã«åå ãããISUCON ãžã®åå ã¯ä»åãåããŠãšãªããç§ nsfisis ã®1人ããŒã ããã€ãããããšããŠåå ããæçµã¹ã³ã¢ã¯ 13,580 ç¹ã ã£ãã䜿çšèšèªã¯ Goã + å
æ¥ 11æ25æ¥ã <a href="https://isucon.net/archives/57801192.html" rel="noreferrer" target="_blank">ISUCON 13</a> ã«åå ããã ISUCON ãžã®åå ã¯ä»åãåããŠãšãªãã ç§ nsfisis ã®1人ããŒã ããã€ãããããšããŠåå ããæçµã¹ã³ã¢ã¯ 13,580 ç¹ã ã£ãã䜿çšèšèªã¯ Goã </p> - <div class="admonition"> <div class="admonition-label"> NOTE </div> <div class="admonition-content"> - ãISUCONãã¯ãLINEã€ããŒæ ªåŒäŒç€Ÿã®åæšãŸãã¯ç»é²åæšã§ãã<a href="https://isucon.net/" rel="noreferrer" target="_blank">ISUCON å
¬åŒãµã€ãã¯ãã¡ãã</a> + <p> + ãISUCONãã¯ãLINEã€ããŒæ ªåŒäŒç€Ÿã®åæšãŸãã¯ç»é²åæšã§ãã <a href="https://isucon.net/" rel="noreferrer" target="_blank">ISUCON å
¬åŒãµã€ãã¯ãã¡ãã</a> + </p> </div> </div> </section> - <section id="section--goals"> - <h2><a href="#section--goals">ç®æš</a></h2> + <h2><a href="#section--goals">ç®æš</a></h2> <p> - ä»åã¯ååå ãšããããšããããç®æšã以äžã®ããã«å®ããã + ä»åã¯ååå ãšããããšããããç®æšã以äžã®ããã«å®ããã </p> - <ul> <li> - æ£ã®ã¹ã³ã¢ãåã + <p> + æ£ã®ã¹ã³ã¢ãåã + </p> <ul> <li> ISUCON ã§ã¯ãµãŒãåäœã®æŽåæ§ããã§ãã¯ããã倱æãããšã¹ã³ã¢ 0 ãšãªã </li> </ul> </li> - <li> - é床æ¹å以å€ã«æéãæµªè²»ããªã (= ããããªã) + <p> + é床æ¹å以å€ã«æéãæµªè²»ããªã (= ããããªã) + </p> <ul> <li> ããããžã§ãã³ã°ããããã°ãããã«ãŠã§ã¢ã®èšå®æ¹æ³ã®èª¿æ»ãªã©ãæ§èœæ¹åã«å¯äžããªãæéãæå°éã«ãã @@ -99,53 +101,46 @@ </li> </ul> </section> - <section id="section--strategy"> - <h2><a href="#section--strategy">æŠç¥</a></h2> + <h2><a href="#section--strategy">æŠç¥</a></h2> <p> - ISUCON ã§é«ã¹ã³ã¢ãåºãæŠç¥ã«ã€ããŠã¯ãæŠéåã®é«ãæ¹ã
ãè¯è³ªãªèšäºãæžããŠãã ãã£ãŠãããããã§ã¯ãäžè¿°ãããããªäœãç®æšãéæããããã®æŠç¥ã«ã€ããŠæžãããšæãã + ISUCON ã§é«ã¹ã³ã¢ãåºãæŠç¥ã«ã€ããŠã¯ãæŠéåã®é«ãæ¹ã
ãè¯è³ªãªèšäºãæžããŠãã ãã£ãŠããã ããã§ã¯ãäžè¿°ãããããªäœãç®æšãéæããããã®æŠç¥ã«ã€ããŠæžãããšæãã </p> - <section id="section--strategy--do-not-destroy-environment"> - <h3><a href="#section--strategy--do-not-destroy-environment">ç°å¢ãç Žå£ããªã</a></h3> + <h3><a href="#section--strategy--do-not-destroy-environment">ç°å¢ãç Žå£ããªã</a></h3> <p> - ããã«ãŠã§ã¢ã®èšå®ãã¢ããªã±ãŒã·ã§ã³ã³ãŒããªã©ã倿Žãå ãããããããã®ã¯ãå¿
ãããã¯ã¢ãããåãã Git ã§ç®¡çããã埩æ§äžèœã«ãªã£ãŠç°å¢ããšäœãçŽãããšã ãã¯å¿
ãé¿ããã + ããã«ãŠã§ã¢ã®èšå®ãã¢ããªã±ãŒã·ã§ã³ã³ãŒããªã©ã倿Žãå ãããããããã®ã¯ãå¿
ãããã¯ã¢ãããåãã Git ã§ç®¡çããã 埩æ§äžèœã«ãªã£ãŠç°å¢ããšäœãçŽãããšã ãã¯å¿
ãé¿ããã </p> </section> - <section id="section--strategy--revert-changes-immediately"> - <h3><a href="#section--strategy--revert-changes-immediately">ããã«å€æŽãåãæ¶ã</a></h3> + <h3><a href="#section--strategy--revert-changes-immediately">ããã«å€æŽãåãæ¶ã</a></h3> <p> - ããã§ãå£ããŠããŸã£ããšãã¯ãå³åº§ã«å€æŽãåãæ¶ããå£ããçç±ã調ã¹ãããšã«åºå·ããªãã + ããã§ãå£ããŠããŸã£ããšãã¯ãå³åº§ã«å€æŽãåãæ¶ããå£ããçç±ã調ã¹ãããšã«åºå·ããªãã </p> </section> - <section id="section--strategy--do-small-deployment"> - <h3><a href="#section--strategy--do-small-deployment">å°ãããããã€ãã</a></h3> + <h3><a href="#section--strategy--do-small-deployment">å°ãããããã€ãã</a></h3> <p> - äžåºŠã«è€æ°ã®å€æŽãå ãããå¯èœãªéãå°ããªåäœã§ãããã€ããããããŠãã®éœåºŠãã³ãããŒã¯ãèµ°ãããæŽåæ§ãã§ãã¯ãéããã©ããã (åœç¶éããªã£ãŠãããã©ããã) 確ãããã + äžåºŠã«è€æ°ã®å€æŽãå ãããå¯èœãªéãå°ããªåäœã§ãããã€ããããããŠãã®éœåºŠãã³ãããŒã¯ãèµ°ãããæŽåæ§ãã§ãã¯ãéããã©ããã (åœç¶éããªã£ãŠãããã©ããã) 確ãããã </p> </section> - <section id="section--strategy--use-familiar-tools"> - <h3><a href="#section--strategy--use-familiar-tools">䜿ãæ
£ããéå
·ã䜿ã</a></h3> + <h3><a href="#section--strategy--use-familiar-tools">䜿ãæ
£ããéå
·ã䜿ã</a></h3> <p> - 䜿çšããèšèªãããã«ãŠã§ã¢ãããŒã«é¡ãã䜿ãæ
£ãããã®ã«éå®ãããããã®ããŒã«ã®ãªãã·ã§ã³ã¯ã»ãšãã©ããã§æå®ã§ããããšèšãããããªãã®ã ãã䜿ãããèªåã§ã¯äœ¿ã£ãããšããªãã ISUCON 匷è
ããå§ãããŠããããšãã£ãçç±ã§ããŒã«ãéžå®ããªã (ãã¡ãããæ¬çªãŸã§ã«ç·Žç¿ããŠç¿çãããšããéžæè¢ã¯ååšãã)ã + 䜿çšããèšèªãããã«ãŠã§ã¢ãããŒã«é¡ãã䜿ãæ
£ãããã®ã«éå®ããã ããã®ããŒã«ã®ãªãã·ã§ã³ã¯ã»ãšãã©ããã§æå®ã§ããããšèšãããããªãã®ã ãã䜿ãã ãèªåã§ã¯äœ¿ã£ãããšããªãã ISUCON 匷è
ããå§ãããŠããããšãã£ãçç±ã§ããŒã«ãéžå®ããªã (ãã¡ãããæ¬çªãŸã§ã«ç·Žç¿ããŠç¿çãããšããéžæè¢ã¯ååšãã)ã </p> </section> </section> - <section id="section--performance-optimization"> - <h2><a href="#section--performance-optimization">ããã©ãŒãã³ã¹ã®æé©å</a></h2> + <h2><a href="#section--performance-optimization">ããã©ãŒãã³ã¹ã®æé©å</a></h2> <p> - ãã£ãšåŒ·ã人ã®èšäºãåèã«ããŠã»ããã + ãã£ãšåŒ·ã人ã®èšäºãåèã«ããŠã»ããã </p> </section> - <section id="section--outro"> - <h2><a href="#section--outro">ãããã«</a></h2> + <h2><a href="#section--outro">ãããã«</a></h2> <p> - äºåã®æºåãå«ããŠã倧倿¥œããã€ãã³ãã ã£ããæ¬¡åããããªãæ¯éãŸãåå ãããããã®éã¯ãé äœãã¹ã³ã¢ãç®æšãšããŠç«ãŠãããããã«ãªããããã®ã§ããã + äºåã®æºåãå«ããŠã倧倿¥œããã€ãã³ãã ã£ããæ¬¡åããããªãæ¯éãŸãåå ãããããã®éã¯ãé äœãã¹ã³ã¢ãç®æšãšããŠç«ãŠãããããã«ãªããããã®ã§ããã </p> </section> </div> diff --git a/vhosts/blog/public/posts/2023-12-31/2023-reflections/index.html b/vhosts/blog/public/posts/2023-12-31/2023-reflections/index.html index 355f11bd..535f4b6a 100644 --- a/vhosts/blog/public/posts/2023-12-31/2023-reflections/index.html +++ b/vhosts/blog/public/posts/2023-12-31/2023-reflections/index.html @@ -52,96 +52,85 @@ </ol> </section> <section id="section--intro"> - <h2><a href="#section--intro">ã¯ããã«</a></h2> + <h2><a href="#section--intro">ã¯ããã«</a></h2> <p> - ç·ãããªã幎æ«ã®æ¯ãè¿ããšããµãã®ã女ãããŠã¿ããšãŠãããªãã + ç·ãããªã幎æ«ã®æ¯ãè¿ããšããµãã®ã女ãããŠã¿ããšãŠãããªãã </p> </section> - <section id="section--conferences"> - <h2><a href="#section--conferences">ç»å£ã»ã«ã³ãã¡ã¬ã³ã¹ã¹ã¿ãã</a></h2> + <h2><a href="#section--conferences">ç»å£ã»ã«ã³ãã¡ã¬ã³ã¹ã¹ã¿ãã</a></h2> <p> - å匷äŒãã«ã³ãã¡ã¬ã³ã¹ã§ç»å£ãããã¹ã¿ãããããããå§ããã®ã¯ä»å¹ŽããããããLT çãå«ããŠèš 11 åã®ç»å£ããããªã£ãã + å匷äŒãã«ã³ãã¡ã¬ã³ã¹ã§ç»å£ãããã¹ã¿ãããããããå§ããã®ã¯ä»å¹Žãããããã LT çãå«ããŠèš 11 åã®ç»å£ããããªã£ãã </p> - <ul> <li> - PHP å匷äŒ@æ±äº¬ã§ã®ç»å£ (èš 8 å) + <p> + PHP å匷äŒ@æ±äº¬ã§ã®ç»å£ (èš 8 å) + </p> <ul> <li> <a href="/slides/2023-01-18/phpstudy-tokyo-148/">第 148 å</a> </li> - <li> <a href="/slides/2023-02-15/phpstudy-tokyo-149/">第 149 å</a> </li> - <li> <a href="/slides/2023-03-15/phpstudy-tokyo-150/">第 150 å</a> </li> - <li> <a href="/slides/2023-04-12/phpstudy-tokyo-151/">第 151 å</a> </li> - <li> <a href="/slides/2023-06-21/phpstudy-tokyo-153/">第 153 å</a> </li> - <li> <a href="/slides/2023-07-26/phpstudy-tokyo-154/">第 154 å</a> </li> - <li> <a href="/slides/2023-08-24/phpstudy-tokyo-155/">第 155 å</a> </li> - <li> <a href="/slides/2023-10-25/phpstudy-tokyo-157/">第 157 å</a> </li> </ul> </li> - <li> - PHPerKaigi 2023 ã§ã®ç»å£ + <p> + PHPerKaigi 2023 ã§ã®ç»å£ + </p> <ul> <li> <a href="/slides/2023-03-24/phperkaigi-2023/">ã¬ã®ã¥ã©ãŒããŒã¯</a> </li> - <li> <a href="/slides/2023-03-25/phperkaigi-2023-tokens/">ããŒã¯ã³è§£èª¬ã»ãã·ã§ã³</a> </li> </ul> </li> - <li> PHPerKaigi 2023 ã§ã®åœæ¥ã¹ã¿ããæ¥ </li> - <li> <a href="/slides/2023-06-23/phpconfuk-2023-eve/">éå
¬åŒã§ãããªããã PHP ã«ã³ãã¡ã¬ã³ã¹çŠå²¡ 2023 ã® åå€ç¥ã€ãã³ãã§ã®ç»å£</a> </li> - <li> PHPerKaigi 2024 ã§ã®ã³ã¢ã¹ã¿ããæ¥ </li> </ul> </section> - <section id="section--articles"> - <h2><a href="#section--articles">æžããèšäº</a></h2> + <h2><a href="#section--articles">æžããèšäº</a></h2> <p> - ç»å£ãå¢ãããããèšäºãæžãæ©äŒãæžã£ãŠããŸã£ããç¹ã«ç€Ÿå
èšäºã®æ¬æ°ã倧ããæžå°ããŠãããäžæšå¹Žã¯çŽ 100 æ¬ãæšå¹Žã¯çŽ 60 æ¬ã®ç€Ÿå
èšäºãæžããŠããããä»å¹Žã¯ 30 æ¬åŒ·ã«çãŸã£ãããã®é ãšæ¯ã¹ããšæç« ãæžãçèãè¡°ããŠããããã«æããã + ç»å£ãå¢ãããããèšäºãæžãæ©äŒãæžã£ãŠããŸã£ãã ç¹ã«ç€Ÿå
èšäºã®æ¬æ°ã倧ããæžå°ããŠãããäžæšå¹Žã¯çŽ 100 æ¬ãæšå¹Žã¯çŽ 60 æ¬ã®ç€Ÿå
èšäºãæžããŠããããä»å¹Žã¯ 30 æ¬åŒ·ã«çãŸã£ãã ãã®é ãšæ¯ã¹ããšæç« ãæžãçèãè¡°ããŠããããã«æããã </p> - <ul> <li> 瀟å€èšäº (ãã®ããã°): 8æ¬ </li> - <li> - 瀟å
èšäº: 34æ¬ + <p> + 瀟å
èšäº: 34æ¬ + </p> <ul> <li> 幎éã§æãèšäºãæžãã人ãšããŠç€Ÿå
衚地ããã @@ -150,53 +139,44 @@ </li> </ul> </section> - <section id="section--coding"> - <h2><a href="#section--coding">äœã£ããã®</a></h2> + <h2><a href="#section--coding">äœã£ããã®</a></h2> <p> - ã¬ã©ã¯ã¿ãããã€ãäœã£ãã圹ã«ã¯ç«ããªãããäœãã®ã楜ãããšããå¹çšãããã + ã¬ã©ã¯ã¿ãããã€ãäœã£ãã圹ã«ã¯ç«ããªãããäœãã®ã楜ãããšããå¹çšãããã </p> - <ul> <li> - <a href="https://github.com/nsfisis/PHPerKaigi2023-tokens" rel="noreferrer" target="_blank">PHPerKaigi2023-tokens</a>: PHPerKaigi 2023 ã§ãããªããã PHPer ãã£ã¬ã³ãžãšããäŒç»ã§çšæããåé¡ + <a href="https://github.com/nsfisis/PHPerKaigi2023-tokens" rel="noreferrer" target="_blank">PHPerKaigi2023-tokens</a> : PHPerKaigi 2023 ã§ãããªããã PHPer ãã£ã¬ã³ãžãšããäŒç»ã§çšæããåé¡ </li> - <li> - <a href="https://github.com/nsfisis/twitter2x-quine" rel="noreferrer" target="_blank">twitter2x-quine</a>: Twitter ã®ããŽã ð ã«ããå€å quine + <a href="https://github.com/nsfisis/twitter2x-quine" rel="noreferrer" target="_blank">twitter2x-quine</a> : Twitter ã®ããŽã ð ã«ããå€å quine </li> - <li> - <a href="https://github.com/nsfisis/9-puzzle-quine.php" rel="noreferrer" target="_blank">9-puzzle-quine.php</a>: 9ããºã«ãéã¹ãå€å quine + <a href="https://github.com/nsfisis/9-puzzle-quine.php" rel="noreferrer" target="_blank">9-puzzle-quine.php</a> : 9ããºã«ãéã¹ãå€å quine </li> </ul> </section> - <section id="section--misc"> - <h2><a href="#section--misc">ãã®ä»</a></h2> + <h2><a href="#section--misc">ãã®ä»</a></h2> <ul> <li> <a href="/posts/2023-10-13/i-entered-the-open-university-of-japan/">æŸé倧åŠã«å
¥åŠãã</a> </li> - <li> <a href="/posts/2023-12-03/isucon-13/">ISUCON ã«ååå ãã</a> </li> - <li> ããŒã¿ããŒã¹ã¹ãã·ã£ãªã¹ããååŸãã </li> - <li> 挢æ€2çŽãååŸãã </li> </ul> </section> - <section id="section--outro"> - <h2><a href="#section--outro">ãããã«</a></h2> + <h2><a href="#section--outro">ãããã«</a></h2> <p> - ä»å¹Žã倧å€ãäžè©±ã«ãªããŸãããããã幎ãïŒ + ä»å¹Žã倧å€ãäžè©±ã«ãªããŸãããããã幎ãïŒ </p> </section> </div> diff --git a/vhosts/blog/public/posts/2024-01-10/neovim-insert-namespace-declaration-to-empty-php-file/index.html b/vhosts/blog/public/posts/2024-01-10/neovim-insert-namespace-declaration-to-empty-php-file/index.html index 07043627..68eb1fe9 100644 --- a/vhosts/blog/public/posts/2024-01-10/neovim-insert-namespace-declaration-to-empty-php-file/index.html +++ b/vhosts/blog/public/posts/2024-01-10/neovim-insert-namespace-declaration-to-empty-php-file/index.html @@ -65,58 +65,51 @@ NOTE </div> <div class="admonition-content"> - ãã®èšäºã¯ <a href="https://vim-jp.org/ekiden/" rel="noreferrer" target="_blank">Vim é§
äŒ</a> #136 ã®èšäºã§ãã + <p> + ãã®èšäºã¯ <a href="https://vim-jp.org/ekiden/" rel="noreferrer" target="_blank">Vim é§
äŒ</a> #136 ã®èšäºã§ãã + </p> </div> </div> - <section id="section--intro"> - <h2><a href="#section--intro">ããããããš</a></h2> + <h2><a href="#section--intro">ããããããš</a></h2> <p> - Neovim ã§ç©ºã® PHP ãã¡ã€ã«ãéãããšãããã®ãã¡ã€ã«ã眮ãããŠãããã£ã¬ã¯ããªã®æ§é ã«åºã¥ããŠãèªåçã« <code>namespace</code> 宣èšãæ¿å
¥ããããå
·äœçã«ã¯ããããã¬ãã«ã®åå空éã <code>MyNamespace</code> ã§ããããã¡ã€ã« <code>src/Foo/Bar/Baz.php</code> ãéãããšãã«ããã®ãã¡ã€ã«ã空ã§ãããªããæ¬¡ã®ãããªãã³ãã¬ãŒããèªåçã«æ¿å
¥ãããŠã»ããã + Neovim ã§ç©ºã® PHP ãã¡ã€ã«ãéãããšãããã®ãã¡ã€ã«ã眮ãããŠãããã£ã¬ã¯ããªã®æ§é ã«åºã¥ããŠãèªåçã« <code>namespace</code> 宣èšãæ¿å
¥ããããå
·äœçã«ã¯ããããã¬ãã«ã®åå空éã <code>MyNamespace</code> ã§ããããã¡ã€ã« <code>src/Foo/Bar/Baz.php</code> ãéãããšãã«ããã®ãã¡ã€ã«ã空ã§ãããªããæ¬¡ã®ãããªãã³ãã¬ãŒããèªåçã«æ¿å
¥ãããŠã»ããã </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49"><?</span><span style="color:#005CC5">php</span></span> <span class="line"></span> <span class="line"><span style="color:#D73A49">namespace</span><span style="color:#6F42C1"> MyNamespace\Foo\Bar</span><span style="color:#24292E">;</span></span></code></pre> </div> </section> - <section id="section--version"> - <h2><a href="#section--version">ããŒãžã§ã³æ
å ±</a></h2> + <h2><a href="#section--version">ããŒãžã§ã³æ
å ±</a></h2> <div class="codeblock"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>$ nvim --version</span></span> <span class="line"><span>NVIM v0.9.2</span></span> <span class="line"><span>Build type: Release</span></span> <span class="line"><span>LuaJIT 2.1.1693350652</span></span></code></pre> </div> - <p> - ä»å㯠Lua ã§åŠçãèšè¿°ãããããVim ã§ã¯åäœããªãã以äžã®èª¬æã§ã Neovim ã«çµã£ãŠè¿°ã¹ãããŸãããã¹åºåããã¹ã©ãã·ã¥ã§ããåæã§èšè¿°ãããããWindows ã«ã¯å¯Ÿå¿ããŠããªãã + ä»å㯠Lua ã§åŠçãèšè¿°ãããããVim ã§ã¯åäœããªãã以äžã®èª¬æã§ã Neovim ã«çµã£ãŠè¿°ã¹ãã ãŸãããã¹åºåããã¹ã©ãã·ã¥ã§ããåæã§èšè¿°ãããããWindows ã«ã¯å¯Ÿå¿ããŠããªãã </p> </section> - <section id="section--ftplugin"> - <h2><a href="#section--ftplugin">ftplugin ãçšæãã</a></h2> + <h2><a href="#section--ftplugin">ftplugin ãçšæãã</a></h2> <p> - Neovim ã«ã¯ç¹å®ã®ãã¡ã€ã«ã¿ã€ãã«å¯ŸããŠç¹å¥ãªåŠçããããªãããã® ftplugin ãšåŒã°ããä»çµã¿ããããNeovim ã®èšå®ã眮ããã£ã¬ã¯ã㪠(äŸãã° <code>~/.config/nvim</code>) ã®é
äžã« <code>ftplugin/<FILE_TYPE>.vim</code> ãŸã㯠<code>ftplugin/<FILE_TYPE>.lua</code> ãšãããã¡ã€ã«ãé
眮ãããšããã® <code><FILE_TYPE></code> ãèªã¿èŸŒãŸãããšãã«ãã®ãã¡ã€ã«ãèªåçã«å®è¡ãããã + Neovim ã«ã¯ç¹å®ã®ãã¡ã€ã«ã¿ã€ãã«å¯ŸããŠç¹å¥ãªåŠçããããªãããã® ftplugin ãšåŒã°ããä»çµã¿ãããã Neovim ã®èšå®ã眮ããã£ã¬ã¯ã㪠(äŸãã° <code>~/.config/nvim</code>) ã®é
äžã« <code>ftplugin/<FILE_TYPE>.vim</code> ãŸã㯠<code>ftplugin/<FILE_TYPE>.lua</code> ãšãããã¡ã€ã«ãé
眮ãããšããã® <code><FILE_TYPE></code> ãèªã¿èŸŒãŸãããšãã«ãã®ãã¡ã€ã«ãèªåçã«å®è¡ãããã </p> - <p> - ä»åã¯ãNeovim ãããã©ã«ãã§çšæããŠãã PHP çš ftplugin ãåäœããããšã«è¿œå ã®åŠçããããªãããã®ã§ã<code>after/ftplugin/php.{vim,lua}</code> ãšãããã¡ã€ã«ãé
眮ãããååããå¯ãããããšããã<code>after/ftplugin</code> 以äžã®ãã¡ã€ã«ã¯ <code>ftplugin</code> 以äžã®ãã¡ã€ã«ãããããšã«å®è¡ãããã + ä»åã¯ãNeovim ãããã©ã«ãã§çšæããŠãã PHP çš ftplugin ãåäœããããšã«è¿œå ã®åŠçããããªãããã®ã§ã<code>after/ftplugin/php.{vim,lua}</code> ãšãããã¡ã€ã«ãé
眮ãããååããå¯ãããããšããã<code>after/ftplugin</code> 以äžã®ãã¡ã€ã«ã¯ <code>ftplugin</code> 以äžã®ãã¡ã€ã«ãããããšã«å®è¡ãããã </p> - <p> - ãã®èšäºã§ã¯ Lua ã§åŠçãèšè¿°ãããããæ¡åŒµåã«ã¯ <code>.lua</code> ãçšããããã以éèŒããã³ãŒãã¯ããã¹ãŠ <code>after/ftplugin/php.lua</code> ã®äžã«èšè¿°ããŠããã + ãã®èšäºã§ã¯ Lua ã§åŠçãèšè¿°ãããããæ¡åŒµåã«ã¯ <code>.lua</code> ãçšããã ãã以éèŒããã³ãŒãã¯ããã¹ãŠ <code>after/ftplugin/php.lua</code> ã®äžã«èšè¿°ããŠããã </p> </section> - <section id="section--did-ftplugin"> - <h2><a href="#section--did-ftplugin">äºéèªã¿èŸŒã¿ãé²ã</a></h2> + <h2><a href="#section--did-ftplugin">äºéèªã¿èŸŒã¿ãé²ã</a></h2> <p> - ãã¡ã€ã«ã¿ã€ãã¯èªã¿èŸŒãã ããšã«å€æŽãããããšãããã®ã§ãftplugin ã¯è€æ°åå®è¡ãããããäºéèªã¿èŸŒã¿ãé²ãããã«ã<code>did_ftplugin_<FILE_TYPE>_after</code> ãšãããããã¡ããŒã«ã«å€æ°ãå®çŸ©ããŠããã®ãæ
£ç¿ãšãªã£ãŠããã + ãã¡ã€ã«ã¿ã€ãã¯èªã¿èŸŒãã ããšã«å€æŽãããããšãããã®ã§ãftplugin ã¯è€æ°åå®è¡ããããã äºéèªã¿èŸŒã¿ãé²ãããã«ã<code>did_ftplugin_<FILE_TYPE>_after</code> ãšãããããã¡ããŒã«ã«å€æ°ãå®çŸ©ããŠããã®ãæ
£ç¿ãšãªã£ãŠããã </p> - <div class="codeblock" language="lua"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49">if</span><span style="color:#24292E"> vim.</span><span style="color:#6F42C1">b</span><span style="color:#24292E">.</span><span style="color:#6F42C1">did_ftplugin_php_after</span><span style="color:#D73A49"> then</span></span> <span class="line"><span style="color:#D73A49"> return</span></span> @@ -127,43 +120,34 @@ <span class="line"><span style="color:#24292E">vim.</span><span style="color:#6F42C1">b</span><span style="color:#24292E">.</span><span style="color:#6F42C1">did_ftplugin_php_after</span><span style="color:#D73A49"> =</span><span style="color:#005CC5"> true</span></span></code></pre> </div> </section> - <section id="section--implement"> - <h2><a href="#section--implement">å®è£
ãã</a></h2> + <h2><a href="#section--implement">å®è£
ãã</a></h2> <p> - ã§ã¯å®è£
ããŠããããä»åç§ã¯æ¬¡ã®ãããªããžãã¯ãšããã以éããä» Neovim ã§éãã PHP ãã¡ã€ã«ãã®ããšãã察象ãã¡ã€ã«ããšåŒã¶ããšã«ããã + ã§ã¯å®è£
ããŠããããä»åç§ã¯æ¬¡ã®ãããªããžãã¯ãšããã以éããä» Neovim ã§éãã PHP ãã¡ã€ã«ãã®ããšãã察象ãã¡ã€ã«ããšåŒã¶ããšã«ããã </p> - <ol> <li> 察象ãã¡ã€ã«ã空ã§ãªããã°äœãããªã </li> - <li> 察象ãã¡ã€ã«ã眮ããããã£ã¬ã¯ããªãäžã«èŸ¿ã£ãŠã<code>composer.json</code> ãèŠã€ãã </li> - <li> <code>composer.json</code> ã® <code>autoload.psr-4</code> ãèŠãŠããããã¬ãã«ã®åå空éãšãã£ã¬ã¯ããªãç¹å®ãã </li> - <li> 察象ãã¡ã€ã«ã眮ããããã£ã¬ã¯ããªãããããã¬ãã«ã®ãã£ã¬ã¯ããªãåºæºãšããŠã©ã®ããã«ãã¹ãããŠããã調ã¹ã </li> - <li> ãªãŒãããŒãã®èšå®ãšç
§ããåãããŠã察象ãã¡ã€ã«ãå±ãã¹ãåå空éãç¹å®ãã </li> - <li> PHP ã®éå§ã¿ã°ãšãšãã« <code>namespace</code> 宣èšãæ¿å
¥ãã </li> </ol> - <p> - å®è£
ãç°¡åã«ãããããComposer ãçšããªãå Žåã PSR 4 以å€ã®ãªãŒãããŒãèŠåã䜿ãå Žåã«ã¯å¯Ÿå¿ããªããå°ã
é·ããªããã以äžã«ã¹ã¯ãªããå
šæãèŒããã + å®è£
ãç°¡åã«ãããããComposer ãçšããªãå Žåã PSR 4 以å€ã®ãªãŒãããŒãèŠåã䜿ãå Žåã«ã¯å¯Ÿå¿ããªããå°ã
é·ããªããã以äžã«ã¹ã¯ãªããå
šæãèŒããã </p> - <div class="codeblock" language="lua"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49">if</span><span style="color:#24292E"> vim.</span><span style="color:#6F42C1">b</span><span style="color:#24292E">.</span><span style="color:#6F42C1">did_ftplugin_php_after</span><span style="color:#D73A49"> then</span></span> <span class="line"><span style="color:#D73A49"> return</span></span> @@ -280,11 +264,10 @@ <span class="line"><span style="color:#24292E">vim.</span><span style="color:#6F42C1">b</span><span style="color:#24292E">.</span><span style="color:#6F42C1">did_ftplugin_php_after</span><span style="color:#D73A49"> =</span><span style="color:#005CC5"> true</span></span></code></pre> </div> </section> - <section id="section--outro"> - <h2><a href="#section--outro">ãããã«</a></h2> + <h2><a href="#section--outro">ãããã«</a></h2> <p> - ç°¡æçãªå®è£
ã ããå€ãã®ã±ãŒã¹ã§ã¯ããŸãåããŠããããã ãæå€§ã®åé¡ã¯ PSR 4 ã«æºæ ããªããã¬ãŒã ã¯ãŒã¯ãçšããŠãããšãŸã£ãã圹ã«ç«ããªãããšã§ãä»ãŸãã«è·å Žã§å°ã£ãŠããããã¡ãã¯ãããæ¹è¯ãããã + ç°¡æçãªå®è£
ã ããå€ãã®ã±ãŒã¹ã§ã¯ããŸãåããŠããããã ã æå€§ã®åé¡ã¯ PSR 4 ã«æºæ ããªããã¬ãŒã ã¯ãŒã¯ãçšããŠãããšãŸã£ãã圹ã«ç«ããªãããšã§ãä»ãŸãã«è·å Žã§å°ã£ãŠããã ãã¡ãã¯ãããæ¹è¯ãããã </p> </section> </div> diff --git a/vhosts/blog/public/posts/2024-02-03/install-wireguard-on-personal-server/index.html b/vhosts/blog/public/posts/2024-02-03/install-wireguard-on-personal-server/index.html index f7a6f601..05ad3423 100644 --- a/vhosts/blog/public/posts/2024-02-03/install-wireguard-on-personal-server/index.html +++ b/vhosts/blog/public/posts/2024-02-03/install-wireguard-on-personal-server/index.html @@ -64,60 +64,49 @@ </ol> </section> <section id="section--intro"> - <h2><a href="#section--intro">ã¯ããã«</a></h2> + <h2><a href="#section--intro">ã¯ããã«</a></h2> <p> - å人çšãµãŒãã¹ã®ã»ã«ããã¹ãã«äœ¿ã£ãŠãããµãŒãã« <a href="https://www.wireguard.com/" rel="noreferrer" target="_blank">WireGuard</a> ãå°å
¥ããäœæ¥ãããã®ã§ã¡ã¢ã + å人çšãµãŒãã¹ã®ã»ã«ããã¹ãã«äœ¿ã£ãŠãããµãŒãã« <a href="https://www.wireguard.com/" rel="noreferrer" target="_blank">WireGuard</a> ãå°å
¥ããäœæ¥ãããã®ã§ã¡ã¢ã </p> - <p> - ç»å Žãããã¹ãã¯ä»¥äžã®ãšãã: + ç»å Žãããã¹ãã¯ä»¥äžã®ãšãã: </p> - <ul> <li> ãµãŒã (Ubuntu): <code>10.10.1.1</code> </li> - <li> ã¯ã©ã€ã¢ã³ã 1 (Windows): <code>10.10.1.2</code> </li> - <li> ã¯ã©ã€ã¢ã³ã 2 (Android): <code>10.10.1.3</code> </li> </ul> - <p> - åŸãã® IP ã¢ãã¬ã¹ã¯ VPN å
ã§äœ¿çšãããã©ã€ããŒã IP ã¢ãã¬ã¹ã + åŸãã® IP ã¢ãã¬ã¹ã¯ VPN å
ã§äœ¿çšãããã©ã€ããŒã IP ã¢ãã¬ã¹ã </p> </section> - <section id="section--install-wireguard-server"> - <h2><a href="#section--install-wireguard-server">WireGuard ã®ã€ã³ã¹ããŒã«: ãµãŒã</a></h2> + <h2><a href="#section--install-wireguard-server">WireGuard ã®ã€ã³ã¹ããŒã«: ãµãŒã</a></h2> <p> - ãŸãã¯å人çšãµãŒãã¹ããã¹ãããŠãã Ubuntu ã®ãµãŒãã« WireGuard ãã€ã³ã¹ããŒã«ããã + ãŸãã¯å人çšãµãŒãã¹ããã¹ãããŠãã Ubuntu ã®ãµãŒãã« WireGuard ãã€ã³ã¹ããŒã«ããã </p> - <div class="codeblock"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>$ sudo apt install wireguard</span></span></code></pre> </div> - <p> - 次ã«ãWireGuard ã§äœ¿çšããéµãçæããã + 次ã«ãWireGuard ã§äœ¿çšããéµãçæããã </p> - <div class="codeblock"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>$ wg genkey | sudo tee /etc/wireguard/server.key | wg pubkey | sudo tee /etc/wireguard/server.pub</span></span> <span class="line"><span>$ sudo chmod 600 /etc/wireguard/server.{key,pub}</span></span></code></pre> </div> </section> - <section id="section--install-wireguard-client"> - <h2><a href="#section--install-wireguard-client">WireGuard ã®ã€ã³ã¹ããŒã«: ã¯ã©ã€ã¢ã³ã</a></h2> + <h2><a href="#section--install-wireguard-client">WireGuard ã®ã€ã³ã¹ããŒã«: ã¯ã©ã€ã¢ã³ã</a></h2> <p> - å
¬åŒãµã€ãããå OS åãã®ã¯ã©ã€ã¢ã³ããœãããŠã§ã¢ãå
¥æããã€ã³ã¹ããŒã«ãããæ¬¡ã«ãèšå®ããããªãã + å
¬åŒãµã€ãããå OS åãã®ã¯ã©ã€ã¢ã³ããœãããŠã§ã¢ãå
¥æããã€ã³ã¹ããŒã«ãããæ¬¡ã«ãèšå®ããããªãã </p> - <div class="codeblock" language="ini"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#6A737D"># ã¯ã©ã€ã¢ã³ã 1 ã®å Žå</span></span> <span class="line"><span style="color:#6F42C1">[Interface]</span></span> @@ -129,7 +118,6 @@ <span class="line"><span style="color:#D73A49">AllowedIPs</span><span style="color:#24292E"> = <ãµãŒãã®å€éš IP ã¢ãã¬ã¹>/32</span></span> <span class="line"><span style="color:#D73A49">Endpoint</span><span style="color:#24292E"> = <ãµãŒãã®å€éš IP ã¢ãã¬ã¹>:51820</span></span></code></pre> </div> - <div class="codeblock" language="ini"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#6A737D"># ã¯ã©ã€ã¢ã³ã 2 ã®å Žå</span></span> <span class="line"><span style="color:#6F42C1">[Interface]</span></span> @@ -141,22 +129,18 @@ <span class="line"><span style="color:#D73A49">AllowedIPs</span><span style="color:#24292E"> = <ãµãŒãã®å€éš IP ã¢ãã¬ã¹>/32</span></span> <span class="line"><span style="color:#D73A49">Endpoint</span><span style="color:#24292E"> = <ãµãŒãã®å€éš IP ã¢ãã¬ã¹>:51820</span></span></code></pre> </div> - <p> <code>PrivateKey</code> ã <code>PublicKey</code> ã¯éµãã¡ã€ã«ã®ãã¹ã§ã¯ãªãäžèº«ãæžãããšã«æ³šæã </p> </section> - <section id="section--configure-wireguard"> - <h2><a href="#section--configure-wireguard"> WireGuard ã®èšå® </a></h2> + <h2><a href="#section--configure-wireguard">WireGuard ã®èšå®</a></h2> <p> - äžåºŠãµãŒããžæ»ããWireGuard ã®èšå®ãã¡ã€ã«ãæžãã + äžåºŠãµãŒããžæ»ããWireGuard ã®èšå®ãã¡ã€ã«ãæžãã </p> - <div class="codeblock"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>$ sudo vim /etc/wireguard/wg0.conf</span></span></code></pre> </div> - <div class="codeblock" language="ini"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#6F42C1">[Interface]</span></span> <span class="line"><span style="color:#D73A49">Address</span><span style="color:#24292E"> = 10.10.1.1/32</span></span> @@ -172,59 +156,49 @@ <span class="line"><span style="color:#D73A49">PublicKey</span><span style="color:#24292E"> = <ã¯ã©ã€ã¢ã³ã 2 ã®å
¬ééµ></span></span> <span class="line"><span style="color:#D73A49">AllowedIPs</span><span style="color:#24292E"> = 10.10.1.3/32</span></span></code></pre> </div> - <p> - 次ã«ãWireGuard ã®ãµãŒãã¹ãèµ·åããã + 次ã«ãWireGuard ã®ãµãŒãã¹ãèµ·åããã </p> - <div class="codeblock"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>$ sudo systemctl enable wg-quick@wg0</span></span> <span class="line"><span>$ sudo systemctl start wg-quick@wg0</span></span></code></pre> </div> </section> - <section id="section--configure-firewall"> - <h2><a href="#section--configure-firewall"> ãã¡ã€ã¢ãŠã©ãŒã«ã®èšå® </a></h2> + <h2><a href="#section--configure-firewall">ãã¡ã€ã¢ãŠã©ãŒã«ã®èšå®</a></h2> <p> - ç¶ããŠãã¡ã€ã¢ãŠã©ãŒã«ãèšå®ããããŸã㯠WireGuard ã䜿çšãã UDP ã®ããŒããéãã<code>wg0</code> ãéãéä¿¡ãèš±å¯ããã + ç¶ããŠãã¡ã€ã¢ãŠã©ãŒã«ãèšå®ããããŸã㯠WireGuard ã䜿çšãã UDP ã®ããŒããéãã<code>wg0</code> ãéãéä¿¡ãèš±å¯ããã </p> - <div class="codeblock"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>$ sudo ufw allow 51820/udp</span></span> <span class="line"><span>$ sudo ufw allow in on wg0</span></span> <span class="line"><span>$ sudo ufw allow out on wg0</span></span></code></pre> </div> - <p> - 次ã«ã80 ã 443 ãªã©ã®å¿
èŠãªããŒãã«ã€ããŠã<code>wg0</code> ãçµç±ããŠã®ã¢ã¯ã»ã¹ã®ã¿èš±å¯ããã + 次ã«ã80 ã 443 ãªã©ã®å¿
èŠãªããŒãã«ã€ããŠã<code>wg0</code> ãçµç±ããŠã®ã¢ã¯ã»ã¹ã®ã¿èš±å¯ããã </p> - <div class="codeblock"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>$ sudo ufw allow in on wg0 to any port 80 proto tcp</span></span> <span class="line"><span>$ sudo ufw allow in on wg0 to any port 443 proto tcp</span></span></code></pre> </div> - <p> - æåŸã«ã<code>ufw</code> ãæå¹ã«ããã + æåŸã«ã<code>ufw</code> ãæå¹ã«ããã </p> - <div class="codeblock"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>$ sudo ufw status</span></span> <span class="line"><span>$ sudo ufw enable</span></span></code></pre> </div> </section> - <section id="section--connect-each-other"> - <h2><a href="#section--connect-each-other"> æ¥ç¶ãã </a></h2> + <h2><a href="#section--connect-each-other">æ¥ç¶ãã</a></h2> <p> - ããã§ãåã¯ã©ã€ã¢ã³ãã§ VPN ãæå¹ã«ãããšãåœè©²ãµãŒãã® 80 ããŒãã 443 ããŒãã«ã¢ã¯ã»ã¹ã§ããããã«ãªã£ãã¯ãã ã念ã®ãã VPN ãåã£ãç¶æ
ã§ã¢ã¯ã»ã¹ã§ããªãããšã確èªããŠãããšããã ããã + ããã§ãåã¯ã©ã€ã¢ã³ãã§ VPN ãæå¹ã«ãããšãåœè©²ãµãŒãã® 80 ããŒãã 443 ããŒãã«ã¢ã¯ã»ã¹ã§ããããã«ãªã£ãã¯ãã ã念ã®ãã VPN ãåã£ãç¶æ
ã§ã¢ã¯ã»ã¹ã§ããªãããšã確èªããŠãããšããã ããã </p> </section> - <section id="section--edit-80-port"> - <h2><a href="#section--edit-80-port"> 远èš: 80 çªããŒãã«ã€ã㊠</a></h2> + <h2><a href="#section--edit-80-port">远èš: 80 çªããŒãã«ã€ããŠ</a></h2> <p> - Let's Encrypt ã§ãµãŒãã®èšŒææžãååŸããŠããå Žåã80 çªããŒãã空ããŠããå¿
èŠããããæ°ã¥ããªããã¡ã«èšŒææžãåããªãããæ³šæã + Letâs Encrypt ã§ãµãŒãã®èšŒææžãååŸããŠããå Žåã80 çªããŒãã空ããŠããå¿
èŠããããæ°ã¥ããªããã¡ã«èšŒææžãåããªãããæ³šæã </p> </section> </div> diff --git a/vhosts/blog/public/posts/2024-02-10/yapcjapan-2024-report/index.html b/vhosts/blog/public/posts/2024-02-10/yapcjapan-2024-report/index.html index 62debe04..8ed35d82 100644 --- a/vhosts/blog/public/posts/2024-02-10/yapcjapan-2024-report/index.html +++ b/vhosts/blog/public/posts/2024-02-10/yapcjapan-2024-report/index.html @@ -64,61 +64,59 @@ </ol> </section> <section id="section--intro"> - <h2><a href="#section--intro">ã¯ããã«</a></h2> + <h2><a href="#section--intro">ã¯ããã«</a></h2> <p> - 2024-02-10 ã«éå¬ãããã<a href="https://yapcjapan.org/2024hiroshima/" rel="noreferrer" target="_blank">YAPC::Hiroshima 2024</a> ã«åå ããã + 2024-02-10 ã«éå¬ãããã <a href="https://yapcjapan.org/2024hiroshima/" rel="noreferrer" target="_blank">YAPC::Hiroshima 2024</a> ã«åå ããã </p> </section> - <section id="section--sessions-thoughts"> - <h2><a href="#section--sessions-thoughts">ã»ãã·ã§ã³ã®ææ³</a></h2> + <h2><a href="#section--sessions-thoughts">ã»ãã·ã§ã³ã®ææ³</a></h2> <p> - â»ã»ãã·ã§ã³ã®é¡åãšçºè¡šè
åã¯ã<a href="https://fortee.jp/yapc-hiroshima-2024" rel="noreferrer" target="_blank">ã«ã³ãã¡ã¬ã³ã¹ã® fortee ããŒãž</a>ããåŒçšã + â»ã»ãã·ã§ã³ã®é¡åãšçºè¡šè
åã¯ã <a href="https://fortee.jp/yapc-hiroshima-2024" rel="noreferrer" target="_blank">ã«ã³ãã¡ã¬ã³ã¹ã® fortee ããŒãž</a> ããåŒçšã </p> - <ul> <li> - <a href="https://fortee.jp/yapc-hiroshima-2024/proposal/c0e77f91-f856-48a0-9741-b9afb662cd30" rel="noreferrer" target="_blank">VISAã«ãŒãã®è£åŽãš âæãæããâ æ±ºæžã·ã¹ãã ã®è²ãŠæ¹ (äžè°· ãã)</a> + <p> + <a href="https://fortee.jp/yapc-hiroshima-2024/proposal/c0e77f91-f856-48a0-9741-b9afb662cd30" rel="noreferrer" target="_blank">VISAã«ãŒãã®è£åŽãš âæãæããâ æ±ºæžã·ã¹ãã ã®è²ãŠæ¹ (äžè°· ãã)</a> + </p> <ul> <li> ãã¹ãã¹ããŒã«ãŒè³ã«ãéžã°ããŠããŸãããã倧å€é¢çœãçºè¡šã§ãããç§èªèº«ã¯ã«ãŒã決æžã®ç¥èããŸã£ãããªãã£ãã®ã§ãããå·§ã¿ãªèª¬æã«ããããããã£ããããªæ°ããããç¶æ
ã«ãªããŸããã </li> </ul> </li> - <li> - <a href="https://fortee.jp/yapc-hiroshima-2024/proposal/0e545260-61e1-465e-951c-91d6afb7782c" rel="noreferrer" target="_blank">awkã§ã€ãã£ãŠããããWebã¢ããªã±ãŒã·ã§ã³ (ãããŸãŒ ãã)</a> + <p> + <a href="https://fortee.jp/yapc-hiroshima-2024/proposal/0e545260-61e1-465e-951c-91d6afb7782c" rel="noreferrer" target="_blank">awkã§ã€ãã£ãŠããããWebã¢ããªã±ãŒã·ã§ã³ (ãããŸãŒ ãã)</a> + </p> <ul> <li> ã²ãŒã ã§ãããã°ã©ãã³ã°ã§ãçžããã¬ã€ã»ã©æ¥œãããã®ã¯ãªããšæããŸããçºè¡šäžã§ã¯ããã£ãšæµãããŠããŸããããããŒã¿ããŒã¹ãšã®éä¿¡ã TLSãGitHub ã® SSO ãªã©ãããã awk ã§æžããããšã¯æãã¬æ©èœã倿°å®è£
ãããŠãããã«ã³ãã¡ã¬ã³ã¹ãªã©ã®å Žã§ãããªããªãå³ããããšã®ãªãçæ°ã«è§Šããããšãã§ããŸããã </li> </ul> </li> - <li> - ããŒããŒã (æç«ã
ãã) + <p> + ããŒããŒã (æç«ã
ãã) + </p> + <ul> + <li> + â» æåŸ
è¬æŒã®ãã fortee ã®ããããŒã¶ã«ããŒãžãªã + </li> + <li> + ç§ãå°åŠ6幎çã®ãšããããã°ã©ãã³ã°ãå§ããããšæåã«éããã®ãã <a href="https://www.tohoho-web.com/java/" rel="noreferrer" target="_blank">ãšã»ã»ã® Java å
¥é</a> ãã§ãããç§ã®äººçã®éãæ±ºå®ãããã®ç¬¬äžæ©ç®ã®ãµã€ãã®éå¶è
ãä»ãŸãã«ç®ã®åã§è©±ããŠãããšããã®ã¯ãæåãªã©ãšããèšèã§ã¯ãšãŠãèšãå°œãããŸãããããã ãã§ãåºå³¶ãŸã§æ¥ã䟡å€ããã£ããšæèšã§ããŸãã + </li> + </ul> </li> - - <ul> - <li> - â» æåŸ
è¬æŒã®ãã fortee ã®ããããŒã¶ã«ããŒãžãªã - </li> - - <li> - ç§ãå°åŠ6幎çã®ãšããããã°ã©ãã³ã°ãå§ããããšæåã«éããã®ãã<a href="https://www.tohoho-web.com/java/" rel="noreferrer" target="_blank">ãšã»ã»ã® Java å
¥é</a>ãã§ãããç§ã®äººçã®éãæ±ºå®ãããã®ç¬¬äžæ©ç®ã®ãµã€ãã®éå¶è
ãä»ãŸãã«ç®ã®åã§è©±ããŠãããšããã®ã¯ãæåãªã©ãšããèšèã§ã¯ãšãŠãèšãå°œãããŸãããããã ãã§ãåºå³¶ãŸã§æ¥ã䟡å€ããã£ããšæèšã§ããŸãã - </li> - </ul> </ul> </section> - <section id="section--outro"> - <h2><a href="#section--outro">ãããã«</a></h2> + <h2><a href="#section--outro">ãããã«</a></h2> <p> - æé«ã ã£ããç¹ã«ãæç«ã
æ°ã®è¬æŒãçã§æèŽã§ããã®ã¯ãææ
šãšãšãã«å€§ãã«åºæ¿ãšãªã£ããæ¬¡åã® YAPC ã«ãæ¯éåå ãããã + æé«ã ã£ããç¹ã«ãæç«ã
æ°ã®è¬æŒãçã§æèŽã§ããã®ã¯ãææ
šãšãšãã«å€§ãã«åºæ¿ãšãªã£ããæ¬¡åã® YAPC ã«ãæ¯éåå ãããã </p> - <p> - P.S. Perl ãæžããããšããªããšãåäºåã«æ¥œãããã€ãã³ããªã®ã§ããPerl ãæžããªãããšããçç±ã§åå ããªãã£ãããã¯ãæ¬¡åæ¯éåå ãæ€èšããŠã¿ãŠã»ããã + P.S. Perl ãæžããããšããªããšãåäºåã«æ¥œãããã€ãã³ããªã®ã§ããPerl ãæžããªãããšããçç±ã§åå ããªãã£ãããã¯ãæ¬¡åæ¯éåå ãæ€èšããŠã¿ãŠã»ããã </p> </section> </div> diff --git a/vhosts/blog/public/posts/2024-02-22/phpkansai-2024-report/index.html b/vhosts/blog/public/posts/2024-02-22/phpkansai-2024-report/index.html index e47eef88..dbe5dde8 100644 --- a/vhosts/blog/public/posts/2024-02-22/phpkansai-2024-report/index.html +++ b/vhosts/blog/public/posts/2024-02-22/phpkansai-2024-report/index.html @@ -64,57 +64,56 @@ </ol> </section> <section id="section--intro"> - <h2><a href="#section--intro">ã¯ããã«</a></h2> + <h2><a href="#section--intro">ã¯ããã«</a></h2> <p> - 2024-02-11 ã«éå¬ãããã<a href="https://2024.kphpug.jp/" rel="noreferrer" target="_blank">PHPã«ã³ãã¡ã¬ã³ã¹é¢è¥¿ 2024</a> ã«åå ããã + 2024-02-11 ã«éå¬ãããã <a href="https://2024.kphpug.jp/" rel="noreferrer" target="_blank">PHPã«ã³ãã¡ã¬ã³ã¹é¢è¥¿ 2024</a> ã«åå ããã </p> </section> - <section id="section--sessions-thoughts"> - <h2><a href="#section--sessions-thoughts">ã»ãã·ã§ã³ã®ææ³</a></h2> + <h2><a href="#section--sessions-thoughts">ã»ãã·ã§ã³ã®ææ³</a></h2> <p> - â»ã»ãã·ã§ã³ã®é¡åãšçºè¡šè
åã¯ã<a href="https://fortee.jp/phpcon-kansai2024" rel="noreferrer" target="_blank">ã«ã³ãã¡ã¬ã³ã¹ã® fortee ããŒãž</a>ããåŒçšã + â»ã»ãã·ã§ã³ã®é¡åãšçºè¡šè
åã¯ã <a href="https://fortee.jp/phpcon-kansai2024" rel="noreferrer" target="_blank">ã«ã³ãã¡ã¬ã³ã¹ã® fortee ããŒãž</a> ããåŒçšã </p> - <ul> <li> - <a href="https://fortee.jp/phpcon-kansai2024/proposal/4e03491c-2a97-40aa-8ff9-a68593b0e847" rel="noreferrer" target="_blank">RDBã¢ã³ããã¿ãŒã³ãšæŠã - åé€ãã©ã° å®å
šæ»ç¥ã¬ã€ã (æœæ ¹ 壮倧 ãã)</a> + <p> + <a href="https://fortee.jp/phpcon-kansai2024/proposal/4e03491c-2a97-40aa-8ff9-a68593b0e847" rel="noreferrer" target="_blank">RDBã¢ã³ããã¿ãŒã³ãšæŠã - åé€ãã©ã° å®å
šæ»ç¥ã¬ã€ã (æœæ ¹ 壮倧 ãã)</a> + </p> <ul> <li> ã¢ã³ããã¿ãŒã³ãšããŠçŽã®äžã§ã®ç¥èã ããããã®ã®ãå®éã«ã©ãèšèšãã¹ããªã®ãããããã¯ä»ãã§ã«äœ¿ãããŠããå Žåã«ã©ãçŽããŠããã¹ããªã®ãã«ã€ããŠã¯ãç¥èããŸã£ããè¶³ããŠããªãã£ããããããæ©äŒãšãªããŸãããããŒã¿ããŒã¹åéã«ã€ããŠã¯ãä»åŸãç¥èã®ã€ã³ããããšçµéšãå¿
èŠã ãšæããŠããŸãã </li> </ul> </li> - <li> - <a href="https://fortee.jp/phpcon-kansai2024/proposal/c903c4be-77bb-47b9-85a1-5bfdfd61c1aa" rel="noreferrer" target="_blank">PHPã³ãã¥ããã£ããã®é
åãšç±çãããªãã«ãïŒïŒïŒ (ããšã¿ã ãã)</a> + <p> + <a href="https://fortee.jp/phpcon-kansai2024/proposal/c903c4be-77bb-47b9-85a1-5bfdfd61c1aa" rel="noreferrer" target="_blank">PHPã³ãã¥ããã£ããã®é
åãšç±çãããªãã«ãïŒïŒïŒ (ããšã¿ã ãã)</a> + </p> <ul> <li> ãããã®èšäºãèªãã§ããããªãããŸã äžåºŠãã«ã³ãã¡ã¬ã³ã¹ãå匷äŒã«åå ããããšããªããªãããã®èšäºã¯ã©ãã§ãããã®ã§ã¹ã©ã€ããèŠãŠãã ãããäŒããã¹ãããšã¯ä»¥äžã§ãã </li> </ul> </li> - <li> - <a href="https://fortee.jp/phpcon-kansai2024/proposal/0e0befdb-2028-42c8-98e2-b19e434f5a82" rel="noreferrer" target="_blank">ã»ãèšèªã«ãã£ãŠPHPã«ãªãæ©èœ (ç°äžã²ããŠã ãã)</a> + <p> + <a href="https://fortee.jp/phpcon-kansai2024/proposal/0e0befdb-2028-42c8-98e2-b19e434f5a82" rel="noreferrer" target="_blank">ã»ãèšèªã«ãã£ãŠPHPã«ãªãæ©èœ (ç°äžã²ããŠã ãã)</a> + </p> + <ul> + <li> + ç§ã¯ããã°ã©ãã³ã°èšèªã®æ¯èŒã倧奜ããªã®ã§ãéåžžã«æ¥œããã£ãã§ããUFCS (Uniform Function Call Syntax) ã®ç¥å床ã®äœãã«ã¯é©ããŸããããDèšèªer ã§äŒå Žãåãå°œããããŠãããããã¯ããã§é©ããªã®ã§ãããªããããããŸãããå人çã«ãã»ãèšèªã«ãã£ãŠPHPã«ãªãæ©èœãã®äžã§äžçªã»ããã®ã¯ä»£æ°çããŒã¿åã§ãã + </li> + </ul> </li> - - <ul> - <li> - ç§ã¯ããã°ã©ãã³ã°èšèªã®æ¯èŒã倧奜ããªã®ã§ãéåžžã«æ¥œããã£ãã§ããUFCS (Uniform Function Call Syntax) ã®ç¥å床ã®äœãã«ã¯é©ããŸããããDèšèªer ã§äŒå Žãåãå°œããããŠãããããã¯ããã§é©ããªã®ã§ãããªããããããŸãããå人çã«ãã»ãèšèªã«ãã£ãŠPHPã«ãªãæ©èœãã®äžã§äžçªã»ããã®ã¯ä»£æ°çããŒã¿åã§ãã - </li> - </ul> </ul> </section> - <section id="section--outro"> - <h2><a href="#section--outro">ãããã«</a></h2> + <h2><a href="#section--outro">ãããã«</a></h2> <p> - <a href="/posts/2024-02-10/yapcjapan-2024-report/">æ¬ã«ã³ãã¡ã¬ã³ã¹ã®åæ¥ 2024-02-10 㯠YAPC::Hiroshima ã«åå ããŠãã</a>ã2æ¥é£ç¶ã®ã«ã³ãã¡ã¬ã³ã¹ãšãªã£ããããªãç²ãã¯ãããããã®åå
å®ãã鱿«ãšãªã£ãããã«æãã + <a href="/posts/2024-02-10/yapcjapan-2024-report/">æ¬ã«ã³ãã¡ã¬ã³ã¹ã®åæ¥ 2024-02-10 㯠YAPC::Hiroshima ã«åå ããŠãã</a> ã2æ¥é£ç¶ã®ã«ã³ãã¡ã¬ã³ã¹ãšãªã£ããããªãç²ãã¯ãããããã®åå
å®ãã鱿«ãšãªã£ãããã«æãã </p> - <p> - ç¿3æã¯ PHPerKaigi 2024ã4æã¯ PHPã«ã³ãã¡ã¬ã³ã¹å°ç°å 2024 ããããããããã¹ã¿ããå
Œã¹ããŒã«ãŒã§åå äºå®ã§ãããä»åºŠã¯æäŸããåŽãšããŠãæºè¶³ã®ããã«ã³ãã¡ã¬ã³ã¹ã«ãªãããã«ãããã + ç¿3æã¯ PHPerKaigi 2024ã4æã¯ PHPã«ã³ãã¡ã¬ã³ã¹å°ç°å 2024 ããããããããã¹ã¿ããå
Œã¹ããŒã«ãŒã§åå äºå®ã§ããã ä»åºŠã¯æäŸããåŽãšããŠãæºè¶³ã®ããã«ã³ãã¡ã¬ã³ã¹ã«ãªãããã«ãããã </p> </section> </div> diff --git a/vhosts/blog/public/posts/2024-03-17/phperkaigi-2024-report/index.html b/vhosts/blog/public/posts/2024-03-17/phperkaigi-2024-report/index.html index 80ec045e..bb00a6ce 100644 --- a/vhosts/blog/public/posts/2024-03-17/phperkaigi-2024-report/index.html +++ b/vhosts/blog/public/posts/2024-03-17/phperkaigi-2024-report/index.html @@ -67,117 +67,98 @@ </ol> </section> <section id="section--intro"> - <h2><a href="#section--intro">ã¯ããã«</a></h2> + <h2><a href="#section--intro">ã¯ããã«</a></h2> <p> - 2024-03-07 ãã 2024-03-09 ã«ãããŠéå¬ãããã<a href="https://phperkaigi.jp/2024/" rel="noreferrer" target="_blank">PHPerKaigi 2024</a> ã«åå ãããä»å¹Žã¯ã¹ããŒã«ãŒãšããŠããŸããã³ã¢ã¹ã¿ãããšããŠåå ããã + 2024-03-07 ãã 2024-03-09 ã«ãããŠéå¬ãããã <a href="https://phperkaigi.jp/2024/" rel="noreferrer" target="_blank">PHPerKaigi 2024</a> ã«åå ããã ä»å¹Žã¯ã¹ããŒã«ãŒãšããŠããŸããã³ã¢ã¹ã¿ãããšããŠåå ããã </p> - <p> - éå»ã®åå ã¬ãã¯ãã¡ã: + éå»ã®åå ã¬ãã¯ãã¡ã: </p> - <ul> <li> <a href="/posts/2023-04-04/phperkaigi-2023-report/">PHPerKaigi 2023</a> </li> - <li> <a href="/posts/2022-05-01/phperkaigi-2022/">PHPerKaigi 2022</a> </li> - <li> <a href="/posts/2021-03-30/phperkaigi-2021/">PHPerKaigi 2021</a> </li> </ul> </section> - <section id="section--as-speaker"> - <h2><a href="#section--as-speaker">ã¹ããŒã«ãŒãšããŠ</a></h2> + <h2><a href="#section--as-speaker">ã¹ããŒã«ãŒãšããŠ</a></h2> <p> - æšå¹Žã«ç¶ããã¹ããŒã«ãŒãšããŠç»å£ããããªã£ãã + æšå¹Žã«ç¶ããã¹ããŒã«ãŒãšããŠç»å£ããããªã£ãã </p> - <ul> <li> - WebAssembly ãçè§£ãã ãVM ã®äœæãéããŠã + <p> + WebAssembly ãçè§£ãã ãVM ã®äœæãéããŠã + </p> <ul> <li> <a href="https://fortee.jp/phperkaigi-2024/proposal/bc5dc153-17af-4079-8f1b-2660af97e2c8" rel="noreferrer" target="_blank">ããããŒã¶ã«</a> </li> - <li> <a href="/slides/2024-03-08/phperkaigi-2024/">ã¹ã©ã€ã</a> </li> </ul> </li> </ul> - <p> - WebAssembly ã® VM ã PHP ã§å®è£
ããå®è£
ã«è³ããŸã§ã®éçšã WebAssembly ã®ç¹åŸŽãèšèªåŠçç³»ãäœã楜ããã«ã€ããŠèªã£ããã¿ã€ãã«ã«ãããWebAssembly ãçè§£ããããšããç®çãéæã§ãããããªããŒã¯ã ã£ãããšèšããããšçåã¯æ®ããã®ã®ãå®éã«äœã£ã人ã«ããã§ããªã話ãããããšã¯ã§ãããšæãã + WebAssembly ã® VM ã PHP ã§å®è£
ããå®è£
ã«è³ããŸã§ã®éçšã WebAssembly ã®ç¹åŸŽãèšèªåŠçç³»ãäœã楜ããã«ã€ããŠèªã£ãã ã¿ã€ãã«ã«ãããWebAssembly ãçè§£ããããšããç®çãéæã§ãããããªããŒã¯ã ã£ãããšèšããããšçåã¯æ®ããã®ã®ãå®éã«äœã£ã人ã«ããã§ããªã話ãããããšã¯ã§ãããšæãã </p> </section> - <section id="section--as-staff"> - <h2><a href="#section--as-staff">ã³ã¢ã¹ã¿ãããšããŠ</a></h2> + <h2><a href="#section--as-staff">ã³ã¢ã¹ã¿ãããšããŠ</a></h2> <p> - æšå¹Žã¯åœæ¥ã¹ã¿ãããšããŠåå ããããä»å¹Žã¯ã³ã¢ã¹ã¿ãããšããŠéå¶ã«åå ãããä»å¹Žã¯ã³ãŒããŽã«ãäŒç»ãææ¡ãããã®æºåãšã·ã¹ãã ã®éçºãåœæ¥ã®éçšããããªã£ãããã®ã·ã¹ãã ã¯çŸåšãäžèšã® URL ããé²èЧã§ããåœæ¥åºé¡ãããåé¡ãåå è
ã®æ¹ã
ã®åçãèŠãããã + æšå¹Žã¯åœæ¥ã¹ã¿ãããšããŠåå ããããä»å¹Žã¯ã³ã¢ã¹ã¿ãããšããŠéå¶ã«åå ããã ä»å¹Žã¯ã³ãŒããŽã«ãäŒç»ãææ¡ãããã®æºåãšã·ã¹ãã ã®éçºãåœæ¥ã®éçšããããªã£ãã ãã®ã·ã¹ãã ã¯çŸåšãäžèšã® URL ããé²èЧã§ããåœæ¥åºé¡ãããåé¡ãåå è
ã®æ¹ã
ã®åçãèŠãããã </p> - <p> <a href="https://t.nil.ninja/phperkaigi/2024/golf/" rel="noreferrer" target="_blank">Albatross.PHP</a> </p> - <p> - ã·ã¹ãã ã®éçºå®äºãåé¡ã®äœæå®äºã¯ã¹ã±ãžã¥ãŒã«ã®ãªã®ãªãšãªã£ãã®ã ããåœæ¥ã¯ããããå®å®ããŠçšŒåããŠããã®ã§ã¯ãªãããšæãã + ã·ã¹ãã ã®éçºå®äºãåé¡ã®äœæå®äºã¯ã¹ã±ãžã¥ãŒã«ã®ãªã®ãªãšãªã£ãã®ã ããåœæ¥ã¯ããããå®å®ããŠçšŒåããŠããã®ã§ã¯ãªãããšæãã </p> </section> - <section id="section--as-attendee"> - <h2><a href="#section--as-attendee">åå è
ãšããŠ</a></h2> + <h2><a href="#section--as-attendee">åå è
ãšããŠ</a></h2> <section id="section--as-attendee--my-best-session"> - <h3><a href="#section--as-attendee--my-best-session">ãã€ãã¹ãã»ãã·ã§ã³</a></h3> + <h3><a href="#section--as-attendee--my-best-session">ãã€ãã¹ãã»ãã·ã§ã³</a></h3> <p> - <a href="https://fortee.jp/phperkaigi-2024/proposal/ac59d0dd-795a-47cb-ba59-c0b1772d00cc" rel="noreferrer" target="_blank">RubyVM ã PHP ã§å®è£
ãããHello World ãåºåãããŸã§ã</a> (ããã㌠ãã) + <a href="https://fortee.jp/phperkaigi-2024/proposal/ac59d0dd-795a-47cb-ba59-c0b1772d00cc" rel="noreferrer" target="_blank">RubyVM ã PHP ã§å®è£
ãããHello World ãåºåãããŸã§ã</a> (ããã㌠ãã) </p> - <p> - ä»åäžçªæ¥œãã¿ã«ããŠããã»ãã·ã§ã³ã§ãããæåŸ
ã©ããã®é¢çœãã ã£ããç§ãä»å VM ãäœããšããããŒãã§ç»å£ããããšããããé«ãè§£å床ã§åãåãããšãã§ããããã«æãã + ä»åäžçªæ¥œãã¿ã«ããŠããã»ãã·ã§ã³ã§ãããæåŸ
ã©ããã®é¢çœãã ã£ãã ç§ãä»å VM ãäœããšããããŒãã§ç»å£ããããšããããé«ãè§£å床ã§åãåãããšãã§ããããã«æãã </p> - <p> - P.S. Ask the Speaker ã§è©±ãããRuby VM (written in PHP) on PHP VM (compiled to Wasm) on Wasm VM (written in PHP) on PHP ãšããã¢ã€ãã¢ã¯ãããžããªã®ã§ãç¶å ±ããåŸ
ã¡ãã ãã (èªäœ Wasm runtime ã«äžè¶³ããŠããæ©èœãéæå®è£
äžã§ã)ã + P.S. Ask the Speaker ã§è©±ãããRuby VM (written in PHP) on PHP VM (compiled to Wasm) on Wasm VM (written in PHP) on PHP ãšããã¢ã€ãã¢ã¯ãããžããªã®ã§ãç¶å ±ããåŸ
ã¡ãã ãã (èªäœ Wasm runtime ã«äžè¶³ããŠããæ©èœãéæå®è£
äžã§ã)ã </p> - <p> - 2024-07-07 远èš: <a href="https://github.com/nsfisis/php-waddiwasi/commit/a312e95a95d243943535f94653822d6796d4637f" rel="noreferrer" target="_blank">ã³ããã a312e95</a> ã§ãã€ãã« Ruby VM on PHP VM on Wasm VM on PHP ãå®çŸãããçŸæç¹ã§ã®åãããã㯠README ã«èšèŒããŠããã + 2024-07-07 远èš: <a href="https://github.com/nsfisis/php-waddiwasi/commit/a312e95a95d243943535f94653822d6796d4637f" rel="noreferrer" target="_blank">ã³ããã a312e95</a> ã§ãã€ãã« Ruby VM on PHP VM on Wasm VM on PHP ãå®çŸãããçŸæç¹ã§ã®åãããã㯠README ã«èšèŒããŠããã </p> </section> </section> - <section id="section--outro"> - <h2><a href="#section--outro">ãããã«</a></h2> + <h2><a href="#section--outro">ãããã«</a></h2> <p> - ä»å¹Žã¯ã¹ããŒã«ãŒãšã¹ã¿ãããšãã«éçºã䌎ããã®ã ã£ãã®ã§ (Wasm åŠçç³»ãšã³ãŒããŽã«ãã·ã¹ãã )ãäž¡è
ãã¶ã€ãã£ãçµæãšããŠæºå段éã¯å»å¹Žããã倧å€ã«ãªã£ãã + ä»å¹Žã¯ã¹ããŒã«ãŒãšã¹ã¿ãããšãã«éçºã䌎ããã®ã ã£ãã®ã§ (Wasm åŠçç³»ãšã³ãŒããŽã«ãã·ã¹ãã )ãäž¡è
ãã¶ã€ãã£ãçµæãšããŠæºå段éã¯å»å¹Žããã倧å€ã«ãªã£ãã </p> - <p> <a href="https://twitter.com/nsfisis/status/1765366490277253502" rel="noreferrer" target="_blank">ãŽãªãŽãªã«éçºããªããã°ãããªãã»ãã·ã§ã³ã®ã¹ããŒã«ãŒãšãŽãªãŽãªã«éçºããªããã°ãããªãäŒç»ã®ã¹ã¿ãããåãã«ã³ãã¡ã¬ã³ã¹ã§ãã£ãŠã¯ãããªã</a> </p> - <p> - ãã ãããã§ãã³ã¢ã¹ã¿ãããšããŠå幎ã»ã©é¢ãã£ãã ãã«ãçµãã£ãŠã¿ããšææ
šæ·±ããäŸå¹Žã©ããããç¥ã®ãããªæŽ»æ°ã»ç±æ°ãæããããšãã§ããã + ãã ãããã§ãã³ã¢ã¹ã¿ãããšããŠå幎ã»ã©é¢ãã£ãã ãã«ãçµãã£ãŠã¿ããšææ
šæ·±ãã äŸå¹Žã©ããããç¥ã®ãããªæŽ»æ°ã»ç±æ°ãæããããšãã§ããã </p> - <p> - æ¥æã¯ããŸãç»å£ãšã¹ã¿ãã (ãã¡ãã¯åœæ¥ã¹ã¿ãã) ããããªã <a href="https://phpcon-odawara.jp/" rel="noreferrer" target="_blank">PHP ã«ã³ãã¡ã¬ã³ã¹å°ç°å</a> ãããã®ã§ãè¯ãããŒã¯ã»è¯ãã«ã³ãã¡ã¬ã³ã¹ãäœããããã«ãããã + æ¥æã¯ããŸãç»å£ãšã¹ã¿ãã (ãã¡ãã¯åœæ¥ã¹ã¿ãã) ããããªã <a href="https://phpcon-odawara.jp/" rel="noreferrer" target="_blank">PHP ã«ã³ãã¡ã¬ã³ã¹å°ç°å</a> ãããã®ã§ãè¯ãããŒã¯ã»è¯ãã«ã³ãã¡ã¬ã³ã¹ãäœããããã«ãããã </p> - <p> - ããŠãåå ã¬ãã¯äŸå¹Žãã®èšèã§ç· ãæ¬ã£ãŠããã®ã§ãä»å¹Žãããã§çµããããšæãã + ããŠãåå ã¬ãã¯äŸå¹Žãã®èšèã§ç· ãæ¬ã£ãŠããã®ã§ãä»å¹Žãããã§çµããããšæãã </p> - <p> - ã§ã¯ãŸãæ¥å¹Žã + ã§ã¯ãŸãæ¥å¹Žã </p> </section> </div> diff --git a/vhosts/blog/public/posts/2024-03-20/my-bucket-list/index.html b/vhosts/blog/public/posts/2024-03-20/my-bucket-list/index.html index 2b874bf3..68109153 100644 --- a/vhosts/blog/public/posts/2024-03-20/my-bucket-list/index.html +++ b/vhosts/blog/public/posts/2024-03-20/my-bucket-list/index.html @@ -55,89 +55,69 @@ </ol> </section> <p> - ããã¯ç ããªãå€ã«ããŒããžæžãæ£ãããæããªããšãæç« ã®äœè£ã«çŽãããã®ã§ããããããè«çãšåŒã¹ããã®ãæåŸ
ããŠã¯ãªãã¬ã + ããã¯ç ããªãå€ã«ããŒããžæžãæ£ãããæããªããšãæç« ã®äœè£ã«çŽãããã®ã§ããããããè«çãšåŒã¹ããã®ãæåŸ
ããŠã¯ãªãã¬ã </p> - <p> - Knuth æ°ãããã°ã©ãã³ã°ã¯æèžã§ãããæã£ãŠããããåŽåœ¹ã«äŒŽããããã¯ãã£ãã§ãã©ã¯ãã£ã«ã«ãªè¡çºãæããŠããèšã£ãŠããã®ã§ã¯ãªã (Knuth ãã©ãèããŠãããã¯ç¥ããªãããå°ãªããšãç§ã«ãšã£ãŠã¯)ãããããè¶£å³ããã°ã©ãã³ã°ãç©¢ããªãèªç±æå¿ã®äžã§èšè¿°ãããããã°ã©ã ãšã¯ããªãã¡ãçµµæãã«ãšã£ãŠã®çµµãæåæžãã«ãšã£ãŠã®æç« ã«çãããããã°ã©ã ãšã¯ããœãŒã¹ã³ãŒããšã¯ãèžè¡äœåã®äžåœ¢æ
ãªã®ã§ããã + Knuth æ°ãããã°ã©ãã³ã°ã¯æèžã§ãããæã£ãŠããããåŽåœ¹ã«äŒŽããããã¯ãã£ãã§ãã©ã¯ãã£ã«ã«ãªè¡çºãæããŠããèšã£ãŠããã®ã§ã¯ãªã (Knuth ãã©ãèããŠãããã¯ç¥ããªãããå°ãªããšãç§ã«ãšã£ãŠã¯)ãããããè¶£å³ããã°ã©ãã³ã°ãç©¢ããªãèªç±æå¿ã®äžã§èšè¿°ãããããã°ã©ã ãšã¯ããªãã¡ãçµµæãã«ãšã£ãŠã®çµµãæåæžãã«ãšã£ãŠã®æç« ã«çãããããã°ã©ã ãšã¯ããœãŒã¹ã³ãŒããšã¯ãèžè¡äœåã®äžåœ¢æ
ãªã®ã§ããã </p> - <p> - ãã®äººçã§ããã°ã©ãã³ã°ãšããè¡çºã«é
ããããããã«ã¯ãçŸããäœåãéºããã°ãªãã¬ãããªãã¡ãç°¡æœã§ãçè§£ãããããåçž®ãããæ©èœçã§ãéãã軜ããããååãæã¡ãããŸãåããã®ãã ã + ãã®äººçã§ããã°ã©ãã³ã°ãšããè¡çºã«é
ããããããã«ã¯ãçŸããäœåãéºããã°ãªãã¬ãããªãã¡ãç°¡æœã§ãçè§£ãããããåçž®ãããæ©èœçã§ãéãã軜ããããååãæã¡ãããŸãåããã®ãã ã </p> - <p> - äœãäœããããã¯åã
ç°ãªãã§ãããããç§ã«ãšã£ãŠã¯è»èŒªã®åçºæãšããŠç¥ãããèªäœââã§ããã + äœãäœããããã¯åã
ç°ãªãã§ãããããç§ã«ãšã£ãŠã¯è»èŒªã®åçºæãšããŠç¥ãããèªäœââã§ããã </p> - <p> - è»èŒªã®åçºæãæããŠã¯ãããªãããããæ¹å€ãã人éãšããã®ã¯ããããã¯ãã£ããã£ããã©ã¯ãã£ã«ãªãã£ã«ãã©ãŒã«ã¹ãããšã³ãžãã¢ãšãã人皮ã§ãããä»ç§ã衚çŸè
ããããšãããªããèªãã®æã§èªãã®è»èŒªãäœãããšã«äœã®æããæ±ãå¿
èŠãããããã + è»èŒªã®åçºæãæããŠã¯ãããªãããããæ¹å€ãã人éãšããã®ã¯ããããã¯ãã£ããã£ããã©ã¯ãã£ã«ãªãã£ã«ãã©ãŒã«ã¹ãããšã³ãžãã¢ãšãã人皮ã§ãããä»ç§ã衚çŸè
ããããšãããªããèªãã®æã§èªãã®è»èŒªãäœãããšã«äœã®æããæ±ãå¿
èŠãããããã </p> - <p> - ããããããç§ã®æ»ã¬ãŸã§ã«äœãèªäœââäžèЧãããã¯äººçã® TODO ãªã¹ãã§ãã (çŸæç¹ã§ãã§ã«éšåçãããã¯å
šé¢çã«éæããŠãããã®ãå«ã)ã + ããããããç§ã®æ»ã¬ãŸã§ã«äœãèªäœââäžèЧãããã¯äººçã® TODO ãªã¹ãã§ãã (çŸæç¹ã§ãã§ã«éšåçãããã¯å
šé¢çã«éæããŠãããã®ãå«ã)ã </p> - <ul> <li> èªäœ C ã³ã³ãã€ã© </li> - <li> èªäœã¢ã»ã³ãã© </li> - <li> èªäœãªã³ã« </li> - <li> èªäœ Scheme åŠçç³» </li> - <li> èªäœ ML ã³ã³ãã€ã© </li> - <li> èªäœ Lua åŠçç³» </li> - <li> èªäœ JVM </li> - <li> èªäœ Wasm åŠçç³» </li> - <li> èªäœæ£èŠè¡šçŸãšã³ãžã³ </li> - <li> èªäœ JavaScript åŠçç³» </li> - <li> èªäœãã©ãŠã¶ </li> - <li> èªäœãšãã£ã¿ </li> - <li> èªäœ ActivityPub å®è£
</li> </ul> - <p> - éžå®çç±ã¯äœããããšããããšã®ã»ãã«ãªããããã«é¡æãšãã£ã³ãã¹ãããçµµçãšçµµå
·ãããã°ãçããšãçãããã®ããã¥ããã³ãŒããæžãããããã + éžå®çç±ã¯äœããããšããããšã®ã»ãã«ãªããããã«é¡æãšãã£ã³ãã¹ãããçµµçãšçµµå
·ãããã°ãçããšãçãããã®ããã¥ããã³ãŒããæžãããããã </p> - <p> - ãããé¡ããã¯ãç§ã«ããããçã¿åºãã ãã®æéããããããšãã + ãããé¡ããã¯ãç§ã«ããããçã¿åºãã ãã®æéããããããšãã </p> </div> </article> diff --git a/vhosts/blog/public/posts/2024-04-14/phpcon-odawara-2024-report/index.html b/vhosts/blog/public/posts/2024-04-14/phpcon-odawara-2024-report/index.html index 92983841..0c8dda5c 100644 --- a/vhosts/blog/public/posts/2024-04-14/phpcon-odawara-2024-report/index.html +++ b/vhosts/blog/public/posts/2024-04-14/phpcon-odawara-2024-report/index.html @@ -67,101 +67,93 @@ </ol> </section> <section id="section--intro"> - <h2><a href="#section--intro">ã¯ããã«</a></h2> + <h2><a href="#section--intro">ã¯ããã«</a></h2> <p> - 2024-04-13 ã«éå¬ããã<a href="https://phpcon-odawara.jp/" rel="noreferrer" target="_blank">PHP ã«ã³ãã¡ã¬ã³ã¹å°ç°å</a>ã«ãã¹ããŒã«ãŒãšããŠããŸãåœæ¥ã¹ã¿ãããšããŠåå ããã + 2024-04-13 ã«éå¬ããã <a href="https://phpcon-odawara.jp/" rel="noreferrer" target="_blank">PHP ã«ã³ãã¡ã¬ã³ã¹å°ç°å</a> ã«ãã¹ããŒã«ãŒãšããŠããŸãåœæ¥ã¹ã¿ãããšããŠåå ããã </p> </section> - <section id="section--as-speaker"> - <h2><a href="#section--as-speaker">ã¹ããŒã«ãŒãšããŠ</a></h2> + <h2><a href="#section--as-speaker">ã¹ããŒã«ãŒãšããŠ</a></h2> <p> - PHP åŠç系㮠JIT ã³ã³ãã€ã«ã«ããã PHP 8.4 ã§ã®å€æŽã«ã€ããŠãç»å£ããããªã£ãã + PHP åŠç系㮠JIT ã³ã³ãã€ã«ã«ããã PHP 8.4 ã§ã®å€æŽã«ã€ããŠãç»å£ããããªã£ãã </p> - <ul> <li> - æ¥ãæ° JIT ãšã³ãžã³ã«ã€ããŠç¥ã£ãæ°ã«ãªã + <p> + æ¥ãæ° JIT ãšã³ãžã³ã«ã€ããŠç¥ã£ãæ°ã«ãªã + </p> <ul> <li> <a href="https://fortee.jp/phpconodawara-2024/proposal/bc9669f6-6583-489c-aa6a-1b68abf7c291" rel="noreferrer" target="_blank">ããããŒã¶ã«</a> </li> - <li> <a href="/slides/2024-04-13/phpcon-odawara-2024/">ã¹ã©ã€ã</a> </li> </ul> </li> </ul> - <p> - ä»åãã©ããã話ãå§ããã倧ãã«è¿·ã£ãã®ã ããæçµçã«ã¯ PHP åŠç系㮠opcode ã VM ãšãã£ãæŠå¿µã¯æ¢ç¥ã®ãã®ãšãããããã JIT ã³ã³ãã€ã«ãžç¹ãããšãã£ãæ§æã«ããã + ä»åãã©ããã話ãå§ããã倧ãã«è¿·ã£ãã®ã ããæçµçã«ã¯ PHP åŠç系㮠opcode ã VM ãšãã£ãæŠå¿µã¯æ¢ç¥ã®ãã®ãšãããããã JIT ã³ã³ãã€ã«ãžç¹ãããšãã£ãæ§æã«ããã </p> - <p> - PHP ã®åŠçç³»ãã¹ã¯ãªããã opcode ãžå€æããéçšã«ã€ããŠã¯ãã¡ããã©åãã«ã³ãã¡ã¬ã³ã¹ã®<a href="https://fortee.jp/phpconodawara-2024/proposal/21d94a60-404d-4fba-8c60-d1c8889a0138" rel="noreferrer" target="_blank">ããããŒããã®çºè¡š</a>ããããåèã«ããŠããã ããšããã ããããŸããæ°ãã IR ã«ã€ããŠãã詳ããç¥ããããšããæ¹ã¯ãã¹ã©ã€ãæ«å°Ÿã®ãåèè³æãã«ãããªã³ã¯ãåç
§ããã ãã®ãããããšæãã + PHP ã®åŠçç³»ãã¹ã¯ãªããã opcode ãžå€æããéçšã«ã€ããŠã¯ãã¡ããã©åãã«ã³ãã¡ã¬ã³ã¹ã® <a href="https://fortee.jp/phpconodawara-2024/proposal/21d94a60-404d-4fba-8c60-d1c8889a0138" rel="noreferrer" target="_blank">ããããŒããã®çºè¡š</a> ããããåèã«ããŠããã ããšããã ããã ãŸããæ°ãã IR ã«ã€ããŠãã詳ããç¥ããããšããæ¹ã¯ãã¹ã©ã€ãæ«å°Ÿã®ãåèè³æãã«ãããªã³ã¯ãåç
§ããã ãã®ãããããšæãã </p> - <p> - Tracing JIT ã®çºç«æ¡ä»¶ããIR ã䜿ã£ãŠå®çŸãããæé©åæ¹æ³ãªã©ã調ã¹ããã®ã®çºè¡šã«å
¥ããªãã£ã話ãããŸããšããã®ã§ããããã©ããã«æã£ãŠãããã°ãšèããŠããã + Tracing JIT ã®çºç«æ¡ä»¶ããIR ã䜿ã£ãŠå®çŸãããæé©åæ¹æ³ãªã©ã調ã¹ããã®ã®çºè¡šã«å
¥ããªãã£ã話ãããŸããšããã®ã§ããããã©ããã«æã£ãŠãããã°ãšèããŠããã </p> </section> - <section id="section--as-staff"> - <h2><a href="#section--as-staff">ã¹ã¿ãããšããŠ</a></h2> + <h2><a href="#section--as-staff">ã¹ã¿ãããšããŠ</a></h2> <p> - åœæ¥ã¹ã¿ãããšããŠåæ¥ã®æºåãšåœæ¥ã®éå¶ããããªã£ããä»åã¯ã¢ãã®ç§»åãæ¯èŒç (æ¯èŒå¯Ÿè±¡: <a href="/posts/2024-03-17/phperkaigi-2024-report/">PHPerKaigi</a>) å°ãªããäœåã«ã¯ããªãäœè£ããã£ãã + åœæ¥ã¹ã¿ãããšããŠåæ¥ã®æºåãšåœæ¥ã®éå¶ããããªã£ããä»åã¯ã¢ãã®ç§»åãæ¯èŒç (æ¯èŒå¯Ÿè±¡: <a href="/posts/2024-03-17/phperkaigi-2024-report/">PHPerKaigi</a> ) å°ãªããäœåã«ã¯ããªãäœè£ããã£ãã </p> - <p> - èªåã®æ
åœç¯å²å
ã§ã¯ãäžåºŠã¿ã€ã ããŒããŒä¿ã®ãšãã«æéãæãããééãã以å€ã¯ãã¹ã ãŒãºã«é²ããããããšæãã + èªåã®æ
åœç¯å²å
ã§ã¯ãäžåºŠã¿ã€ã ããŒããŒä¿ã®ãšãã«æéãæãããééãã以å€ã¯ãã¹ã ãŒãºã«é²ããããããšæãã </p> - <p> - ãŸããããã¯ã³ã¢ã¹ã¿ããã®æ¹ã
ã®ãããã ããããåéå¬ãšããŠã¯å€§ããªãã©ãã«ãªãçµãã£ããšèšããã®ã§ã¯ãªãã ãããã + ãŸããããã¯ã³ã¢ã¹ã¿ããã®æ¹ã
ã®ãããã ããããåéå¬ãšããŠã¯å€§ããªãã©ãã«ãªãçµãã£ããšèšããã®ã§ã¯ãªãã ãããã </p> </section> - <section id="section--as-attendee"> - <h2><a href="#section--as-attendee">åå è
ãšããŠ</a></h2> + <h2><a href="#section--as-attendee">åå è
ãšããŠ</a></h2> <p> - çºè¡šã¿ã€ãã«ãšçºè¡šè
å㯠fortee ããåŒçš + çºè¡šã¿ã€ãã«ãšçºè¡šè
å㯠fortee ããåŒçš </p> - <ul> <li> - FigmaãšPHPã§äœãã1ããªãããšã衚瀺厩ãããªãæåŒ·ã®åž³ç¥šå°å·ãœãªã¥ãŒã·ã§ã³ (ãã€ãã¡ ãã) + <p> + FigmaãšPHPã§äœãã1ããªãããšã衚瀺厩ãããªãæåŒ·ã®åž³ç¥šå°å·ãœãªã¥ãŒã·ã§ã³ (ãã€ãã¡ ãã) + </p> <ul> <li> ããããŒã¶ã«ãªã³ã¯: <a href="https://fortee.jp/phpconodawara-2024/proposal/7c57d5ca-213a-4d7a-aaf0-26ddc44897f0" rel="noreferrer" target="_blank">https://fortee.jp/phpconodawara-2024/proposal/7c57d5ca-213a-4d7a-aaf0-26ddc44897f0</a> </li> - <li> ææ³: æåã®ã¢ã€ãã¢ããéäžã®æ³¥èãã¯ãŒã¯ã¢ã©ãŠã³ããŸã§éåžžã«ãããããã£ãã§ãã垳祚ã«ã¯äœåºŠãèŠãããããŠããã®ã§ãæ©äŒãããã°è©ŠããŠã¿ããã§ãã </li> </ul> </li> - <li> - PHPã®æ¬¡æããŒãžã§ã³ã¯ãã®ææã©ããªã£ãŠããã®ããInternalsã®éçºäœå¶ã«ã€ã㊠(ãŠããã ãã) + <p> + PHPã®æ¬¡æããŒãžã§ã³ã¯ãã®ææã©ããªã£ãŠããã®ããInternalsã®éçºäœå¶ã«ã€ã㊠(ãŠããã ãã) + </p> <ul> <li> ããããŒã¶ã«ãªã³ã¯: <a href="https://fortee.jp/phpconodawara-2024/proposal/740b034a-81f0-4b7a-90e9-cd3fa01c651f" rel="noreferrer" target="_blank">https://fortee.jp/phpconodawara-2024/proposal/740b034a-81f0-4b7a-90e9-cd3fa01c651f</a> </li> - <li> - ææ³: åã
ããåºãããšããŠãã RFC ãããã®ã§ãRFC ã«ã€ããŠã®æ¥æ¬èªæ
å ±ãå¢ããã®ã¯å€§å€ãããããã§ããããšã¯äœæ¥ãé²ããªããã°......ã + ææ³: åã
ããåºãããšããŠãã RFC ãããã®ã§ãRFC ã«ã€ããŠã®æ¥æ¬èªæ
å ±ãå¢ããã®ã¯å€§å€ãããããã§ããããšã¯äœæ¥ãé²ããªããã°âŠâŠã </li> </ul> </li> - <li> - Architecture Decision Record ãäžå¹ŽéçšããŠã¿ã (坿 亮 ãã) + <p> + Architecture Decision Record ãäžå¹ŽéçšããŠã¿ã (坿 亮 ãã) + </p> <ul> <li> ããããŒã¶ã«ãªã³ã¯: <a href="https://fortee.jp/phpconodawara-2024/proposal/56218b4f-b724-4199-82f1-67497501a9ef" rel="noreferrer" target="_blank">https://fortee.jp/phpconodawara-2024/proposal/56218b4f-b724-4199-82f1-67497501a9ef</a> </li> - <li> ææ³: ä»åæã楜ãã¿ã«ããŠããçºè¡šã®äžã€ã§ããèšèšæéã®èª¿æ»ã»å
±æçã«ã¯èª²é¡ãæããŠããã®ã§ãåŒããŒã ã§ãå°å
¥ã®ããã«åããŠããããšæããŸãã </li> @@ -169,15 +161,13 @@ </li> </ul> </section> - <section id="section--outro"> - <h2><a href="#section--outro">ãããã«</a></h2> + <h2><a href="#section--outro">ãããã«</a></h2> <p> - ææ¶ã®æå PHP ã«ã³ãã¡ã¬ã³ã¹ãæãè¿ããšãªã£ããããŸã ãŸã æ°é®®ã«æ¥œããã + ææ¶ã®æå PHP ã«ã³ãã¡ã¬ã³ã¹ãæãè¿ããšãªã£ããããŸã ãŸã æ°é®®ã«æ¥œããã </p> - <p> - ãŸãä»åºŠãã«ã³ãã¡ã¬ã³ã¹ã§äŒããŸããã (éæºå°ãããããã£ãŠããªãã®ã ããã©ã575 ãæµè¡ã£ãŠããããã)ã + ãŸãä»åºŠãã«ã³ãã¡ã¬ã³ã¹ã§äŒããŸããã (éæºå°ãããããã£ãŠããªãã®ã ããã©ã575 ãæµè¡ã£ãŠããããã)ã </p> </section> </div> diff --git a/vhosts/blog/public/posts/2024-04-21/pipefail-option-in-gitlab-ci-cd/index.html b/vhosts/blog/public/posts/2024-04-21/pipefail-option-in-gitlab-ci-cd/index.html index 3e41bbf7..197c6074 100644 --- a/vhosts/blog/public/posts/2024-04-21/pipefail-option-in-gitlab-ci-cd/index.html +++ b/vhosts/blog/public/posts/2024-04-21/pipefail-option-in-gitlab-ci-cd/index.html @@ -68,27 +68,25 @@ NOTE </div> <div class="admonition-content"> - ãã®èšäºã¯ã2022-11-17 ã«<a href="https://www.dgcircus.com/" rel="noreferrer" target="_blank">ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ</a> ã®ç€Ÿå
Qiita Team ã«å
¬éãããèšäºãããŒã¹ã«ãå çä¿®æ£ããŠäžè¬å
¬éãããã®ã§ãã + <p> + ãã®èšäºã¯ã2022-11-17 ã« <a href="https://www.dgcircus.com/" rel="noreferrer" target="_blank">ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ</a> ã®ç€Ÿå
Qiita Team ã«å
¬éãããèšäºãããŒã¹ã«ãå çä¿®æ£ããŠäžè¬å
¬éãããã®ã§ãã + </p> </div> </div> - <p> - ããã£ãã®ã§ã¡ã¢ã + ããã£ãã®ã§ã¡ã¢ã </p> - <section id="section--background"> - <h2><a href="#section--background">åæ</a></h2> + <h2><a href="#section--background">åæ</a></h2> <section id="section--background--gitlab-ci-cd"> - <h3><a href="#section--background--gitlab-ci-cd">GitLab CI/CD ã«ã€ããŠ</a></h3> + <h3><a href="#section--background--gitlab-ci-cd">GitLab CI/CD ã«ã€ããŠ</a></h3> <p> - GitLab CI/CD ã§ã¯ãDocker executor ãçšããŠä»»æã® Docker image äžã§ã¹ã¯ãªãããèµ°ãããããšãã§ããã + GitLab CI/CD ã§ã¯ãDocker executor ãçšããŠä»»æã® Docker image äžã§ã¹ã¯ãªãããèµ°ãããããšãã§ããã </p> - <p> - äŸ: + äŸ: </p> - - <div class="codeblock" filename=".gitlab-ci.yml" language="yaml"> + <div class="codeblock" language="yaml"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#22863A">hello-world</span><span style="color:#24292E">:</span></span> <span class="line"><span style="color:#22863A"> stage</span><span style="color:#24292E">: </span><span style="color:#032F62">test</span></span> <span class="line"><span style="color:#22863A"> image</span><span style="color:#24292E">: </span><span style="color:#032F62">alpine:latest</span></span> @@ -98,16 +96,13 @@ <span class="line"><span style="color:#24292E"> - </span><span style="color:#22863A">if</span><span style="color:#24292E">: </span><span style="color:#032F62">'$CI_MERGE_REQUEST_IID'</span></span> <span class="line"><span style="color:#22863A"> when</span><span style="color:#24292E">: </span><span style="color:#032F62">always</span></span></code></pre> </div> - <p> - ããã§ã<code>script</code> ã«æå®ããã³ãã³ãã倱æãã (exit status ã 0 以å€ã«ãªã) ãšãå³åº§ã«å®è¡ã忢ããããžã§ãã¯å€±æããã + ããã§ã<code>script</code> ã«æå®ããã³ãã³ãã倱æãã (exit status ã 0 以å€ã«ãªã) ãšãå³åº§ã«å®è¡ã忢ããããžã§ãã¯å€±æããã </p> - <p> - ã§ã¯ã次ã®ãããªã±ãŒã¹ã ãšã©ããªããã + ã§ã¯ã次ã®ãããªã±ãŒã¹ã ãšã©ããªããã </p> - - <div class="codeblock" filename=".gitlab-ci.yml" language="yaml"> + <div class="codeblock" language="yaml"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#22863A">hello-world</span><span style="color:#24292E">:</span></span> <span class="line"><span style="color:#22863A"> stage</span><span style="color:#24292E">: </span><span style="color:#032F62">test</span></span> <span class="line"><span style="color:#22863A"> image</span><span style="color:#24292E">: </span><span style="color:#032F62">alpine:latest</span></span> @@ -117,38 +112,32 @@ <span class="line"><span style="color:#24292E"> - </span><span style="color:#22863A">if</span><span style="color:#24292E">: </span><span style="color:#032F62">'$CI_MERGE_REQUEST_IID'</span></span> <span class="line"><span style="color:#22863A"> when</span><span style="color:#24292E">: </span><span style="color:#032F62">always</span></span></code></pre> </div> - <p> - 倱æããã³ãã³ãããã€ãã«æ¥ç¶ãããéåžž Bash ã§ã¯ããã€ãã®æåŸã®ã³ãã³ãã® exit code ãå
šäœã® exit code ã«ãªãã + 倱æããã³ãã³ãããã€ãã«æ¥ç¶ãããéåžž Bash ã§ã¯ããã€ãã®æåŸã®ã³ãã³ãã® exit code ãå
šäœã® exit code ã«ãªãã </p> </section> - <section id="section--background--pipefail-option"> - <h3><a href="#section--background--pipefail-option"><code>pipefail</code> ãªãã·ã§ã³ã«ã€ããŠ</a></h3> + <h3><a href="#section--background--pipefail-option"><code>pipefail</code> ãªãã·ã§ã³ã«ã€ããŠ</a></h3> <p> - åè¿°ãããããªã±ãŒã¹ã«ãããŠãéäžã§å€±æãããšãã«å
šäœã倱æãããã«ã¯ã<code>pipefail</code> ãªãã·ã§ã³ãæå¹ã«ããã + åè¿°ãããããªã±ãŒã¹ã«ãããŠãéäžã§å€±æãããšãã«å
šäœã倱æãããã«ã¯ã<code>pipefail</code> ãªãã·ã§ã³ãæå¹ã«ããã </p> - <div class="codeblock" language="bash"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#6A737D"># On ã«ãã</span></span> <span class="line"><span style="color:#005CC5">set</span><span style="color:#005CC5"> -o</span><span style="color:#032F62"> pipefail</span></span> <span class="line"><span style="color:#6A737D"># Off ã«ãã</span></span> <span class="line"><span style="color:#005CC5">set</span><span style="color:#032F62"> +o</span><span style="color:#032F62"> pipefail</span></span></code></pre> </div> - <p> - ãããããšããã€ãå
šäœã倱æããããã«ãªãããã®èšå®ã¯ãããã©ã«ãã ãš off ã«ãªã£ãŠããã + ãããããšããã€ãå
šäœã倱æããããã«ãªãã ãã®èšå®ã¯ãããã©ã«ãã ãš off ã«ãªã£ãŠããã </p> </section> </section> - <section id="section--problem"> - <h2><a href="#section--problem">çºçããåé¡</a></h2> + <h2><a href="#section--problem">çºçããåé¡</a></h2> <p> - 次ã®ãã㪠GitLab CI/CD ãžã§ãã倱æããŠããŸã£ãã + 次ã®ãã㪠GitLab CI/CD ãžã§ãã倱æããŠããŸã£ãã </p> - - <div class="codeblock" filename=".gitlab-ci.yml" language="yaml"> + <div class="codeblock" language="yaml"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#22863A">hoge</span><span style="color:#24292E">:</span></span> <span class="line"><span style="color:#22863A"> stage</span><span style="color:#24292E">: </span><span style="color:#032F62">test</span></span> <span class="line"><span style="color:#22863A"> image</span><span style="color:#24292E">: </span><span style="color:#032F62">alpine:latest</span></span> @@ -158,15 +147,12 @@ <span class="line"><span style="color:#24292E"> - </span><span style="color:#22863A">if</span><span style="color:#24292E">: </span><span style="color:#032F62">'$CI_MERGE_REQUEST_IID'</span></span> <span class="line"><span style="color:#22863A"> when</span><span style="color:#24292E">: </span><span style="color:#032F62">always</span></span></code></pre> </div> - <p> - <code>grep</code> ã³ãã³ãã¯ããã¿ãŒã³ã«ãããããè¡ãäžè¡ããªãã£ããšããexit code 1 ãè¿ãããã£ãŠã<code>pipefail</code> ã on ã«ãªã£ãŠãããšããã®ãžã§ãã¯å€±æãããçŸåšã® <code>pipefail</code> ãã©ããªã£ãŠããã確ããããã <code>set +o</code> ã§å
šãªãã·ã§ã³ãåºåããããšããã<code>pipefail</code> ã on ã«ãªã£ãŠããã + <code>grep</code> ã³ãã³ãã¯ããã¿ãŒã³ã«ãããããè¡ãäžè¡ããªãã£ããšããexit code 1 ãè¿ãããã£ãŠã<code>pipefail</code> ã on ã«ãªã£ãŠãããšããã®ãžã§ãã¯å€±æããã çŸåšã® <code>pipefail</code> ãã©ããªã£ãŠããã確ããããã <code>set +o</code> ã§å
šãªãã·ã§ã³ãåºåããããšããã<code>pipefail</code> ã on ã«ãªã£ãŠããã </p> - <p> - ããããå
è¿°ããããã« Bash ã«ããã <code>pipefail</code> ã®ããã©ã«ãå€ã¯ off ã®ã¯ãã ãå®éã«ãããŒã«ã«ã§ <code>alpine:latest</code> ãåãããŠã¿ããšããã + ããããå
è¿°ããããã« Bash ã«ããã <code>pipefail</code> ã®ããã©ã«ãå€ã¯ off ã®ã¯ãã ã å®éã«ãããŒã«ã«ã§ <code>alpine:latest</code> ãåãããŠã¿ããšããã </p> - <div class="codeblock"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>$ docker run --rm alpine:latest sh -c "set +o"</span></span> <span class="line"><span>set +o errexit</span></span> @@ -183,36 +169,30 @@ <span class="line"><span>set +o vi</span></span> <span class="line"><span>set +o pipefail</span></span></code></pre> </div> - <p> - 確ãã« <code>pipefail</code> ã¯ç¡å¹ã«ãªã£ãŠããã + 確ãã« <code>pipefail</code> ã¯ç¡å¹ã«ãªã£ãŠããã </p> - <p> - ãªãã¹ã¯ãªããå
ã§ <code>set -o pipefail</code> ããŠããããã§ããªãã®ã« <code>pipefail</code> ã on ã«ãªã£ãŠããã®ãã + ãªãã¹ã¯ãªããå
ã§ <code>set -o pipefail</code> ããŠããããã§ããªãã®ã« <code>pipefail</code> ã on ã«ãªã£ãŠããã®ãã </p> </section> - <section id="section--where-pipefail-is-enabled"> - <h2><a href="#section--where-pipefail-is-enabled">ã©ãã§ <code>pipefail</code> ã on ã«ãªãã</a></h2> + <h2><a href="#section--where-pipefail-is-enabled">ã©ãã§ <code>pipefail</code> ã on ã«ãªãã</a></h2> <p> - <code>.gitlab-ci.yml</code> ã§æç€ºçã«ã¯æžããŠããªãã®ã§ãGitLab Runner (GitLab CI/CD ã®ã¹ã¯ãªãããå®è¡ããããã°ã©ã ) ãåæã«è¿œå ããŠããã«éããªãããã仮説ãç«ãŠãŠ <a href="https://gitlab.com/gitlab-org/gitlab-runner" rel="noreferrer" target="_blank">GitLab Runner ã®ãªããžããª</a> ã調æ»ãããšããã<a href="https://gitlab.com/gitlab-org/gitlab-runner/-/blob/c75da0796a0e3048991dccfdf2784e3d931beda4/shells/bash.go#L276" rel="noreferrer" target="_blank">ãœãŒã¹ã³ãŒãäžã®ä»¥äžã®ç®æ</a> ã§ <code>set -o pipefail</code> ããŠããããšã倿ãã (ã³ã¡ã³ãã¯çè
ã«ãã)ã + <code>.gitlab-ci.yml</code> ã§æç€ºçã«ã¯æžããŠããªãã®ã§ãGitLab Runner (GitLab CI/CD ã®ã¹ã¯ãªãããå®è¡ããããã°ã©ã ) ãåæã«è¿œå ããŠããã«éããªãã ãã仮説ãç«ãŠãŠ <a href="https://gitlab.com/gitlab-org/gitlab-runner" rel="noreferrer" target="_blank">GitLab Runner ã®ãªããžããª</a> ã調æ»ãããšããã <a href="https://gitlab.com/gitlab-org/gitlab-runner/-/blob/c75da0796a0e3048991dccfdf2784e3d931beda4/shells/bash.go#L276" rel="noreferrer" target="_blank">ãœãŒã¹ã³ãŒãäžã®ä»¥äžã®ç®æ</a> ã§ <code>set -o pipefail</code> ããŠããããšã倿ãã (ã³ã¡ã³ãã¯çè
ã«ãã)ã </p> - <div class="codeblock" language="go"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#6A737D">// pipefail ãªãã·ã§ã³ãååšããªãç°å¢ã«ã察å¿ããããã</span></span> <span class="line"><span style="color:#6A737D">// å
ã« set -o ã§ãªãã·ã§ã³äžèЧã衚瀺ãããããšãset -o pipefail ããŠãã</span></span> <span class="line"><span style="color:#24292E">buf.</span><span style="color:#6F42C1">WriteString</span><span style="color:#24292E">(</span><span style="color:#032F62">"if set -o | grep pipefail > /dev/null; then set -o pipefail; fi; set -o errexit</span><span style="color:#005CC5">\n</span><span style="color:#032F62">"</span><span style="color:#24292E">)</span></span></code></pre> </div> </section> - <section id="section--how-to-solve"> - <h2><a href="#section--how-to-solve">ã©ã®ããã«è§£æ±ºããã</a></h2> + <h2><a href="#section--how-to-solve">ã©ã®ããã«è§£æ±ºããã</a></h2> <p> - éåžžã® Bash ã¹ã¯ãªãããæžãå Žåãšåæ§ã«ã<code>pipefail</code> ã on ã«ãªã£ãŠããŠã¯å°ãå Žæã ã off ã«ããŠããã°ããã + éåžžã® Bash ã¹ã¯ãªãããæžãå Žåãšåæ§ã«ã<code>pipefail</code> ã on ã«ãªã£ãŠããŠã¯å°ãå Žæã ã off ã«ããŠããã°ããã </p> - - <div class="codeblock" diff="true" filename=".gitlab-ci.yml" language="yaml"> + <div class="codeblock" language="yaml"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#22863A"> hoge</span><span style="color:#24292E">:</span></span> <span class="line"><span style="color:#22863A"> stage</span><span style="color:#24292E">: </span><span style="color:#032F62">test</span></span> <span class="line"><span style="color:#22863A"> image</span><span style="color:#24292E">: </span><span style="color:#032F62">alpine:latest</span></span> @@ -225,11 +205,10 @@ <span class="line"><span style="color:#22863A"> when</span><span style="color:#24292E">: </span><span style="color:#032F62">always</span></span></code></pre> </div> </section> - <section id="section--remarks"> - <h2><a href="#section--remarks">åè</a></h2> + <h2><a href="#section--remarks">åè</a></h2> <p> - ãªããäžè¿°ããå®è£
ãã¡ã€ã«ã¯ <code>shells/bash.go</code> ã ãã<code>alpine:latest</code> ã®äŸã§ãããã§ãã£ãããã«ãã·ã§ã«ã <code>sh</code> ã§ããå Žåã«ãé©çšãããã + ãªããäžè¿°ããå®è£
ãã¡ã€ã«ã¯ <code>shells/bash.go</code> ã ãã<code>alpine:latest</code> ã®äŸã§ãããã§ãã£ãããã«ãã·ã§ã«ã <code>sh</code> ã§ããå Žåã«ãé©çšãããã </p> </section> </div> diff --git a/vhosts/blog/public/posts/2024-04-29/zsh-file-completion-for-composer-custom-commands/index.html b/vhosts/blog/public/posts/2024-04-29/zsh-file-completion-for-composer-custom-commands/index.html index c1390ced..7cd16d21 100644 --- a/vhosts/blog/public/posts/2024-04-29/zsh-file-completion-for-composer-custom-commands/index.html +++ b/vhosts/blog/public/posts/2024-04-29/zsh-file-completion-for-composer-custom-commands/index.html @@ -64,39 +64,33 @@ </ol> </section> <section id="section--version-info"> - <h2><a href="#section--version-info">ããŒãžã§ã³æ
å ±</a></h2> + <h2><a href="#section--version-info">ããŒãžã§ã³æ
å ±</a></h2> <ul> <li> Composer: 2.7.4 </li> - <li> PHP: 8.3.6 </li> - <li> Zsh: 5.9 </li> </ul> </section> - <section id="section--intro"> - <h2><a href="#section--intro">ã¯ããã«</a></h2> + <h2><a href="#section--intro">ã¯ããã«</a></h2> <p> - <a href="https://getcomposer.org/" rel="noreferrer" target="_blank">Composer</a> 㯠PHP ã®ããã¡ã¯ãã¹ã¿ã³ããŒããªããã±ãŒãžãããŒãžã£ã§ãããZsh ã§ã¯ã<code>composer</code> ã³ãã³ãã«å¯Ÿããè£å®ãæäŸãããŠããã<code>composer</code> ãšå
¥åããŠã¿ãããŒãæŒããšãå©çšå¯èœãªã³ãã³ãããªãã·ã§ã³ãè£å®ããããZsh ã®è£å®ã¯ã·ã§ã«é¢æ°ã®åœ¢ã§å®è£
ãããŠããã<code>composer</code> ã³ãã³ãã«å¯Ÿå¿ããè£å®ããããªãã®ã¯ <code>_composer</code> ã§ããã<a href="https://github.com/zsh-users/zsh/blob/a66e92918568881af110a3e2e3018b317c054e4a/Completion/Unix/Command/_composer" rel="noreferrer" target="_blank">èšäºå·çæç¹ã§ã®è£å®é¢æ°ã®å®çŸ©ã¯ãGitHub ã®ãã©ãŒãªããžããªããåç
§ã§ããã</a> + <a href="https://getcomposer.org/" rel="noreferrer" target="_blank">Composer</a> 㯠PHP ã®ããã¡ã¯ãã¹ã¿ã³ããŒããªããã±ãŒãžãããŒãžã£ã§ããã Zsh ã§ã¯ã<code>composer</code> ã³ãã³ãã«å¯Ÿããè£å®ãæäŸãããŠããã<code>composer</code> ãšå
¥åããŠã¿ãããŒãæŒããšãå©çšå¯èœãªã³ãã³ãããªãã·ã§ã³ãè£å®ãããã Zsh ã®è£å®ã¯ã·ã§ã«é¢æ°ã®åœ¢ã§å®è£
ãããŠããã<code>composer</code> ã³ãã³ãã«å¯Ÿå¿ããè£å®ããããªãã®ã¯ <code>_composer</code> ã§ããã <a href="https://github.com/zsh-users/zsh/blob/a66e92918568881af110a3e2e3018b317c054e4a/Completion/Unix/Command/_composer" rel="noreferrer" target="_blank">èšäºå·çæç¹ã§ã®è£å®é¢æ°ã®å®çŸ©ã¯ãGitHub ã®ãã©ãŒãªããžããªããåç
§ã§ããã</a> </p> </section> - <section id="section--problem"> - <h2><a href="#section--problem">çºçããŠããåé¡</a></h2> + <h2><a href="#section--problem">çºçããŠããåé¡</a></h2> <p> - <code>composer</code> ã³ãã³ãã¯ã«ã¹ã¿ã ã³ãã³ã (<code>composer.json</code> ã® <code>scripts</code> ã§å®çŸ©ãããã³ãã³ã) ã«å¯ŸããŠè£å®ããããªããªããã€ãŸããéäžãŸã§å
¥åãããã«ã¹ã¿ã ã³ãã³ããè£å®ããªãããã«ã¹ã¿ã ã³ãã³ãã®åŒæ°ãè£å®ããªããäŸãã°ãPHPUnit ãåŒã³åºã <code>phpunit</code> ãšããã«ã¹ã¿ã ã³ãã³ããå®çŸ©ã <code>composer phpu</code> ãŸã§æã£ãŠã¿ãããŒãæŒããŠãã<code>composer phpunit</code> ã«ã¯ãªããªãããŸãã<code>composer phpunit -- --</code> ãŸã§æã£ãŠã¿ãããŒãæŒããŠãã<code>phpunit</code> ã³ãã³ãã®ãªãã·ã§ã³ã¯è£å®ãããªãã + <code>composer</code> ã³ãã³ãã¯ã«ã¹ã¿ã ã³ãã³ã (<code>composer.json</code> ã® <code>scripts</code> ã§å®çŸ©ãããã³ãã³ã) ã«å¯ŸããŠè£å®ããããªããªãã ã€ãŸããéäžãŸã§å
¥åãããã«ã¹ã¿ã ã³ãã³ããè£å®ããªãããã«ã¹ã¿ã ã³ãã³ãã®åŒæ°ãè£å®ããªãã äŸãã°ãPHPUnit ãåŒã³åºã <code>phpunit</code> ãšããã«ã¹ã¿ã ã³ãã³ããå®çŸ©ã <code>composer phpu</code> ãŸã§æã£ãŠã¿ãããŒãæŒããŠãã<code>composer phpunit</code> ã«ã¯ãªããªãã ãŸãã<code>composer phpunit -- --</code> ãŸã§æã£ãŠã¿ãããŒãæŒããŠãã<code>phpunit</code> ã³ãã³ãã®ãªãã·ã§ã³ã¯è£å®ãããªãã </p> - <p> - ãã®ããšã¯ãå
ã»ã©ãªã³ã¯ãèŒãã <code>_composer</code> 颿°ãå®çŸ©ããŠãããã¡ã€ã«ã®åé ã«ãæžãããŠããã + ãã®ããšã¯ãå
ã»ã©ãªã³ã¯ãèŒãã <code>_composer</code> 颿°ãå®çŸ©ããŠãããã¡ã€ã«ã®åé ã«ãæžãããŠããã </p> - <div class="codeblock" language="zsh"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#6A737D"># - @todo We don't complete custom commands (including script aliases). This is</span></span> <span class="line"><span style="color:#6A737D"># easy to do in the general case, but it probably requires some clever caching</span></span> @@ -105,51 +99,42 @@ <span class="line"><span style="color:#6A737D"># commands requires making slow calls to Composer</span></span></code></pre> </div> </section> - <section id="section--what-i-want-to-achive"> - <h2><a href="#section--what-i-want-to-achive">ããããããš</a></h2> + <h2><a href="#section--what-i-want-to-achive">ããããããš</a></h2> <p> - 確ãã«ãã«ã¹ã¿ã ã³ãã³ãã«å¯ŸããŠå®å
šãªè£å®ãæäŸããã®ã¯äžå¯èœãããããã¯å®çŸã§ããŠãé
ããªããããã ãããããããäžå®å
šãªãã©ãŒã«ããã¯ãæäŸããããããªãå¯èœãªã¯ãã ã + 確ãã«ãã«ã¹ã¿ã ã³ãã³ãã«å¯ŸããŠå®å
šãªè£å®ãæäŸããã®ã¯äžå¯èœãããããã¯å®çŸã§ããŠãé
ããªããããã ããã ããããäžå®å
šãªãã©ãŒã«ããã¯ãæäŸããããããªãå¯èœãªã¯ãã ã </p> - <p> - ãã®èšäºã§ã¯ããããã®ã«ã¹ã¿ã ã³ãã³ãã«ã€ããŠãZsh ãæäŸããããã©ã«ãã®ãã¡ã€ã«ã»ãã£ã¬ã¯ããªè£å®ãé©çšãããã€ãŸãã<code>composer phpunit -- tests/</code> ãŸã§æã£ãŠã¿ãããŒãæŒããšã<code>tests</code> ãã£ã¬ã¯ããªã®äžã«ãããã¹ããã¡ã€ã«ãŸãã¯ãã£ã¬ã¯ããªãè£å®ãããã + ãã®èšäºã§ã¯ããããã®ã«ã¹ã¿ã ã³ãã³ãã«ã€ããŠãZsh ãæäŸããããã©ã«ãã®ãã¡ã€ã«ã»ãã£ã¬ã¯ããªè£å®ãé©çšããã ã€ãŸãã<code>composer phpunit -- tests/</code> ãŸã§æã£ãŠã¿ãããŒãæŒããšã<code>tests</code> ãã£ã¬ã¯ããªã®äžã«ãããã¹ããã¡ã€ã«ãŸãã¯ãã£ã¬ã¯ããªãè£å®ãããã </p> </section> - <section id="section--solution"> - <h2><a href="#section--solution">解決ç</a></h2> + <h2><a href="#section--solution">解決ç</a></h2> <p> - ãŸãã¯ãZsh ã§è£å®é¢æ°ãæäŸããå Žåã®ãã€ã©ãŒãã¬ãŒãã³ãŒããæžãã以äžã¯ <code>~/.zshrc</code> ã«ãã¹ãŠæžãåæã ãã<code>autoload</code> ãèšå®ãããªã©ããã°å¥ãã¡ã€ã«ã«åé¢ã§ãã (è©³çŽ°ãªæé ã¯å²æ)ã + ãŸãã¯ãZsh ã§è£å®é¢æ°ãæäŸããå Žåã®ãã€ã©ãŒãã¬ãŒãã³ãŒããæžãã 以äžã¯ <code>~/.zshrc</code> ã«ãã¹ãŠæžãåæã ãã<code>autoload</code> ãèšå®ãããªã©ããã°å¥ãã¡ã€ã«ã«åé¢ã§ãã (è©³çŽ°ãªæé ã¯å²æ)ã </p> - <div class="codeblock" language="zsh"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#6F42C1">compdef</span><span style="color:#032F62"> _my_composer</span><span style="color:#032F62"> composer</span><span style="color:#032F62"> composer.phar</span></span></code></pre> </div> - <p> - <code>compdef</code> 㯠Zsh ãçšæããŠãã颿°ã§ã第äžåŒæ°ã«è£å®é¢æ°ã®ååã第äºåŒæ°ä»¥éã«è£å®ãé©çšããã³ãã³ãåã䞊ã¹ãããã®å Žåã¯ã<code>composer</code> ã³ãã³ãã <code>composer.phar</code> ã³ãã³ãã«å¯Ÿã㊠<code>_my_composer</code> ã䜿ã£ãŠè£å®ããããªãããå®çŸ©ããŠããã + <code>compdef</code> 㯠Zsh ãçšæããŠãã颿°ã§ã第äžåŒæ°ã«è£å®é¢æ°ã®ååã第äºåŒæ°ä»¥éã«è£å®ãé©çšããã³ãã³ãåã䞊ã¹ãã ãã®å Žåã¯ã<code>composer</code> ã³ãã³ãã <code>composer.phar</code> ã³ãã³ãã«å¯Ÿã㊠<code>_my_composer</code> ã䜿ã£ãŠè£å®ããããªãããå®çŸ©ããŠããã </p> - <p> - 次㫠<code>_my_composer</code> ãå®çŸ©ãããåºæ¬çã«ã¯ããã©ã«ãã® <code>composer</code> ã³ãã³ãã®è£å®é¢æ° (ã€ãŸã <code>_composer</code> 颿°) ã䜿ãããããäœãè¿ããªãã£ãå Žåã«éããZsh ã®ãã¡ã€ã«ã»ãã£ã¬ã¯ããªè£å®ãžãã©ãŒã«ããã¯ããã + 次㫠<code>_my_composer</code> ãå®çŸ©ãããåºæ¬çã«ã¯ããã©ã«ãã® <code>composer</code> ã³ãã³ãã®è£å®é¢æ° (ã€ãŸã <code>_composer</code> 颿°) ã䜿ãããããäœãè¿ããªãã£ãå Žåã«éããZsh ã®ãã¡ã€ã«ã»ãã£ã¬ã¯ããªè£å®ãžãã©ãŒã«ããã¯ããã </p> - <div class="codeblock" language="zsh"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49">function</span><span style="color:#6F42C1"> _my_composer</span><span style="color:#24292E">() {</span></span> <span class="line"><span style="color:#6F42C1"> _composer</span><span style="color:#032F62"> "</span><span style="color:#005CC5">$@</span><span style="color:#032F62">"</span><span style="color:#D73A49"> ||</span><span style="color:#6F42C1"> _files</span><span style="color:#032F62"> "</span><span style="color:#005CC5">$@</span><span style="color:#032F62">"</span></span> <span class="line"><span style="color:#24292E">}</span></span></code></pre> </div> - <p> - <code>_composer</code> ã³ãã³ãã¯äœãè£å®åè£ããªãã£ããšãéãŒã㪠exit status ã§çµäºããã®ã§ãããã§ãã£ããªã <code>_files</code> ãåŒã³åºãã<code>_files</code> ã¯ãZsh ãããã©ã«ãã§çšæããŠãããã¡ã€ã«ã»ãã£ã¬ã¯ããªã®è£å®ããããªã颿°ã§ããã + <code>_composer</code> ã³ãã³ãã¯äœãè£å®åè£ããªãã£ããšãéãŒã㪠exit status ã§çµäºããã®ã§ãããã§ãã£ããªã <code>_files</code> ãåŒã³åºãã <code>_files</code> ã¯ãZsh ãããã©ã«ãã§çšæããŠãããã¡ã€ã«ã»ãã£ã¬ã¯ããªã®è£å®ããããªã颿°ã§ããã </p> </section> - <section id="section--conclusion"> - <h2><a href="#section--conclusion">ãŸãšã</a></h2> + <h2><a href="#section--conclusion">ãŸãšã</a></h2> <p> - ãããã®èšå®ããããªãããšã§ãéšåçãªãã Composer ã®ã«ã¹ã¿ã ã³ãã³ãã«å¯ŸããŠè£å®ããããªãããšãã§ãããç¹ã«ãPHPUnit ã PHPStan ãªã©ã®å¯Ÿè±¡ãã¡ã€ã«ã»ãã£ã¬ã¯ããªãåŒæ°ã«åããããªã³ãã³ãã䜿ãå Žåã«æçšã§ãããã + ãããã®èšå®ããããªãããšã§ãéšåçãªãã Composer ã®ã«ã¹ã¿ã ã³ãã³ãã«å¯ŸããŠè£å®ããããªãããšãã§ããã ç¹ã«ãPHPUnit ã PHPStan ãªã©ã®å¯Ÿè±¡ãã¡ã€ã«ã»ãã£ã¬ã¯ããªãåŒæ°ã«åããããªã³ãã³ãã䜿ãå Žåã«æçšã§ãããã </p> </section> </div> diff --git a/vhosts/blog/public/posts/2024-05-11/phpconkagawa-2024-report/index.html b/vhosts/blog/public/posts/2024-05-11/phpconkagawa-2024-report/index.html index 1e9634dd..a9bb4710 100644 --- a/vhosts/blog/public/posts/2024-05-11/phpconkagawa-2024-report/index.html +++ b/vhosts/blog/public/posts/2024-05-11/phpconkagawa-2024-report/index.html @@ -64,109 +64,103 @@ </ol> </section> <section id="section--intro"> - <h2><a href="#section--intro">ã¯ããã«</a></h2> + <h2><a href="#section--intro">ã¯ããã«</a></h2> <p> - 2024-05-11 ã«éå¬ããã <a href="https://phpcon.kagawa.jp/2024/" rel="noreferrer" target="_blank">PHP ã«ã³ãã¡ã¬ã³ã¹éŠå· 2024</a> ã«åå ããã + 2024-05-11 ã«éå¬ããã <a href="https://phpcon.kagawa.jp/2024/" rel="noreferrer" target="_blank">PHP ã«ã³ãã¡ã¬ã³ã¹éŠå· 2024</a> ã«åå ããã </p> </section> - <section id="section--session-thoughts"> - <h2><a href="#section--session-thoughts">ã»ãã·ã§ã³ææ³</a></h2> + <h2><a href="#section--session-thoughts">ã»ãã·ã§ã³ææ³</a></h2> <ul> <li> - æ³¥ãŸã¿ãã®æè¡é©æ°: ããªãã®[ PHPããŒãžã§ã³ã¢ãã | æ°ãã¬ãŒã ã¯ãŒã¯æ¡çš | ã¢ãŒããã¯ãã£å·æ° | ⊠]ãåŸæŒãããããã« by nrslib + <p> + æ³¥ãŸã¿ãã®æè¡é©æ°: ããªãã®[ PHPããŒãžã§ã³ã¢ãã | æ°ãã¬ãŒã ã¯ãŒã¯æ¡çš | ã¢ãŒããã¯ãã£å·æ° | ⊠]ãåŸæŒãããããã« by nrslib + </p> <ul> <li> - fortee URL: <a href="https://fortee.jp/phpconkagawa-2024/proposal/7f4622af-03b6-4b83-a0ef-e1cfc7b7c930" rel="noreferrer" target="_blank">https://fortee.jp/phpconkagawa-2024/proposal/7f4622af-03b6-4b83-a0ef-e1cfc7b7c930</a> + fortee URL: <a href="https://fortee.jp/phpconkagawa-2024/proposal/7f4622af-03b6-4b83-a0ef-e1cfc7b7c930" rel="noreferrer" target="_blank">https://fortee.jp/phpconkagawa-2024/proposal/7f4622af-03b6-4b83-a0ef-e1cfc7b7c930</a> </li> - <li> - ææ³: ã¡ããã©ãšãããã€ã°ã¬ãŒã·ã§ã³äœæ¥ãããŠããã®ã§ãé ·ããªããæèŽããŸãããçµå±ã¯èª°ããç§»è¡äœæ¥ã¯æ ¹æ°ãšè
åãªã®ã ãšããããšã«åæ°ãããããŸããã + ææ³: ã¡ããã©ãšãããã€ã°ã¬ãŒã·ã§ã³äœæ¥ãããŠããã®ã§ãé ·ããªããæèŽããŸãããçµå±ã¯èª°ããç§»è¡äœæ¥ã¯æ ¹æ°ãšè
åãªã®ã ãšããããšã«åæ°ãããããŸããã </li> </ul> </li> - <li> - PHP 9 ã«åãã - åçããããã£ãã©ãããã°ããïŒ by èç¬ æ³°èŒ + <p> + PHP 9 ã«åãã - åçããããã£ãã©ãããã°ããïŒ by èç¬ æ³°èŒ + </p> <ul> <li> - fortee URL: <a href="https://fortee.jp/phpconkagawa-2024/proposal/039ebb21-d104-4df2-86bb-be2680979b7b" rel="noreferrer" target="_blank">https://fortee.jp/phpconkagawa-2024/proposal/039ebb21-d104-4df2-86bb-be2680979b7b</a> + fortee URL: <a href="https://fortee.jp/phpconkagawa-2024/proposal/039ebb21-d104-4df2-86bb-be2680979b7b" rel="noreferrer" target="_blank">https://fortee.jp/phpconkagawa-2024/proposal/039ebb21-d104-4df2-86bb-be2680979b7b</a> </li> - <li> - ææ³: ãããäžãšåããç§»è¡äœæ¥ã®è©±ã§ã¯ãããçµå±ã®ãšããã¯ãé 匵ã£ãŠå°éã«ãã£ãŠããããããªããšããããããŸã (ãšã¯ãããã¡ãã¯éçè§£æã§ããçšåºŠæœ°ããŸãã)ãPHP èšèªã®ã³ãã¥ããã£å
šäœã§é 匵ã£ãŠãããŸãããã + ææ³: ãããäžãšåããç§»è¡äœæ¥ã®è©±ã§ã¯ãããçµå±ã®ãšããã¯ãé 匵ã£ãŠå°éã«ãã£ãŠããããããªããšããããããŸã (ãšã¯ãããã¡ãã¯éçè§£æã§ããçšåºŠæœ°ããŸãã)ãPHP èšèªã®ã³ãã¥ããã£å
šäœã§é 匵ã£ãŠãããŸãããã </li> </ul> </li> - <li> - 1人ããã»ãã¢ããã»ã¢ãããã®å¹æçãªäœ¿ãåã by ãŸããŸã + <p> + 1人ããã»ãã¢ããã»ã¢ãããã®å¹æçãªäœ¿ãåã by ãŸããŸã + </p> <ul> <li> - fortee URL: <a href="https://fortee.jp/phpconkagawa-2024/proposal/db3e9634-4a79-46c1-84fd-8ffa4d495a13" rel="noreferrer" target="_blank">https://fortee.jp/phpconkagawa-2024/proposal/db3e9634-4a79-46c1-84fd-8ffa4d495a13</a> + fortee URL: <a href="https://fortee.jp/phpconkagawa-2024/proposal/db3e9634-4a79-46c1-84fd-8ffa4d495a13" rel="noreferrer" target="_blank">https://fortee.jp/phpconkagawa-2024/proposal/db3e9634-4a79-46c1-84fd-8ffa4d495a13</a> </li> - <li> - ææ³: ä»äŒç€Ÿã§ãã¢ãããéšåçã«åãå
¥ããŠãããã®ã®ãè¿·ããšãããå€ããæ¥œãã¿ã«ããŠããçºè¡šã§ãããŸãã¯äœãäžã€å€ããªãããšã«ã¯å§ãŸããªãã®ã§ãçºè¡šããåŸããã³ããèªåãã¡ã®ããŒã ã«åæ ãã¹ããäœããããããå€ããŠã¿ãäºå®ã§ãã + ææ³: ä»äŒç€Ÿã§ãã¢ãããéšåçã«åãå
¥ããŠãããã®ã®ãè¿·ããšãããå€ããæ¥œãã¿ã«ããŠããçºè¡šã§ãããŸãã¯äœãäžã€å€ããªãããšã«ã¯å§ãŸããªãã®ã§ãçºè¡šããåŸããã³ããèªåãã¡ã®ããŒã ã«åæ ãã¹ããäœããããããå€ããŠã¿ãäºå®ã§ãã </li> </ul> </li> - <li> - mb_trim颿°ãäœããŸãã - PHPã«æ°ãã颿°ã远å ããŸãã - by ãŠããã + <p> + mb_trim颿°ãäœããŸãã - PHPã«æ°ãã颿°ã远å ããŸãã - by ãŠããã + </p> <ul> <li> - fortee URL: <a href="https://fortee.jp/phpconkagawa-2024/proposal/0ec36f50-c4b7-4aa4-abef-006f8bab3931" rel="noreferrer" target="_blank">https://fortee.jp/phpconkagawa-2024/proposal/0ec36f50-c4b7-4aa4-abef-006f8bab3931</a> + fortee URL: <a href="https://fortee.jp/phpconkagawa-2024/proposal/0ec36f50-c4b7-4aa4-abef-006f8bab3931" rel="noreferrer" target="_blank">https://fortee.jp/phpconkagawa-2024/proposal/0ec36f50-c4b7-4aa4-abef-006f8bab3931</a> </li> - <li> - ææ³: RFC ãå¿
èŠãšãããããªæ©èœè¿œå ã®ããã»ã¹ãæ¥æ¬èªã§è§£èª¬ããè³æãã©ãã©ããšå¢ããŠããã®ã¯ãããŒãã«ãäžãããšããæå³ã§éåžžã«ãããããã§ããç§ã以åããåºããåºãããšèããŠããæžãããã® RFC ãããã®ã§ãããå
·äœçãªããã»ã¹ãæç€ºããããšãã¯ãããæ°ã«ãªããŸããã + ææ³: RFC ãå¿
èŠãšãããããªæ©èœè¿œå ã®ããã»ã¹ãæ¥æ¬èªã§è§£èª¬ããè³æãã©ãã©ããšå¢ããŠããã®ã¯ãããŒãã«ãäžãããšããæå³ã§éåžžã«ãããããã§ããç§ã以åããåºããåºãããšèããŠããæžãããã® RFC ãããã®ã§ãããå
·äœçãªããã»ã¹ãæç€ºããããšãã¯ãããæ°ã«ãªããŸããã </li> </ul> </li> - <li> - (ãPHPã«ã³ãã¡ã¬ã³ã¹å°ç°å2024ããå®è¡å§å¡é·ããµãããã by asumikam) + <p> + (ãPHPã«ã³ãã¡ã¬ã³ã¹å°ç°å2024ããå®è¡å§å¡é·ããµãããã by asumikam) + </p> <ul> <li> - fortee URL: <a href="https://fortee.jp/phpconkagawa-2024/proposal/c1efd828-72c9-4719-93f7-2ca3f8f20ac1" rel="noreferrer" target="_blank">https://fortee.jp/phpconkagawa-2024/proposal/c1efd828-72c9-4719-93f7-2ca3f8f20ac1</a> + fortee URL: <a href="https://fortee.jp/phpconkagawa-2024/proposal/c1efd828-72c9-4719-93f7-2ca3f8f20ac1" rel="noreferrer" target="_blank">https://fortee.jp/phpconkagawa-2024/proposal/c1efd828-72c9-4719-93f7-2ca3f8f20ac1</a> </li> - <li> - åè: ã¡ãã£ãšãããã©ãã«ã«ããååäžã®çºè¡šãèŠãããªãã£ãã®ã§ãçã§æèŽããããã§ã¯ãªããã¹ã©ã€ããæèŠããŠææ³ãæžããŠããŸãã + åè: ã¡ãã£ãšãããã©ãã«ã«ããååäžã®çºè¡šãèŠãããªãã£ãã®ã§ãçã§æèŽããããã§ã¯ãªããã¹ã©ã€ããæèŠããŠææ³ãæžããŠããŸãã </li> - <li> - ææ³: Thanks ã®ã¹ã©ã€ãéåžžã«å¬ããã£ãã§ãããã¡ãããçŽ æŽãããã«ã³ãã¡ã¬ã³ã¹ã®å ŽãããããšãããããŸããïŒã¹ã¿ããåéããã°æ¥å¹Žãæ¯éåå ãããŠãã ããã + ææ³: Thanks ã®ã¹ã©ã€ãéåžžã«å¬ããã£ãã§ãããã¡ãããçŽ æŽãããã«ã³ãã¡ã¬ã³ã¹ã®å ŽãããããšãããããŸããïŒã¹ã¿ããåéããã°æ¥å¹Žãæ¯éåå ãããŠãã ããã </li> </ul> </li> </ul> </section> - <section id="section--lightning-talk"> - <h2><a href="#section--lightning-talk">æèŠªäŒ LT</a></h2> + <h2><a href="#section--lightning-talk">æèŠªäŒ LT</a></h2> <p> - ä»åç»å£è
ã§ã¯ãªãã£ãã®ã ããããããŒã¶ã«åéæã«çšæããŠããã¹ã©ã€ã (LT çšã«äœã£ãŠããã®ã ãããããã LT æ ããªãã£ãã®ã§ãèµå
¥ãã«ãªã£ãŠãã) ããã£ãã®ã§æèŠªäŒã® LT ã§çºè¡šããã + ä»åç»å£è
ã§ã¯ãªãã£ãã®ã ããããããŒã¶ã«åéæã«çšæããŠããã¹ã©ã€ã (LT çšã«äœã£ãŠããã®ã ãããããã LT æ ããªãã£ãã®ã§ãèµå
¥ãã«ãªã£ãŠãã) ããã£ãã®ã§æèŠªäŒã® LT ã§çºè¡šããã </p> - <p> - äžèº«ã¯<a href="/slides/2023-03-15/phpstudy-tokyo-150/">第150åPHPå匷äŒ@æ±äº¬ã§ç»å£ããå
容</a>ãšã»ãŒåãã§ãã¿ã€ãã«ãããã©ãã®ããã«çްé·ã FizzBuzz ãæžããã«ããã ãã®ææãã»äžçºãã¿çºè¡šã§ãããåå¥ã«ã¹ã©ã€ãã¯ã¢ããããŒãããªãã®ã§ãåè¿°ã®ãªã³ã¯ãåç
§ããŠã»ããã + äžèº«ã¯ <a href="/slides/2023-03-15/phpstudy-tokyo-150/">第150åPHPå匷äŒ@æ±äº¬ã§ç»å£ããå
容</a> ãšã»ãŒåãã§ãã¿ã€ãã«ãããã©ãã®ããã«çްé·ã FizzBuzz ãæžããã«ããã ãã®ææãã»äžçºãã¿çºè¡šã§ãããåå¥ã«ã¹ã©ã€ãã¯ã¢ããããŒãããªãã®ã§ãåè¿°ã®ãªã³ã¯ãåç
§ããŠã»ããã </p> - <p> - ãªãããã®çºè¡šã«ã¯<a href="/posts/2022-09-29/write-fizzbuzz-in-php-2-letters-per-line/">ããã°èšäºããŒãžã§ã³</a>ãããã + ãªãããã®çºè¡šã«ã¯ <a href="/posts/2022-09-29/write-fizzbuzz-in-php-2-letters-per-line/">ããã°èšäºããŒãžã§ã³</a> ãããã </p> </section> - <section id="section--outro"> - <h2><a href="#section--outro">ãããã«</a></h2> + <h2><a href="#section--outro">ãããã«</a></h2> <p> - ååäžã®çºè¡šã«éã«åããªãã£ãããšããšã«ããå¿æ®ããªã®ã ãããã以å€ã¯ PHP ã«ã³ãã¡ã¬ã³ã¹å°ç°åã®ã¹ã¿ããã®æ¹ã
ãã¯ããå€ãã®æ¹ãšäº€æµã§ããéåžžã«æ¥œããã«ã³ãã¡ã¬ã³ã¹ã ã£ããæ¥å¹Žããããããªã®ã§ (ãã®åã ãšæ¥å¹Žãæå PHP ã«ã³ãã¡ã¬ã³ã¹ã«ãªããªããïŒ)ãæ¯éåå ãããã + ååäžã®çºè¡šã«éã«åããªãã£ãããšããšã«ããå¿æ®ããªã®ã ãããã以å€ã¯ PHP ã«ã³ãã¡ã¬ã³ã¹å°ç°åã®ã¹ã¿ããã®æ¹ã
ãã¯ããå€ãã®æ¹ãšäº€æµã§ããéåžžã«æ¥œããã«ã³ãã¡ã¬ã³ã¹ã ã£ããæ¥å¹Žããããããªã®ã§ (ãã®åã ãšæ¥å¹Žãæå PHP ã«ã³ãã¡ã¬ã³ã¹ã«ãªããªããïŒ)ãæ¯éåå ãããã </p> - <p> - ãããããããã°éŠå·ã§ãã©ãé£ã¹ãŠãªããª......ã + ãããããããã°éŠå·ã§ãã©ãé£ã¹ãŠãªããªâŠâŠã </p> </section> </div> diff --git a/vhosts/blog/public/posts/2024-06-19/scalamatsuri-2024-report/index.html b/vhosts/blog/public/posts/2024-06-19/scalamatsuri-2024-report/index.html index 5e3263bf..906051cc 100644 --- a/vhosts/blog/public/posts/2024-06-19/scalamatsuri-2024-report/index.html +++ b/vhosts/blog/public/posts/2024-06-19/scalamatsuri-2024-report/index.html @@ -64,60 +64,60 @@ </ol> </section> <section id="section--intro"> - <h2><a href="#section--intro">ã¯ããã«</a></h2> + <h2><a href="#section--intro">ã¯ããã«</a></h2> <p> - 2024-06-08 ãã 2024-06-09 ã«ãããŠéå¬ããã <a href="https://2024.scalamatsuri.org/ja" rel="noreferrer" target="_blank">ScalaMatsuri 2024</a> ã«åå ããã + 2024-06-08 ãã 2024-06-09 ã«ãããŠéå¬ããã <a href="https://2024.scalamatsuri.org/ja" rel="noreferrer" target="_blank">ScalaMatsuri 2024</a> ã«åå ããã </p> - <p> - Day 2 ã«ã¯åœæ¥åå ã§ããªãã£ããããday 2 ã®ã»ãã·ã§ã³ã®ææ³ã¯ YouTube ã«ã¢ããããŒããããã¢ãŒã«ã€ãåç»ãèŠ³ãŠæžããŠããã + Day 2 ã«ã¯åœæ¥åå ã§ããªãã£ããããday 2 ã®ã»ãã·ã§ã³ã®ææ³ã¯ YouTube ã«ã¢ããããŒããããã¢ãŒã«ã€ãåç»ãèŠ³ãŠæžããŠããã </p> </section> - <section id="section--sessions"> - <h2><a href="#section--sessions">ã»ãã·ã§ã³ææ³</a></h2> + <h2><a href="#section--sessions">ã»ãã·ã§ã³ææ³</a></h2> <p> - ç¹ã«å°è±¡ã«æ®ã£ãã»ãã·ã§ã³ããday 1 ãš day 2 ã§äžã€ãã€éžãã (ã¿ã€ãã«ãšç»å£è
å㯠<a href="https://2024.scalamatsuri.org/ja/programs" rel="noreferrer" target="_blank">å
¬åŒããŒã ããŒãžã®ãããã°ã©ã ã</a> ããåŒçš)ã + ç¹ã«å°è±¡ã«æ®ã£ãã»ãã·ã§ã³ããday 1 ãš day 2 ã§äžã€ãã€éžãã (ã¿ã€ãã«ãšç»å£è
å㯠<a href="https://2024.scalamatsuri.org/ja/programs" rel="noreferrer" target="_blank">å
¬åŒããŒã ããŒãžã®ãããã°ã©ã ã</a> ããåŒçš)ã </p> - <ul> <li> - <a href="https://2024.scalamatsuri.org/ja/programs/SESSION_DAY_1_02" rel="noreferrer" target="_blank">Scala to WebAssembly: åæ©ãšæ¹æ³</a> (Rikito Taniguchi ãã) + <p> + <a href="https://2024.scalamatsuri.org/ja/programs/SESSION_DAY_1_02" rel="noreferrer" target="_blank">Scala to WebAssembly: åæ©ãšæ¹æ³</a> (Rikito Taniguchi ãã) + </p> <ul> - <a href="/posts/2024-03-17/phperkaigi-2024-report/#section--as-speaker">æè¿ WebAssembly ã®åŠçç³»ãäœã£ã</a> ããšããã£ãŠãæ°ã«ãªã£ãŠããã»ãã·ã§ã³ã§ããç§ã®åŠç系㯠WasmGC proposal ãå®è£
ããŠããªãã®ã§åãããªãã®ã§ããããã€ããµããŒãããŠåãããŠã¿ããã§ããã + <li> + <a href="/posts/2024-03-17/phperkaigi-2024-report/#section--as-speaker">æè¿ WebAssembly ã®åŠçç³»ãäœã£ã</a> ããšããã£ãŠãæ°ã«ãªã£ãŠããã»ãã·ã§ã³ã§ããç§ã®åŠç系㯠WasmGC proposal ãå®è£
ããŠããªãã®ã§åãããªãã®ã§ããããã€ããµããŒãããŠåãããŠã¿ããã§ããã + </li> </ul> </li> - <li> - <a href="https://2024.scalamatsuri.org/ja/programs/SESSION_DAY_2_04" rel="noreferrer" target="_blank">äœã£ãŠåŠã¶ Extensible Effects</a> (Kory ããã»hsjoihs ãã) + <p> + <a href="https://2024.scalamatsuri.org/ja/programs/SESSION_DAY_2_04" rel="noreferrer" target="_blank">äœã£ãŠåŠã¶ Extensible Effects</a> (Kory ããã»hsjoihs ãã) + </p> <ul> - ä»åäžçªæ¥œãã¿ã«ããŠããã»ãã·ã§ã³ã§ããDay 2 åœæ¥ã¯åå ã§ãããåŸæ¥ã¢ãŒã«ã€ãåç»ãèŠèŽããã®ã§ãããæåŸ
ãè£åããªãæ¿åãªã»ãã·ã§ã³ã§ãããåŸæ¥éããã <a href="https://nextbeat.connpass.com/event/315988/" rel="noreferrer" target="_blank">NB-Scala ã¬ããã¹ãã¯ãã£ã (éå
¬åŒåŸå€ç¥)</a> ã®çºè¡šãæèŽããã®ã§ãããã©ã¡ããéåžžã«é¢çœãã£ãã§ãã + <li> + ä»åäžçªæ¥œãã¿ã«ããŠããã»ãã·ã§ã³ã§ããDay 2 åœæ¥ã¯åå ã§ãããåŸæ¥ã¢ãŒã«ã€ãåç»ãèŠèŽããã®ã§ãããæåŸ
ãè£åããªãæ¿åãªã»ãã·ã§ã³ã§ãããåŸæ¥éããã <a href="https://nextbeat.connpass.com/event/315988/" rel="noreferrer" target="_blank">NB-Scala ã¬ããã¹ãã¯ãã£ã (éå
¬åŒåŸå€ç¥)</a> ã®çºè¡šãæèŽããã®ã§ãããã©ã¡ããéåžžã«é¢çœãã£ãã§ãã + </li> </ul> </li> </ul> </section> - <section id="section--others"> - <h2><a href="#section--others">ãã®ä»ææ³</a></h2> + <h2><a href="#section--others">ãã®ä»ææ³</a></h2> <ul> <li> è¯ãäŒå Žã ã£ããããåãæ²æ±°ãããã¹ã©ã€ãã®æåãµã€ãºã®åé¡ã¯ã巚倧ãªã¹ã¯ãªãŒã³ãçšæããããšã§è§£æ±ºãããšããçºèŠããã£ã </li> - <li> - ã©ã³ãã«ãåŒåœãçšæãããŠãããããããã£ã (<a href="https://x.com/nsfisis/status/1799276217583260092" rel="noreferrer" target="_blank">åèç»å</a>) + ã©ã³ãã«ãåŒåœãçšæãããŠãããããããã£ã ( <a href="https://x.com/nsfisis/status/1799276217583260092" rel="noreferrer" target="_blank">åèç»å</a> ) </li> </ul> </section> - <section id="section--outro"> - <h2><a href="#section--outro">ãããã«</a></h2> + <h2><a href="#section--outro">ãããã«</a></h2> <p> - ç§ã Scala ãæžããã远ã£ããããŠããã®ã¯ Scala 2 ã®é ã§ãScala 3 ã¯ã»ãšãã©æµŠå³¶å€ªéç¶æ
ã ã£ãã®ã ããéåžžã«æ¥œããé¢çœãã€ãã³ãã ã£ããã€ãã³ãã«è§ŠçºãããŠãé·ãã塩挬ãã«ãªã£ãŠãã Scala 補ã®è¶£å³ãããžã§ã¯ããä¹
ãã¶ãã«è§Šã£ãŠããã®ã ããããããŸã楜ããã + ç§ã Scala ãæžããã远ã£ããããŠããã®ã¯ Scala 2 ã®é ã§ãScala 3 ã¯ã»ãšãã©æµŠå³¶å€ªéç¶æ
ã ã£ãã®ã ããéåžžã«æ¥œããé¢çœãã€ãã³ãã ã£ãã ã€ãã³ãã«è§ŠçºãããŠãé·ãã塩挬ãã«ãªã£ãŠãã Scala 補ã®è¶£å³ãããžã§ã¯ããä¹
ãã¶ãã«è§Šã£ãŠããã®ã ããããããŸã楜ããã </p> - <p> - ScalaMatsuri éå¶ã®çããŸãã¹ããŒã«ãŒã®çããŸãã¹ãã³ãµãŒã®çããŸãæé«ã®ã€ãã³ããããããšãããããŸããïŒæ¬¡åãæ¥œãã¿ã«ããŠããŸãã + ScalaMatsuri éå¶ã®çããŸãã¹ããŒã«ãŒã®çããŸãã¹ãã³ãµãŒã®çããŸãæé«ã®ã€ãã³ããããããšãããããŸããïŒæ¬¡åãæ¥œãã¿ã«ããŠããŸãã </p> </section> </div> diff --git a/vhosts/blog/public/posts/2024-07-19/reparojson-fix-only-json-formatter/index.html b/vhosts/blog/public/posts/2024-07-19/reparojson-fix-only-json-formatter/index.html index 6fb4f0d0..05050332 100644 --- a/vhosts/blog/public/posts/2024-07-19/reparojson-fix-only-json-formatter/index.html +++ b/vhosts/blog/public/posts/2024-07-19/reparojson-fix-only-json-formatter/index.html @@ -65,31 +65,28 @@ NOTE </div> <div class="admonition-content"> - ãã®èšäºã¯ <a href="https://vim-jp.org/ekiden/" rel="noreferrer" target="_blank">Vim é§
äŒ</a> #218 ã®èšäºã§ãã + <p> + ãã®èšäºã¯ <a href="https://vim-jp.org/ekiden/" rel="noreferrer" target="_blank">Vim é§
äŒ</a> #218 ã®èšäºã§ãã + </p> </div> </div> - <section id="section--intro"> - <h2><a href="#section--intro">欲ããã£ããã®</a></h2> + <h2><a href="#section--intro">欲ããã£ããã®</a></h2> <p> - Vim ã§ JSON ãç·šéããŠãããšãã«ãææ³ãšã©ãŒ (æ«å°Ÿã«ã³ããã«ã³ãã®äžè¶³) ã®ã¿ãä¿®æ£ããŠäžåã®æŽåœ¢ããããªããªããã©ã°ã€ã³ã欲ããã£ããæŽåœ¢ãåæã«ãããªããã©ã°ã€ã³ã¯èŠã€ãã£ãã ãã§ã倿°ãã£ãã®ã ããæŽåœ¢ããªããã®ã¯èŠã€ããããªãã£ãã®ã§èªäœããããšã«ããã + Vim ã§ JSON ãç·šéããŠãããšãã«ãææ³ãšã©ãŒ (æ«å°Ÿã«ã³ããã«ã³ãã®äžè¶³) ã®ã¿ãä¿®æ£ããŠäžåã®æŽåœ¢ããããªããªããã©ã°ã€ã³ã欲ããã£ãã æŽåœ¢ãåæã«ãããªããã©ã°ã€ã³ã¯èŠã€ãã£ãã ãã§ã倿°ãã£ãã®ã ããæŽåœ¢ããªããã®ã¯èŠã€ããããªãã£ãã®ã§èªäœããããšã«ããã </p> - <p> - ãªããäœæããããŒã«èªäœã¯åäœã® CLI ãšããŠåäœããVim ãšã¯ç¡é¢ä¿ã«äœ¿ãããšãã§ããããã®èšäºã§ã¯ Neovim ãšçµã¿åãããå Žåã®èšå®ã玹ä»ãããããããä»»æã®ãšãã£ã¿ã§äœ¿ããã ããã + ãªããäœæããããŒã«èªäœã¯åäœã® CLI ãšããŠåäœããVim ãšã¯ç¡é¢ä¿ã«äœ¿ãããšãã§ããã ãã®èšäºã§ã¯ Neovim ãšçµã¿åãããå Žåã®èšå®ã玹ä»ãããããããä»»æã®ãšãã£ã¿ã§äœ¿ããã ããã </p> </section> - <section id="section--reparojson"> - <h2><a href="#section--reparojson">äœã£ããã®</a></h2> + <h2><a href="#section--reparojson">äœã£ããã®</a></h2> <p> - äœæãããã®ããã¡ã: <a href="https://github.com/nsfisis/reparojson" rel="noreferrer" target="_blank">ReparoJSON</a> + äœæãããã®ããã¡ã: <a href="https://github.com/nsfisis/reparojson" rel="noreferrer" target="_blank">ReparoJSON</a> </p> - <p> - 次ã®ããã«åäœããã + 次ã®ããã«åäœããã </p> - <div class="codeblock"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>$ echo '[ 1 2 ]' | reparojson</span></span> <span class="line"><span>[ 1, 2 ]</span></span> @@ -103,116 +100,99 @@ <span class="line"><span>$ echo '{ "foo": 1, "bar": 2, }' | reparojson</span></span> <span class="line"><span>{ "foo": 1, "bar": 2 }</span></span></code></pre> </div> - <p> - ããŒãžã§ã³ 0.1.1 æç¹ã§ä¿®æ£å¯Ÿè±¡ã®ææ³ãšã©ãŒã¯æ¬¡ã®ãšãã: + ããŒãžã§ã³ 0.1.1 æç¹ã§ä¿®æ£å¯Ÿè±¡ã®ææ³ãšã©ãŒã¯æ¬¡ã®ãšãã: </p> - <ul> <li> é
åæ«å°Ÿã®äœèšãªã«ã³ã (åé€ãã) </li> - <li> é
åå
ã®ã«ã³ãäžè¶³ (æ¿å
¥ãã) </li> - <li> ãªããžã§ã¯ãæ«å°Ÿã®äœèšãªã«ã³ã (åé€ãã) </li> - <li> ãªããžã§ã¯ãå
ã®ã«ã³ãäžè¶³ (æ¿å
¥ãã) </li> </ul> - <p> - ä»ã«ãèªåã§çŽããããªãšã©ãŒã¯ããã€ãæãã€ãã (ãªããžã§ã¯ãã®ããŒãã¯ã©ãŒããããŠããªãç)ãç§èªèº«ãããŸãå°ã£ãŠããªãã®ã§åªå
床ã¯äœãã + ä»ã«ãèªåã§çŽããããªãšã©ãŒã¯ããã€ãæãã€ãã (ãªããžã§ã¯ãã®ããŒãã¯ã©ãŒããããŠããªãç)ãç§èªèº«ãããŸãå°ã£ãŠããªãã®ã§åªå
床ã¯äœãã </p> </section> - <section id="section--itegration-with-neovim"> - <h2><a href="#section--itegration-with-neovim">Neovim ãšã®é£æº</a></h2> + <h2><a href="#section--itegration-with-neovim">Neovim ãšã®é£æº</a></h2> <p> - Neovim ã§ JSON ãã¡ã€ã«ãä¿åãããšãã«ãäžèšã®ããŒã«ãèªåã§èµ°ãããããã«èšå®ããã + Neovim ã§ JSON ãã¡ã€ã«ãä¿åãããšãã«ãäžèšã®ããŒã«ãèªåã§èµ°ãããããã«èšå®ããã </p> - <p> - ããã§ã¯ã<a href="https://github.com/neovim/nvim-lspconfig" rel="noreferrer" target="_blank">nvim-lspconfig</a> ãš <a href="https://github.com/mattn/efm-langserver" rel="noreferrer" target="_blank">efm-langserver</a> ãçšããèšå®äŸã玹ä»ããã + ããã§ã¯ã <a href="https://github.com/neovim/nvim-lspconfig" rel="noreferrer" target="_blank">nvim-lspconfig</a> ãš <a href="https://github.com/mattn/efm-langserver" rel="noreferrer" target="_blank">efm-langserver</a> ãçšããèšå®äŸã玹ä»ããã </p> - <div class="codeblock" language="lua"> - <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49">local</span><span style="color:#24292E"> lspconfig </span><span style="color:#D73A49">=</span><span style="color:#005CC5"> require</span><span style="color:#24292E">(</span><span style="color:#032F62">'lspconfig'</span><span style="color:#24292E">)</span></span> + <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49"> local</span><span style="color:#24292E"> lspconfig </span><span style="color:#D73A49">=</span><span style="color:#005CC5"> require</span><span style="color:#24292E">(</span><span style="color:#032F62">'lspconfig'</span><span style="color:#24292E">)</span></span> <span class="line"></span> -<span class="line"><span style="color:#24292E">lspconfig.</span><span style="color:#6F42C1">efm</span><span style="color:#24292E">.</span><span style="color:#005CC5">setup</span><span style="color:#24292E">({</span></span> -<span class="line"><span style="color:#24292E"> init_options </span><span style="color:#D73A49">=</span><span style="color:#24292E"> { documentFormatting </span><span style="color:#D73A49">=</span><span style="color:#005CC5"> true</span><span style="color:#24292E"> },</span></span> -<span class="line"><span style="color:#24292E"> settings </span><span style="color:#D73A49">=</span><span style="color:#24292E"> {</span></span> -<span class="line"><span style="color:#24292E"> rootMarkers </span><span style="color:#D73A49">=</span><span style="color:#24292E"> {</span><span style="color:#032F62">".git/"</span><span style="color:#24292E">},</span></span> -<span class="line"><span style="color:#24292E"> languages </span><span style="color:#D73A49">=</span><span style="color:#24292E"> {</span></span> -<span class="line"><span style="color:#24292E"> json </span><span style="color:#D73A49">=</span><span style="color:#24292E"> {</span></span> -<span class="line"><span style="color:#24292E"> {</span></span> -<span class="line"><span style="color:#24292E"> formatCommand </span><span style="color:#D73A49">=</span><span style="color:#032F62"> "reparojson -q"</span><span style="color:#24292E">,</span></span> -<span class="line"><span style="color:#24292E"> formatStdin </span><span style="color:#D73A49">=</span><span style="color:#005CC5"> true</span><span style="color:#24292E">,</span></span> +<span class="line"><span style="color:#24292E"> lspconfig.</span><span style="color:#6F42C1">efm</span><span style="color:#24292E">.</span><span style="color:#005CC5">setup</span><span style="color:#24292E">({</span></span> +<span class="line"><span style="color:#24292E"> init_options </span><span style="color:#D73A49">=</span><span style="color:#24292E"> { documentFormatting </span><span style="color:#D73A49">=</span><span style="color:#005CC5"> true</span><span style="color:#24292E"> },</span></span> +<span class="line"><span style="color:#24292E"> settings </span><span style="color:#D73A49">=</span><span style="color:#24292E"> {</span></span> +<span class="line"><span style="color:#24292E"> rootMarkers </span><span style="color:#D73A49">=</span><span style="color:#24292E"> {</span><span style="color:#032F62">".git/"</span><span style="color:#24292E">},</span></span> +<span class="line"><span style="color:#24292E"> languages </span><span style="color:#D73A49">=</span><span style="color:#24292E"> {</span></span> +<span class="line"><span style="color:#24292E"> json </span><span style="color:#D73A49">=</span><span style="color:#24292E"> {</span></span> +<span class="line"><span style="color:#24292E"> {</span></span> +<span class="line"><span style="color:#24292E"> formatCommand </span><span style="color:#D73A49">=</span><span style="color:#032F62"> "reparojson -q"</span><span style="color:#24292E">,</span></span> +<span class="line"><span style="color:#24292E"> formatStdin </span><span style="color:#D73A49">=</span><span style="color:#005CC5"> true</span><span style="color:#24292E">,</span></span> +<span class="line"><span style="color:#24292E"> },</span></span> <span class="line"><span style="color:#24292E"> },</span></span> <span class="line"><span style="color:#24292E"> },</span></span> -<span class="line"><span style="color:#24292E"> },</span></span> -<span class="line"><span style="color:#24292E"> }</span></span> -<span class="line"><span style="color:#24292E">})</span></span> +<span class="line"><span style="color:#24292E"> }</span></span> +<span class="line"><span style="color:#24292E"> })</span></span> <span class="line"></span> -<span class="line"><span style="color:#24292E">vim.</span><span style="color:#6F42C1">api</span><span style="color:#24292E">.</span><span style="color:#005CC5">nvim_create_autocmd</span><span style="color:#24292E">(</span><span style="color:#032F62">'LspAttach'</span><span style="color:#24292E">, {</span></span> -<span class="line"><span style="color:#6F42C1"> callback</span><span style="color:#D73A49"> =</span><span style="color:#D73A49"> function</span><span style="color:#24292E">(e)</span></span> -<span class="line"><span style="color:#24292E"> vim.</span><span style="color:#6F42C1">api</span><span style="color:#24292E">.</span><span style="color:#005CC5">nvim_create_autocmd</span><span style="color:#24292E">(</span><span style="color:#032F62">'BufWritePre'</span><span style="color:#24292E">, {</span></span> -<span class="line"><span style="color:#24292E"> buffer </span><span style="color:#D73A49">=</span><span style="color:#24292E"> e.</span><span style="color:#6F42C1">buf</span><span style="color:#24292E">,</span></span> -<span class="line"><span style="color:#6F42C1"> callback</span><span style="color:#D73A49"> =</span><span style="color:#D73A49"> function</span><span style="color:#24292E">()</span></span> -<span class="line"><span style="color:#24292E"> vim.</span><span style="color:#6F42C1">lsp</span><span style="color:#24292E">.</span><span style="color:#6F42C1">buf</span><span style="color:#24292E">.</span><span style="color:#005CC5">format</span><span style="color:#24292E">({ async </span><span style="color:#D73A49">=</span><span style="color:#005CC5"> false</span><span style="color:#24292E"> })</span></span> -<span class="line"><span style="color:#D73A49"> end</span></span> -<span class="line"><span style="color:#24292E"> })</span></span> -<span class="line"><span style="color:#D73A49"> end</span><span style="color:#24292E">,</span></span> -<span class="line"><span style="color:#24292E">})</span></span></code></pre> +<span class="line"><span style="color:#24292E"> vim.</span><span style="color:#6F42C1">api</span><span style="color:#24292E">.</span><span style="color:#005CC5">nvim_create_autocmd</span><span style="color:#24292E">(</span><span style="color:#032F62">'LspAttach'</span><span style="color:#24292E">, {</span></span> +<span class="line"><span style="color:#6F42C1"> callback</span><span style="color:#D73A49"> =</span><span style="color:#D73A49"> function</span><span style="color:#24292E">(e)</span></span> +<span class="line"><span style="color:#24292E"> vim.</span><span style="color:#6F42C1">api</span><span style="color:#24292E">.</span><span style="color:#005CC5">nvim_create_autocmd</span><span style="color:#24292E">(</span><span style="color:#032F62">'BufWritePre'</span><span style="color:#24292E">, {</span></span> +<span class="line"><span style="color:#24292E"> buffer </span><span style="color:#D73A49">=</span><span style="color:#24292E"> e.</span><span style="color:#6F42C1">buf</span><span style="color:#24292E">,</span></span> +<span class="line"><span style="color:#6F42C1"> callback</span><span style="color:#D73A49"> =</span><span style="color:#D73A49"> function</span><span style="color:#24292E">()</span></span> +<span class="line"><span style="color:#24292E"> vim.</span><span style="color:#6F42C1">lsp</span><span style="color:#24292E">.</span><span style="color:#6F42C1">buf</span><span style="color:#24292E">.</span><span style="color:#005CC5">format</span><span style="color:#24292E">({ async </span><span style="color:#D73A49">=</span><span style="color:#005CC5"> false</span><span style="color:#24292E"> })</span></span> +<span class="line"><span style="color:#D73A49"> end</span></span> +<span class="line"><span style="color:#24292E"> })</span></span> +<span class="line"><span style="color:#D73A49"> end</span><span style="color:#24292E">,</span></span> +<span class="line"><span style="color:#24292E"> })</span></span></code></pre> </div> - <p> - ã»ãšãã©ã¯ nvim-lspconfig ãš efm-langserver ã䜿ãéã®ãã€ã©ãŒãã¬ãŒãã ãã<code>formatCommand</code> ã§ <code>-q</code> ãã©ã°ãæå®ããŠããããšã«æ³šæããŠã»ããããã®ããŒã«ã¯ãããã©ã«ãã§ã¯ JSON ãä¿®æ£ãããå Žå exit code 1 ã§çµäºãããããã¯ãå
¥åãæåããæ£ããã£ãå Žåãšä¿®æ£ããŠæ£ãããªã£ãå Žåãåºå¥ããããã ããç°åžžçµäºããŠããŸããšçœ®ãæããçºçããªãããã®ããã<code>-q</code> ãã©ã°ãæå®ããŠãä¿®æ£ããããšãã exit code 0 ã§çµäºããããã«ããŠããã + ã»ãšãã©ã¯ nvim-lspconfig ãš efm-langserver ã䜿ãéã®ãã€ã©ãŒãã¬ãŒãã ãã<code>formatCommand</code> ã§ <code>-q</code> ãã©ã°ãæå®ããŠããããšã«æ³šæããŠã»ããã ãã®ããŒã«ã¯ãããã©ã«ãã§ã¯ JSON ãä¿®æ£ãããå Žå exit code 1 ã§çµäºããã ããã¯ãå
¥åãæåããæ£ããã£ãå Žåãšä¿®æ£ããŠæ£ãããªã£ãå Žåãåºå¥ããããã ããç°åžžçµäºããŠããŸããšçœ®ãæããçºçããªãã ãã®ããã<code>-q</code> ãã©ã°ãæå®ããŠãä¿®æ£ããããšãã exit code 0 ã§çµäºããããã«ããŠããã </p> </section> - <section id="section--outro"> - <h2><a href="#section--outro">ãããã«</a></h2> + <h2><a href="#section--outro">ãããã«</a></h2> <p> - ãã®ããŒã«ãåšåãçºæ®ããã®ã¯ãè¡ã®å
¥ãæãæã§ãããæ¬¡ã®ãã㪠JSON ãããã + ãã®ããŒã«ãåšåãçºæ®ããã®ã¯ãè¡ã®å
¥ãæãæã§ãããæ¬¡ã®ãã㪠JSON ãããã </p> - <div class="codeblock" language="json"> - <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#24292E">{</span></span> -<span class="line"><span style="color:#005CC5"> "a"</span><span style="color:#24292E">: </span><span style="color:#005CC5">true</span><span style="color:#24292E">,</span></span> -<span class="line"><span style="color:#005CC5"> "b"</span><span style="color:#24292E">: </span><span style="color:#005CC5">false</span></span> -<span class="line"><span style="color:#24292E">}</span></span></code></pre> + <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#24292E"> {</span></span> +<span class="line"><span style="color:#005CC5"> "a"</span><span style="color:#24292E">: </span><span style="color:#005CC5">true</span><span style="color:#24292E">,</span></span> +<span class="line"><span style="color:#005CC5"> "b"</span><span style="color:#24292E">: </span><span style="color:#005CC5">false</span></span> +<span class="line"><span style="color:#24292E"> }</span></span></code></pre> </div> - <p> - 2è¡ç®ãš3è¡ç®ãå
¥ãæããŠä»¥äžã®ããã«ç·šéããã + 2è¡ç®ãš3è¡ç®ãå
¥ãæããŠä»¥äžã®ããã«ç·šéããã </p> - <div class="codeblock" language="json"> - <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#24292E">{</span></span> -<span class="line"><span style="color:#005CC5"> "b"</span><span style="color:#24292E">: </span><span style="color:#005CC5">false</span></span> -<span class="line"><span style="color:#032F62"> "a"</span><span style="color:#B31D28;font-style:italic">:</span><span style="color:#005CC5"> true</span><span style="color:#24292E">,</span></span> -<span class="line"><span style="color:#24292E">}</span></span></code></pre> + <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#24292E"> {</span></span> +<span class="line"><span style="color:#005CC5"> "b"</span><span style="color:#24292E">: </span><span style="color:#005CC5">false</span></span> +<span class="line"><span style="color:#032F62"> "a"</span><span style="color:#B31D28;font-style:italic">:</span><span style="color:#005CC5"> true</span><span style="color:#24292E">,</span></span> +<span class="line"><span style="color:#24292E"> }</span></span></code></pre> </div> - <p> - ããã¯äžæ£ãª JSON ã ãããã®ããŒã«ãéãã°æ¬¡ã®ããã«ãªãã + ããã¯äžæ£ãª JSON ã ãããã®ããŒã«ãéãã°æ¬¡ã®ããã«ãªãã </p> - <div class="codeblock" language="json"> - <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#24292E">{</span></span> -<span class="line"><span style="color:#005CC5"> "b"</span><span style="color:#24292E">: </span><span style="color:#005CC5">false</span><span style="color:#24292E">,</span></span> -<span class="line"><span style="color:#005CC5"> "a"</span><span style="color:#24292E">: </span><span style="color:#005CC5">true</span></span> -<span class="line"><span style="color:#24292E">}</span></span></code></pre> + <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#24292E"> {</span></span> +<span class="line"><span style="color:#005CC5"> "b"</span><span style="color:#24292E">: </span><span style="color:#005CC5">false</span><span style="color:#24292E">,</span></span> +<span class="line"><span style="color:#005CC5"> "a"</span><span style="color:#24292E">: </span><span style="color:#005CC5">true</span></span> +<span class="line"><span style="color:#24292E"> }</span></span></code></pre> </div> - <p> - ãã¡ããããã®ãããªæäœãææ³ãå£ããã«ãããªã Vim ãã©ã°ã€ã³ã¯ååšãããããããåãªãè¡ã®å
¥ãæãã§ããã° <code>ddp</code> ã®3ã¹ãããŒã¯ã§ãããªãããšãã§ããå°çšã®ããŒãã€ã³ããèŠããå¿
èŠããªãããã®ããŒã«ãçšããããšã§ããã Vimmer-friendly 㪠JSON ç·šéãå¯èœãšãªãã + ãã¡ããããã®ãããªæäœãææ³ãå£ããã«ãããªã Vim ãã©ã°ã€ã³ã¯ååšããã ããããåãªãè¡ã®å
¥ãæãã§ããã° <code>ddp</code> ã®3ã¹ãããŒã¯ã§ãããªãããšãã§ããå°çšã®ããŒãã€ã³ããèŠããå¿
èŠããªãã ãã®ããŒã«ãçšããããšã§ããã Vimmer-friendly 㪠JSON ç·šéãå¯èœãšãªãã </p> </section> </div> diff --git a/vhosts/blog/public/posts/2024-08-19/go-template-access-outer-scope-pipeline-within-with-or-range/index.html b/vhosts/blog/public/posts/2024-08-19/go-template-access-outer-scope-pipeline-within-with-or-range/index.html index aa6d2afb..2c7cae67 100644 --- a/vhosts/blog/public/posts/2024-08-19/go-template-access-outer-scope-pipeline-within-with-or-range/index.html +++ b/vhosts/blog/public/posts/2024-08-19/go-template-access-outer-scope-pipeline-within-with-or-range/index.html @@ -58,18 +58,16 @@ </ol> </section> <section id="section--tldr"> - <h2><a href="#section--tldr">TL;DR</a></h2> + <h2><a href="#section--tldr">TL;DR</a></h2> <p> - åžžã«ãããã¬ãã«ãæãç¹æ®å€æ° <code>$</code> ã䜿ãã°ããã + åžžã«ãããã¬ãã«ãæãç¹æ®å€æ° <code>$</code> ã䜿ãã°ããã </p> </section> - <section id="section--intro"> - <h2><a href="#section--intro">ã¯ããã«</a></h2> + <h2><a href="#section--intro">ã¯ããã«</a></h2> <p> - Go ã«ã¯ãæšæºã©ã€ãã©ãªã«ãã³ãã¬ãŒãã©ã€ãã©ãª <code>text/template</code> ãããããã® <code>text/template</code> ã«ãããå¶åŸ¡æ§é ã<code>with</code> ãš <code>range</code> ã¯æ¬¡ã®ããã«äœ¿ãããã + Go ã«ã¯ãæšæºã©ã€ãã©ãªã«ãã³ãã¬ãŒãã©ã€ãã©ãª <code>text/template</code> ãããã ãã® <code>text/template</code> ã«ãããå¶åŸ¡æ§é ã<code>with</code> ãš <code>range</code> ã¯æ¬¡ã®ããã«äœ¿ãããã </p> - <div class="codeblock"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span># {{ .Title }}</span></span> <span class="line"><span></span></span> @@ -85,19 +83,15 @@ <span class="line"><span> - {{ . }}</span></span> <span class="line"><span>{{ end }}</span></span></code></pre> </div> - <p> <code>text/template</code> ã® <code>.</code> ã¯ãçŸåšã®æäœå¯Ÿè±¡ã衚ãç¹æ®ãªãªããžã§ã¯ãã§ããã </p> - <p> - <code>with</code> ã <code>range</code> ã¯ã<code>.</code> ã倿Žãã广ãæã€ã<code>with</code> ã¯åŒæ°ã«æž¡ããããªããžã§ã¯ãã <code>.</code> ãžã»ããããŠãå
éšã®ãã³ãã¬ãŒããå®è¡ããã<code>range</code> ã¯åŒæ°ã«æž¡ãããã€ãã¬ãŒãå¯èœãªãªããžã§ã¯ãã«å¯Ÿããããããã®èŠçŽ ã <code>.</code> ãžã»ããããŠãèŠçŽ ã®åæ°ã ãå
éšã®ãã³ãã¬ãŒããå®è¡ããã + <code>with</code> ã <code>range</code> ã¯ã<code>.</code> ã倿Žãã广ãæã€ã <code>with</code> ã¯åŒæ°ã«æž¡ããããªããžã§ã¯ãã <code>.</code> ãžã»ããããŠãå
éšã®ãã³ãã¬ãŒããå®è¡ããã <code>range</code> ã¯åŒæ°ã«æž¡ãããã€ãã¬ãŒãå¯èœãªãªããžã§ã¯ãã«å¯Ÿããããããã®èŠçŽ ã <code>.</code> ãžã»ããããŠãèŠçŽ ã®åæ°ã ãå
éšã®ãã³ãã¬ãŒããå®è¡ããã </p> - <p> - ã€ãŸããã®ãã³ãã¬ãŒãã¯ã次ã®ãããªæ§é ãã¬ã³ããªã³ã°ããŠãã (<code>Execute()</code> ã®ç¬¬2åŒæ°)ã + ã€ãŸããã®ãã³ãã¬ãŒãã¯ã次ã®ãããªæ§é ãã¬ã³ããªã³ã°ããŠãã (<code>Execute()</code> ã®ç¬¬2åŒæ°)ã </p> - <div class="codeblock" language="go"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#24292E">tmpl.</span><span style="color:#6F42C1">Execute</span><span style="color:#24292E">(out, </span><span style="color:#6F42C1">Params</span><span style="color:#24292E">{</span></span> <span class="line"><span style="color:#24292E"> Title: </span><span style="color:#032F62">"foo"</span><span style="color:#24292E">,</span></span> @@ -113,13 +107,11 @@ <span class="line"><span style="color:#24292E">})</span></span></code></pre> </div> </section> - <section id="section--what-i-want-to-do"> - <h2><a href="#section--what-i-want-to-do">ããããããš</a></h2> + <h2><a href="#section--what-i-want-to-do">ããããããš</a></h2> <p> - ä»åãããªãããã®ã¯ã<code>with</code> ã <code>range</code> ã®äžã§ããã®å€åŽã§äœ¿ãããŠãããããã¬ãã«ã®ãªããžã§ã¯ããåç
§ããããšã ã + ä»åãããªãããã®ã¯ã<code>with</code> ã <code>range</code> ã®äžã§ããã®å€åŽã§äœ¿ãããŠãããããã¬ãã«ã®ãªããžã§ã¯ããåç
§ããããšã ã </p> - <div class="codeblock"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>{{ with .User }}</span></span> <span class="line"><span> ãããã .Title ãåç
§ããã«ã¯ïŒ</span></span> @@ -129,34 +121,27 @@ <span class="line"><span> ãããã .User ãåç
§ããã«ã¯ïŒ</span></span> <span class="line"><span>{{ end }}</span></span></code></pre> </div> - <p> - <code>with</code> ã <code>range</code> ã¯ã<code>.</code> ãèªèº«ã®å¯Ÿè±¡ãªããžã§ã¯ãã«å€æŽããã®ã§ãåã« <code>{{ with .User }}</code> ã®äžã§ <code>.Title</code> ãšæžããŠãããã㯠<code>User</code> ã® <code>Title</code> ããããã£ãåç
§ããŠãããšã¿ãªãããã + <code>with</code> ã <code>range</code> ã¯ã<code>.</code> ãèªèº«ã®å¯Ÿè±¡ãªããžã§ã¯ãã«å€æŽããã®ã§ã åã« <code>{{ with .User }}</code> ã®äžã§ <code>.Title</code> ãšæžããŠãããã㯠<code>User</code> ã® <code>Title</code> ããããã£ãåç
§ããŠãããšã¿ãªãããã </p> - <p> - <code>text/template</code> ã§ã¯å€æ°ã䜿ããã®ã§ããã³ãã¬ãŒãã®å
é ã§ + <code>text/template</code> ã§ã¯å€æ°ã䜿ããã®ã§ããã³ãã¬ãŒãã®å
é ã§ </p> - <div class="codeblock"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>{{ $params := . }}</span></span></code></pre> </div> - <p> - ãšã§ãããŠããã°å®çŸã¯å¯èœã§ããã + ãšã§ãããŠããã°å®çŸã¯å¯èœã§ããã </p> - <p> - ããããªãããé »çºããã·ãã¥ãšãŒã·ã§ã³ã«ããŠã¯ããŸãã«äžæ°å¥œã§ãããããã¹ããŒããªæ¹æ³ãçšæãããŠããã¯ãã ã + ããããªãããé »çºããã·ãã¥ãšãŒã·ã§ã³ã«ããŠã¯ããŸãã«äžæ°å¥œã§ãããããã¹ããŒããªæ¹æ³ãçšæãããŠããã¯ãã ã </p> </section> - <section id="section--solution"> - <h2><a href="#section--solution">è§£æ±ºæ¹æ³</a></h2> + <h2><a href="#section--solution">è§£æ±ºæ¹æ³</a></h2> <p> - åžžã«ãããã¬ãã«ãæãç¹æ®å€æ° <code>$</code> ã䜿ãã°ããã + åžžã«ãããã¬ãã«ãæãç¹æ®å€æ° <code>$</code> ã䜿ãã°ããã </p> - <div class="codeblock"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>{{ with .User }}</span></span> <span class="line"><span> {{ $.Title }}</span></span> @@ -166,27 +151,24 @@ <span class="line"><span> {{ $.User.Name }}</span></span> <span class="line"><span>{{ end }}</span></span></code></pre> </div> - <p> - <code>$</code> ã¯ããã³ãã¬ãŒããå®è¡ããããšãã«æž¡ããããªããžã§ã¯ããæããããã䜿ãã°çŸåšã® <code>.</code> ã«é¢ä¿ãªããããã¬ãã«ãåç
§ã§ããã + <code>$</code> ã¯ããã³ãã¬ãŒããå®è¡ããããšãã«æž¡ããããªããžã§ã¯ããæãã ããã䜿ãã°çŸåšã® <code>.</code> ã«é¢ä¿ãªããããã¬ãã«ãåç
§ã§ããã </p> - <p> - ãã®ããšã¯ã<a href="https://pkg.go.dev/text/template#hdr-Variables" rel="noreferrer" target="_blank"><code>text/template</code> ã®å
¬åŒããã¥ã¡ã³ã</a>ã«ã以äžã®ããã«èšèŒãããŠããã + ãã®ããšã¯ã<a href="https://pkg.go.dev/text/template#hdr-Variables" rel="noreferrer" target="_blank"><code>text/template</code> ã®å
¬åŒããã¥ã¡ã³ã</a>ã«ã以äžã®ããã«èšèŒãããŠããã </p> - <blockquote> - When execution begins, $ is set to the data argument passed to Execute, that is, to the starting value of dot. + <p> + When execution begins, $ is set to the data argument passed to Execute, that is, to the starting value of dot. + </p> </blockquote> </section> - <section id="section--reference"> - <h2><a href="#section--reference">åè</a></h2> + <h2><a href="#section--reference">åè</a></h2> <ul> <li> - <a href="https://stackoverflow.com/questions/14800204/in-a-template-how-do-you-access-an-outer-scope-while-inside-of-a-with-or-rang" rel="noreferrer" target="_blank">çŽæ¥ã®åºå
žã§ãã Stack Overflow ã®åç: "In a template how do you access an outer scope while inside of a "with" or "range" scope?"</a> + <a href="https://stackoverflow.com/questions/14800204/in-a-template-how-do-you-access-an-outer-scope-while-inside-of-a-with-or-rang" rel="noreferrer" target="_blank">çŽæ¥ã®åºå
žã§ãã Stack Overflow ã®åç: <span>In a template how do you access an outer scope while inside of a âwithâ or ârangeâ scope?</span></a> </li> - <li> <a href="https://pkg.go.dev/text/template#hdr-Variables" rel="noreferrer" target="_blank">倧å
ã®åºå
žã§ãã <code>text/template</code> ã®å
¬åŒããã¥ã¡ã³ã</a> </li> diff --git a/vhosts/blog/public/posts/2024-09-28/mncore-challenge-1/index.html b/vhosts/blog/public/posts/2024-09-28/mncore-challenge-1/index.html index bb998a4b..d1eed50f 100644 --- a/vhosts/blog/public/posts/2024-09-28/mncore-challenge-1/index.html +++ b/vhosts/blog/public/posts/2024-09-28/mncore-challenge-1/index.html @@ -62,40 +62,36 @@ NOTE </div> <div class="admonition-content"> - ãã ã®åå èšã§è§£èª¬ã¯ãªãã + <p> + ãã ã®åå èšã§è§£èª¬ã¯ãªãã + </p> </div> </div> - <section id="section--intro"> - <h2><a href="#section--intro">ã¯ããã«</a></h2> + <h2><a href="#section--intro">ã¯ããã«</a></h2> <p> - 2024-08-28 ãã 2024-09-24 ã®çŽ1ã¶æã«æž¡ãéå¬ããã <a href="https://mncore-challenge.preferred.jp/" rel="noreferrer" target="_blank">MN-Core Challenge #1</a> ã«åå ãããç§ nsfisis (<a href="https://x.com/nsfisis/status/1838276770560364977" rel="noreferrer" target="_blank">ããã㯠<code>0b0100000111111000</code></a>) ã¯ã¹ã³ã¢ 1181 ã§ãæçµé äœ 29 äœã ã£ãã + 2024-08-28 ãã 2024-09-24 ã®çŽ1ã¶æã«æž¡ãéå¬ããã <a href="https://mncore-challenge.preferred.jp/" rel="noreferrer" target="_blank">MN-Core Challenge #1</a> ã«åå ãããç§ nsfisis (<a href="https://x.com/nsfisis/status/1838276770560364977" rel="noreferrer" target="_blank">ããã㯠<code>0b0100000111111000</code></a>) ã¯ã¹ã³ã¢ 1181 ã§ãæçµé äœ 29 äœã ã£ãã </p> - <p> - ãã®èšäºã§è§£èª¬ã¯ããªãããæåºããåçã¯ãã¡ãã®ãªããžã㪠(<a href="https://github.com/nsfisis/mncore-challenge" rel="noreferrer" target="_blank">GitHub: nsfisis/mncore-challenge</a>) ã«ã¢ããããŒãããŠããã + ãã®èšäºã§è§£èª¬ã¯ããªãããæåºããåçã¯ãã¡ãã®ãªããžã㪠(<a href="https://github.com/nsfisis/mncore-challenge" rel="noreferrer" target="_blank">GitHub: nsfisis/mncore-challenge</a>) ã«ã¢ããããŒãããŠããã </p> </section> - <section id="section--thought"> - <h2><a href="#section--thought">ææ³</a></h2> + <h2><a href="#section--thought">ææ³</a></h2> <p> - MN-Core ã«ã¯åããŠè§Šããããããã§ãåé¡ãªãå
šå (é€ FizzBuzz) è§£ããããç·è·¯ãæ·ãããŠãããååã®åé¡ãè§£ãããšã§èªç¶ãšåŸåãè§£ãã ãã®ç¥èã身ã«ä»ãããã«èšèšãããŠããã + MN-Core ã«ã¯åããŠè§Šããããããã§ãåé¡ãªãå
šå (é€ FizzBuzz) è§£ããããç·è·¯ãæ·ãããŠãããååã®åé¡ãè§£ãããšã§èªç¶ãšåŸåãè§£ãã ãã®ç¥èã身ã«ä»ãããã«èšèšãããŠããã </p> - <p> - é嬿éäžã¯ã»ãŒåžžã« MN-Core Challenge ã®ããšãèãç¶ããŠãããæéäž (åæ²ããåçã貯ããããã®ãªããžããªãé€ã) èªåã® Git ãªããžããªãã»ãšãã©è§Šãããšããªãã£ããéäžæŽæ°ãã§ããã«èŠããæéããã£ãããäžã€æ°ä»ããšäžã€çž®ãŸã楜ãããŽã«ãã ã£ãã + é嬿éäžã¯ã»ãŒåžžã« MN-Core Challenge ã®ããšãèãç¶ããŠãããæéäž (åæ²ããåçã貯ããããã®ãªããžããªãé€ã) èªåã® Git ãªããžããªãã»ãšãã©è§Šãããšããªãã£ããéäžæŽæ°ãã§ããã«èŠããæéããã£ãããäžã€æ°ä»ããšäžã€çž®ãŸã楜ãããŽã«ãã ã£ãã </p> - <p> - æãããã€ã³ãã倿°ããã®ã ããæžããŠãããšããªããªãã®ã§èªåã§åçããã ãã«ããŠããã + æãããã€ã³ãã倿°ããã®ã ããæžããŠãããšããªããªãã®ã§èªåã§åçããã ãã«ããŠããã </p> </section> - <section id="section--outro"> - <h2><a href="#section--outro">ãããã«</a></h2> + <h2><a href="#section--outro">ãããã«</a></h2> <p> - æåŸã«ãªããŸããããéå¶ã®ã¿ãªããŸãçŽ æŽããã³ã³ãã¹ããããããšãããããŸããïŒéåžžã«æ¥œããæéã§ããïŒç¬¬2åãéŠãé·ãããŠåŸ
ã£ãŠããŸãïŒ + æåŸã«ãªããŸããããéå¶ã®ã¿ãªããŸãçŽ æŽããã³ã³ãã¹ããããããšãããããŸããïŒéåžžã«æ¥œããæéã§ããïŒç¬¬2åãéŠãé·ãããŠåŸ
ã£ãŠããŸãïŒ </p> </section> </div> diff --git a/vhosts/blog/public/posts/2024-12-04/cohackpp-report/index.html b/vhosts/blog/public/posts/2024-12-04/cohackpp-report/index.html index 97f8e6b3..516b0c77 100644 --- a/vhosts/blog/public/posts/2024-12-04/cohackpp-report/index.html +++ b/vhosts/blog/public/posts/2024-12-04/cohackpp-report/index.html @@ -64,87 +64,73 @@ </ol> </section> <section id="section--intro"> - <h2><a href="#section--intro">ã¯ããã«</a></h2> + <h2><a href="#section--intro">ã¯ããã«</a></h2> <p> - 2024-11-30 ã«éå¬ããã<a href="https://connpass.com/event/329428/" rel="noreferrer" target="_blank">çŽ
çœãºã±åæŠ</a>ãªãå¬ãã«åå ããŸãããç§ã¯ããºãé£å¶ã®ã¡ã³ããšã㊠LT ããããªããŸããã + 2024-11-30 ã«éå¬ããã <a href="https://connpass.com/event/329428/" rel="noreferrer" target="_blank">çŽ
çœãºã±åæŠ</a> ãªãå¬ãã«åå ããŸãããç§ã¯ããºãé£å¶ã®ã¡ã³ããšã㊠LT ããããªããŸããã </p> - <p> - çŽ
çœãºã±åæŠã®ã€ãã³ãããŒãžã«ãã説æã以äžã«åŒçšããŸãã + çŽ
çœãºã±åæŠã®ã€ãã³ãããŒãžã«ãã説æã以äžã«åŒçšããŸãã </p> - <blockquote> <p> - Webãšã³ãžãã¢ã®<a href="https://x.com/asumikam" rel="noreferrer" target="_blank">asumikam</a>ãšWebãšã³ãžãã¢ã®<a href="https://x.com/stefafafan" rel="noreferrer" target="_blank">stefafafan</a>ã2024幎7æ7æ¥ã«çµå©ããŸããã + Webãšã³ãžãã¢ã® <a href="https://x.com/asumikam" rel="noreferrer" target="_blank">asumikam</a> ãšWebãšã³ãžãã¢ã® <a href="https://x.com/stefafafan" rel="noreferrer" target="_blank">stefafafan</a> ã2024幎7æ7æ¥ã«çµå©ããŸããã </p> - <p> - ãã£ãããªã®ã§æè¡ããŒã¯ãšãã§çŽ
çœæŠãããŸãããïŒããã§ããïŒãã£ãŠãããŸãïŒ + ãã£ãããªã®ã§æè¡ããŒã¯ãšãã§çŽ
çœæŠãããŸãããïŒããã§ããïŒãã£ãŠãããŸãïŒ </p> - <p> - å Žæã¯ã¡ïŒå°ç°åã¡ïŒçãäžãã£ãŠãããŸããã¥ïŒïŒïŒ + å Žæã¯ã¡ïŒå°ç°åã¡ïŒçãäžãã£ãŠãããŸããã¥ïŒïŒïŒ </p> </blockquote> - <p> - ãã£ãããšèšãã°ãããã¯ã«ã³ãã¡ã¬ã³ã¹ã®åœ¢åŒããšã£ãçµå©æ«é²å®Žã§ããã¿ã€ãã«ã®ããºã㯠PHPerããã±ã㯠Perl Monger ã®ç¥ã§ãã + ãã£ãããšèšãã°ãããã¯ã«ã³ãã¡ã¬ã³ã¹ã®åœ¢åŒããšã£ãçµå©æ«é²å®Žã§ããã¿ã€ãã«ã®ããºã㯠PHPerããã±ã㯠Perl Monger ã®ç¥ã§ãã </p> </section> - <section id="section--thoughts"> - <h2><a href="#section--thoughts">ææ³</a></h2> + <h2><a href="#section--thoughts">ææ³</a></h2> <p> - ç§ã¯ããºãé£å¶ã®ã¹ããŒã«ãŒãšã㊠LT ãããŠããã®ã§ããããã®åã«ãŸãã¯ç»å£ä»¥å€ã®ææ³ãã + ç§ã¯ããºãé£å¶ã®ã¹ããŒã«ãŒãšã㊠LT ãããŠããã®ã§ããããã®åã«ãŸãã¯ç»å£ä»¥å€ã®ææ³ãã </p> - <p> - ããïœæé«ã§ããããã©ã®æ ã®ã¹ããŒãã®æ¹ãè¯ãã£ãã®ã§ãããç¹ã« (asumikam ãã/stefafafan ããã«)ãè²ãŠããããæ ã®ãäºæ¹ãå°è±¡ã«æ®ã£ãŠããŸãã(asumikam ãã/stefafafan ããã)ãè²ãŠããæ ãšããŠãäžè©±ã«ãªã£ãæ¹ã«å£°ããããããšã¯ã§ãããšæããã§ãããããã ãã§ãªãããèªåãè²ãŠãã®ã ããšèšãã人ãããŠããããŠããã« 100 ç¹ã§å¿ãã人ããããšããããšããã®çŽ æŽããã人埳ã + ããïœæé«ã§ããããã©ã®æ ã®ã¹ããŒãã®æ¹ãè¯ãã£ãã®ã§ãããç¹ã« (asumikam ãã/stefafafan ããã«)ãè²ãŠããããæ ã®ãäºæ¹ãå°è±¡ã«æ®ã£ãŠããŸãã (asumikam ãã/stefafafan ããã)ãè²ãŠããæ ãšããŠãäžè©±ã«ãªã£ãæ¹ã«å£°ããããããšã¯ã§ãããšæããã§ããã ããã ãã§ãªãããèªåãè²ãŠãã®ã ããšèšãã人ãããŠããããŠããã« 100 ç¹ã§å¿ãã人ããããšããããšããã®çŽ æŽããã人埳ã </p> - <p> - æ¹ããŠãasumikam ãããstefafafan ããããçµå©ããã§ãšãããããŸãïŒ + æ¹ããŠãasumikam ãããstefafafan ããããçµå©ããã§ãšãããããŸãïŒ </p> </section> - <section id="section--lt"> - <h2><a href="#section--lt">LT</a></h2> + <h2><a href="#section--lt">LT</a></h2> <section id="section--lt--prepare"> - <h3><a href="#section--lt--prepare">åæŠæºå</a></h3> + <h3><a href="#section--lt--prepare">åæŠæºå</a></h3> <p> - ããŠãæãåæŠã®åã«æ»ããŸããŠãäž¡é£å¶ã®ç»å£è
ãçºè¡šããåŸã
ã«è¬ã®ã€ãã³ãã®èŒªéãèŠããŠããé ãasumikam ããããæ¬¡ã®ãããªé£çµ¡ãåããŸããã + ããŠãæãåæŠã®åã«æ»ããŸããŠãäž¡é£å¶ã®ç»å£è
ãçºè¡šããåŸã
ã«è¬ã®ã€ãã³ãã®èŒªéãèŠããŠããé ãasumikam ããããæ¬¡ã®ãããªé£çµ¡ãåããŸããã </p> - - <img alt="asumikamãããŸãããããã€ããããŸã§ãããºã±åæŠã§ãLTã¿ã€ã ããããšã«ãªããæè¡ã§3人ããºãåŽãéžåºããããšã«ãªã£ãã®ã§ãããããŸãããããLTãããŸããããããºãé£å¶ã§äžç·ã«é ããç®æããŸãããããnsfisisãOKã§ãïŒã" src="/posts/2024-12-04/cohackpp-report/lt.png"> - </img> - <p> - æåã¯çŽè¿ã®ã«ã³ãã¡ã¬ã³ã¹ã«åºããŠèœéžããããããŒã¶ã«ããŒãã LT ã«ç·šéããŠè©±ãããšããŠããã®ã§ããããã®æ©äŒã§ãªããã°è©±ããªãã»ãã®æ©äŒã§è©±ãããšã«æå³ãããããŒãã«ããããšãã¿åºãããããªããæçµçã«æ¬¡ã®ããŒãã§ã®ç»å£ãšãªããŸããã + <img alt="asumikamãããŸãããããã€ããããŸã§ãããºã±åæŠã§ãLTã¿ã€ã ããããšã«ãªããæè¡ã§3人ããºãåŽãéžåºããããšã«ãªã£ãã®ã§ãããããŸãããããLTãããŸããããããºãé£å¶ã§äžç·ã«é ããç®æããŸãããããnsfisisãOKã§ãïŒã" src="/posts/2024-12-04/cohackpp-report/lt.png"> + </img> + </p> + <p> + æåã¯çŽè¿ã®ã«ã³ãã¡ã¬ã³ã¹ã«åºããŠèœéžããããããŒã¶ã«ããŒãã LT ã«ç·šéããŠè©±ãããšããŠããã®ã§ããããã®æ©äŒã§ãªããã°è©±ããªãã»ãã®æ©äŒã§è©±ãããšã«æå³ãããããŒãã«ããããšãã¿åºãããããªããæçµçã«æ¬¡ã®ããŒãã§ã®ç»å£ãšãªããŸããã </p> </section> - <section id="section--lt--battle"> - <h3><a href="#section--lt--battle">ããå°åžžã«åè² </a></h3> + <h3><a href="#section--lt--battle">ããå°åžžã«åè² </a></h3> <p> - åœæ¥ã¯ããããã°ã©ãã³ã°ãããŒè¬åº§ããšé¡ããŠçºè¡šããããªããŸãããçµå©åŒã®ãããŒãç¹ã«ãå¿ã¿èšèããžãã©ãŒã«ã¹ãããããç¡çããããã°ã©ãã³ã°ã«é©çšãããšãããã®ã§ãã<a href="/slides/2024-11-30/cohackpp/">ã¹ã©ã€ãã¯ãã¡ãã«ã¢ããããŒãããŠããŸãã</a> + åœæ¥ã¯ããããã°ã©ãã³ã°ãããŒè¬åº§ããšé¡ããŠçºè¡šããããªããŸããã çµå©åŒã®ãããŒãç¹ã«ãå¿ã¿èšèããžãã©ãŒã«ã¹ãããããç¡çããããã°ã©ãã³ã°ã«é©çšãããšãããã®ã§ãã <a href="/slides/2024-11-30/cohackpp/">ã¹ã©ã€ãã¯ãã¡ãã«ã¢ããããŒãããŠããŸãã</a> </p> - <p> - æçµçã«ãç¥ãã®ã¡ãã»ãŒãžãä»èŸŒãã ãœãŒã¹ã³ãŒãã§ç· ãããšããæ§æã¯ãæãªãã綺éºã«ãŸãšãŸã£ããšæã£ãŠããŸããå¿ã¿èšèã®æ¡ã¯ä»ã«ã倧éã«ãã£ãã®ã§ãããæè¡ LT ãã€çµå©ç¥ãã¹ããŒãã«ããããã«ã©ãããŠãæåŸã®ãœãŒã¹ã³ãŒããå¿
èŠã ã£ãã®ã§ãæéã®é¢ä¿äžãããã«ã¯ç ç²ãšãªã£ãŠããããŸãã (<a href="https://x.com/nsfisis/status/1862798137452327206" rel="noreferrer" target="_blank">ããã«ãªã£ãæ¡ã®ã²ãšã€</a>)ã + æçµçã«ãç¥ãã®ã¡ãã»ãŒãžãä»èŸŒãã ãœãŒã¹ã³ãŒãã§ç· ãããšããæ§æã¯ãæãªãã綺éºã«ãŸãšãŸã£ããšæã£ãŠããŸããå¿ã¿èšèã®æ¡ã¯ä»ã«ã倧éã«ãã£ãã®ã§ãããæè¡ LT ãã€çµå©ç¥ãã¹ããŒãã«ããããã«ã©ãããŠãæåŸã®ãœãŒã¹ã³ãŒããå¿
èŠã ã£ãã®ã§ãæéã®é¢ä¿äžãããã«ã¯ç ç²ãšãªã£ãŠããããŸãã ( <a href="https://x.com/nsfisis/status/1862798137452327206" rel="noreferrer" target="_blank">ããã«ãªã£ãæ¡ã®ã²ãšã€</a> )ã </p> - <p> - ããããçµå©åŒã»æ«é²å®Žã§ã®ã¹ããŒãèªäœãåããŠã ã£ãã®ã§ãããªãã«ç·åŒµããŠããã®ã§ãããç»å£æããã®åŸã®åå¿ã䌺ãéãæŠã奜è©ã ã£ãããã§è¯ãã£ãã§ãã + ããããçµå©åŒã»æ«é²å®Žã§ã®ã¹ããŒãèªäœãåããŠã ã£ãã®ã§ãããªãã«ç·åŒµããŠããã®ã§ãããç»å£æããã®åŸã®åå¿ã䌺ãéãæŠã奜è©ã ã£ãããã§è¯ãã£ãã§ãã </p> </section> </section> - <section id="section--congrats"> - <h2><a href="#section--congrats">ãçµå©ããã§ãšãããããŸã</a></h2> + <h2><a href="#section--congrats">ãçµå©ããã§ãšãããããŸã</a></h2> <p> - <a href="https://github.com/nsfisis/cohackpp/blob/main/congrats.php" rel="noreferrer" target="_blank">https://github.com/nsfisis/cohackpp/blob/main/congrats.php</a> + <a href="https://github.com/nsfisis/cohackpp/blob/main/congrats.php" rel="noreferrer" target="_blank">https://github.com/nsfisis/cohackpp/blob/main/congrats.php</a> </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49"><?</span><span style="color:#005CC5">php</span></span> <span class="line"><span style="color:#24292E">$s</span><span style="color:#D73A49">=</span><span style="color:#032F62"><<<'</span><span style="color:#D73A49">Q</span><span style="color:#032F62">'</span></span> diff --git a/vhosts/blog/public/posts/2024-12-33/2024-reflections/index.html b/vhosts/blog/public/posts/2024-12-33/2024-reflections/index.html index a6e0f3f6..78c87cc5 100644 --- a/vhosts/blog/public/posts/2024-12-33/2024-reflections/index.html +++ b/vhosts/blog/public/posts/2024-12-33/2024-reflections/index.html @@ -52,120 +52,103 @@ </ol> </section> <section id="section--intro"> - <h2><a href="#section--intro">ã¯ããã«</a></h2> + <h2><a href="#section--intro">ã¯ããã«</a></h2> <p> - ãåãã®ãšããã4 ãš 11 ãš 23 ã§å²ãåãã幎ã¯é幎ãšãããã€ã§ 12 æã 33 æ¥ãŸã§ããã1å¹Žã®æ¯ãè¿ããæžãç¶äºã平幎ãããé·ããªãã®ã§å€§å€ã«éœåãããã + ãåãã®ãšããã4 ãš 11 ãš 23 ã§å²ãåãã幎ã¯é幎ãšãããã€ã§ 12 æã 33 æ¥ãŸã§ããã 1å¹Žã®æ¯ãè¿ããæžãç¶äºã平幎ãããé·ããªãã®ã§å€§å€ã«éœåãããã </p> - <p> - å»å¹Žã®ãã€: <a href="/posts/2023-12-31/2023-reflections/">/posts/2023-12-31/2023-reflections/</a> + å»å¹Žã®ãã€: <a href="/posts/2023-12-31/2023-reflections/">/posts/2023-12-31/2023-reflections/</a> </p> </section> - <section id="section--conference"> - <h2><a href="#section--conference">ç»å£ã»ã«ã³ãã¡ã¬ã³ã¹åå </a></h2> + <h2><a href="#section--conference">ç»å£ã»ã«ã³ãã¡ã¬ã³ã¹åå </a></h2> <p> - åå ãŸãã¯ç»å£ããå匷äŒãã«ã³ãã¡ã¬ã³ã¹ãLT çãå«ããŠèš 8 åã®ç»å£ããããªã£ãããŸãã4ã€ã®ã«ã³ãã¡ã¬ã³ã¹ã§ã³ã¢ã¹ã¿ãããŸãã¯åœæ¥ã¹ã¿ãããšããŠåå ããã + åå ãŸãã¯ç»å£ããå匷äŒãã«ã³ãã¡ã¬ã³ã¹ã LT çãå«ããŠèš 8 åã®ç»å£ããããªã£ãã ãŸãã4ã€ã®ã«ã³ãã¡ã¬ã³ã¹ã§ã³ã¢ã¹ã¿ãããŸãã¯åœæ¥ã¹ã¿ãããšããŠåå ããã </p> - <ul> <li> PHP ã«ã³ãã¡ã¬ã³ã¹åæµ·é 2024 ãªã³ã©ã€ã³ã§åå </li> - <li> <a href="/slides/2024-01-24/phpstudy-tokyo-160/">PHP å匷äŒ@æ±äº¬ 第 160 å ç»å£</a> </li> - <li> <a href="/posts/2024-02-10/yapcjapan-2024-report/">YAPC::Hiroshima 2024 åå </a> </li> - <li> <a href="/posts/2024-02-22/phpkansai-2024-report/">PHPã«ã³ãã¡ã¬ã³ã¹é¢è¥¿ 2024 åå </a> </li> - <li> - PHPerKaigi 2024 + <p> + PHPerKaigi 2024 + </p> <ul> <li> <a href="/slides/2024-03-08/phperkaigi-2024/">ç»å£</a> </li> - <li> ã³ã¢ã¹ã¿ãããšããŠåå </li> </ul> </li> - <li> <a href="/slides/2024-03-15/ya8-2024/">Ya8 2024 ç»å£</a> </li> - <li> - PHP ã«ã³ãã¡ã¬ã³ã¹å°ç°å 2024 + <p> + PHP ã«ã³ãã¡ã¬ã³ã¹å°ç°å 2024 + </p> <ul> <li> <a href="/slides/2024-04-13/phpcon-odawara-2024/">ç»å£</a> </li> - <li> åœæ¥ã¹ã¿ãããšããŠåå </li> </ul> </li> - <li> <a href="/slides/2024-04-25/phpstudy-tokyo-163/">PHP å匷äŒ@æ±äº¬ 第 163 å LT ã§ç»å£</a> </li> - <li> <a href="/posts/2024-05-11/phpconkagawa-2024-report/">PHP ã«ã³ãã¡ã¬ã³ã¹éŠå· 2024 åå </a> </li> - <li> <a href="/posts/2024-06-19/scalamatsuri-2024-report/">ScalaMatsuri 2024 åå </a> </li> - <li> <a href="/slides/2024-07-18/phpstudy-tokyo-166/">PHP å匷äŒ@æ±äº¬ 第 166 å ç»å£</a> </li> - <li> iOSDC Japan 2024 ã³ã¢ã¹ã¿ãããšããŠåå </li> - <li> Nix meetup #1 åå </li> - <li> <a href="/slides/2024-10-30/phpstudy-tokyo-169/">PHP å匷äŒ@æ±äº¬ 第 169 å ç»å£</a> </li> - <li> <a href="/slides/2024-11-30/cohackpp/">çŽ
çœãºã±åæŠ LT ã§ç»å£</a> </li> - <li> PHP ã«ã³ãã¡ã¬ã³ã¹ 2024 åœæ¥ã¹ã¿ãããšããŠåå </li> </ul> </section> - <section id="section--articles"> - <h2><a href="#section--articles">æžããèšäº</a></h2> + <h2><a href="#section--articles">æžããèšäº</a></h2> <p> - ä»å¹Žã¯ãã®ããã°ã«æ1èšäºä»¥äžã®èšäºãæžããšããç®æšãç«ãŠãŠãããæ¬æ°ãšããŠã¯ 12 æ¬ä»¥äžãããã10æãš11æã¯ãŒãã«ãªã£ãŠããŸã£ãã瀟å
èšäºã瀟å€åãã«ãªã©ã€ãããäœæ¥ãäžã
é²ããããŠããªãã®ã§ã2025幎ã¯å®æçã«æ¶åããŠããããã + ä»å¹Žã¯ãã®ããã°ã«æ1èšäºä»¥äžã®èšäºãæžããšããç®æšãç«ãŠãŠãããæ¬æ°ãšããŠã¯ 12 æ¬ä»¥äžãããã10æãš11æã¯ãŒãã«ãªã£ãŠããŸã£ãã 瀟å
èšäºã瀟å€åãã«ãªã©ã€ãããäœæ¥ãäžã
é²ããããŠããªãã®ã§ã2025幎ã¯å®æçã«æ¶åããŠããããã </p> - <ul> <li> 瀟å€èšäº (ãã®ããã°): 15æ¬ </li> - <li> - 瀟å
èšäº: 22æ¬ + <p> + 瀟å
èšäº: 22æ¬ + </p> <ul> <li> 幎éã§æãèšäºãæžãã人ãšããŠç€Ÿå
衚地ããã @@ -174,49 +157,41 @@ </li> </ul> </section> - <section id="section--coding"> - <h2><a href="#section--coding">äœã£ããã®</a></h2> + <h2><a href="#section--coding">äœã£ããã®</a></h2> <p> - ä»å¹Žã¯äž»ã« WebAssembly ã©ã³ã¿ã€ã ãšãã«ã³ãã¡ã¬ã³ã¹ã®äŒç»ã§äœ¿ãã·ã¹ãã ãäœã£ãŠãããåŸè
ã®ã·ã¹ãã ã§ããµã³ãããã¯ã¹åã®ããã®æè¡ãšã㊠WebAssembly ãçšããŠããã®ã§ãä»å¹Žã¯ WebAssembly ãšæ¯ããäžå¹Žã ã£ããšèšããã + ä»å¹Žã¯äž»ã« WebAssembly ã©ã³ã¿ã€ã ãšãã«ã³ãã¡ã¬ã³ã¹ã®äŒç»ã§äœ¿ãã·ã¹ãã ãäœã£ãŠããã åŸè
ã®ã·ã¹ãã ã§ããµã³ãããã¯ã¹åã®ããã®æè¡ãšã㊠WebAssembly ãçšããŠããã®ã§ãä»å¹Žã¯ WebAssembly ãšæ¯ããäžå¹Žã ã£ããšèšããã </p> - <ul> <li> <a href="https://github.com/nsfisis/php-waddiwasi" rel="noreferrer" target="_blank">Waddiwasi: pure PHP ã§æžããã WebAssembly ã©ã³ã¿ã€ã </a> </li> - <li> <a href="https://github.com/nsfisis/phperkaigi-2024-albatross" rel="noreferrer" target="_blank">Albatross.PHP: PHPerKaigi 2024 ã®ã³ãŒããŽã«ãäŒç»ã§äœ¿ãããã·ã¹ãã </a> </li> - <li> <a href="https://github.com/nsfisis/iosdc-japan-2024-albatross" rel="noreferrer" target="_blank">Albatross.swift: iOSDC Japan 2024 ã®ã³ãŒãããã«äŒç»ã§äœ¿ãããã·ã¹ãã </a> </li> - <li> <a href="/posts/2024-07-19/reparojson-fix-only-json-formatter/">ReparoJSON: ææ³ãšã©ãŒãçŽãã ãã® JSON ãã©ãŒããã¿</a> </li> </ul> </section> - <section id="section--misc"> - <h2><a href="#section--misc">ãã®ä»</a></h2> + <h2><a href="#section--misc">ãã®ä»</a></h2> <ul> <li> <a href="/posts/2024-09-28/mncore-challenge-1/">MN-Core Challenge #1 ã«åå </a> </li> - <li> ISUCON 14 ã«åå </li> </ul> </section> - <section id="section--outro"> - <h2><a href="#section--outro">ãããã«</a></h2> + <h2><a href="#section--outro">ãããã«</a></h2> <p> - ä»å¹Žã倧å€ãäžè©±ã«ãªããŸãããããã幎ãïŒ + ä»å¹Žã倧å€ãäžè©±ã«ãªããŸãããããã幎ãïŒ </p> </section> </div> diff --git a/vhosts/blog/public/posts/2025-01-08/phperkaigi-2023-tokens-q1/index.html b/vhosts/blog/public/posts/2025-01-08/phperkaigi-2023-tokens-q1/index.html index 892c7f34..5da025ff 100644 --- a/vhosts/blog/public/posts/2025-01-08/phperkaigi-2023-tokens-q1/index.html +++ b/vhosts/blog/public/posts/2025-01-08/phperkaigi-2023-tokens-q1/index.html @@ -70,199 +70,162 @@ </ol> </section> <section id="section--intro"> - <h2><a href="#section--intro">ã¯ããã«</a></h2> + <h2><a href="#section--intro">ã¯ããã«</a></h2> <div class="admonition"> <div class="admonition-label"> NOTE </div> <div class="admonition-content"> - ãã㯠PHPerKaigi 2023 ã®èšäºã§ããä»ã¯ 2025 幎ã§ãããPHPerKaigi 2023 ã®èšäºã§ãã + <p> + ãã㯠PHPerKaigi 2023 ã®èšäºã§ããä»ã¯ 2025 幎ã§ãããPHPerKaigi 2023 ã®èšäºã§ãã + </p> </div> </div> - <p> - 2023-03-23 ãã 2023-03-25 ã«ãããŠéå¬ããã <a href="https://phperkaigi.jp/2023/" rel="noreferrer" target="_blank">PHPerKaigi 2023</a> ã§ã¯ãPHPer ãã£ã¬ã³ãžãšããäŒç»ããããªããããPHPer ãã£ã¬ã³ãžãšã¯ãã¹ãã³ãµãŒã®ãã³ãã¬ãããã«ã³ãã¡ã¬ã³ã¹äŒå Žãªã©ããã#ãèšå·ã§å§ãŸãæååãéããæ¯åãªã©ãåŸããšããäŒç»ã§ããããã®æååã¯ãPHPer ããŒã¯ã³ããšåŒã°ããŠãããåŒç€Ÿ<a href="https://www.dgcircus.com/" rel="noreferrer" target="_blank">ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ</a>ããã¯ãããŒã¯ã³åé¡ãšãã圢ã§ãPHP ã«é¢ããåé¡ãè§£ããš PHPer ããŒã¯ã³ãåŸãããããã«ãªã£ãŠããåé¡ãåºé¡ããã + 2023-03-23 ãã 2023-03-25 ã«ãããŠéå¬ããã <a href="https://phperkaigi.jp/2023/" rel="noreferrer" target="_blank">PHPerKaigi 2023</a> ã§ã¯ãPHPer ãã£ã¬ã³ãžãšããäŒç»ããããªãããã PHPer ãã£ã¬ã³ãžãšã¯ãã¹ãã³ãµãŒã®ãã³ãã¬ãããã«ã³ãã¡ã¬ã³ã¹äŒå Žãªã©ããã#ãèšå·ã§å§ãŸãæååãéããæ¯åãªã©ãåŸããšããäŒç»ã§ããã ãã®æååã¯ãPHPer ããŒã¯ã³ããšåŒã°ããŠãããåŒç€Ÿ <a href="https://www.dgcircus.com/" rel="noreferrer" target="_blank">ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ</a> ããã¯ãããŒã¯ã³åé¡ãšãã圢ã§ãPHP ã«é¢ããåé¡ãè§£ããš PHPer ããŒã¯ã³ãåŸãããããã«ãªã£ãŠããåé¡ãåºé¡ããã </p> - <p> - <a href="/posts/2023-04-04/phperkaigi-2023-report/">PHPerKaigi 2023 ã®åå ã¬ã</a> ã§ãæžãããšããããã®å¹Žã®ããŒã¯ã³åé¡ã¯ãæšå¹Žã® PHPerKaigi 2022 ãçµãã£ã段éããäœãå§ããçŽå幎ãããŠå¶äœãããããPHPerKaigi åœæ¥ã <a href="/slides/2023-03-25/phperkaigi-2023-tokens/">PHPer ãã£ã¬ã³ãžè§£èª¬ã»ãã·ã§ã³</a> ãšãã圢ã§è§£èª¬ã®æ©äŒãé ããã®ã ãããã£ããæéããããŠäœé¡ããã®ã§èšäºã®åœ¢ã§ãæ®ããŠããããšæãã + <a href="/posts/2023-04-04/phperkaigi-2023-report/">PHPerKaigi 2023 ã®åå ã¬ã</a> ã§ãæžãããšããããã®å¹Žã®ããŒã¯ã³åé¡ã¯ãæšå¹Žã® PHPerKaigi 2022 ãçµãã£ã段éããäœãå§ããçŽå幎ãããŠå¶äœããããã PHPerKaigi åœæ¥ã <a href="/slides/2023-03-25/phperkaigi-2023-tokens/">PHPer ãã£ã¬ã³ãžè§£èª¬ã»ãã·ã§ã³</a> ãšãã圢ã§è§£èª¬ã®æ©äŒãé ããã®ã ãããã£ããæéããããŠäœé¡ããã®ã§èšäºã®åœ¢ã§ãæ®ããŠããããšæãã </p> - <p> - ãã®èšäºã§ã¯ãå
š5åããäžã®ç¬¬1åã«ã€ããŠè§£èª¬ãããä»ã®åé¡ã«ã€ããŠã¯ä»¥äžã®ãªã³ã¯ãåç
§ã®ããšã + ãã®èšäºã§ã¯ãå
š5åããäžã®ç¬¬1åã«ã€ããŠè§£èª¬ãããä»ã®åé¡ã«ã€ããŠã¯ä»¥äžã®ãªã³ã¯ãåç
§ã®ããšã </p> - <ol> <li> <a href="/posts/2025-01-08/phperkaigi-2023-tokens-q1/">第1å (ãã®èšäº)</a> </li> - <li> 第2å (TODO: å·çäž) </li> - <li> 第3å (TODO: å·çäž) </li> - <li> 第4å (TODO: å·çäž) </li> - <li> 第5å (TODO: å·çäž) </li> </ol> - <p> - ããããã®åé¡ã¯ãã¡ãã® GitHub ãªããžã㪠(<a href="https://github.com/nsfisis/PHPerKaigi2023-tokens" rel="noreferrer" target="_blank">nsfisis/PHPerKaigi2023-tokens</a>) ãããé²èЧã§ããã + ããããã®åé¡ã¯ãã¡ãã® GitHub ãªããžã㪠( <a href="https://github.com/nsfisis/PHPerKaigi2023-tokens" rel="noreferrer" target="_blank">nsfisis/PHPerKaigi2023-tokens</a> ) ãããé²èЧã§ããã </p> </section> - <section id="section--quiz"> - <h2><a href="#section--quiz">Q1: An Art of Computer Programming</a></h2> + <h2><a href="#section--quiz">Q1: An Art of Computer Programming</a></h2> <p> - 第1åãAn Art of Computer Programmingãã¯ãã¡ãã + 第1åãAn Art of Computer Programmingãã¯ãã¡ãã + </p> + <p> + <img alt="å
šäœãQRã³ãŒãã«ãªã£ãŠãããäžå€®ã«ã¯å°ããªæåã§ãPassword is one of the PHPer tokens.ããšæžãããŠãã" src="/posts/2025-01-08/phperkaigi-2023-tokens-q1/Q1.png"> + </img> </p> - - <img alt="å
šäœãQRã³ãŒãã«ãªã£ãŠãããäžå€®ã«ã¯å°ããªæåã§ãPassword is one of the PHPer tokens.ããšæžãããŠãã" src="/posts/2025-01-08/phperkaigi-2023-tokens-q1/Q1.png"> - </img> </section> - <section id="section--how-to-solve"> - <h2><a href="#section--how-to-solve">è§£ãæ¹</a></h2> + <h2><a href="#section--how-to-solve">è§£ãæ¹</a></h2> <p> - ãŸãã¯ããŒã¯ã³ãåŸãæ¹æ³ã解説æãã§èª¬æãããæ¬¡ã®ããã«å®è¡ããã + ãŸãã¯ããŒã¯ã³ãåŸãæ¹æ³ã解説æãã§èª¬æãããæ¬¡ã®ããã«å®è¡ããã </p> - <div class="codeblock"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>$ echo "#iwillblog" | php Q1.png >/dev/null</span></span></code></pre> </div> - <p> - ç¡äºã«å®è¡ã§ããŠããã°ã#ModernPHPisStaticallyTypedLanguageããšããããŒã¯ã³ãåŸãããã + ç¡äºã«å®è¡ã§ããŠããã°ã#ModernPHPisStaticallyTypedLanguageããšããããŒã¯ã³ãåŸãããã </p> </section> - <section id="section--commentary"> - <h2><a href="#section--commentary">解説</a></h2> + <h2><a href="#section--commentary">解説</a></h2> <section id="section--commentary--read-as-image"> - <h3><a href="#section--commentary--read-as-image">ç»åãšããŠè§£éãã</a></h3> + <h3><a href="#section--commentary--read-as-image">ç»åãšããŠè§£éãã</a></h3> <p> - ãŸãã¯çŽ çŽã«ç»åãšããŠèŠãŠã¿ãããå
šäœã¯ QR ã³ãŒãã«ãªã£ãŠãããé©åœãª QR ã³ãŒããªãŒãã§èªã¿èŸŒããšã次ã®ãããªããã¹ãã衚瀺ãããã¯ãã ã + ãŸãã¯çŽ çŽã«ç»åãšããŠèŠãŠã¿ããã å
šäœã¯ QR ã³ãŒãã«ãªã£ãŠãããé©åœãª QR ã³ãŒããªãŒãã§èªã¿èŸŒããšã次ã®ãããªããã¹ãã衚瀺ãããã¯ãã ã </p> - <div class="codeblock"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>Guess password. $ echo "password" | php Q1.png >/dev/null</span></span></code></pre> </div> - <p> - ã¡ãã»ãŒãžã¯ããã®ç»åã®å®è¡æ¹æ³ãšãã®åé¡ã§ããã¹ãããš (ãã¹ã¯ãŒãã®æšæž¬) ã瀺ããŠããã + ã¡ãã»ãŒãžã¯ããã®ç»åã®å®è¡æ¹æ³ãšãã®åé¡ã§ããã¹ãããš (ãã¹ã¯ãŒãã®æšæž¬) ã瀺ããŠããã </p> - <p> - 次㫠QR ã³ãŒãã®äžå€®éšã«ç®ãåãããšãå°ããªæåã§ãPassword is one of the PHPer tokens.ããšæžãããŠããã®ãããããä»ã® PHPer ããŒã¯ã³ã®äžããé©åãª1ã€ãèŠã€ãã ããããã¹ã¯ãŒãããšããŠæž¡ãããšã§çããšãªã PHPer ããŒã¯ã³ãåŸããããšããããã ã + 次㫠QR ã³ãŒãã®äžå€®éšã«ç®ãåãããšãå°ããªæåã§ãPassword is one of the PHPer tokens.ããšæžãããŠããã®ããããã ä»ã® PHPer ããŒã¯ã³ã®äžããé©åãª1ã€ãèŠã€ãã ããããã¹ã¯ãŒãããšããŠæž¡ãããšã§çããšãªã PHPer ããŒã¯ã³ãåŸããããšããããã ã </p> </section> - <section id="section--commentary--password"> - <h3><a href="#section--commentary--password">ãã¹ã¯ãŒã</a></h3> + <h3><a href="#section--commentary--password">ãã¹ã¯ãŒã</a></h3> <p> - äžæ£ãªãã¹ã¯ãŒãã䜿ã£ãŠå®è¡ããŠã¿ããšã次ã®ãããªãšã©ãŒã¡ãã»ãŒãžã衚瀺ãããã + äžæ£ãªãã¹ã¯ãŒãã䜿ã£ãŠå®è¡ããŠã¿ããšã次ã®ãããªãšã©ãŒã¡ãã»ãŒãžã衚瀺ãããã </p> - <div class="codeblock"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>$ echo "foo" | php Q1.png >/dev/null</span></span> <span class="line"><span>401 Unauthorized</span></span></code></pre> </div> - <p> - ãã§ã«<a href="#section--how-to-solve">ãè§£ãæ¹ãã®ç¯</a>ã§ç€ºããããã«ããã¹ã¯ãŒãã§ãã PHPer ããŒã¯ã³ã¯ã#iwillblogãã§ããããããäžããŠå®è¡ãããšæ£è§£ã®ããŒã¯ã³ãåŸãããã + ãã§ã« <a href="#section--how-to-solve">ãè§£ãæ¹ãã®ç¯</a> ã§ç€ºããããã«ããã¹ã¯ãŒãã§ãã PHPer ããŒã¯ã³ã¯ã#iwillblogãã§ããããããäžããŠå®è¡ãããšæ£è§£ã®ããŒã¯ã³ãåŸãããã </p> - <p> - ãã®ãã¹ã¯ãŒãã®éžæã«ã¯ãšããäºæ
ããããä»åã®åé¡ã®äœåã¯ååã®éå¬ (PHPerKaigi 2022) çŽåŸããã¹ã¿ãŒãããŠããããã®æç¹ã§ã¯ PHPerKaigi 2023 ã§ç»é²ããã PHPer ããŒã¯ã³ã«ã©ã®ãããªãã®ããããã¯ãŸã£ããããããªãç¶æ
ã§ãã£ããäœåäœæ¥ãæ©æã«çµããããã«ã¯ã次åéå¬ã§ã確å®ã«äœ¿ãããã§ãããå®çªã®ããŒã¯ã³ãäºæž¬ããŠéžã¶å¿
èŠããã£ãã®ã ãããããŠãç§ãç¥ãéãæ¯åç»å ŽããŠããããŒã¯ã³ã§ããã#iwillblogãã«çœçŸœã®ç¢ãç«ãŠãããã + ãã®ãã¹ã¯ãŒãã®éžæã«ã¯ãšããäºæ
ãããã ä»åã®åé¡ã®äœåã¯ååã®éå¬ (PHPerKaigi 2022) çŽåŸããã¹ã¿ãŒãããŠããããã®æç¹ã§ã¯ PHPerKaigi 2023 ã§ç»é²ããã PHPer ããŒã¯ã³ã«ã©ã®ãããªãã®ããããã¯ãŸã£ããããããªãç¶æ
ã§ãã£ãã äœåäœæ¥ãæ©æã«çµããããã«ã¯ã次åéå¬ã§ã確å®ã«äœ¿ãããã§ãããå®çªã®ããŒã¯ã³ãäºæž¬ããŠéžã¶å¿
èŠããã£ãã®ã ã ããããŠãç§ãç¥ãéãæ¯åç»å ŽããŠããããŒã¯ã³ã§ããã#iwillblogãã«çœçŸœã®ç¢ãç«ãŠãããã </p> - <p> - ãªããè§£ããŠãã ãã£ãæ¹ã®äžã«ã¯ãå
é ã®ã#ããå
¥åããã«äœåºŠã詊ããŠããŸãçããåŸãããããŸãã«ãªã£ãæ¹ãããã£ãããããã ã£ããåé¡ã眮ããŠãããªããžããªã«ãã³ããšããŠãã¹ã¯ãŒãã®ããŒã¯ã³ããiãã§å§ãŸããšæžããŠããã®ã ãããããæå³ãããã¹ãªãŒãã«ãªã£ãŠããŸã£ããããã¯ç§ã®ãã¹ã§ããã + ãªããè§£ããŠãã ãã£ãæ¹ã®äžã«ã¯ãå
é ã®ã#ããå
¥åããã«äœåºŠã詊ããŠããŸãçããåŸãããããŸãã«ãªã£ãæ¹ãããã£ãããããã ã£ãã åé¡ã眮ããŠãããªããžããªã«ãã³ããšããŠãã¹ã¯ãŒãã®ããŒã¯ã³ããiãã§å§ãŸããšæžããŠããã®ã ãããããæå³ãããã¹ãªãŒãã«ãªã£ãŠããŸã£ãã ããã¯ç§ã®ãã¹ã§ããã </p> </section> - <section id="section--commentary--png-steganography"> - <h3><a href="#section--commentary--png-steganography">PNG ã¹ãã¬ãã°ã©ãã£</a></h3> + <h3><a href="#section--commentary--png-steganography">PNG ã¹ãã¬ãã°ã©ãã£</a></h3> <p> - QR ã³ãŒããèšã£ãŠããããã«ããã®ãã¡ã€ã«ã¯ PNG ç»åã§ããã«ãããããã PHP ã§å®è¡ããããšãã§ããããªããã®ãããªããšãå¯èœãªã®ãã + QR ã³ãŒããèšã£ãŠããããã«ããã®ãã¡ã€ã«ã¯ PNG ç»åã§ããã«ãããããã PHP ã§å®è¡ããããšãã§ããããªããã®ãããªããšãå¯èœãªã®ãã </p> - <p> - PNG ç»åã®ãã©ãŒãããã¯ã次ã®ããã«ãªã£ãŠããã + PNG ç»åã®ãã©ãŒãããã¯ã次ã®ããã«ãªã£ãŠããã </p> - <ol> <li> ããžãã¯ãã³ããŒãªã© </li> - <li> PNG ããã (<code>IHDR</code> ãã£ã³ã¯) </li> - <li> å®éã®ç»åããŒã¿ (<code>IDAT</code> ãã£ã³ã¯) </li> - <li> PNG ããã¿ (<code>IEND</code> ãã£ã³ã¯) </li> </ol> - <p> - PNG ããã¿ã®åŸãã«ããããŒã¿ã¯ãç»åãã¥ãŒã¢ã«ã¯è§£éããããç»åã®è¡šç€ºã«ã¯åœ±é¿ãäžããªãããããã£ãŠãPNG ããã¿ã®åŸãã«ã¯ä»»æã®ããŒã¿ãåã蟌ãããšãã§ããã + PNG ããã¿ã®åŸãã«ããããŒã¿ã¯ãç»åãã¥ãŒã¢ã«ã¯è§£éããããç»åã®è¡šç€ºã«ã¯åœ±é¿ãäžããªãããããã£ãŠãPNG ããã¿ã®åŸãã«ã¯ä»»æã®ããŒã¿ãåã蟌ãããšãã§ããã </p> - <p> - ããŠãPHP ã«ã¯ãPHP ããã°ã©ã ã®å§ãŸãã瀺ãããã® PHP ã¿ã° (<code><?php</code> ãŸã㯠<code><?</code>) ããããCLI ã§å®è¡ããå ŽåãPHP ã¿ã°ãããåã«ããããŒã¿ã¯æšæºåºåãžãã®ãŸãŸåºåãããã + ããŠãPHP ã«ã¯ãPHP ããã°ã©ã ã®å§ãŸãã瀺ãããã® PHP ã¿ã° (<code><?php</code> ãŸã㯠<code><?</code>) ãããã CLI ã§å®è¡ããå ŽåãPHP ã¿ã°ãããåã«ããããŒã¿ã¯æšæºåºåãžãã®ãŸãŸåºåãããã </p> - <p> - ãã®ç»åãã¡ã€ã«ã¯æ¬¡ã®ãããªæ§é ã«ãªã£ãŠããã + ãã®ç»åãã¡ã€ã«ã¯æ¬¡ã®ãããªæ§é ã«ãªã£ãŠããã </p> - <ol> <li> ããžãã¯ãã³ããŒãªã© </li> - <li> PNG ããã (<code>IHDR</code> ãã£ã³ã¯) </li> - <li> å®éã®ç»åããŒã¿ (<code>IDAT</code> ãã£ã³ã¯) </li> - <li> PNG ããã¿ (<code>IEND</code> ãã£ã³ã¯) </li> - <li> <strong>PHP ã¿ã° (<code><?php</code>)</strong> </li> - <li> <strong>éåžžã® PHP ãœãŒã¹ã³ãŒã</strong> </li> </ol> - <p> - PNG ãã¡ã€ã«ãšããŠèªããšã㯠PNG ããã¿ä»¥éã¯ç¡èŠãããPHP ã¹ã¯ãªãããšããŠèªããšã㯠PHP ã¿ã°ä»¥åãç¡èŠããããšãã仿ãã§ããã + PNG ãã¡ã€ã«ãšããŠèªããšã㯠PNG ããã¿ä»¥éã¯ç¡èŠãããPHP ã¹ã¯ãªãããšããŠèªããšã㯠PHP ã¿ã°ä»¥åãç¡èŠããããšãã仿ãã§ããã </p> - <p> <code>strings</code> ã³ãã³ãã䜿ããšãé ãããããŒã¿ãç°¡åã«é²èЧã§ããã </p> - <div class="codeblock"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>IHDR</span></span> <span class="line"><span>-HHc</span></span> @@ -276,30 +239,24 @@ <span class="line"><span>$h = $b[24]+2;</span></span> <span class="line"><span>// (以äžç¥)</span></span></code></pre> </div> - <p> - <code>IHDR</code> ã <code>IEND</code> ã PNG ç»åã®äžéšã§ã<code><?php</code> ãããå®éã®ããã°ã©ã ã«ãªã£ãŠããããã¡ããããã PHP ããã°ã©ã ãšããŠåãããšãPHP ã¿ã°ããåã«ãã PNG ç»åãšããŠã®ããŒã¿ã¯ãã®ãŸãŸæšæºåºåãžãšåºåãããŠããŸãããããé²ããããQR ã³ãŒããèªã¿èŸŒãã ãšãã®å®è¡æ¹æ³ + <code>IHDR</code> ã <code>IEND</code> ã PNG ç»åã®äžéšã§ã<code><?php</code> ãããå®éã®ããã°ã©ã ã«ãªã£ãŠããã ãã¡ããããã PHP ããã°ã©ã ãšããŠåãããšãPHP ã¿ã°ããåã«ãã PNG ç»åãšããŠã®ããŒã¿ã¯ãã®ãŸãŸæšæºåºåãžãšåºåãããŠããŸãã ãããé²ããããQR ã³ãŒããèªã¿èŸŒãã ãšãã®å®è¡æ¹æ³ </p> - <div class="codeblock"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>Guess password. $ echo "password" | php Q1.png >/dev/null</span></span></code></pre> </div> - <p> - ã«ã¯æšæºåºåãæšãŠããã <code>>/dev/null</code> ãšæå®ãããŠããã + ã«ã¯æšæºåºåãæšãŠããã <code>>/dev/null</code> ãšæå®ãããŠããã </p> - <p> - ãªãããã®ããã« PNG ç»åãªã©ã«æ¬æ¥ã®ããŒã¿ãšã¯ç°ãªãå¥ã®ããŒã¿ãé ãããšããã¹ãã¬ãã°ã©ãã£ã(<a href="https://ja.wikipedia.org/wiki/%E3%82%B9%E3%83%86%E3%82%AC%E3%83%8E%E3%82%B0%E3%83%A9%E3%83%95%E3%82%A3%E3%83%BC" rel="noreferrer" target="_blank">Wikipediaãã¹ãã¬ãã°ã©ãã£ãŒã</a>) ãšåŒã¶ã + ãªãããã®ããã« PNG ç»åãªã©ã«æ¬æ¥ã®ããŒã¿ãšã¯ç°ãªãå¥ã®ããŒã¿ãé ãããšããã¹ãã¬ãã°ã©ãã£ã( <a href="https://ja.wikipedia.org/wiki/%E3%82%B9%E3%83%86%E3%82%AC%E3%83%8E%E3%82%B0%E3%83%A9%E3%83%95%E3%82%A3%E3%83%BC" rel="noreferrer" target="_blank">Wikipediaãã¹ãã¬ãã°ã©ãã£ãŒã</a> ) ãšåŒã¶ã </p> </section> - <section id="section--commentary--php-program"> - <h3><a href="#section--commentary--php-program">å®è¡ããã PHP ããã°ã©ã </a></h3> + <h3><a href="#section--commentary--php-program">å®è¡ããã PHP ããã°ã©ã </a></h3> <p> - ç»åã®æ£äœãããã£ããšããã§ãç»åã«é ãããŠãã PHP ããã°ã©ã ã«ã€ããŠèŠãŠããããå
ã»ã©ã¯äžéšããèšèŒããªãã£ãã®ã§ãå
šäœãèŒããããªããããçšåºŠãŽã«ãããªããæžããã®ã§ã空çœããæ®ããŠãããã®ã®å¯èªæ§ã¯éåžžã«äœãããšãšæãã + ç»åã®æ£äœãããã£ããšããã§ãç»åã«é ãããŠãã PHP ããã°ã©ã ã«ã€ããŠèŠãŠãããã å
ã»ã©ã¯äžéšããèšèŒããªãã£ãã®ã§ãå
šäœãèŒããã ãªããããçšåºŠãŽã«ãããªããæžããã®ã§ã空çœããæ®ããŠãããã®ã®å¯èªæ§ã¯éåžžã«äœãããšãšæãã </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#D73A49"><?</span><span style="color:#005CC5">php</span></span> <span class="line"><span style="color:#005CC5">error_reporting</span><span style="color:#24292E">(</span><span style="color:#D73A49">-</span><span style="color:#005CC5">1</span><span style="color:#24292E">);</span></span> @@ -403,64 +360,62 @@ <span class="line"><span style="color:#6A737D">// Piet any longer at that time.</span></span> <span class="line"><span style="color:#005CC5">fwrite</span><span style="color:#24292E">(</span><span style="color:#005CC5">STDERR</span><span style="color:#24292E">, </span><span style="color:#005CC5">str_replace</span><span style="color:#24292E">(</span><span style="color:#032F62">'403 Forbidden'</span><span style="color:#24292E">, </span><span style="color:#032F62">'401 Unauthorized'</span><span style="color:#24292E">, $o));</span></span></code></pre> </div> - <p> - ããã¯äžäœãªããªã®ãããã°ããé£è§£ããã°ã©ãã³ã°èšèªã®äžã€ Piet ã®ã€ã³ã¿ããªã¿ã§ãããPiet ã¯ããšãã»ã¢ã³ããªã¢ã³ (ãèµ€ã»éã»é»ã®ã³ã³ããžã·ã§ã³ããªã©ã§ç¥ãããæœè±¡ç»å®¶) ã®äœåã«ã€ã³ã¹ãã¬ãŒã·ã§ã³ãåããŠäœããããç»åããœãŒã¹ã³ãŒããšããããã°ã©ãã³ã°èšèªã§ãããã€ã³ã¿ããªã¿ã¯ç»åã®åãã¯ã»ã«ã®äžãé²ã¿ãªãããè²çã«å¿ããŠç¹å®ã®åŠçããããªã£ãŠãããããã§ã¯è©³ããèšèªä»æ§ã«ã€ããŠã¯è§£èª¬ããªãã®ã§ãæ°ã«ãªãæ¹ã¯ <a href="https://ja.wikipedia.org/wiki/Piet" rel="noreferrer" target="_blank">Wikipedia ã®èšäºãPietã</a> ãªã©ãåç
§ããŠã»ããã + ããã¯äžäœãªããªã®ãããã°ããé£è§£ããã°ã©ãã³ã°èšèªã®äžã€ Piet ã®ã€ã³ã¿ããªã¿ã§ããã Piet ã¯ããšãã»ã¢ã³ããªã¢ã³ (ãèµ€ã»éã»é»ã®ã³ã³ããžã·ã§ã³ããªã©ã§ç¥ãããæœè±¡ç»å®¶) ã®äœåã«ã€ã³ã¹ãã¬ãŒã·ã§ã³ãåããŠäœããããç»åããœãŒã¹ã³ãŒããšããããã°ã©ãã³ã°èšèªã§ããã ã€ã³ã¿ããªã¿ã¯ç»åã®åãã¯ã»ã«ã®äžãé²ã¿ãªãããè²çã«å¿ããŠç¹å®ã®åŠçããããªã£ãŠããã ããã§ã¯è©³ããèšèªä»æ§ã«ã€ããŠã¯è§£èª¬ããªãã®ã§ãæ°ã«ãªãæ¹ã¯ <a href="https://ja.wikipedia.org/wiki/Piet" rel="noreferrer" target="_blank">Wikipedia ã®èšäºãPietã</a> ãªã©ãåç
§ããŠã»ããã </p> - <p> - ããã°ã©ã ã®åé ã«ãããã®ç®æ + ããã°ã©ã ã®åé ã«ãããã®ç®æ </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#24292E">$b </span><span style="color:#D73A49">=</span><span style="color:#005CC5"> unpack</span><span style="color:#24292E">(</span><span style="color:#032F62">'C*'</span><span style="color:#24292E">, </span><span style="color:#005CC5">file_get_contents</span><span style="color:#24292E">(</span><span style="color:#005CC5">__FILE__</span><span style="color:#24292E">));</span></span></code></pre> </div> - <p> - ã§ <code>__FILE__</code> ã€ãŸããã®ç»åãã¡ã€ã«ãèªã¿èŸŒãã§ãããå
ã»ã© Piet ã¯ç»åããœãŒã¹ã³ãŒãã«ããŠãããšèª¬æããããããä»åã®åé¡ã®ç»åãã¡ã€ã« <code>Q1.png</code> ã¯ãPHP 補 Piet ã€ã³ã¿ããªã¿ã§ãããšåæã«ãPiet ã®ãœãŒã¹ã³ãŒãç»åã§ãããã®ã ãQR ã³ãŒãäžå€®ã®ã«ã©ãã«ãªéšåã Piet ã®åœä»€ã«ãªã£ãŠããã + ã§ <code>__FILE__</code> ã€ãŸããã®ç»åãã¡ã€ã«ãèªã¿èŸŒãã§ããã å
ã»ã© Piet ã¯ç»åããœãŒã¹ã³ãŒãã«ããŠãããšèª¬æããã ãããä»åã®åé¡ã®ç»åãã¡ã€ã« <code>Q1.png</code> ã¯ãPHP 補 Piet ã€ã³ã¿ããªã¿ã§ãããšåæã«ãPiet ã®ãœãŒã¹ã³ãŒãç»åã§ãããã®ã ã QR ã³ãŒãäžå€®ã®ã«ã©ãã«ãªéšåã Piet ã®åœä»€ã«ãªã£ãŠããã </p> </section> - <section id="section--commentary--piet-source-code"> - <h3><a href="#section--commentary--piet-source-code">Piet ã®ãœãŒã¹ã³ãŒã</a></h3> + <h3><a href="#section--commentary--piet-source-code">Piet ã®ãœãŒã¹ã³ãŒã</a></h3> <p> - ããŠãPiet ã§ã©ã®ãããªã³ãŒããæžãã㊠(ãããæãããŠ) ããã®ãã解説ããããšããã ããä»ã®ç§ã«ã¯ã§ãããã«ãªãããšããã®ãããã§ã«è¿°ã¹ãããã« Piet ã¯ãé£è§£ããã°ã©ãã³ã°èšèªãã§ãããããã人ãæãããèªãã ãããããã«ã¯äœãããŠããªããæ§è³ªãšããŠã¯ãããºã«ã«è¿ã代ç©ã§ããã + ããŠãPiet ã§ã©ã®ãããªã³ãŒããæžãã㊠(ãããæãããŠ) ããã®ãã解説ããããšããã ããä»ã®ç§ã«ã¯ã§ãããã«ãªãã ãšããã®ãããã§ã«è¿°ã¹ãããã« Piet ã¯ãé£è§£ããã°ã©ãã³ã°èšèªãã§ããã ããã人ãæãããèªãã ãããããã«ã¯äœãããŠããªããæ§è³ªãšããŠã¯ãããºã«ã«è¿ã代ç©ã§ããã </p> - <p> - ãšããããã§ãããã§ã¯ãããŸãã説æããã ãã§ã容赊ããã ããããããããã®éšåã¯ããããæ¬¡ã®ãããªããšããã£ãŠãã (åæ€èšŒã»åèªè§£ã¯ããŠããªãã®ã§å€§åãããããªã)ã + ãšããããã§ãããã§ã¯ãããŸãã説æããã ãã§ã容赊ããã ãããã ããããã®éšåã¯ããããæ¬¡ã®ãããªããšããã£ãŠãã (åæ€èšŒã»åèªè§£ã¯ããŠããªãã®ã§å€§åãããããªã)ã </p> - <ul> <li> - å·Šäž: å
¥ååãä»ã + <p> + å·Šäž: å
¥ååãä»ã + </p> <ul> <li> æšæºå
¥åãã1æåãã€èªã¿èŸŒã¿ãå
¥åããªããªããŸã§ã¹ã¿ãã¯ã«ç©ããå€åã </li> </ul> </li> - <li> - äžèŸºãå³èŸº: ãã¹ã¯ãŒãã®æ€èšŒ + <p> + äžèŸºãå³èŸº: ãã¹ã¯ãŒãã®æ€èšŒ + </p> <ul> <li> å
¥åããã¹ã¯ãŒããšäžèŽããã (= <code>#iwillblog</code> ãã©ãã) ã調ã¹ããå€åã </li> </ul> </li> - <li> - äžèŸºã巊蟺ãäžèŸºã®3åç®ãå³èŸºã®3åç®ãäžèŸºã®2åç®: ããŒã¯ã³ã®åºå + <p> + äžèŸºã巊蟺ãäžèŸºã®3åç®ãå³èŸºã®3åç®ãäžèŸºã®2åç®: ããŒã¯ã³ã®åºå + </p> <ul> <li> ãã¹ã¯ãŒããšäžèŽããŠããã°ããã«é£ãã§ãããæ£è§£ã®ããŒã¯ã³ãåºåãããå€åã </li> </ul> </li> - <li> - å³èŸºã®2åç®ãäžèŸºã®2åç®: äžæ£è§£ã®ã¡ãã»ãŒãžåºå + <p> + å³èŸºã®2åç®ãäžèŸºã®2åç®: äžæ£è§£ã®ã¡ãã»ãŒãžåºå + </p> <ul> <li> ãã¹ã¯ãŒããšäžèŽããŠããªããã°ããã«é£ãã§ãããäžæ£è§£ã®ãšãã®ã¡ãã»ãŒãžãåºåãããå€åã @@ -468,11 +423,9 @@ </ul> </li> </ul> - <p> - ãšããã§ãå
ã»ã©æ²èŒãã Piet ã®ã€ã³ã¿ããªã¿ã®ãœãŒã¹ã³ãŒãæ«å°Ÿã«ã¯æ¬¡ã®ãããªç®æãããã + ãšããã§ãå
ã»ã©æ²èŒãã Piet ã®ã€ã³ã¿ããªã¿ã®ãœãŒã¹ã³ãŒãæ«å°Ÿã«ã¯æ¬¡ã®ãããªç®æãããã </p> - <div class="codeblock" language="php"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#6A737D">// The original Piet image is wrong: it outputs 403 error for invalid passwords.</span></span> <span class="line"><span style="color:#6A737D">// Failure of authentication should be notified by 401, not 403.</span></span> @@ -480,47 +433,38 @@ <span class="line"><span style="color:#6A737D">// Piet any longer at that time.</span></span> <span class="line"><span style="color:#005CC5">fwrite</span><span style="color:#24292E">(</span><span style="color:#005CC5">STDERR</span><span style="color:#24292E">, </span><span style="color:#005CC5">str_replace</span><span style="color:#24292E">(</span><span style="color:#032F62">'403 Forbidden'</span><span style="color:#24292E">, </span><span style="color:#032F62">'401 Unauthorized'</span><span style="color:#24292E">, $o));</span></span></code></pre> </div> - <p> - ã³ã¡ã³ãã«ãæžãããŠãããããã® Piet ã®ãœãŒã¹ã³ãŒãç»åã«ã¯èª€ãããã£ããæ¬æ¥ HTTP ã®ã¹ããŒã¿ã¹ã³ãŒããç䌌ãã®ãªããèªèšŒã®å€±æã«ã¯ 401 ãè¿ããªããã°ãªããªããããããPiet ã®ãœãŒã¹ã¯ 403 ãè¿ãããã«æžããŠããŸã£ãŠããããã®ããšã«ç§ãæ°ä»ããã®ã¯ PHPerKaigi 2023 ãéå¬ãããã²ãšæåã§ããã®æç¹ã§ç§ã¯ãã® Piet ã®ãœãŒã¹ã³ãŒãã (ã¡ããã©ãã®èšäºã§ãããªã£ãŠããã®ãšåãããã«) èªè§£ã§ããªããªã£ãŠãããããã«æªãããšã«ãæ£ããã¡ãã»ãŒãžã401 Unauthorizedãã¯å
ã®ã403 Forbiddenãããã3æåé·ãã3æååºåãé·ããªããšããããšã¯ãããã ã Piet ã§å¡ãã¹ããã¯ã»ã«ãå¢ããããšãæå³ããããã¯ã3æå远å ã§åºåããã ãã®äœçœã¯ãã®ç»åã«æ®ãããŠããªãã£ã (ãšæããè
ããã® Piet ããã°ã©ããªãã§ãããããããªãã®ã§ææŠããŠã¿ãŠã»ãã)ã + ã³ã¡ã³ãã«ãæžãããŠãããããã® Piet ã®ãœãŒã¹ã³ãŒãç»åã«ã¯èª€ãããã£ãã æ¬æ¥ HTTP ã®ã¹ããŒã¿ã¹ã³ãŒããç䌌ãã®ãªããèªèšŒã®å€±æã«ã¯ 401 ãè¿ããªããã°ãªããªãã ããããPiet ã®ãœãŒã¹ã¯ 403 ãè¿ãããã«æžããŠããŸã£ãŠããã ãã®ããšã«ç§ãæ°ä»ããã®ã¯ PHPerKaigi 2023 ãéå¬ãããã²ãšæåã§ããã®æç¹ã§ç§ã¯ãã® Piet ã®ãœãŒã¹ã³ãŒãã (ã¡ããã©ãã®èšäºã§ãããªã£ãŠããã®ãšåãããã«) èªè§£ã§ããªããªã£ãŠããã ããã«æªãããšã«ãæ£ããã¡ãã»ãŒãžã401 Unauthorizedãã¯å
ã®ã403 Forbiddenãããã3æåé·ãã 3æååºåãé·ããªããšããããšã¯ãããã ã Piet ã§å¡ãã¹ããã¯ã»ã«ãå¢ããããšãæå³ããã ãã¯ã3æå远å ã§åºåããã ãã®äœçœã¯ãã®ç»åã«æ®ãããŠããªãã£ã (ãšæããè
ããã® Piet ããã°ã©ããªãã§ãããããããªãã®ã§ææŠããŠã¿ãŠã»ãã)ã </p> - <p> - ããã解決ããããã«ç§ãéžãã ã®ã¯ãã€ã³ã¿ããªã¿ãæ¹é ããæ¬æ¥ã®ã¡ãã»ãŒãžãšã¯ç°ãªãã¡ãã»ãŒãžãç¡çããåºåãããŠåž³å°»ãåãããããšã ã£ããããããããã§ãã® Piet ã€ã³ã¿ããªã¿ã¯å®å
šãª Piet ã€ã³ã¿ããªã¿ã§ã¯ãªããã403 Forbiddenããšããããã¹ãã絶察ã«åºåã§ããªãã + ããã解決ããããã«ç§ãéžãã ã®ã¯ãã€ã³ã¿ããªã¿ãæ¹é ããæ¬æ¥ã®ã¡ãã»ãŒãžãšã¯ç°ãªãã¡ãã»ãŒãžãç¡çããåºåãããŠåž³å°»ãåãããããšã ã£ãã ããããããã§ãã® Piet ã€ã³ã¿ããªã¿ã¯å®å
šãª Piet ã€ã³ã¿ããªã¿ã§ã¯ãªããã403 Forbiddenããšããããã¹ãã絶察ã«åºåã§ããªãã </p> </section> - <section id="section--commentary--misc"> - <h3><a href="#section--commentary--misc">ãã®ä»å°ãã¿</a></h3> + <h3><a href="#section--commentary--misc">ãã®ä»å°ãã¿</a></h3> <p> - ãããŸã§ã§åé¡ã®æ žå¿éšåã¯èª¬æãçµããã®ã§ãããããã¯æ®ã£ãå°ãã¿ã玹ä»ããŠããã + ãããŸã§ã§åé¡ã®æ žå¿éšåã¯èª¬æãçµããã®ã§ãããããã¯æ®ã£ãå°ãã¿ã玹ä»ããŠããã </p> - <p> - ãã®åé¡ã®ã¿ã€ãã«ãAn Art of Computer Programmingãã¯ãããã«ãã»ã¯ããŒã¹ã®ãThe Art of Computer Programmingãããããã£ãããã®ã§ããã + ãã®åé¡ã®ã¿ã€ãã«ãAn Art of Computer Programmingãã¯ãããã«ãã»ã¯ããŒã¹ã®ãThe Art of Computer Programmingãããããã£ãããã®ã§ããã </p> - <p> - ãã®åé¡ã§åŸãããããŒã¯ã³ã#ModernPHPisStaticallyTypedLanguageãã¯ç¹ã«å
ãã¿ãããããã§ã¯ãªããåœç¶ã®ãããªé¡ã§åã䞻匵ãããã£ãã®ã§ãããªã£ãã + ãã®åé¡ã§åŸãããããŒã¯ã³ã#ModernPHPisStaticallyTypedLanguageãã¯ç¹ã«å
ãã¿ãããããã§ã¯ãªããåœç¶ã®ãããªé¡ã§åã䞻匵ãããã£ãã®ã§ãããªã£ãã </p> </section> </section> - <section id="section--outro"> - <h2><a href="#section--outro">ãããã«</a></h2> + <h2><a href="#section--outro">ãããã«</a></h2> <p> - ãã®åé¡ã®èªå·±è©äŸ¡ã¯ãã¡ããåé¡ã®åºé¡é ã¯ããããäœæããé ã«ãªã£ãŠããã®ã ãããã®ããã§é£æåºŠé«ãã®åé¡ã1åç®ã«é
眮ãããŠããŸã£ããããã¯åçç¹ã®äžã€ã§ããã + ãã®åé¡ã®èªå·±è©äŸ¡ã¯ãã¡ãã åé¡ã®åºé¡é ã¯ããããäœæããé ã«ãªã£ãŠããã®ã ãããã®ããã§é£æåºŠé«ãã®åé¡ã1åç®ã«é
眮ãããŠããŸã£ãã ããã¯åçç¹ã®äžã€ã§ããã </p> - <ul> <li> é£ãã: â
â
â
â
</li> - <li> ãæ°ã«å
¥ã床: â
â
</li> - <li> é®®ããã: â
â
â
â
â
â
â
</li> diff --git a/vhosts/blog/public/posts/2025-01-26/yaml-breaking-changes-between-v1-1-and-v1-2/index.html b/vhosts/blog/public/posts/2025-01-26/yaml-breaking-changes-between-v1-1-and-v1-2/index.html index 87efea12..37cb8206 100644 --- a/vhosts/blog/public/posts/2025-01-26/yaml-breaking-changes-between-v1-1-and-v1-2/index.html +++ b/vhosts/blog/public/posts/2025-01-26/yaml-breaking-changes-between-v1-1-and-v1-2/index.html @@ -65,43 +65,39 @@ NOTE </div> <div class="admonition-content"> - ãã®èšäºã¯ã2021-06-30 ã«<a href="https://www.dgcircus.com/" rel="noreferrer" target="_blank">ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ</a> ã®ç€Ÿå
Qiita Team ã«å
¬éãããèšäºãããŒã¹ã«ãå çä¿®æ£ããŠäžè¬å
¬éãããã®ã§ãã + <p> + ãã®èšäºã¯ã2021-06-30 ã« <a href="https://www.dgcircus.com/" rel="noreferrer" target="_blank">ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ</a> ã®ç€Ÿå
Qiita Team ã«å
¬éãããèšäºãããŒã¹ã«ãå çä¿®æ£ããŠäžè¬å
¬éãããã®ã§ãã + </p> </div> </div> - <section id="section--intro"> - <h2><a href="#section--intro">ã¯ããã«</a></h2> + <h2><a href="#section--intro">ã¯ããã«</a></h2> <p> - ããŒã¿èšè¿°èšèªã®äžã€ YAML ã«ã¯ 1.0ã1.1ã1.2 ã®ããŒãžã§ã³ãããããããã®ãã¡ã1.1 ãš 1.2 ã®éã«ã¯ç¡èŠã§ããªãéäºæã®å€æŽãå€ãã1.2 ã«å¯Ÿå¿ããŠããªãã©ã€ãã©ãªããã (Ruby 忢±ã® <code>yaml</code> ãªã©)ããã®èšäºã§ã¯ãYAML 1.1 ãš YAML 1.2 ã®äž»ãªç Žå£ç倿Žã玹ä»ãã (圱é¿ç¯å²ãåºããã®ãæç²ããŠããããã¹ãŠã®éäºæãç¶²çŸ
ããŠã¯ããªã)ã + ããŒã¿èšè¿°èšèªã®äžã€ YAML ã«ã¯ 1.0ã1.1ã1.2 ã®ããŒãžã§ã³ãããã ãããã®ãã¡ã1.1 ãš 1.2 ã®éã«ã¯ç¡èŠã§ããªãéäºæã®å€æŽãå€ãã1.2 ã«å¯Ÿå¿ããŠããªãã©ã€ãã©ãªããã (Ruby 忢±ã® <code>yaml</code> ãªã©)ã ãã®èšäºã§ã¯ãYAML 1.1 ãš YAML 1.2 ã®äž»ãªç Žå£ç倿Žã玹ä»ãã (圱é¿ç¯å²ãåºããã®ãæç²ããŠããããã¹ãŠã®éäºæãç¶²çŸ
ããŠã¯ããªã)ã </p> - <p> - åç
§ãã仿§æžã¯ãã¡ã: <a href="https://yaml.org/spec/1.2.2/ext/changes/" rel="noreferrer" target="_blank">https://yaml.org/spec/1.2.2/ext/changes/</a> + åç
§ãã仿§æžã¯ãã¡ã: <a href="https://yaml.org/spec/1.2.2/ext/changes/" rel="noreferrer" target="_blank">https://yaml.org/spec/1.2.2/ext/changes/</a> </p> </section> - <section id="section--breaking-changes"> - <h2><a href="#section--breaking-changes">äž»ãªç Žå£ç倿Ž</a></h2> + <h2><a href="#section--breaking-changes">äž»ãªç Žå£ç倿Ž</a></h2> <section id="section--breaking-changes--boolean-literals"> - <h3><a href="#section--breaking-changes--boolean-literals">Boolean ãšããŠããŒã¹ãããããŒã¯ã³ã <code>true</code> / <code>false</code> ãšãã®äºçš®ã®ã¿ã«</a></h3> + <h3><a href="#section--breaking-changes--boolean-literals">Boolean ãšããŠããŒã¹ãããããŒã¯ã³ã <code>true</code> / <code>false</code> ãšãã®äºçš®ã®ã¿ã«</a></h3> <p> - ãã®å€æŽã®åœ±é¿ãæã倧ãããšæããããYAML 1.1 ã§ã¯ãboolean å€ã®ãªãã©ã«ãšã㊠<code>true</code>ã<code>false</code> ã®ã»ã <code>yes</code>ã<code>no</code>ã<code>y</code>ã<code>n</code>ã<code>on</code>ã<code>off</code>ããããã®å€§æåããŒãžã§ã³ãªã©ãèªããããŠãããYAML 1.2 ã§ã¯ã<code>true</code> ãš <code>false</code>ããããã®å€§æåããŒãžã§ã³ (<code>True</code>ã<code>TRUE</code>ã<code>False</code>ã<code>FALSE</code>) ã®ã¿ã boolean ãšããŠããŒã¹ãããããã«ãªã£ãã + ãã®å€æŽã®åœ±é¿ãæã倧ãããšæãããã YAML 1.1 ã§ã¯ãboolean å€ã®ãªãã©ã«ãšã㊠<code>true</code>ã<code>false</code> ã®ã»ã <code>yes</code>ã<code>no</code>ã<code>y</code>ã<code>n</code>ã<code>on</code>ã<code>off</code>ããããã®å€§æåããŒãžã§ã³ãªã©ãèªããããŠããã YAML 1.2 ã§ã¯ã<code>true</code> ãš <code>false</code>ããããã®å€§æåããŒãžã§ã³ (<code>True</code>ã<code>TRUE</code>ã<code>False</code>ã<code>FALSE</code>) ã®ã¿ã boolean ãšããŠããŒã¹ãããããã«ãªã£ãã </p> </section> - <section id="section--breaking-changes--octal-literals"> - <h3><a href="#section--breaking-changes--octal-literals">å
«é²æ°ãªãã©ã«ã«ã¯ <code>0o</code> ãå¿
é ã«</a></h3> + <h3><a href="#section--breaking-changes--octal-literals">å
«é²æ°ãªãã©ã«ã«ã¯ <code>0o</code> ãå¿
é ã«</a></h3> <p> - C èšèªãªã©ã§ã¯ã<code>0</code> ããå§ãŸãæ°åã®åãå
«é²æ°ãšããŠããŒã¹ãããYAML 1.1 ãããã«æºããŠãããã1.2 ãã㯠<code>0o</code> ã®ãã¬ãã£ã¯ã¹ãå¿
é ãšãªã£ã ("o" 㯠"octal" ã® "o")ãããã°ã©ãã³ã°èšèªã§ã¯ãPython ã HaskellãSwiftãRust ãªã©ããã®èšæ³ãæ¡çšããŠããã + C èšèªãªã©ã§ã¯ã<code>0</code> ããå§ãŸãæ°åã®åãå
«é²æ°ãšããŠããŒã¹ããã YAML 1.1 ãããã«æºããŠãããã1.2 ãã㯠<code>0o</code> ã®ãã¬ãã£ã¯ã¹ãå¿
é ãšãªã£ã (âoâ 㯠âoctalâ ã® âoâ)ã ããã°ã©ãã³ã°èšèªã§ã¯ãPython ã HaskellãSwiftãRust ãªã©ããã®èšæ³ãæ¡çšããŠããã </p> </section> - <section id="section--breaking-changes--merging"> - <h3><a href="#section--breaking-changes--merging"><code><<</code> ã«ããããŒãžãäžå¯èœã«</a></h3> + <h3><a href="#section--breaking-changes--merging"><code><<</code> ã«ããããŒãžãäžå¯èœã«</a></h3> <p> - YAML 1.1 ã§ã¯ã<code><<</code> ãšããæååãããŒã«æå®ããããšã§ãããããããŒãžããããšãã§ããã + YAML 1.1 ã§ã¯ã<code><<</code> ãšããæååãããŒã«æå®ããããšã§ãããããããŒãžããããšãã§ããã </p> - <div class="codeblock" language="yaml"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span style="color:#22863A">x</span><span style="color:#24292E">: </span><span style="color:#D73A49">&</span><span style="color:#6F42C1">base</span></span> <span class="line"><span style="color:#22863A"> a</span><span style="color:#24292E">: </span><span style="color:#005CC5">123</span></span> @@ -112,24 +108,21 @@ <span class="line"><span style="color:#22863A"> b</span><span style="color:#24292E">: </span><span style="color:#005CC5">456</span></span> <span class="line"><span style="color:#6A737D"># => { "y": { "a": 123, "b": 456 } }</span></span></code></pre> </div> - <p> - 1.2 ããã¯ãããã§ããªããªãã + 1.2 ããã¯ãããã§ããªããªãã </p> </section> - <section id="section--breaking-changes--number-separator"> - <h3><a href="#section--breaking-changes--number-separator">æ°åã <code>_</code> ã§åºåãã®ãçŠæ¢ã«</a></h3> + <h3><a href="#section--breaking-changes--number-separator">æ°åã <code>_</code> ã§åºåãã®ãçŠæ¢ã«</a></h3> <p> <code>1234567</code> ã <code>1_234_567</code> ãšæžããªããªã£ãã </p> </section> </section> - <section id="section--outro"> - <h2><a href="#section--outro">ãããã«</a></h2> + <h2><a href="#section--outro">ãããã«</a></h2> <p> - å
šäœçã«ã<i>There's more than one way to do it.</i> ãã <i>There should be one - and preferably only one - obvious way to do it.</i> ãžç§»è¡ããŠããããã«æããããããŒã¿èšè¿°èšèªãšããŠã¯æãŸããæ¹åæ§ã§ã¯ãªãããšæããã + å
šäœçã«ã<em>Thereâs more than one way to do it.</em> ãã <em>There should be one - and preferably only one - obvious way to do it.</em> ãžç§»è¡ããŠããããã«æãããã ããŒã¿èšè¿°èšèªãšããŠã¯æãŸããæ¹åæ§ã§ã¯ãªãããšæããã </p> </section> </div> diff --git a/vhosts/blog/public/posts/2025-02-24/phpcon-nagoya-2025-report/index.html b/vhosts/blog/public/posts/2025-02-24/phpcon-nagoya-2025-report/index.html index ee924cdc..11c4db0e 100644 --- a/vhosts/blog/public/posts/2025-02-24/phpcon-nagoya-2025-report/index.html +++ b/vhosts/blog/public/posts/2025-02-24/phpcon-nagoya-2025-report/index.html @@ -64,58 +64,55 @@ </ol> </section> <section id="section--intro"> - <h2><a href="#section--intro">ã¯ããã«</a></h2> + <h2><a href="#section--intro">ã¯ããã«</a></h2> <p> - 2025-02-22 ã«éå¬ããã<a href="https://phpcon.nagoya/2025/" rel="noreferrer" target="_blank">PHP ã«ã³ãã¡ã¬ã³ã¹åå€å±</a>ã«åå ããã + 2025-02-22 ã«éå¬ããã <a href="https://phpcon.nagoya/2025/" rel="noreferrer" target="_blank">PHP ã«ã³ãã¡ã¬ã³ã¹åå€å±</a> ã«åå ããã </p> </section> - <section id="section--sessions"> - <h2><a href="#section--sessions">ã»ãã·ã§ã³ææ³</a></h2> + <h2><a href="#section--sessions">ã»ãã·ã§ã³ææ³</a></h2> <p> - ç¹ã«å°è±¡ã«æ®ã£ãã»ãã·ã§ã³ãäºã€ããã¯ã¢ãããã (ã¿ã€ãã«ãšçºè¡šè
å㯠fortee ã®ããããŒã¶ã«ããŒãžã«ãã)ã + ç¹ã«å°è±¡ã«æ®ã£ãã»ãã·ã§ã³ãäºã€ããã¯ã¢ãããã (ã¿ã€ãã«ãšçºè¡šè
å㯠fortee ã®ããããŒã¶ã«ããŒãžã«ãã)ã </p> - <ul> <li> - <a href="https://fortee.jp/phpcon-nagoya-2025/proposal/26795bcc-78dd-431e-9538-7450779fa2cf" rel="noreferrer" target="_blank">PHPã§å°å·æã«å
¥çš¿ã§ããåæããŒã¿ãäœã by é·è°·å·æºåž ãã</a> + <p> + <a href="https://fortee.jp/phpcon-nagoya-2025/proposal/26795bcc-78dd-431e-9538-7450779fa2cf" rel="noreferrer" target="_blank">PHPã§å°å·æã«å
¥çš¿ã§ããåæããŒã¿ãäœã by é·è°·å·æºåž ãã</a> + </p> <ul> <li> PHPerKaigi ã iOSDC ã®åæã¯å質ãé«ãã®ã§ãä»ã®å匷äŒãã«ã³ãã¡ã¬ã³ã¹ã§ãã€ãã€ã䜿ã£ãŠããŸãã®ã§ããããã®è£åŽãèŠãããšãã§ãé¢çœãã£ãã§ããã«ã³ãã¡ã¬ã³ã¹ã®1ã»ãã·ã§ã³ãšãã圢ã§ãªããã°è§Šããããšã®ãªããããªè©±ãèŽããã®ã¯ã«ã³ãã¡ã¬ã³ã¹ã«åå ããééå³ã®äžã€ã ãšæããŸãã </li> </ul> </li> - <li> - <a href="https://fortee.jp/phpcon-nagoya-2025/proposal/d3ecbb68-318d-4b03-abfe-9ecccc6beb81" rel="noreferrer" target="_blank">PHP 補 OSS ã®ã¡ã¢ãªåé¡ã蟻æ¬ãããŠãã by sji ãã</a> + <p> + <a href="https://fortee.jp/phpcon-nagoya-2025/proposal/d3ecbb68-318d-4b03-abfe-9ecccc6beb81" rel="noreferrer" target="_blank">PHP 補 OSS ã®ã¡ã¢ãªåé¡ã蟻æ¬ãããŠãã by sji ãã</a> + </p> <ul> <li> - ä»åäžçªæ¥œãã¿ã«ããŠããçºè¡šã§ãã<a href="https://github.com/reliforp/reli-prof" rel="noreferrer" target="_blank">Reli</a> ã¯ä»¥å<a href="/slides/2024-03-15/ya8-2024/">èªäœã® WebAssembly åŠçç³»ãé«éåããã®ã«äœ¿ã£ãã®ããã</a>ãã®åŒ·åãã«ã€ããŠã¯ããçšåºŠç¥ã£ãŠããã€ããã§ããããå®éã«åºã䜿ãããŠããã©ã€ãã©ãªã§ã®èª¿æ»éçšãèŠããšåžãã°ããã§ããããããã¹ãŠ (FFI ãã䜿ã£ãŠãããã®ã®) pure PHP ã§å®è£
ããŠãããšã¯ä¿ã«ä¿¡ããããŸããã + ä»åäžçªæ¥œãã¿ã«ããŠããçºè¡šã§ãã <a href="https://github.com/reliforp/reli-prof" rel="noreferrer" target="_blank">Reli</a> ã¯ä»¥å <a href="/slides/2024-03-15/ya8-2024/">èªäœã® WebAssembly åŠçç³»ãé«éåããã®ã«äœ¿ã£ãã®ããã</a> ãã®åŒ·åãã«ã€ããŠã¯ããçšåºŠç¥ã£ãŠããã€ããã§ããããå®éã«åºã䜿ãããŠããã©ã€ãã©ãªã§ã®èª¿æ»éçšãèŠããšåžãã°ããã§ããããããã¹ãŠ (FFI ãã䜿ã£ãŠãããã®ã®) pure PHP ã§å®è£
ããŠãããšã¯ä¿ã«ä¿¡ããããŸããã </li> </ul> </li> </ul> </section> - <section id="section--my-session"> - <h2><a href="#section--my-session">ç»å£ããã»ãã·ã§ã³</a></h2> + <h2><a href="#section--my-session">ç»å£ããã»ãã·ã§ã³</a></h2> <p> - <a href="https://fortee.jp/phpcon-nagoya-2025/proposal/24a2ec04-ca57-46f1-905c-52143a449eea" rel="noreferrer" target="_blank">ãPHP åŠç系㮠garbage collection ãçè§£ãã ãã¡ã¢ãªã¯ãã€è§£æŸãããã®ããã</a>ãšããã¿ã€ãã«ã§ç»å£ããããªã£ããã¿ã€ãã«ã©ãããPHP ã® garbage collection (GC) ã«ã€ããŠæ±ã£ãçºè¡šã§ããã + <a href="https://fortee.jp/phpcon-nagoya-2025/proposal/24a2ec04-ca57-46f1-905c-52143a449eea" rel="noreferrer" target="_blank">ãPHP åŠç系㮠garbage collection ãçè§£ãã ãã¡ã¢ãªã¯ãã€è§£æŸãããã®ããã</a> ãšããã¿ã€ãã«ã§ç»å£ããããªã£ããã¿ã€ãã«ã©ãããPHP ã® garbage collection (GC) ã«ã€ããŠæ±ã£ãçºè¡šã§ããã </p> - <p> - æè¡çãªå
容ãšããŠã¯<a href="https://www.php.net/manual/ja/features.gc.php" rel="noreferrer" target="_blank">PHP ã®ããã¥ã¢ã«ã® GC ã«é¢ããèšè¿°</a>ãåºãŠããªããã®ã®ãPHP åŠçç³»ã®å
éšçãªçšèªã䜿ããªãããã«ããããæ¬è³ªçã§ãªãåŠçãçãããããŠãçè§£ã®ããã®åææ¡ä»¶ãæžãããã®ã§ã¯ãªãããšæãã + æè¡çãªå
容ãšããŠã¯ <a href="https://www.php.net/manual/ja/features.gc.php" rel="noreferrer" target="_blank">PHP ã®ããã¥ã¢ã«ã® GC ã«é¢ããèšè¿°</a> ãåºãŠããªããã®ã®ãPHP åŠçç³»ã®å
éšçãªçšèªã䜿ããªãããã«ããããæ¬è³ªçã§ãªãåŠçãçãããããŠãçè§£ã®ããã®åææ¡ä»¶ãæžãããã®ã§ã¯ãªãããšæãã </p> - <p> - ãšããã§ä»åã¹ã©ã€ãã®ãã©ã³ããµã€ãºã倧ããããããã«åã¹ã©ã€ãã®èŠåºãéšåãæ¶ããŠã¿ãã®ã ããçµå±ã»ãšãã©ã®ã¹ã©ã€ãã§èŠåºããããæèšãå¿
èŠã«ãªã£ãã®ã§ãããŸã广ã¯ãªãã£ããããããªãã + ãšããã§ä»åã¹ã©ã€ãã®ãã©ã³ããµã€ãºã倧ããããããã«åã¹ã©ã€ãã®èŠåºãéšåãæ¶ããŠã¿ãã®ã ããçµå±ã»ãšãã©ã®ã¹ã©ã€ãã§èŠåºããããæèšãå¿
èŠã«ãªã£ãã®ã§ãããŸã广ã¯ãªãã£ããããããªãã </p> </section> - <section id="section--outro"> - <h2><a href="#section--outro">ãããã«</a></h2> + <h2><a href="#section--outro">ãããã«</a></h2> <p> - ä»åãã«ã³ãã¡ã¬ã³ã¹ãããã§ããèŽããªããããªã»ãã·ã§ã³ãããã€ãèŽããŠããã£ãããŸããã¡ããã©é£äŒã ã£ãã®ãããåå€å±ã楜ããããšãã§ãããéå¶ã®ã¿ãªããŸããç²ãããŸã§ãã&ããããšãããããŸãããæ¬¡ã¯ PHPerKaigi 2025 ã§äŒããŸãããã + ä»åãã«ã³ãã¡ã¬ã³ã¹ãããã§ããèŽããªããããªã»ãã·ã§ã³ãããã€ãèŽããŠããã£ãã ãŸããã¡ããã©é£äŒã ã£ãã®ãããåå€å±ã楜ããããšãã§ããã éå¶ã®ã¿ãªããŸããç²ãããŸã§ãã&ããããšãããããŸããã æ¬¡ã¯ PHPerKaigi 2025 ã§äŒããŸãããã </p> </section> </div> diff --git a/vhosts/blog/public/posts/2025-03-27/zip-function-like-command-paste-command/index.html b/vhosts/blog/public/posts/2025-03-27/zip-function-like-command-paste-command/index.html index c1d25c00..abc10b53 100644 --- a/vhosts/blog/public/posts/2025-03-27/zip-function-like-command-paste-command/index.html +++ b/vhosts/blog/public/posts/2025-03-27/zip-function-like-command-paste-command/index.html @@ -65,40 +65,35 @@ NOTE </div> <div class="admonition-content"> - ãã®èšäºã¯ã2021-03-22 ã«<a href="https://www.dgcircus.com/" rel="noreferrer" target="_blank">ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ</a> ã®ç€Ÿå
Qiita Team ã«å
¬éãããèšäºãããŒã¹ã«ãå çä¿®æ£ããŠäžè¬å
¬éãããã®ã§ãã + <p> + ãã®èšäºã¯ã2021-03-22 ã« <a href="https://www.dgcircus.com/" rel="noreferrer" target="_blank">ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ</a> ã®ç€Ÿå
Qiita Team ã«å
¬éãããèšäºãããŒã¹ã«ãå çä¿®æ£ããŠäžè¬å
¬éãããã®ã§ãã + </p> </div> </div> - <section id="section--intro"> - <h2><a href="#section--intro">å®çŸãããå
容</a></h2> + <h2><a href="#section--intro">å®çŸãããå
容</a></h2> <p> - 次ã®2ãã¡ã€ã« <code>a.txt</code> / <code>b.txt</code> ããåºå <code>ab.txt</code> ãåŸããã + 次ã®2ãã¡ã€ã« <code>a.txt</code> / <code>b.txt</code> ããåºå <code>ab.txt</code> ãåŸããã </p> - <p> <code>a.txt</code> </p> - <div class="codeblock"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>a1</span></span> <span class="line"><span>a2</span></span> <span class="line"><span>a3</span></span></code></pre> </div> - <p> <code>b.txt</code> </p> - <div class="codeblock"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>b1</span></span> <span class="line"><span>b2</span></span> <span class="line"><span>b3</span></span></code></pre> </div> - <p> <code>ab.txt</code> </p> - <div class="codeblock"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>a1</span></span> <span class="line"><span>b1</span></span> @@ -107,42 +102,34 @@ <span class="line"><span>a3</span></span> <span class="line"><span>b3</span></span></code></pre> </div> - <p> - ã¡ããã© Python ã Haskell ãªã©ã«ãã <code>zip</code> 颿°ã®ãããªåããããããã + ã¡ããã© Python ã Haskell ãªã©ã«ãã <code>zip</code> 颿°ã®ãããªåããããããã </p> </section> - <section id="section--paste-command"> - <h2><a href="#section--paste-command">å®çŸæ¹æ³</a></h2> + <h2><a href="#section--paste-command">å®çŸæ¹æ³</a></h2> <p> - èšäºã¿ã€ãã«ã«æžããããã«ã<code>paste</code> ã³ãã³ãã䜿ããšå®çŸã§ããã + èšäºã¿ã€ãã«ã«æžããããã«ã<code>paste</code> ã³ãã³ãã䜿ããšå®çŸã§ããã </p> - <div class="codeblock"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>$ paste -d '\</span></span> <span class="line"><span>' a.txt b.txt > ab.txt</span></span></code></pre> </div> - <p> - <code>paste</code> ã³ãã³ãã¯è€æ°ã®ãã¡ã€ã«ãåŒæ°ã«åãããããã1è¡ãã€æ¶è²»ããªãã <code>-d</code> ã§æå®ããæåã§åºåã£ãŠåºåããã<code>-d</code> ã¯åºåãæåã®æå®ã§ãããã©ã«ãã ãšã¿ãåºåãã«ãªãã + <code>paste</code> ã³ãã³ãã¯è€æ°ã®ãã¡ã€ã«ãåŒæ°ã«åãããããã1è¡ãã€æ¶è²»ããªãã <code>-d</code> ã§æå®ããæåã§åºåã£ãŠåºåããã <code>-d</code> ã¯åºåãæåã®æå®ã§ãããã©ã«ãã ãšã¿ãåºåãã«ãªãã </p> - <p> - ãã¡ã€ã«åã«ã¯ <code>-</code> ãæå®ã§ãããã®å Žåã¯æšæºå
¥åããèªã¿èŸŒãã§åºåããããã®ãšã <code>paste - -</code> ã®ããã«è€æ°å <code>-</code> ãæå®ãããšãæå®ããåæ°ã®è¡ããšã«é£çµããããšãã§ãããäŸãã° <code>ab.txt</code> ã ãšãããªãã + ãã¡ã€ã«åã«ã¯ <code>-</code> ãæå®ã§ãããã®å Žåã¯æšæºå
¥åããèªã¿èŸŒãã§åºåããã ãã®ãšã <code>paste - -</code> ã®ããã«è€æ°å <code>-</code> ãæå®ãããšãæå®ããåæ°ã®è¡ããšã«é£çµããããšãã§ããã äŸãã° <code>ab.txt</code> ã ãšãããªãã </p> - <div class="codeblock"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>$ paste - - < ab.txt</span></span> <span class="line"><span>a1 b1</span></span> <span class="line"><span>a2 b2</span></span> <span class="line"><span>a3 b3</span></span></code></pre> </div> - <p> - ããã¯æšæºå
¥åã䜿ããšãç¹æã®æåã§ãåã«åããã¡ã€ã«åãæå®ããŠãããã¯ãªããªãã + ããã¯æšæºå
¥åã䜿ããšãç¹æã®æåã§ãåã«åããã¡ã€ã«åãæå®ããŠãããã¯ãªããªãã </p> - <div class="codeblock"> <pre class="shiki github-light" style="background-color:#f5f5f5;color:#24292e" tabindex="0"><code><span class="line"><span>$ paste ab.txt ab.txt</span></span> <span class="line"><span>a1 a1</span></span> @@ -152,9 +139,8 @@ <span class="line"><span>a3 a3</span></span> <span class="line"><span>b3 b3</span></span></code></pre> </div> - <p> - ãšãã©ã䟿å©ã + ãšãã©ã䟿å©ã </p> </section> </div> diff --git a/vhosts/blog/public/posts/2025-03-28/http-1-1-send-multiple-same-headers/index.html b/vhosts/blog/public/posts/2025-03-28/http-1-1-send-multiple-same-headers/index.html index ff3c7a86..e6829d92 100644 --- a/vhosts/blog/public/posts/2025-03-28/http-1-1-send-multiple-same-headers/index.html +++ b/vhosts/blog/public/posts/2025-03-28/http-1-1-send-multiple-same-headers/index.html @@ -65,109 +65,97 @@ NOTE </div> <div class="admonition-content"> - ãã®èšäºã¯ã2022-08-18 ã«<a href="https://www.dgcircus.com/" rel="noreferrer" target="_blank">ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ</a> ã®ç€Ÿå
Qiita Team ã«å
¬éãããèšäºãããŒã¹ã«ãå çä¿®æ£ããŠäžè¬å
¬éãããã®ã§ãã + <p> + ãã®èšäºã¯ã2022-08-18 ã« <a href="https://www.dgcircus.com/" rel="noreferrer" target="_blank">ããžã¿ã«ãµãŒã«ã¹æ ªåŒäŒç€Ÿ</a> ã®ç€Ÿå
Qiita Team ã«å
¬éãããèšäºãããŒã¹ã«ãå çä¿®æ£ããŠäžè¬å
¬éãããã®ã§ãã + </p> </div> </div> - <section id="section--intro"> - <h2><a href="#section--intro">ã¯ããã«</a></h2> + <h2><a href="#section--intro">ã¯ããã«</a></h2> <p> - HTTP version 1.1 ã§åãååã®ãããã2åéããšãã©ã®ããã«è§£éãããã®ãã仿§ã確èªããã + HTTP version 1.1 ã§åãååã®ãããã2åéããšãã©ã®ããã«è§£éãããã®ãã仿§ã確èªããã </p> - <p> - ä»åèªãã 仿§ã¯ RFC 7230 ã§ããã¡ãã®ãªã³ã¯ããé²èЧã§ãã: <a href="https://datatracker.ietf.org/doc/html/rfc7230" rel="noreferrer" target="_blank">https://datatracker.ietf.org/doc/html/rfc7230</a> + ä»åèªãã 仿§ã¯ RFC 7230 ã§ããã¡ãã®ãªã³ã¯ããé²èЧã§ãã: <a href="https://datatracker.ietf.org/doc/html/rfc7230" rel="noreferrer" target="_blank">https://datatracker.ietf.org/doc/html/rfc7230</a> </p> - <p> - ãã®äžã§ãã<a href="https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.2" rel="noreferrer" target="_blank">https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.2</a> ãäž»ã«åŒçšããã + ãã®äžã§ãã<a href="https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.2" rel="noreferrer" target="_blank">https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.2</a> ãäž»ã«åŒçšããã </p> - <p> - ãšããã§ãHTTP åšãã®ä»æ§ãæ¢ããšãã¯ããããé£ã¶ãšäŸ¿å©: <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Resources_and_specifications" rel="noreferrer" target="_blank">https://developer.mozilla.org/en-US/docs/Web/HTTP/Resources_and_specifications</a> + ãšããã§ãHTTP åšãã®ä»æ§ãæ¢ããšãã¯ããããé£ã¶ãšäŸ¿å©: <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Resources_and_specifications" rel="noreferrer" target="_blank">https://developer.mozilla.org/en-US/docs/Web/HTTP/Resources_and_specifications</a> </p> </section> - <section id="section--specification"> - <h2><a href="#section--specification">仿§</a></h2> + <h2><a href="#section--specification">仿§</a></h2> <section id="section--specification--sender"> - <h3><a href="#section--specification--sender">éä¿¡åŽ</a></h3> + <h3><a href="#section--specification--sender">éä¿¡åŽ</a></h3> <blockquote> - A sender MUST NOT generate multiple header fields with the same field name in a message unless either the entire field value for that header field is defined as a comma-separated list [i.e., #(values)] or the header field is a well-known exception (as noted below). + <p> + A sender MUST NOT generate multiple header fields with the same field name in a message unless either the entire field value for that header field is defined as a comma-separated list [i.e., #(values)] or the header field is a well-known exception (as noted below). + </p> </blockquote> - <p> - ãæ¥æ¬èªèš³ (ç§ãèš³ãããã®ã§ãå
¬åŒãªãã®ã§ã¯ãªã)ã éä¿¡è
ã¯ãåã field name ã® header field ãè€æ°çæããŠã¯ãªããªã (MUST NOT)ããã ããheader field ã®å€ãã³ã³ãåºåãã®ãªã¹ããšããŠå®çŸ©ãããŠããããheader field ãããç¥ãããäŸå€ (åŸè¿°) ã§ããå Žåã¯ãã®éãã§ãªãã + ãæ¥æ¬èªèš³ (ç§ãèš³ãããã®ã§ãå
¬åŒãªãã®ã§ã¯ãªã)ã éä¿¡è
ã¯ãåã field name ã® header field ãè€æ°çæããŠã¯ãªããªã (MUST NOT)ã ãã ããheader field ã®å€ãã³ã³ãåºåãã®ãªã¹ããšããŠå®çŸ©ãããŠããããheader field ãããç¥ãããäŸå€ (åŸè¿°) ã§ããå Žåã¯ãã®éãã§ãªãã </p> </section> - <section id="section--specification--recipient"> - <h3><a href="#section--specification--recipient">åä¿¡åŽ</a></h3> + <h3><a href="#section--specification--recipient">åä¿¡åŽ</a></h3> <blockquote> - A recipient MAY combine multiple header fields with the same field name into one "field-name: field-value" pair, without changing the semantics of the message, by appending each subsequent field value to the combined field value in order, separated by a comma. The order in which header fields with the same field name are received is therefore significant to the interpretation of the combined field value; a proxy MUST NOT change the order of these field values when forwarding a message. + <p> + A recipient MAY combine multiple header fields with the same field name into one âfield-name: field-valueâ pair, without changing the semantics of the message, by appending each subsequent field value to the combined field value in order, separated by a comma. The order in which header fields with the same field name are received is therefore significant to the interpretation of the combined field value; a proxy MUST NOT change the order of these field values when forwarding a message. + </p> </blockquote> - <p> - ãæ¥æ¬èªèš³ (ç§ãèš³ãããã®ã§ãå
¬åŒãªãã®ã§ã¯ãªã)ã åä¿¡è
ã¯ãåã field name ãæã€è€æ°ã® header field ããã¡ãã»ãŒãžã®æå³ãå€ããªãããã«ãã€ã€åãé åºã§è¿œå ããŠãåäžã®ã³ã³ãã§åºåããã <code>"field-name: field-value"</code> ã®ãã¢ã«çµåããŠãã (MAY)ããããã£ãŠãåã field name ãæã€ header field ãã©ã®ãããªé åºã§åä¿¡ããããã¯ãçµåãããå€ã®è§£éã«åœ±é¿ããããã£ãŠããããã·ã¯ãã¡ãã»ãŒãžã転éããéãheader field ã®é åºãå€ããŠã¯ãªããªã (MUST NOT)ã + ãæ¥æ¬èªèš³ (ç§ãèš³ãããã®ã§ãå
¬åŒãªãã®ã§ã¯ãªã)ã åä¿¡è
ã¯ãåã field name ãæã€è€æ°ã® header field ããã¡ãã»ãŒãžã®æå³ãå€ããªãããã«ãã€ã€åãé åºã§è¿œå ããŠãåäžã®ã³ã³ãã§åºåããã <code>"field-name: field-value"</code> ã®ãã¢ã«çµåããŠãã (MAY)ã ãããã£ãŠãåã field name ãæã€ header field ãã©ã®ãããªé åºã§åä¿¡ããããã¯ãçµåãããå€ã®è§£éã«åœ±é¿ããã ãã£ãŠããããã·ã¯ãã¡ãã»ãŒãžã転éããéãheader field ã®é åºãå€ããŠã¯ãªããªã (MUST NOT)ã </p> </section> - <section id="section--specification--exception"> - <h3><a href="#section--specification--exception">äŸå€ã±ãŒã¹: Set-Cookie</a></h3> + <h3><a href="#section--specification--exception">äŸå€ã±ãŒã¹: Set-Cookie</a></h3> <blockquote> - Note: In practice, the "Set-Cookie" header field ([<a href="https://datatracker.ietf.org/doc/html/rfc6265" rel="noreferrer" target="_blank">RFC6265</a>]) often appears multiple times in a response message and does not use the list syntax, violating the above requirements on multiple header fields with the same name. Since it cannot be combined into a single field-value, recipients ought to handle "Set-Cookie" as a special case while processing header fields. (See Appendix A.2.3 of [Kri2001] for details.) + <p> + Note: In practice, the âSet-Cookieâ header field ([<a href="https://datatracker.ietf.org/doc/html/rfc6265" rel="noreferrer" target="_blank">RFC6265</a>]) often appears multiple times in a response message and does not use the list syntax, violating the above requirements on multiple header fields with the same name. Since it cannot be combined into a single field-value, recipients ought to handle âSet-Cookieâ as a special case while processing header fields. (See Appendix A.2.3 of [Kri2001] for details.) + </p> </blockquote> - <p> - ãæ¥æ¬èªèš³ (ç§ãèš³ãããã®ã§ãå
¬åŒãªãã®ã§ã¯ãªã)ã æ³šæ: å®éã«ã¯ã<code>Set-Cookie</code> header field (<a href="https://datatracker.ietf.org/doc/html/rfc6265" rel="noreferrer" target="_blank">RFC6265</a>) ã¯ããã°ãã°ã¬ã¹ãã³ã¹ã¡ãã»ãŒãžäžã«è€æ°åçŸãããããã¯ãªã¹ãã®æ§æã䜿ã£ãŠããããäžè¿°ããåã field name ãæã€ header field ã«ã€ããŠã®èŠä»¶ã«éåããŠããããã®å€ã¯åäžã®å€ãžçµåã§ããªããããåä¿¡è
ã¯ãheader field ãåŠçããéã<code>Set-Cookie</code> ãç¹å¥æ±ãããæ¹ãããã + ãæ¥æ¬èªèš³ (ç§ãèš³ãããã®ã§ãå
¬åŒãªãã®ã§ã¯ãªã)ã æ³šæ: å®éã«ã¯ã<code>Set-Cookie</code> header field (<a href="https://datatracker.ietf.org/doc/html/rfc6265" rel="noreferrer" target="_blank">RFC6265</a>) ã¯ããã°ãã°ã¬ã¹ãã³ã¹ã¡ãã»ãŒãžäžã«è€æ°åçŸããã ããã¯ãªã¹ãã®æ§æã䜿ã£ãŠããããäžè¿°ããåã field name ãæã€ header field ã«ã€ããŠã®èŠä»¶ã«éåããŠããã ãã®å€ã¯åäžã®å€ãžçµåã§ããªããããåä¿¡è
ã¯ãheader field ãåŠçããéã<code>Set-Cookie</code> ãç¹å¥æ±ãããæ¹ãããã </p> - <p> - ããããããéä¿¡åŽãã®ãšããã§æžãããŠãããããç¥ãããäŸå€ãã®äžã€ãããã ãšæãããã + ããããããéä¿¡åŽãã®ãšããã§æžãããŠãããããç¥ãããäŸå€ãã®äžã€ãããã ãšæãããã </p> </section> - <section id="section--specification--comma-separated-list"> - <h3><a href="#section--specification--comma-separated-list">ã©ã® header field ãã³ã³ãåºåãã®ãªã¹ããªã®ã</a></h3> + <h3><a href="#section--specification--comma-separated-list">ã©ã® header field ãã³ã³ãåºåãã®ãªã¹ããªã®ã</a></h3> <p> - äžèšã®ããã«ãåã field name ãæã€ header field ãè€æ°åéãããã©ããã¯ããã® header field ãã³ã³ãåºåãã®ãªã¹ããšããŠå®çŸ©ãããŠãããã©ããã§æ±ºãŸããã§ã¯ãç¹å®ã® header field ããã®æ¡ä»¶ãæºãããŠãããã©ããç¥ããããšãã¯ãäœãèŠãã°ããã®ãã + äžèšã®ããã«ãåã field name ãæã€ header field ãè€æ°åéãããã©ããã¯ããã® header field ãã³ã³ãåºåãã®ãªã¹ããšããŠå®çŸ©ãããŠãããã©ããã§æ±ºãŸããã§ã¯ãç¹å®ã® header field ããã®æ¡ä»¶ãæºãããŠãããã©ããç¥ããããšãã¯ãäœãèŠãã°ããã®ãã </p> - <p> - HTTP ã®ä»æ§ãšããŠå®çŸ©ãããŠãããã㪠header field ã§ããã°ãäžèšã®ãªã³ã¯ããããããã®å®çŸ©ãåç
§ã§ããã + HTTP ã®ä»æ§ãšããŠå®çŸ©ãããŠãããã㪠header field ã§ããã°ãäžèšã®ãªã³ã¯ããããããã®å®çŸ©ãåç
§ã§ããã </p> - <ul> <li> <a href="https://datatracker.ietf.org/doc/html/rfc7231#section-5" rel="noreferrer" target="_blank">https://datatracker.ietf.org/doc/html/rfc7231#section-5</a> </li> - <li> <a href="https://datatracker.ietf.org/doc/html/rfc7231#section-7" rel="noreferrer" target="_blank">https://datatracker.ietf.org/doc/html/rfc7231#section-7</a> </li> </ul> - <p> - ããã§ãªãå Žå (ããšãã° <code>X-</code> ããå§ãŸããã®ç) ã¯ãMDN ãåãã³ãã®ããã¥ã¡ã³ããæ¢ãããšã«ãªãã ããã + ããã§ãªãå Žå (ããšãã° <code>X-</code> ããå§ãŸããã®ç) ã¯ãMDN ãåãã³ãã®ããã¥ã¡ã³ããæ¢ãããšã«ãªãã ããã </p> </section> </section> - <section id="section--outro"> - <h2><a href="#section--outro">ãŸãšã</a></h2> + <h2><a href="#section--outro">ãŸãšã</a></h2> <ul> <li> éä¿¡åŽ: åºæ¬çã«ã¯è€æ°åéããªããã³ã³ãåºåãã®ãããã¯äŸå€ </li> - <li> åä¿¡åŽ: åºæ¬çã«ã¯æªèŠå®ãã³ã³ãåºåãã®ãããã¯è€æ°åæ¥ãããã®é ã«çµåãã </li> - <li> ãããã·: é åºãå€ããŠã¯ãªããªã </li> - <li> <code>Set-Cookie</code> ã¯äŸå€ã±ãŒã¹ </li> |
