はてなキーワード: charとは
確かに使ってた。使ってはいるけど解凍を使ってるのは自己解凍のところだけで、e,xオプションのところでは「ファイルを取り出す」表記。凍結表記もaオプションのところだけ。
(LHAになる前のバージョンだけど)LHarcソースコード内の日本語版の使い方
char use[] =
"LHarc version 1.13c Copyright(c) H.Yoshizaki(吉崎栄泰), 1988-89.\n"
"============================================================= 1989 - 5 - 21 ===\n"
" <<< 高圧縮書庫管理プログラム >>>\n"
"===============================================================================\n"
" 使用法:LHarc [<命令>] [{/|-}{<スイッチ>[-|+|2|<オプション>]}...] <書庫名>\n"
" [<ドライブ名>:|<基準ディレクトリ名>\\] [<パス名> ...]\n"
"-------------------------------------------------------------------------------\n"
" 《命令》\n"
" a: 書庫にファイルを追加 u: 書庫にファイルを追加(日時照合付)\n"
" f: 書庫のファイルを更新 m: 書庫にファイルを移動(日時照合付)\n"
" d: 書庫内のファイルの削除 e,x: 書庫からファイルを取り出す\n"
" p: 書庫内のファイルの閲覧 l,v: 書庫の一覧表示\n"
" s: 自己解凍書庫の作成 t: 書庫内のファイルの CRC チェック\n"
" 《スイッチ》\n"
" r: 再帰的収集を行う w: ワークディレクトリの指定\n"
" x: ディレクトリ名を有効にする m: 問い合わせを行わない\n"
" p: 名前の比較を厳密に行う c: 日時照合を行わない\n"
" a: 全属性を凍結の対象とする v: 他のユーティリティでファイルを閲覧\n"
" n: 経過表示をしない k: 自動実行のキーワードの設定\n"
"===============================================================================\n"
" 転載・再配布などは自由です。 Nifty-Serve PFF00253\n"
英語版の使い方
char use[] =
"LHarc version 1.13c Copyright (c) Haruyasu Yoshizaki, 1988-89.\n"
"================================================================ 05/21/89 ===\n"
" <<< High-Performance File-Compression Program >>>\n"
"===============================================================================\n"
"usage: LHarc [<command>] [{{/|-}{<switch>[-|+|2|<option>]}}...] <archive_name>\n"
" [{<drive_name>:}|{<home_directory_name>\\}] [<path_name> ...]\n"
"-------------------------------------------------------------------------------\n"
" a: Add files to archive u: Update files to archive\n"
" f: Freshen files in archive m: Move new files into archive\n"
" d: Delete files from archive e,x: EXtract files from archive\n"
" p: disPlay files in archive l,v: View List of files in archive\n"
" s: make a Self-extracting archive t: Test integrity of archive\n"
" r: Recursively collect files w: assign Work directory\n"
" x: allow eXtended file names m: no Message for query\n"
" p: distinguish full Path names c: skip time-stamp Check\n"
" a: allow any Attributes of files v: View files by another utility\n"
" n: display No indicator k: Key word for AUTOLARC.BAT\n"
" t: archive's Time-stamp option\n"
"===============================================================================\n"
" You may copy or distribute without any donation to me. Nifty-Serve PFF00253\n"
" (See the User's Manual for detailed descriptions.) ASCII-pcs pcs02846";
ワイらみたいなガンキチは初代ガンダムのセリフの一句一句まで覚えてるんやから、
「親父にも打たれたことないのに」→「I've never even been hit by my dad.」
みたいな感じで覚えてけばええんや。
初代だけやなくて逆シャアとかも、ほぼ丸暗記しとるやろ?
→「I, Char Aznable, am going to purge it, Amuro!」
→「That's ego!」
おお、ええ感じやん!
「You know, Lara could have been the one who would have been my mother!」
これやこれ!
main( ){
}
C言語で別のプログラムを作成し、system 関数などを使って最初のプログラムを実行し、その出力を読み取って比較する方法です。
int main() {
char expected_output[] = "hello, world\n";
char actual_output[100]; // 十分なバッファサイズを確保
// hello プログラムを実行し、出力を actual_output にリダイレクト(環境依存)
// これは非常に簡略化された概念であり、実際にはパイプ処理などが必要になります
#ifdef _WIN32
sprintf(command, "hello.exe > temp_output.txt");
#else
sprintf(command, "./hello > temp_output.txt");
#endif
system(command);
FILE *fp = fopen("temp_output.txt", "r");
if (fp != NULL) {
fgets(actual_output, sizeof(actual_output), fp);
fclose(fp);
remove("temp_output.txt"); // 一時ファイルを削除
} else {
printf("エラー:一時ファイルのオープンに失敗しました\n");
return 1;
}
if (strcmp(actual_output, expected_output) == 0) {
return 0;
} else {
printf("テスト失敗: 期待された出力 '%s'、実際の出力 '%s'\n", expected_output, actual_output);
return 1;
}
}
投稿の属性(部分ツイート、読書感想文、マウント、音楽、男女分断、投資勧誘、数年前のネタの掘り返し等々)のみを表示して、実際の投稿内容本文は個人間でひっそりやりとり
やりとりを要ポイントにするとか
ああすべての文章を載せられるサイトは悪意あるコード置き場になりうる。特にrawが落とせたりすると便利すぎる。rentryとか(今はrawは単なるGETでは取ってきにくいように規制された。なんかトークンがいるみたいな)。
"たぬGきOさん".split("GO")で[たぬ, き, さん]を作ったりして難読化(splitの仕様キモすぎ)。さらにそれを16進数としてintにして、さらにその整数をcharとして表現するとコードになる。そいつで本命のコードを取ってきて(fetch)、そいつを実行
こういう疑問こそ、生成AIに回答を作ってもらうのが良いと思うよ。
Perplexity PROに聞いてみたよ。
「大学の入学定員のアファーマティブアクションとして女子枠が設定されているのは日本だけですか?海外で女子枠が一般的にある国を列挙してください。特にEU諸国での考え方が気になっています」
大学入学定員における女子枠の設定は、日本に限らず世界の多くの国で実施されています。ただし、その形態や規模は国によって異なります。以下に、女子枠が比較的一般的な国々を列挙し、特にEU諸国の状況について説明します。
1. インド
2. パキスタン
3. バングラデシュ
4. マレーシア
5. 韓国
EUでは、高等教育における性別による直接的な割当制(クオータ制)は一般的ではありません。しかし、ジェンダー平等を促進するための様々な取り組みが行われています[1][6]。
1. 法的枠組み:EUの基本条約では、男女平等の促進が重要な価値として位置づけられています[28]。
2. ポジティブ・アクション:EUは、形式的な平等だけでなく、実質的な平等の実現を目指しています。これには、一時的な特別措置(ポジティブ・アクション)の実施も含まれます[6][31]。
3. 分野別アプローチ:特に理工系(STEM分野)における女性の参画を促進するための取り組みが行われています[28]。
1. ソフトロー:法的拘束力のない指針や勧告を通じて、ジェンダー平等を推進しています[11]。
2. 財政的支援:女性の参画を促進するためのプログラムに資金を提供しています[11]。
3. データ収集と分析:European Institute for Gender Equalityなどの機関を通じて、ジェンダー平等の進捗状況を継続的に監視しています[28]。
4. 企業の取締役会におけるクオータ制:一部のEU加盟国(フランス、ドイツ、イタリアなど)では、上場企業の取締役会における女性比率の目標を設定しています[10]。
日本の大学入試における「女子枠」の設定は、EUの一般的なアプローチとは異なります。日本の取り組みは、特定の分野(主に理工系)における女性の参画を直接的に促進することを目的としています[15][18]。
一方、EUでは、教育システム全体を通じてジェンダー平等を促進する包括的なアプローチを採用しています。これには、早期教育からのステレオタイプの排除、キャリア指導の改善、ロールモデルの提示などが含まれます[28]。
結論として、大学入学定員における明示的な「女子枠」の設定は、日本を含むアジアの一部の国々でより一般的であり、EUでは直接的なクオータ制よりも、包括的かつ長期的なアプローチが採用されていると言えます。
[1] spaceshipearth.jp/affirmative-action/
[2] univ-journal.jp/column/2024249156/
[3] feminist.org/news/european-court-of-justice-strikes-down-affirmative-action-law/
[4] mainichi.jp/univ/articles/20240925/ddm/010/100/018000c
[5] note.com/yourchoice_ycp/n/n644ad1296281
[6] www.jil.go.jp/institute/zassi/backnumber/2014/07/pdf/060-069.pdf
[7] eur-lex.europa.eu/legal-content/EN/TXT/?uri=legissum%3Ac10935
[8] jbpress.ismedia.jp/articles/-/80117
[9] www.kaonavi.jp/dictionary/affirmative-action/
[10] ja.wikipedia.org/wiki/%E3%82%A2%E3%83%95%E3%82%A1%E3%83%BC%E3%83%9E%E3%83%86%E3%82%A3%E3%83%96%E3%83%BB%E3%82%A2%E3%82%AF%E3%82%B7%E3%83%A7%E3%83%B3
[11] ehne.fr/en/encyclopedia/themes/gender-and-europe/gender-citizenship-in-europe/european-union-gender-equality-policies-1957
[12] www.keinet.ne.jp/teacher/media/guideline/backnumber/23/0203/shiten3.pdf
[13] www.gender.go.jp/kaigi/kento/positive/siryo/pdf/po02-2.pdf
[14] revistaidees.cat/en/la-unio-europea-a-lavantguarda-de-les-politiques-digualtat/?pdf=12310
[15] www.yomiuri.co.jp/kyoiku/kyoiku/daigakunyushi/20240308-OYT1T50053/
[16] waseda.repo.nii.ac.jp/record/10032/files/Honbun-7017.pdf
[17] www.nytimes.com/1997/11/12/world/european-union-court-upholds-affirmative-action-for-women.html
[18] www.nikkei.com/article/DGXZQOCD17DER0X10C24A7000000/
[19] journals.sagepub.com/doi/10.1177/00016993231163416?icid=int.sj-abstract.citing-articles.34
[20] news.tv-asahi.co.jp/news_society/articles/000341947.html
[21] www.eigo-net.jp/easy_readings/easy_readings-3403
[22] note.com/wakari_te/n/n8e298c2e524c
[23] eic.obunsha.co.jp/file/exam_info/2024/1108.pdf
[25] www.gender.go.jp/policy/positive_act/pdf/positive_action_011.pdf
[26] www.gender.go.jp/research/kenkyu/ishiki/kekka53.html
[27] corp.miidas.jp/assessment/10794/
[28] commission.europa.eu/document/download/965ed6c9-3983-4299-8581-046bf0735702_en
[29] mainichi.jp/articles/20240426/k00/00m/040/090000c
[30] www.hosei.ac.jp/diversity/publication/newsletter/vol3-1/?auth=9abbb458a78210eb174f4bdd385bcf54
[31] www.era-comm.eu/oldoku/SNLLaw/04_Positive_action/116DV06_Selanec_EN.pdf
[32] admissions.titech.ac.jp/admissions/admission/admission/international
アメリカの大学における女子枠の状況は、日本とは大きく異なります。
アメリカでは、1972年の平等機会法(Equal Opportunities Act)以降、人種間の不平等是正を目的としたアファーマティブ・アクションが実施されてきました[4]。しかし、近年では性別に基づく優遇措置に対して批判が高まっています。
1. 法的問題:性別に基づく入学枠の設定は、教育改正法第9編(タイトル・ナイン)に違反する可能性があるとして、多くの苦情が申し立てられています[3]。
2. 男性への不利益:現在の大学では、むしろ男性が不利な状況にあるという主張があります[3]。
3. 違憲判断:2023年6月、最高裁判所がハーバード大学とノースカロライナ大学のアファーマティブ・アクションを違憲と判断しました[5]。
多くの大学が、性別に基づく優遇措置を廃止する動きを見せています:
アメリカの大学、特にトップスクールでは、男女比がほぼ半々になっています。例えば、スタンフォード大学のコンピュータサイエンス専攻では、3人に1人が女子学生です[2]。
このように、アメリカでは明示的な「女子枠」ではなく、長期的かつ包括的なアプローチによってジェンダーバランスの改善を図ってきた結果、現在の状況に至っています。
[1] note.com/wakari_te/n/n8e298c2e524c
[3] forbesjapan.com/articles/detail/47454
[4] ipdi.w3.kanazawa-u.ac.jp/cdl/houkoku/doc/090317ppt.pdf
[5] x.com/LazyWorkz/status/1816616538717454751
[6] www.jstage.jst.go.jp/article/kyoiku/89/4/89_683/_pdf/-char/ja
試しに98文字の追加と3文字削除して3文字挿入、3文字削除して4文字挿入をそれぞれ10万行繰り返してみた。
ADD:1984ms
REPLACE(3 char):8942ms
自作のBPlusTreeをListとして使えるようにしたやつよりも文字数が増えるパターンでは遅い。
GapBufferくそ強い。
viviエディターの作者が提唱した局所的行更新のやり方を使うと大体の場面ではO(1)で済ませられる。
ただ、C#だとNaitiveMemoryArrayがstructとcharなど一部の型に限定されるので、クラス設計をどうするのかという問題が出てくる。
メモリーに入りきらないような巨大ファイルだとBPlusTreeに放り込んでうまいことやったほうがここら辺は楽だが、キー(テキストエディターの場合は1-64みたい範囲であることが多い)に何かしらの値を足さないといけないので、遅くなる。
https://www.geonames.org から取れる、人口500人以上の都市の名前に限定すると、
Santa Maria Magdalena Cahuacan
import logging import tempfile import zipfile from collections import Counter import httpx FILE_NAME_BASE = 'cities500' GEONAME_FIELDS = ( 'geoname_id', 'name', 'ascii_name', 'alternate_names', 'latitude', 'longitude', 'feature_class', 'feature_code', 'country_code', 'cc2', 'admin1_code', 'admin2_code', 'admin3_code', 'admin4_code', 'population', 'elevation', 'dem', 'timezone', 'modification_date', ) def retrieve_cities(): """Retrieve city names from a remote server.""" response = httpx.get(f'https://download.geonames.org/export/dump/{FILE_NAME_BASE}.zip') response.raise_for_status() tmpdir = tempfile.TemporaryDirectory() with open(tmpdir.name + f'/{FILE_NAME_BASE}.zip', 'wb') as f: f.write(response.content) with zipfile.ZipFile(tmpdir.name + f'/{FILE_NAME_BASE}.zip', 'r') as z: z.extractall(tmpdir.name) with open(tmpdir.name + f'/{FILE_NAME_BASE}.txt', 'r') as f: for line in f: yield line.split('\t') def count_characters(to_check='ascii_name', filter_func=lambda _: True): """Count characters in city names.""" cities = {} for city_fields in retrieve_cities(): city = dict(zip(GEONAME_FIELDS, city_fields)) if not filter_func(city): continue counter = Counter() for c in city[to_check]: counter[c] += 1 cities[city['geoname_id']] = {'characters': counter, 'city': city} return cities def count_chars_of_city_names(cities, char=None): """Find the city with the most occurrences of a given character.""" cities_by_char_count = {} max_count = 0 max_count_char = None for city_id, data in cities.items(): if 'characters' not in data or not data['characters']: logging.debug(f'No characters found for city {city_id}', data) continue count = 0 if char and char in data['characters']: count = data['characters'][char] cities_by_char_count.setdefault(count, []).append(data) elif char is None: most_common = data['characters'].most_common(1)[0] char, count = most_common cities_by_char_count.setdefault(count, []).append(data) if count > max_count: max_count = count max_count_char = char cities_by_char_count.setdefault(count, []).append(data) return cities_by_char_count.get(max_count, []), max_count_char def not_contain_invalid_chars(city): return ( '(' not in city.get('ascii_name', '') and '/' not in city.get('ascii_name', '') ) def main(): cities = count_characters(filter_func=not_contain_invalid_chars) for char in 'abcdefghijklmnopqrstuvwxyz': cities_counted, char = count_chars_of_city_names(cities, char) max_count = cities_counted[0]['characters'][char] print(f'The character "{char}" appears the most ({max_count} times) in the following cities:') for city in cities_counted: print("\t", city['city']['ascii_name']) if __name__ == "__main__": main()
これを改善してってお願いした。何書いてあるかわからないけど動いたよ。
https://anond.hatelabo.jp/20240125203115
// ==UserScript== // @name 増田ミュート(白塗り版) // @namespace http://tampermonkey.net/ // @version 2024-06-26 // @description ミュートワードを含む最小限の範囲を白塗りにする // @author You // @match https://anond.hatelabo.jp/* // @icon https://www.google.com/s2/favicons?sz=64&amp;domain=hatelabo.jp // @grant none // ==/UserScript== (function() { 'use strict'; const muteWords = [ "弱者男性", "弱男", "弱者", "婚活", "男", "女", "年収", "下方婚", "発達障害", "発達", "ハッタツ", "ハッタショ", "ハッタショ", "競プロ", "競技プログラミング", "AtCoder", ]; function whiteoutElement(element) { element.style.backgroundColor = 'white'; element.style.color = 'white'; element.style.textShadow = 'none'; element.style.cursor = 'default'; element.style.userSelect = 'none'; // テキスト選択を防止 element.style.borderBottom = '1px dashed #ccc'; // 枠線を追加してテキストがあることを示す // リンクの場合、クリックを無効化 if (element.tagName === 'A') { element.style.pointerEvents = 'none'; element.removeAttribute('href'); } // 子要素にも適用 Array.from(element.children).forEach(child => { child.style.backgroundColor = 'white'; child.style.color = 'white'; child.style.textShadow = 'none'; }); // ツールチップを追加 element.title = 'この内容にはミュートワードが含まれています'; } function shouldMute(text) { return muteWords.some(word => { const parts = word.split(''); const regex = new RegExp(parts.map(char => `${char}92;92;s*`).join(''), 'i'); return regex.test(text); }); } function findSmallestMuteableElement(element) { if (element.nodeType === Node.TEXT_NODE) { return shouldMute(element.textContent) ? element.parentElement : null; } if (element.tagName === 'PRE' || element.tagName === 'CODE') { return shouldMute(element.textContent) ? element : null; } for (let child of element.childNodes) { const result = findSmallestMuteableElement(child); if (result) return result; } return shouldMute(element.textContent) ? element : null; } function processElement(element) { const muteableElement = findSmallestMuteableElement(element); if (muteableElement) { whiteoutElement(muteableElement); } } function processAllElements(root = document.body) { const walker = document.createTreeWalker( root, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT, null, false ); let node; while (node = walker.nextNode()) { if (node.nodeType === Node.ELEMENT_NODE) { processElement(node); } else if (node.nodeType === Node.TEXT_NODE &amp;&amp; node.parentElement) { processElement(node.parentElement); } } } function handleClickEvent(event) { setTimeout(() => { processAllElements(event.target); }, 100); } // 初回実行 processAllElements(); // クリックイベントの監視 document.body.addEventListener('click', handleClickEvent); // DOM変更の監視 const observer = new MutationObserver(mutations => { mutations.forEach(mutation => { if (mutation.type === 'childList') { mutation.addedNodes.forEach(node => { if (node.nodeType === Node.ELEMENT_NODE) { processAllElements(node); } }); } else if (mutation.type === 'characterData') { processElement(mutation.target.parentNode); } }); }); observer.observe(document.body, { childList: true, subtree: true, characterData: true }); })();
1. 機動戦士ガンダム(Mobile Suit Gundam): 第1話「ガンダム登場」(Gandamu Tōjō)
2. 機動戦士Zガンダム(Mobile Suit Zeta Gundam): 第1話「憎しみのスクラップ」(Nikushimi no Scrap)
3. 機動戦士ガンダムΖΖ(Mobile Suit Gundam ZZ): 第1話「月面都市開戦」(Getsu Men Toshi Kaisen)
4. 機動戦士ガンダムΖΖ外伝(Mobile Suit Gundam ZZ Side Story): 第1話「初陣」(Uijin)
5. 機動戦士ガンダム 逆襲のシャア(Mobile Suit Gundam: Char's Counterattack): 第1話「メガビームキャノン発射」(Mega Beam Cannon Hassha)
6. 機動戦士ガンダムUC(Mobile Suit Gundam Unicorn): 第1話「デイバイン・ワン」(Daibain Wan)
7. 機動戦士ガンダムNT(Mobile Suit Gundam Narrative): 第1話「星を継ぐ者」(Hoshi o Tsugu Mono)
これらは代表的なガンダムシリーズの第一話のタイトルですが、さまざまなガンダム作品が存在するため、他にもいくつかのシリーズがあります。