■_
東スポによると、Twitterは「つぶやき投稿サイト」らしい
・モラルハザード
どっちの意味が正しいのかわからなくなって結局使わないという罠。
let
一つ前へ
2009年12月(上旬)
一つ後へ
2010年1月(下旬)
おもしろいコピペがあったら貼るスレinマ板part17 143 仕様書無しさん [sage] 2010/01/18(月) 20:43:21 ID: Be: まず完全に防音の、フタのある箱を用意し、この中に「ぬるぽ」と言うかも 知れないやつを一人入れる。箱の中には他に、「全自動ガッ!装置」を入れ ておく。もし箱の中で「ぬるぽ」という音声が発せられた時、装置はそいつを ガッ!するが、音声が発生しなかった場合は叩かれずにすむ。この実験にお いて、中の人が「ぬるぽ」と言うかどうかは完全に確率の問題である。仮に中 の人が我慢できずに1時間で「ぬるぽ」と言う確率が50%として、この箱のフタ を閉め、1時間放っておくと、彼は叩かれているだろうか? 無事でいるだろう か? 確かに確率を用いて記述することもあるが、原理的には「中の人」の状 態は二通りしかない。量子論においては、その状態は原理的に死と生の重ね 合わせであり、どちらか一方だけをとるのではない。つまり、箱の中の人は半 分無事、半分叩かれているという奇妙な状態が続いていると考える。そして観 測者が箱を開けた瞬間、中の人の状態群が一つの状態に収束する。このよう な考えは論理的には誤っていないが、余りにも日常感覚とかけ離れているため、 物理的実在と日常的実在をどう統合させるかが、現代哲学において大きな問 題となった。これを「シュレディンガーのぬるぽ」と言う。 _____ /:\.____\ |: ̄\(∩( ;゚∀゚) |: |: ̄ ̄ ̄∪:| 144 仕様書無しさん [sage] 2010/01/18(月) 21:40:06 ID: Be: 「シュレーディンガーの猫」って、箱の中に猫と一緒に「対青酸ガス装備をした観測者」も 一緒に入れた場合はどうなるんだろ? 猫が死んだかどうかは観測者には明らかに分かっているわけだがw 145 仕様書無しさん [sage] 2010/01/18(月) 21:58:05 ID: Be: そんなの透明なケースでやれば良いんじゃね 146 仕様書無しさん [sage] 2010/01/18(月) 22:07:02 ID: Be: 箱の中の観測者には分かっているが、箱の外の観測者には 前と同じ状況だってとこがミソだ。 147 仕様書無しさん [sage] 2010/01/18(月) 22:56:46 ID: Be: >>146 つ エヴェレットの多世界解釈 148 仕様書無しさん [sage] 2010/01/18(月) 23:27:01 ID: Be: >>144 それ、ウィグナーの友人の変種になるだけ。 150 仕様書無しさん [sage] 2010/01/18(月) 23:33:03 ID: Be: >>143 「20分の1の確立で破産する可能性を持つ一万人に住宅ローンを貸し出す場合、 その一万人分のローン債権を証券化して小分けに広く売り出せば、 貸し倒れのリスクを薄めることができて云々」 この理屈を使って「サブプライムの猫」というのをでっち上げようとしたが 俺の頭ではむりだった。 根本的に間違って理解してるかも知れんが。 152 仕様書無しさん [sage] 2010/01/19(火) 00:43:08 ID: Be: >>143 ガッ×5
全然関係ない話ですが、 特異なバグ - Wikipedia に「シュレディンバグ」ってのがあったりします。 Jargon File には他にも物理学者の名前をもじったバグがいくつかあります。
ためしに受けてみるかねえ。
Programmer Personality Test ― Doolwind ― Game Coding and Game Development Blog Programmer Personality Test Below is the programmer's personality test. It is based of the Myers-Briggs Personality Test and has been changed to relate to your programming personality type. This is not a joke test and is really only relevant to programmers, however anyone is welcome to take the test. There are 12 questions with 2 answers for each question and you must choose one answer from each and every question. There are no ‘right' or ‘wrong' answers, your answer will simply show what type of personality you have.There are two things to note in this test. The first is that you should choose the answer that best describes your feeling about a subject. You may not completely agree with the answer, however the answers are polar opposites and you must choose which end of the spectrum you best relate to. The second thing to note is that many of the questions ask what is ‘best' or ‘better' without any context. This is done because, like an inkblot test, your answer will be shaped based just as much on how you perceive the question as how you answer it. Good luck with the test, and if you have any questions please email me. 以下に示すのはプログラマーの personality のテストです。このテストは Myers-Briggs Personality Test に基づくもので、プログラミングの personality のタイプに関連するように 変更が加えられています。これは joke test ではありませんし、プログラマーだけに関連した ものです。とはいえ誰でもテストを受けるのを歓迎します。12 個の質問があり、質問のそれぞ れには二種類の回答があってあなたは質問ごとに二つの回答のどちらかを必ず選択しなければな りません。“正しい答え”とか“間違った答え”というものはなくて、あなたの回答はただ単に あなた自身の持っている personality のタイプを露にしていきます。このテストには注意すべ きことが二つあります。第一に subject に対してあなたが感じたことを最も良く説明している (best describes) 回答を選択すべきであるということです。あなたはその回答に 100% 賛成だ ということがないかもしれません。その回答が全くの正反対のものであったとしても end of the spectrum you best relate to を選ばなければなりません。第二に、質問の多くは あなたに対して“ベストの”とか“よりよい”といったことを、一切のコンテキストを抜きにし て尋ねていることに注意しなさいということです。これは inkblot test のように行われるので あなたがどのように回答するかと同じ程度にあなたがどのように設問を理解するかに基づいてあ なたの回答が shape されていくからです。 Good luck with the test, and if you have any questions please email me. Question 1: You've just been given a complex task to code. What are you most likely to do? あなたに対して、コーディングが難しい複雑なタスクが割り振られました。 あなたは次のうちのどちらにより近い行動をしますか? Get straight into the task by putting in the initial code and prototyping the task. 即座にタスクに取り掛かりイニシャルコードを書いてそのプロトタイプの作成を行う。 Get everyone's feedback on the problem, discuss all the possible options, then decide the best way to approach the problem given the current situation. その問題に対する全員のフィードバックを集め、 可能な選択肢を全て議論してから 与えられた状況 (current situation) の中で その問題に対するアプローチで最良のものを決定する。 Question 2: Comments should be placed: コメントをつけるべき場所は: To explain anything that may seem ambiguous. 曖昧に感じられ、説明すべき箇所 Only when a programmer isn't good enough to explain themselves in variable and function names. 変数名や関数名では十分説明ができてないようなところだけ Question 3: Where do you spend most of your time? あなたが最も時間をかけるのは? Moving registers around or doing pointer arithmetic (or creating functions) レジスターの操作やポインターの算術演算(あるいは関数の生成) Drawing UML diagrams (or making objects) UML ダイアグラムの作成(もしくはオブジェクトの作成) Question 4: Who is a ‘better' programmer? “より良い”プログラマーなのは誰? Someone who went to university/college and has at least a masters in their field. They should read as many books on a subject as they can find before starting on it. 大学へ行き少なくとも自分の専門分野の修士号 (masters in their field) を持っている人物。 そういった人たちは自分が before starting on it なことを見つけられるように 本をたくさん読んでいるはずだ。 Someone who has been coding since they were 5 and simply goes by raw talent alone. 5歳からコーディングを始めていて、そのまま専門教育を受けずに成長した人物。 Question 5: Which is the ‘best' way to program? プログラミングの手段として“ベスト”なのはどちら? In assembly or straight C. I'm in complete control of what the program's going to do. アセンブリ言語もしくは C。プログラムで行おうとすることを完全に自分の制御下におく。 Java or any .net language. Why waste valuable time on memory management and re-inventing the wheel when someone's handled it for you! Java もしくはなんらかの .NET 言語。 あなたのために誰かが既にやってくれたメモリー管理や車輪の再発明を自前で行うのは 貴重な時間を浪費している。 Question 6: Approximately what % of a project should be spent in planning? あるプロジェクトにおいて計画に費やすのは概ねどのくらいの割合? ~25% - The best way to complete a task is to plan as you go. 25% 未満 計画を実行するためのタスクを完了する最善の方法 ~75% - The more planning, the less code you need to write. By the time you code, you should simply be filling in stubs. もっと細かく計画し、書かなければならないコードの量を少なくする。 コードを書くときには単にスタブを埋めていくだけなるようにする。 Question 7: If something needs to be done properly: 適切に完了しなければならないなにかがあったら Get the team together and discuss the best way of solving the problem. Then break it up and give each piece based on people's strengths. チームのメンバーを集合させて問題を解決するための最善の策を協議する。 そうしておいてから行うことを分割してメンバーの能力に応じて割り振る Do it yourself. 自分でやる Question 8: The ‘perfect' language will: “完璧”な言語は Allow anybody in the world to program. 誰でもプログラムできるもの Allow me to make the best use of systems resources. システムリソースの best use をわたしにさせてくれるもの Question 9: You've been given a task to do that will take one man month, how big is the optimal team? あなたに一人月を要するであろう仕事が与えられました。 理想的なチームはどのくらいの大きさですか? 5 1 Question 10: When you program you: プログラミングのときあなたは Shut the door and the rest of the world out. ドアを閉めて自分の世界にこもる。 Share a desk with a peer and have group meetings often to discuss what to do next. 仲間と机を共有し、次に何を行うかを話し合うグループミーティングを頻繁に行う。 Question 11: White space should be: ホワイトスペースは Used sparingly あまり使わない Used everywhere どこででも使う Question 12: What is the ‘better' implementation: “より良い”実装とは? int main() { printf("5+6=%d", 5+6 ); return 0; } //////////////////////////////////////////////// // AddNumbers // param1 firstParam - The first value to add // param2 secondParam - The second value to add // return - The firstParam added to secondParam // int AddNumbers( int firstParam, int secondParam ) { // Here is some info int theReturn = firstParam + secondParam; // Now return the value return theReturn; } // Entry for program int main() { // Initialize variables int firstParam = 5; int secondParam = 6; // Call the function int returnValue = AddNumbers( firstParam, secondParam ); // Print out the value printf("%d+%d=%d", firstParam, secondParam, returnValue ); return 0; } For a full listing of the personality types, visit the key here
そうか。今月の定例リリースの日か。
Parrot 2.0.0 Released! | Parrot VM Parrot 2.0.0 News: Features o Context PMCs now support attribute-based introspection o Context and CallSignature PMCs merged into CallContext o .lex directive throws exceptions when used with incorrect register types Platforms o Packaging improved for free OS distributions o PPC, PPC64, and ARM now tested when running Linux Performance o Minor improvements to the profiling runcore o Improvements from the CallContext PMC merge New deprecations o In/out parameters in STRING modification functions o Void handling in NCI signatures o Parameter passing opcodes order in PBC Tests o Continued migration of core tests from Perl 5 to PIR Tools o dependency checker improved Miscellaneous o Deprecation cycle length changed to three months from six o GC accuracy improved o PMC freeze improvements; much more reliable o Makefile improvements for dependency handling Thanks to all our contributors for making this possible, and our sponsors for supporting this project. Our next release is 16 February 2010. Enjoy!
今ビルド環境ないんだよねえ。 再構築すっか。
なんで誤解がまかり通ってるんだろうか。 あ、事情はCも一緒で、よく見かける「配列は参照渡しされる」ってのは間違い。
Evaluation strategy - Wikipedia, the free encyclopedia Call by sharing Also known as "call by object" or "call by object-sharing" is an evaluation strategy first named by Barbara Liskov et al. for the language CLU in 1974[1]. It is used by languages such as Python[2], Iota, Java (for object references)[3], Ruby, Scheme, OCaml, AppleScript, and many other languages. However, the term "call by sharing" is not in common use; the terminology is inconsistent across different sources. For example, in the Java community, they say that Java is pass-by-value, whereas in the Ruby community, they say that Ruby is pass-by-reference, even though the two languages exhibit the same semantics. Call-by-sharing implies that values in the language are based on objects rather than primitive types. The semantics of call-by-sharing differ from call-by-reference in that assignments to function arguments within the function aren't visible to the caller (unlike by-reference semantics)[citation needed]. However since the function has access to the same object as the caller (no copy is made), mutations to those objects within the function are visible to the caller, which differs from call-by-value semantics. Although this term has widespread usage in the Python community, identical semantics in other languages such as Java and Visual Basic are often described as call-by-value, where the value is implied to be a reference to the object.
None to write rdoc.
本当は Ruby より Rails の資格があればいいんですけど・・・Rails はバージョンによって動作が変わりすぎなので、現実的ではないんでしょうね。
・きらいなもの
割り勘負け(笑)
8.0のアーカイブを解いてファイル名をつらつらと眺めていたら HACKINGなんつー名前のファイルが。こんなのあったっけ? と思って過去のものを遡って調べてみると、7.0→7.1の時点で入ったらしい。 んで、その二つの差分をなんとなく取ってみたw
--- pcre-8.00/HACKING 2009-10-04 18:27:04.000000000 +0900 +++ pcre-7.1/HACKING 2007-03-19 20:08:59.000000000 +0900 @@ -67,22 +67,22 @@ functions to work this way. This got rid of about 600 lines of source. It should make future maintenance and development easier. As this was such a major change, I never released 6.8, instead upping the number to 7.0 (other quite -major changes were also present in the 7.0 release). +major changes are also present in the 7.0 release). -A side effect of this work was that the previous limit of 200 on the nesting +A side effect of this work is that the previous limit of 200 on the nesting depth of parentheses was removed. However, there is a downside: pcre_compile() runs more slowly than before (30% or more, depending on the pattern) because it -is doing a full analysis of the pattern. My hope was that this would not be a -big issue, and in the event, nobody has commented on it. +is doing a full analysis of the pattern. My hope is that this is not a big +issue. Traditional matching function ----------------------------- The "traditional", and original, matching function is called pcre_exec(), and it implements an NFA algorithm, similar to the original Henry Spencer algorithm -and the way that Perl works. This is not surprising, since it is intended to be -as compatible with Perl as possible. This is the function most users of PCRE -will use most of the time. +and the way that Perl works. Not surprising, since it is intended to be as +compatible with Perl as possible. This is the function most users of PCRE will +use most of the time. Supplementary matching function ------------------------------- (略) @@ -126,23 +125,17 @@ These items are all just one byte long OP_END end of pattern - OP_ANY match any one character other than newline - OP_ALLANY match any one character, including newline + OP_ANY match any character OP_ANYBYTE match any single byte, even in UTF-8 mode OP_SOD match start of data: \A OP_SOM, start of match (subject + offset): \G - OP_SET_SOM, set start of match (\K) OP_CIRC ^ (start of data, or after \n in multiline) OP_NOT_WORD_BOUNDARY \W OP_WORD_BOUNDARY \w OP_NOT_DIGIT \D OP_DIGIT \d - OP_NOT_HSPACE \H - OP_HSPACE \h OP_NOT_WHITESPACE \S OP_WHITESPACE \s - OP_NOT_VSPACE \V - OP_VSPACE \v OP_NOT_WORDCHAR \W OP_WORDCHAR \w OP_EODN match end of data or \n at end: \Z @@ -151,13 +144,6 @@ OP_EXTUNI match an extended Unicode character OP_ANYNL match any Unicode newline sequence - OP_ACCEPT ) These are Perl 5.10's "backtracking - OP_COMMIT ) control verbs". If OP_ACCEPT is inside - OP_FAIL ) capturing parentheses, it may be preceded - OP_PRUNE ) by one or more OP_CLOSE, followed by a 2-byte - OP_SKIP ) number, indicating which parentheses must be - OP_THEN ) closed. - Repeating single characters --------------------------- @@ -419,4 +399,4 @@ data. Philip Hazel -October 2009 +November 2006
あ、いけね。逆方向で差分とってしまってる。 まあそれはそれとして、\K とかいろいろとPerlを追いかけてんだなあ。と感心。 実装も追いかけてみたいところだけど(5.xあたりに読んだのが最後かな)、 ちと時間やら余裕がなっしんぐ。
C でなくても 278のようなことをやりたくなる場面てままありますよね。 Perl や Ruby なんかだと ',' で join すれば。という話ですけど。
C言語なら俺に聞け(入門編)Part 59 278 デフォルトの名無しさん [sage] 2010/01/17(日) 16:49:29 ID: Be: 配列をカンマ区切りで出力するとき、以下のコードだと、 0, 1, 2, 3, と、最後にカンマがあって醜いですよね。 これを、 0, 1, 2, 3 というふうに出力するスマートな方法ってないですかね? #include <stdio.h> int main() { int i; int n[] = {0, 1, 2, 3}; for(i=0; i < sizeof n / sizeof *n; i++) printf("%d, ", n[i]); return 0; } 279 デフォルトの名無しさん [sage] 2010/01/17(日) 16:53:06 ID: Be: #include <stdio.h> int main() { int i; int n[] = {0, 1, 2, 3}; for(i=0; i < sizeof n / sizeof *n; i++) if (i) putc(','); printf("%d", n[i]); return 0; } 280 デフォルトの名無しさん [sage] 2010/01/17(日) 16:53:13 ID: Be: カンマが後ではなく前に付いていると考えればいい。 281 デフォルトの名無しさん [sage] 2010/01/17(日) 17:26:19 ID: Be: >>279-280 ㌧ 284 デフォルトの名無しさん [sage] 2010/01/17(日) 17:46:01 ID: Be: >>278-281 まぁスマートな方法なんて無いわな。 for(i=0; i < sizeof n / sizeof *n; i++) printf("%s%d",i?" ,":"", n[i]); 仕事で書くなら>>279的な書き方するけど、 残念ながらバグってる。 292 デフォルトの名無しさん [sage] 2010/01/17(日) 19:19:10 ID: Be: >>284 その3項演算子はダサい。3項演算子の魔術師と呼ばれた俺様が教授してやろう。 for(i=0; i < sizeof n / sizeof *n; i++) printf(i ? ", %d" : "%d", n[i]); 293 デフォルトの名無しさん [sage] 2010/01/17(日) 19:53:05 ID: Be: printfの魔術師ならこうだな。 printf( "%.*s%d", !!i, ",", n[i] ); 294 293 [sage] 2010/01/17(日) 19:55:32 ID: Be: つかこれで良かったか printf( ",%d"+!i, n[i] ); 295 デフォルトの名無しさん [sage] 2010/01/17(日) 19:56:02 ID: Be: printf("%s%d", ","+!i, n[i]); 296 デフォルトの名無しさん [sage] 2010/01/17(日) 20:29:58 ID: Be: 全然エレガントじゃないが、流れとしてはこうなんだよな i = 0; while (1) { printf("%d", n[i]); if (++i == sizeof(n)/sizeof(n[0])) break; printf(","); } ということは、 こんな感じにも出来るか? do { printf("%d", n[i]); } while (++i == sizeof(...) && printf(",")); 要素0をifで弾いたり、&&以下を評価しなきゃいけないのが美しくないが。 (後者は,演算子を使ってtrue相当にすれば条件分岐にはならないがもっと汚くなる) 298 デフォルトの名無しさん [sage] 2010/01/17(日) 20:34:18 ID: Be: printf("%d", n[0]); for(i=1; i < sizeof n / sizeof *n; i++) printf(",%d", n[i]);
279 のバグがすぐには気がつかなかった(恥)
この辺は用語が重複気味でわかりづらかったりしますよね
ふらっとC#,C♯,C#(初心者用) Part53 464 デフォルトの名無しさん [sage] 2010/01/17(日) 00:47:35 ID: Be: stringって参照型だと思ってたんだけど 以下のコードが上手くいかない どうしてでしょうか class Test { public static void Main() { string str = "入ってない"; change(str); Console.WriteLine(str); } static void change(string str) { str = "入った"; } } 465 デフォルトの名無しさん [sage] 2010/01/17(日) 01:04:39 ID: Be: stringクラスの説明読めばいいよ 466 デフォルトの名無しさん [sage] 2010/01/17(日) 01:05:52 ID: Be: stringは使う側から見ると値型みたいに見える参照型 change(str); の時点では "入ってない"の参照先が渡されてるけど str = "入った"とした時点で change()内のstrの参照先が変更されて新たに作られた"入った"を参照するようにされるから 参照元の引数にしたstrの方には影響が無い 467 デフォルトの名無しさん [sage] 2010/01/17(日) 01:09:59 ID: Be: >>464 参照情報を値渡ししてるんだからそういう挙動で当たり前。 468 デフォルトの名無しさん [sage] 2010/01/17(日) 01:10:40 ID: Be: >>466 string だからとか関係なく、すべての参照型で同じ挙動になるよ。 469 デフォルトの名無しさん [sage] 2010/01/17(日) 01:11:43 ID: Be: 参照型がコピーされるんじゃなくて 参照型に入ってる参照がコピーされてる string str = "入ってない"; のstrと change(string str) のstrは同じ参照が入った参照型だが、同じ参照型ではない 参照型ゲシュタルト崩壊 470 デフォルトの名無しさん [sage] 2010/01/17(日) 01:13:26 ID: Be: >>463 どうなってます? 471 デフォルトの名無しさん [sage] 2010/01/17(日) 01:14:27 ID: Be: ニホンゴムズカシイネ 472 デフォルトの名無しさん [sage] 2010/01/17(日) 01:18:10 ID: Be: そらそうよ 473 デフォルトの名無しさん [sage] 2010/01/17(日) 01:22:08 ID: Be: Cに置き換えたほうが「ポインタ変数に入ってるアドレスがコピーされてる」となってわかりやすいな(言葉的に) ちなみに参照型を参照渡ししたいなら以下のようにする class Test { public static void Main() { string str = "入ってない"; change(ref str); Console.WriteLine(str); } static void change(ref string str) { str = "入った"; } } 474 デフォルトの名無しさん [sage] 2010/01/17(日) 01:24:48 ID: Be: >>468 Listとか引数で渡しても元Listの要素の削除や追加とかできるぜ 475 デフォルトの名無しさん [sage] 2010/01/17(日) 01:27:22 ID: Be: 464のコードだと値とか参照とか関係なく 変わるな。 strのかわりにstructなのをいれようがclassをいれようが・・・ 476 デフォルトの名無しさん [] 2010/01/17(日) 01:28:05 ID: Be: str = "入った"; ↑ つまりこれがstringの新しいインスタンス生成になってるってことだよな 477 デフォルトの名無しさん [sage] 2010/01/17(日) 01:32:41 ID: Be: うん。 Person p1=new Person(); Person p2=p1; p2.name = "ビルゲイツ" だとp1.nameも変わるけど p2=new Person(); p2.name = "ビルゲイツ"; だったらかわらんしょ。 .nameとか入ってるから違う話になるけど。 478 デフォルトの名無しさん [sage] 2010/01/17(日) 01:33:26 ID: Be: 474には呆れる 479 デフォルトの名無しさん [sage] 2010/01/17(日) 01:35:17 ID: Be: >>91にもあったけど参照関係はしっかり理解してないと混乱するな 480 デフォルトの名無しさん [sage] 2010/01/17(日) 01:38:58 ID: Be: >>474 そんなの参照を渡してんだから当たり前だろ。 >str = "入った"; って、実際は >str = new String("入った") なんだよ。 だから>>464のコードをListで書き直すなら >list = new List(); になる。 これで元リストの要素に追加削除できると思う? 思うんなら思ってても別にいいけど外で喋るなよ。 恥ずかしいから。 481 デフォルトの名無しさん [sage] 2010/01/17(日) 01:41:05 ID: Be: >>480 もうちょっと落ち着いて、自分が書いたことを見直して。 482 デフォルトの名無しさん [sage] 2010/01/17(日) 01:42:06 ID: Be: つまりstringが他の参照型と違う点は、new string()てしなくても インスタンス生成ができるってことでいいのかな? 483 デフォルトの名無しさん [sage] 2010/01/17(日) 01:43:30 ID: Be: 参照型の混乱は変数という概念が出てくるときに必ず言われる 変数は「箱」ですっていうイメージが強すぎるのかね。 int x=10; xという名前の箱に10が入ってる!?みたいな? 484 464 [sage] 2010/01/17(日) 01:44:32 ID: Be: changeの中でstrが指すものを書き換えてると勘違いしてた strの参照先を変えてるだけだよな、そりゃそうだ ありがとう 485 デフォルトの名無しさん [sage] 2010/01/17(日) 01:47:45 ID: Be: >>482 ちょっと違うな string s = "あいうえお"; string t = "あいうえお"; this.Text = Object.ReferenceEquals(s, t).ToString(); 通常の参照型だとふつうに考えたら "あいうえお"はメモリのどっかに確保され また別の場所に"あいうえお"が確保され(二つの場所に"あいうえお") があるように見える。 しかしこれはひとつの領域を参照してるのでtrueになる。 486 デフォルトの名無しさん [sage] 2010/01/17(日) 01:49:48 ID: Be: >>485 stringは参照型なのに比較の時は参照比較じゃなくて値比較になると思った 487 デフォルトの名無しさん [sage] 2010/01/17(日) 01:52:17 ID: Be: これかな >string は参照型ですが、等値演算子 (== および !=) は、string オブジェクトの参照ではなく、 >値を比較するように定義されます。値を比較することで、文字列が等しいかを直感的にテストできます。 ttp://msdn.microsoft.com/ja-jp/library/362314fe(VS.80).aspx 488 デフォルトの名無しさん [sage] 2010/01/17(日) 01:53:10 ID: Be: あと string s="あいうえお"; string t="あいうえ"; string u="あいうえ"+"お"; これは参照もsとuはおなじ だがu=t+"お"とやるとuは"あいうえお"という文字列だが参照は異なる こんな風にややこしいから注意 string u="あいうえ"+"お"; string u=t+"お";//t="あいうえ" この二つ違うので注意 489 デフォルトの名無しさん [sage] 2010/01/17(日) 01:54:54 ID: Be: stringの仕様はややこしいんだな 490 デフォルトの名無しさん [sage] 2010/01/17(日) 01:57:00 ID: Be: この話題も定期的に出るような気がする 参照型は通常同じ文字列を比較しても参照するアドレスが違うので falseになるのが使い勝手悪いからという理由でC#は値比較で設計されたはず 491 486 [sage] 2010/01/17(日) 01:58:22 ID: Be: >>485は参照元比較の話だったから話が違ったようだ スマン 492 デフォルトの名無しさん [sage] 2010/01/17(日) 01:59:13 ID: Be: あえて文字列を生成したいならこうだね。 string x = new string( new char [] {'a', 'b', 'c'} ); 文字リテラルの代入はILレベルで専用命令がある。 考え方としては代入時にstringが生成されるというより、 あらかじめ生成済みのオブジェクトがはじめからそこにあると考えたほうが正しいと思う。 ldstr "abc" 493 デフォルトの名無しさん [sage] 2010/01/17(日) 02:02:53 ID: Be: >>490 最近FC#始めたばかりなのでこうゆう話題は勉強になる。 よく悩むのは参照関係だしね。
これで call by refernce/call by value が絡むと大混乱発生と。
ふらっとC#,C♯,C#(初心者用) Part53 91 デフォルトの名無しさん [sage] 2010/01/11(月) 16:00:23 ID: Be: 最近C#でプログラム始めたばかりなんだけど、動的配列にstructを入れると、 メンバを書き換えられなくなる原理がよくわからない こんなことしなきゃいいんだろうけど、理屈がわからなくてなんか気持ち悪い 参照型/値型、参照渡し/値渡しが動的配列でどうなってるか理解できないからだと思うけど public struct Sample1 { public string name; } static void Main(string[] args){ List<Sample1> SampList1 = new List<Sample1>(); Sample1 Samp1 = new Sample1(); SampList1.Add(Samp1); SampList1[0].name = "ゆきお"; }←ここでエラー 変数ではないためList<Sample1>.this[int]の戻り値を変更できません。 ────────────────────────────── public class Sample1 { public string name; } static void Main(string[] args){ List<Sample1> SampList1 = new List<Sample1>(); Sample1 Samp1 = new Sample1(); SampList1.Add(Samp1); SampList1[0].name = "ゆきお"; }← class+コレクションならコンパイル通る ────────────────────────────── public struct Sample1 { public string name; } static void Main(string[] args){ sample1[] SampList1 = new Sample1[1]; Sample1 Samp1 = new Sample1(); SampList1[0] = Samp1; SampList1[0].name = "ゆきお"; }← struct + 静的配列ならコンパイル通る あと、動的配列の中身を別の動的配列にコピーしたい場合、 動的配列2 = 動的配列1; でコピーした場合と、 Addメソッド使って、で要素を一つずつコピーした場合とで、 後でRemoveAtなんかでコピー先の要素を削除した時に 前者はコピー元の要素も削除され、後者はコピー元は影響無しの原理もよくわかってない 今ぐぐって調べてるけど、あまりに基本的過ぎる話のせいか初心者向けの解説無くて
「参照」を「値渡し」とかもうなにがなんだかw Java の呼び出しの解説なんかも日本語で書かれたのはほとんど間違ってるし。
私も車輪の再発明を繰り返して自分を鍛えてきましたので、効果がある事を実感しております。
Vim の正規表現には変わった機能として、マッチングの範囲を制限する機能があります。他の正規表現エンジンではあまり見かけない書き方ですが、 使い方さえわかれば非常に便利な機能です。
また、Vim の後読みは Perl と違い可変長パターンも扱えます。ただし後読みは少々重いので処理速度には注意が必要です。
varargsまたはstdargsな関数(プロトタイプがなかったり、宣言で...を使っていたり)を呼ぶときは %al に何個SSEレジスタを使ったか隠し引数で入れるよ。
・グラフ理論
数日前に、大学でも(バリバリの情報系じゃないけど、同様のことをやってた)グラフ理論
やった覚えないし、アルゴリズムの参考書にも載ってんの少なくないかとか
つぶやいてましたが、
手持ちの本でもよーーーーーーく確認してみると、
確かに全体の傾向としては薄手の本なんかは丸ごと記述がないとか、
ちょっとだけ(「さわり」でなくw)しか載ってないと云う感じなんですが、
アルゴリズムとデータ構造
この辺なんかは結構詳しく載ってました○| ̄|_
大学生のときにお世話になった先生に勧められて(当時としては)ちょっと無理して買った
本なんですけどねえ(苦笑)
それはさておき、岩波のこのシリーズは結構いいと思います。
さすがに新刊ではほとんど入手できないと思いますが、
図書館で借りられるとかあったら一度読んでみるのをオススメします。
お勧めはしますが、古い本ですのでその辺は注意した上でどぞ。
あとあれだ、このシリーズのコンパイラ本はかなりお世話になった。うん。
ソフトウェア科学 岩波講座 ソフトウェア科学 ■構成 全17巻 長尾 真,前川 守,川合 慧, 所 真理雄,米澤 明憲 編集委員 ソフトウェアの作成は人間的な作業で,信頼性や生産性の点でいまだに手工業の域にある.こう した現状をふまえ,ソフトウェア作成の方法を示すとともに,その理論と知識を整理し,新しい 学問体系として提示する. 〈 全巻の構成 〉 〔基礎〕1 計算システム入門 (所 真理雄) 〔基礎〕2 プログラミングの方法 (川合 慧) 〔基礎〕3 アルゴリズムとデータ構造 (石畑 清) 〔基礎〕4 プログラミング言語 (武市 正人) 〔環境〕5 プログラミング言語処理系 (佐々 政孝) 〔環境〕6 オペレーティングシステム (前川 守) 〔環境〕7 ソフトウェア実行/開発環境 (前川 守) 〔処理〕8 記号処理プログラミング (後藤 滋樹) 〔処理〕9 数値処理プログラミング (津田 孝夫) 〔処理〕10 グラフィクスとマンマシンシステム (中嶋 正之,川合 慧) 〔理論〕11 ソフトウェア科学のための論理学 (萩谷 昌己) 〔理論〕12 計算モデルの基礎理論 (井田 哲雄) 〔理論〕13 プログラムの基礎理論 (佐藤 雅彦,桜井 貴文) 〔知識〕14 知識と推論 (長尾 真) 〔知識〕15 自然言語処理 (長尾 真,佐藤 理史 編) 〔知識〕16 認識と学習 (安西 祐一郎) 〔展望〕17 モデルと表現 (米澤 明憲,柴山 悦哉)
なんか64ビットバイナリ作るのにも Pro 版買えとか鬼ですか。 さっきみたらスレッドに400以上コメントついてるし。
Microsoft kills Standard Edition with Visual Studio 2010 - entry price now $799 : programming I just noticed that Microsoft has cut Standard Edition out of the lineup for Visual Studio 2010. Unless you can live with the limitations of the Express Editions (such as no support for ATL/MFC or compiling 64-bit code), Microsoft is effectively raising Visual Studio's entry price from $299 to $799. * http://www.microsoft.com/visualstudio/en-us/products/2010/default.mspx * http://www.undermyhat.org/blog/2009/10/visual-studio-2010-roadmap-final-release-dates-known/ Given the increasing popularity of the Mac as a desktop application platform, I would have assumed Microsoft would make efforts to win the solo developer / individual hacker back to Windows. Instead, doesn't this amount to slamming the door in their face? For less than $799 I can buy a new Macintosh with the complete version of Xcode...
ム板ではあるひとつの話題に特定されたスレッドを立てるのは嫌われてますが、 これもそのひとつ。とはいえ結構伸びてたりすんですが。 まあ話の流れは1から見ていくよりないと思いますが
new/deleteで異常終了する(Visual C++) [chaika] 216 デフォルトの名無しさん [] 2010/01/16(土) 20:46:35 ID: Be: 201の発言をみて怖くなった。 この人は原因を把握しているのだろうか? 「落ちなくなったから正常に違いない」なんだろうか? 今までは「潜在的なバグがあるが偶然デバッグ版で動いていたがリリース版では動かなかった」で、 今は「潜在的なバグがあるが偶然デバッグ版でもリリース版でも落ちない」ではないだろうか? 最後に聞かせて欲しい。 不具合の原因はなんだったの? 初期化漏れ? コードの誤り? 「全く関係ないところを直したら落ちなくなりました」は原因じゃないですよ。
一遍目を通しておくと得られるものがあったりなかったりするかもしれません。
例によって人様のところで知ったのですが
Hena Hena Nikki ~悔い倒れの日々~(2010-01-16) * [computer] Perl Compatible Regular Expressions (PCRE) library を Mac OS X 10.6 にインストールする 事前に libreadline, zlib, bzip2 をインストールしておくと良い。 wget -c ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.00.tar.bz2 bzip2 -cd pcre-8.00.tar.bz2 | tar xvf - cd pcre-8.00/ (略)
いつの間に 8.0。 調べてみると昨年の10月辺りのようですね。 変更点とかチェックしとこう。
News about PCRE releases ------------------------ Release 8.00 19-Oct-09 ---------------------- Bugs have been fixed in the library and in pcregrep. There are also some enhancements. Restrictions on patterns used for partial matching have been removed, extra information is given for partial matches, the partial matching process has been improved, and an option to make a partial match override a full match is available. The "study" process has been enhanced by finding a lower bound matching length. Groups with duplicate numbers may now have duplicated names without the use of PCRE_DUPNAMES. However, they may not have different names. The documentation has been revised to reflect these changes. The version number has been expanded to 3 digits as it is clear that the rate of change is not slowing down. (NEWS から)
技術用語で、意味不明瞭の日本語に出会ったならば、必ず英語表記に立ち戻らなければなりません。 あやふやな言葉や文章の影には、必ず著者の誤解や無理解が隠れています。
友達から「副歴」という言葉を耳にし意味を聞いたのですが、全然わかりません。
タイトルはC/C++に関係していないので、タイトルの内容、「卒論」について回答させていただくと、 「卒論は、自らもしくは共著者とともに」作成するのが普通です。ここで回答してくれる人を全員共著者にされるおつもりなんでしょうか?
ゼロデイ状態が頻発する「Adobe Reader」の無償代替アプリを評価する - 情報漏えいと戦う現場から:ITpro
2004年に上野の国立科学博物館で開かれた「テレビゲームとデジタル科学展」の企画のお手伝いをさせていただいたのですが。今回は、そのときの国立科学博物館が共催というイベントです。
・真っ赤な五つの誓い
ふと
ウルトラ五つの誓いとは - はてなキーワード
な感じでプログラマー五つの誓いを作ってみようかしらんと思ったものの
* 一つ、腹ペコのまま学校に行かぬ事。
* 一つ、天気のいい日に布団を干す事。
* 一つ、道を歩く時には車に気を付ける事。
* 一つ、他人の力を頼りにしない事。
* 一つ、土の上を裸足で走り回って遊ぶ事。
ちょーーっと元のを活かすのは難しそうだなw
・こういうのを見ると
米O'Reilly、iPhone書籍「Version Control with Git」など23点公開 | パソコン | マイコミジャーナル
だんだん欲しくなってしまうではないか。
・ありがたや?
くだすれFORTRAN(超初心者用)その4 847 デフォルトの名無しさん [sage] 2010/01/17(日) 01:04:43 ID: Be: >>832,833,834,835 大変遅くなりましたがありがとうございました。 inquire文で行けそうです。 もう一つ質問ですが、動的配列を宣言するときにある次元だけ固定って できますか?まあ別にそうする必要は無いといえばないんですが、 宣言部を見ただけでどこが動的である必然性があるのか分かった方が 自分としてはスッキリするので。ちなみに DOUBLE PRECISION,allocatable::a(10,:,:) … allocate (CS(10,10,10)) とやったら金比羅にしかられました。 よろしくおねがいします。
金毘羅さまに叱られましたかw
char *p = "hoge"; が使えなくなる(左辺に const 修飾がないから)というはなしで
本の虫: 文字列リテラルのconst性について 歴史をみてみよう。文字列リテラルは要素数nのconst charの配列(array of n const char)だ というのは、そもそも、n0389で提案されている。これは、1993年にリリースされたペーパーだ。 文字列リテラルをconstにし、互換性のため、暗黙的にconstを消し去ることを許可しようという ものだ。 ということは、これ以降に出版されたC++の本は、言い訳できないはずだ。1993年のn0389リリー ス以降、すでにドラフト規格は、文字列リテラルはconstであると規定していた。少なくとも、 1994年以降のC++本で、何も説明せずに、文字列リテラルを非constなポインタに代入している参 考書は、規格を知らない浅はかな人間によって書かれた参考書である。
そんな以前から話があったとは。
アセンブラ言語やマシン語は覚えておくべきですか? 298 仕様書無しさん [sage] 2009/12/31(木) 13:38:03 ID: Be: 組み込みでもまともなOS使えれば全部Cで書けるからなあ。 読めたほうが色々便利だと思うけど。 299 仕様書無しさん [sage] 2009/12/31(木) 14:52:30 ID: Be: よく読め Cだけ理解していればいいのか? だぞ いいわけないだろ 300 仕様書無しさん [sage] 2009/12/31(木) 15:48:35 ID: Be: >>1 時代遅れな程に非常に基本的な事でも 完璧に理解していると言うのは大きな強みになるのではないかと。 ただ、C言語だけでいいかとか、アセンブリ言語をちょっと齧れば大丈夫かとか、 そういう馬鹿げた事考えているようなら先は見えてるかと。 とりあえず C言語でポインタと再起、アセンブリ言語でレジスタとスタックをそれぞれマスターして さらに余裕があればBasic系(Basic系、PASCAL、Fortran連中)とLisp系のプログラムを マニュアル見つつ読み書きできるようになれば とりあえずパッケージ系のプログラマとしては多分一生大丈夫だと思うぞ。 組み込み系ならx86以外の石も触っておいたほうがいいかと思う。 310 仕様書無しさん [] 2010/01/01(金) 20:19:51 ID: Be: >>299 アセンブラを理解しておいたほうがCでもいいはずだべ いざ処理がおかしい時アセンブルリストでアセンブラのバグを追える 311 仕様書無しさん [sage] 2010/01/01(金) 20:22:34 ID: Be: いやそういう意味じゃなくてCだけでいいわけないだろって話だろ Cが出来ればJavaやPHPやPerlなんていつでも出来るみたいに吹聴する奴いるけど 単にifやforの文法がほぼ同じなだけで各言語全然違うわけだし Cだけ知っていればOKなんて話はおかしいってことだよ 312 仕様書無しさん [sage] 2010/01/01(金) 20:45:12 ID: Be: だいたいCをしっかり出来る奴なんて5%くらいしか居ないんじゃないか? 313 仕様書無しさん [sage] 2010/01/01(金) 23:06:24 ID: Be: 5%も居ると思ってるの? 314 仕様書無しさん [sage] 2010/01/01(金) 23:41:40 ID: Be: アセンブラができないやつは馬鹿 315 仕様書無しさん [sage] 2010/01/02(土) 01:53:52 ID: Be: Cがしっかり出来なくても仕事で使う言語が出来ればいい Cができないからと言って貶される理由もないし Cが出来るからと言って他の言語も自動的に出来る訳じゃない 概してCプログラマが他の言語に手を出すと CならできるのにとかCのやり方と違うと言い出して嫌われるというオチがある 317 仕様書無しさん [sage] 2010/01/14(木) 02:23:52 ID: Be: ハードウェア理解度との相関って指標として 一般的な高級言語 ≦ C < アセンブラ ってのはあるとおもう。 ハードウェアを理解したからどうなんだって言われればそれまでだけどなー。 >>315 それ全部Cに限った話じゃないと思うが… 318 仕様書無しさん [sage] 2010/01/14(木) 02:50:22 ID: Be: > c言語だけ、理解していれば、プログラマーとして、大丈夫なのでしょうか? ってスレなんだからC言語だけじゃないよって話になってるんだろうに 319 仕様書無しさん [sage] 2010/01/15(金) 10:56:29 ID: Be: >ハードウェアを理解したからどうなんだって言われればそれまでだけどなー。 ド・モルガンだの、真理値表からの論理圧縮だのは プログラミングに活かせるな、と強弁。 320 仕様書無しさん [] 2010/01/15(金) 13:29:38 ID: Be: 時代遅れのプログラマーになりたい~♪
正直言って、やさしい~ よりは良い本だと思う。 ってあまり誉めたことにならない?(笑)
推薦図書/必読書のためのスレッド 53 985 デフォルトの名無しさん [sage] 2010/01/16(土) 12:34:43 ID: Be: ・明快入門コンパイラ・インタプリタ開発 C処理系を作りながら学ぶ(林晴比古実用マスターシリーズ) http://www.amazon.co.jp/dp/4797357037 神本確定だなこりゃ 986 デフォルトの名無しさん [sage] 2010/01/16(土) 12:40:23 ID: Be: 林晴比古というだけで少し心配なんだがそこんとこどうなのよ 987 デフォルトの名無しさん [sage] 2010/01/16(土) 16:52:24 ID: Be: 少しじゃなくてかなり心配だわ タイトルみたとき 「明快入門」で「んんっ?」と思って胡散臭さを感じ 「林晴比古」でそれが確信に変わった 988 デフォルトの名無しさん [] 2010/01/16(土) 17:21:06 ID: Be: 俺もスーパースター”まつもとゆきひろ”になりたい! って人のために、ここ数年処理系作成ブームだから 遅ればせながら本出してみましたって感じじゃないの。 単なる流行本だろう。 989 デフォルトの名無しさん [sage] 2010/01/16(土) 17:23:25 ID: Be: アジャイル本も流行本だしね 990 デフォルトの名無しさん [sage] 2010/01/16(土) 17:27:40 ID: Be: スーパースター(笑) 991 デフォルトの名無しさん [sage] 2010/01/16(土) 17:29:23 ID: Be: スーパーハカー()笑
「コンパイラ・スクリプトエンジン」相談室14 218 デフォルトの名無しさん [sage] 2010/01/16(土) 12:09:19 ID: Be: ・明快入門コンパイラ・インタプリタ開発 C処理系を作りながら学ぶ(林晴比古実用マスターシリーズ) http://www.amazon.co.jp/dp/4797357037 219 デフォルトの名無しさん [sage] 2010/01/16(土) 12:13:53 ID: Be: 林晴比古(笑) 220 デフォルトの名無しさん [sage] 2010/01/16(土) 12:21:08 ID: Be: 読んだことないから本当に風評通りに酷いのか分からん。 昔は酷かったが成長してるのかもしれんし。 221 デフォルトの名無しさん [sage] 2010/01/16(土) 17:15:16 ID: Be: 老化してるよ
ドラゴンブックやらタイガーブックでも平気という人はおいといて、 なんかやってみようかって入門者がはじめて読むのには、 やさしい~ よりはずっといいと思う。 ただまあ(省略されました)
などとふと思ったり。
Mozilla Firefox Thunderbird の拡張あれこれ-MEMO(2010年1月-2) 例えば、Perl では次のような連想配列を作ってみると、、 %sample = { "1" -> "ひー", "2" -> "ふー", "3" -> "みー" ) @keys = keys(%sample); で @keys は連想配列の 最初の方の数列だが、この場合だと "1"、"2"、 "3" からなるつまりキーの配列である.ところが Perl のキー配列は奇妙な振る舞い をする.普通配列であれば書き出した順番に $key[0] = "1"$key[1] = "2"、 $key[2] = "3" と並ぶと思うがそのように並ばない.メチャメチャな並び方をしてど ういう順番になるか解らない. $key[0] = "2"$key[1] = "3"、$key[2] = "2" かも知れない.つまりランダムに出してきた数字を添え字にして出てきたものは 何であるのか解らないのである.この例でランダムな数字からキーと対になっているバリューを 拾うのは、$sample[$keys[ランダムな数字]]でこの例だと "ひー"、"ふー"、 "みー" の何れかが出てくる. それが照合する方では普通の配列で平仮名を並べそれを送ってきた数字を添え字にして平仮名を 取りだして照合させても合わないのである.つまり、@shogou = ("ひー","ふー ","みー"); とやって送られてきた数字で $shogou[0] とやっても送ってきた書 き込まれた文字は "ひー" なのではなく "ふー" なのかも知れない.そこ で照合する方も連想配列にしたら問題なく照合できるようになった. 以前から Perl の連想配列の順番の解らなさには閉口してなるべく使いたくなかったが何故そん な風になっているのかが解った気がする.先ずソースの連想配列が JavaScript と違ってどんな だか解らない.想像できたとしても数字から幾つ目かは解らない.だからランダムに出てきた数 字を hidden に書き込んで置いてもソースを見たユーザーはその数字が何に対応するかは容易に は解らない仕組みなのである.その為にこそこういう奇妙なやり方を取っていることが理解でき た気がした.これを一応採用して載せておいたが HTML 版と変えたことには誰も気付かないであ ろう.
以前、ある言語ユーザーから別の言語ユーザーがどう見えるかというのがありましたが、 これは、Common Lisp ユーザーからの視点のみです。 How a Common Lisp programmer views users of other programming languages (vintage-digital.com) 例によっていくつかわからんネタが…
How a Common Lisp programmer views users of other programming languages : lisp A link from an old Reddit thread: includes Lisp as seen by various programming language users. http://i.imgur.com/1gF1j.jpgThat made me laugh out loud. Then again, it's late here, and I get a little goofy.Forth is the unabomber.. That means.. what.. it's powerful but has no rules? (edit: spelling)Perhaps because he was a Luddite, (well, not sure if any particular group.) and i did hear some Forth people say lisp was too complicated, less too the point. Imo a valid point for Common Lisp, probably, but hardly for lisps in general.Yeah, I can see that.. Bare metal, hates the affordances of modern languages..I love forth. I don't get it either haha.Smalltalk being Bill Nye was the funniest IMOI'm sorry, I can't hear you over the sound of how awesome I am.The Ruby one was fantastic. Japanese rock'n'roll super star!i loled at python thats really how python users seemFuck. I wish I didn't get these jokes.Factor is a Jedi if CL is Kirk because it's from another universe entirely, but is still very powerful and mysterious. Clojure is Locutus because he's a Star Trek character (lisp family) that has been "assimilated" by the JVM, which is probably considered evil due to its association with the Java language. C++ as C3P0 is pretty hilarious considering how useless he is compared to R2.Clojure is a terrifying meld of a beloved character and an unreasoning alien onslaught.The picture from PHP is famous due to a motivational poster involving the words Special, Olympics, and retarded. CL programmers love three things. themselves, CL and Star Trek. No idea about Clojure or Factor.See me ride out of the sunset On your colored TV screen Out for all that I can get If you know what I mean Women to the left of me Women to the right Ain't got no gun got no knife Don't you start no fight (Chorus) Cos I'm P.H.P. I'm Dynamite P.H.P. And I'll win the fight P.H.P. I'm a power-load P.H.P. Watch me Explode I'm dirty, mean and mighty unclean I'm a Wanted man Public Enemy Number One Understand So lock up your daughter And lock up your wife Lock up your back door And run for your life The man is back in town So don't you mess around (Chorus) (Guitar Solo) P.H.P. oi oi oi P.H.P. oi oi oi P.H.P. oi oi oi P.H.P. oi oi oi P.H.P. I'm Dynamite (oi oi oi) P.H.P. And I'll win the fight (oi oi oi) P.H.P. I'm a power-load (oi oi oi) P.H.P. Watch me explode
Ruby がジャパニーズロッカーって、誰の写真だよ!w あと、最後のPHPの歌ってどんなメロディなんだろう。
DO NOT WRITE A SERVER IN ERLANG JUST BECAUSE YOU HEARD ERLANG IS THE FASTEST AND MOST CONCURRENT LANGUAGE.
Erlang is not “made for multicore”. Erlang only just received SMP support in 2006!
A compiler from Curry to Haskell
・買った
web 連載のときから好きだったのよこれ。
まあプロジェクト X 的というかなんというか、この先ここで取り上げられているような
話はなくなっていくんだろうなあ。いろんな意味で。
ちょっと前のですが、まとめるの面倒だったの ○| ̄|_
スレ立てるまでもない質問はここで 102匹目 979 デフォルトの名無しさん [] 2010/01/07(木) 11:58:47 ID: Be: GPLのコードを自社サイトで開発しているソースコードに埋め込みたいのですが 埋め込んだら最後、自社のコードもGPLに汚染され、 無償公開しなければいけなくなってしまうと聞きました。 この理解は正しいでしょうか? 980 デフォルトの名無しさん [sage] 2010/01/07(木) 12:01:30 ID: Be: そのとおり。 981 デフォルトの名無しさん [sage] 2010/01/07(木) 12:04:05 ID: Be: GPLかつexeも公開されていたら、 それをそのまま呼び出すなら 本体は汚染されない。 982 979 [sage] 2010/01/07(木) 12:08:51 ID: Be: GPLコードを運用するだけなら公開しなくて良いってことでしょうか? あとコードを販売するなら公開する必要が有ありますか? 983 デフォルトの名無しさん [sage] 2010/01/07(木) 12:13:55 ID: Be: GPLコードを少しでも含んいて、コンパイルやリンクしたら出来上がった物もGPL。 GPLであってもexeやDLLの形で配布されている物を呼び出すだけなら、 自作の本体はGPLではない。 984 983 [sage] 2010/01/07(木) 12:16:06 ID: Be: 難しいですね ここの897の質問の回答はどれが正しいのでしょうか? http://pc11.2ch.net/test/read.cgi/php/1260247989/897- 987 デフォルトの名無しさん [sage] 2010/01/07(木) 12:27:12 ID: Be: >>984 コンパイルの無いスクリプトでも、GPLコードを自作コードで呼び出したらGPLでしょ。 自作コード内で、GPLコードが動作するかコンパイルされるかしたらGPL。 exe dllなら、自作コード内でGPLコードは動いてないから平気。 988 デフォルトの名無しさん [sage] 2010/01/07(木) 12:28:22 ID: Be: アドオンなど、後から追加機能としてユーザがGPLのものを入れるのなら汚染は無いが GPLの部分を最初から含めていたり 後から入れたとしてもそれがなければ成り立たないソフトでもアウト ソース出したくなければ近寄るなってことだ 989 デフォルトの名無しさん [sage] 2010/01/07(木) 12:29:59 ID: Be: >>985 間違い。第三者に修正版を頒布しない場合は、ソースコードを公開せずに修正版を自由に使うことが可能。 http://www.gnu.org/licenses/gpl-faq.ja.html#GPLRequireSourcePostedPublic 990 デフォルトの名無しさん [sage] 2010/01/07(木) 12:33:08 ID: Be: 自分で頒布しなくても、ソフトの存在が外に漏れて要求があれば ソースの公開の必要はあるだろ。 991 デフォルトの名無しさん [sage] 2010/01/07(木) 12:33:59 ID: Be: ありません。 Wikipediaのページも参照のこと。 http://ja.wikipedia.org/wiki/GNU_General_Public_License#.E3.82.88.E3.81.8F.E3.81.82.E3.82.8B.E8.AA.A4.E8.A7.A3 992 デフォルトの名無しさん [sage] 2010/01/07(木) 12:35:13 ID: Be: 自分以外にわたった時点で第三者に洩れてるし 993 デフォルトの名無しさん [sage] 2010/01/07(木) 12:36:43 ID: Be: 要するにGPLは「バイナリ」を取得した者に対しその「ソースコード」へのアクセスを確保させる というのを要求しているだけで、バイナリを持っていない者に対しては何の権利も与えてないのよ。 994 デフォルトの名無しさん [sage] 2010/01/07(木) 12:36:59 ID: Be: まあphpの場合、頒布しなくてもそのサイトの利用者はサーバー上で実行してるわけで これをどう解釈するかだなあ 995 デフォルトの名無しさん [sage] 2010/01/07(木) 12:40:08 ID: Be: >>991 しかし、制作者は販売先にソースコード公開するし、 それが制作者の知らぬ間に頒布されれば、そのときにコードが渡ることになるだろ。 もとの制作者が応じる必要は無いだろうが。 996 デフォルトの名無しさん [sage] 2010/01/07(木) 12:43:30 ID: Be: GPLコードを実行する、利用するだけなら、問題なし。 phpのソフトはどこにも公開してない辛菜。 997 デフォルトの名無しさん [sage] 2010/01/07(木) 12:51:25 ID: Be: >>995 GPLソフトウェアを購入してバイナリを受領した者は自由に下記を行ってよい。 - ソースコードを要求すること - 取得したバイナリ・ソースコードを一般に公開すること やらなくてもよい。 998 デフォルトの名無しさん [sage] 2010/01/07(木) 13:02:30 ID: Be: そんなことはない。 GPLの有料ソフトはすべて無料になる。 999 デフォルトの名無しさん [sage] 2010/01/07(木) 13:31:34 ID: Be: こんな終わり間近に釣りなんてしなくても 1000 デフォルトの名無しさん [sage] 2010/01/07(木) 13:31:58 ID: Be: 続きは次スレで
スレ立てるまでもない質問はここで@ム板 103匹目 8 デフォルトの名無しさん [sage] 2010/01/07(木) 12:41:25 ID: Be: GPLに詳しい人いないの 10 デフォルトの名無しさん [sage] 2010/01/07(木) 15:26:36 ID: Be: 前スレ >979 :デフォルトの名無しさん [] :2010/01/07(木) 11:58:47 >GPLのコードを自社サイトで開発しているソースコードに埋め込みたいのですが >埋め込んだら最後、自社のコードもGPLに汚染され、 >無償公開しなければいけなくなってしまうと聞きました。 >この理解は正しいでしょうか? GPLは無条件にソースの公開を求めるライセンスではありません。 「(バイナリの)再頒布」を行う場合に限り、「ソースの公開」が必要になります。 WEBサービスのためにGPLなコードを含むソフトウェアをサーバに設置するという行為は「再頒布」では無いので、 ソース公開の義務は発生しません。 販売する場合、販売した相手に対してソースを提供する手段を提供しなければGPL違反となります。 これを回避するためには - GPLなコードを非GPLなコードに置き換える - GPLなコードの著作権者と直接交渉し、非GPLな著作権契約を結ぶ - GPLv2第3項に基づき、相手にソースコードを入手する手段を保証する などが考えられます。 11 デフォルトの名無しさん [sage] 2010/01/07(木) 15:34:49 ID: Be: 例えば以下の2行のソースコードがGPLだったら $gplecho = "こんにちは"; echo $gplecho; この場合は公開しないといけないけど これを書き直して以下のようにすれば $konnitiwa = "こんにちは"; print $konnitiwa; 公開しなくてもいいってこと? 14 デフォルトの名無しさん [sage] 2010/01/07(木) 15:51:27 ID: Be: 公開しなくていいよ 15 デフォルトの名無しさん [sage] 2010/01/07(木) 16:01:52 ID: Be: >>11 「改変」だと「二次著作物」だから、GPLが適用されますが 「参考にして自分で書いた」のなら、それは貴方のオリジナル、 つまりGPLなコードとは別途の著作物なので 参考にしたコードのライセンス的な影響は受けないと考えます。 しかし、著作権がベースになっているので、 「参考」か「改変」かの判断にはどうしても主観的な判断が入ります。 最終的には裁判官の(主観的な)判断にゆだねられるでしょう。 (パクリではなくても似たようなコードがあれば疑いをかけられる可能性はあるわけなので、 リスク管理として腕の良い弁護士でも抱えておくと安心です。その時はぜひ当社に(キリッ)) >>11の具体例に関して言うなら、 ありきたりすぎて「創作的な表現」とはいえないので「著作権」を主張できない→GPLが無効と考えます。 17 デフォルトの名無しさん [sage] 2010/01/07(木) 16:19:00 ID: Be: >>11 GPLなコードの流用、改変部分だけ動的リンクにしてコードを公開し、 それ以外の部分は非公開にすれば、多分大丈夫だよ。 まだ判例が出ていないので、「多分大丈夫」としか言えないが、 「多分大丈夫」という事で世間は動いているようだ。 http://ja.wikipedia.org/wiki/GNU_General_Public_License#.E5.8B.95.E7.9A.84.E3.83.AA.E3.83.B3.E3.82.AF.E3.81.AE.E5.8F.96.E6.89.B1.E3.81.84 22 デフォルトの名無しさん [sage] 2010/01/07(木) 17:40:52 ID: Be: >>11 それで良い。ソースはrms。 UNIPRESSからGNU emacsはgoslingのコピペと言われて、それと同じ事をやった。 24 デフォルトの名無しさん [sage] 2010/01/07(木) 18:59:14 ID: Be: これか http://builder.japan.zdnet.com/news/story/0,3800079086,20370724,00.htm ビデオ:Gosling氏いわく「Emacsを使うのはやめようよ」
サーバー上で実行して、サービスとしてユーザーに結果を渡しているのなら。 って話ですね。
What I currently hate most about C++ What I currently hate most about C++ June 19th, 2009 by Nicholas Nethercote Everyone knows that global variables are bad and should be avoided wherever possible. Why? Because each global variable is, in effect, an implicit argument to every function that can see the global variable. The same thing is true of any non-local state. 誰もがグローバル変数が悪いものであり可能な限り排除すべきものであることを知っています。 なぜでしょうか? それは個々のグローバル変数が、実際にはそのグローバル変数を見ることのでき るすべての関数に対する暗黙の引数になってしまっているからです。同じことはすべての non-local な状態にも言えます。 And the presence of non-local state means that you can't reason locally about your code. That makes your code more complex, and complex code is likely to have more defects. そして non-local な状態の存在は、あなたのコードに reason locally できないようなものが あることを意味していますそういったものはあなたのコードをさらに複雑なものにし、複雑なコ ードはより defects になりがちです。 And the thing I hate about C++ (and other object-oriented languages) is that it vigorously encourages non-local state. そしてわたしが C++ (とその他のオブジェクト指向言語)で嫌っていることは non-local state を vigorously (精力的、活発に) に encourages していることなのです。 Non-local state within classes (クラスの中のローカルでない状態) First, of all, C++ encourages (nay, forces) non-local state within classes, because all class methods have access to all fields within a class, even the ones they don't need to. In other words, every class field is an implicit argument to every class method. This can work well for, let's say, a “Date” class, because the number of fields is small, and most class methods will access most fields. まず初めに言えるのは、C++ はクラス内部における non-local state を encourages (というよりは むしろ強制) しているということです。なぜなら、すべてのクラスメソッドはあるクラス内部のすべ てのフィールドにその必要がなかったとしてもアクセスするからです。言い換えると、すべての クラスフィールドはすべてのクラスメソッドに対する暗黙の引数 (implicit argument) である ということです。このやり方はたとえば “Date”クラスのようなものではうまく行くでしょう。 なぜなら、フィールドの数は少なくて、大部分のクラスメソッドがほとんどのフィールドにアク セスする可能性があるからです。 But problems appear when classes grow larger, when they start to look like what would be a whole module in a non-OO language like C. For example, Nanojit, the compiler core in TraceMonkey, contains a class called Assembler, which encapsulates the translation of Nanojit's low-level intermediate representation (called “LIR”) to assembly code. If you exclude members that are only included when debugging is enabled, there are 18 data fields and 102 methods. And some of those 18 data fields are pointers to objects that are themselves complex. しかし問題はクラスが大きく成長してC のような non-OO 言語におけるモジュール全体のように なってしまったときに顕在化します。例として、TraceMonkey のコンパイラーコアである Nanojit を挙げてみましょう。これには Assembler と呼ばれるクラスがあって、そのクラスは Nanojitの低水準中間表現(low-level intermediate representation, “LIR”と呼ばれます)か らアセンブリコードへの変換を encapsulates しています。ここでデバッグが有効なときにだけ 含まれるメンバーを展開して(exclude) みると18個のデータフィールドと102個のメソッドがあ ります。なおかつ、18個のデータフィールドの幾つかはそれ自身が複雑なオブジェクトへのポイ ンターになっています。 Let's consider a single field, _thisfrag, which holds a fragment of LIR code. It gets set via an argument passed into the method beginAssembly(). It then gets overwritten ? but with the same value! ? via an argument passed into the method assemble(). It is accessed directly in only 7 of those 103 methods: ここで _thisfrag という、 LIR コード片を保持する single field に注目します。このフィー ルドは beginAssembly() というメソッドに渡される引数経由でセットされます。ところがこれ は後になって メソッド assemble() に渡される引数によって「全く同じ値で」上書きされてし まうのです。直接アクセスするのは103個あるメソッドのうちのたったの7つだけです: * assemble(): which increments _thisfrag->compileNbr _thisfrag->compileNbr をインクリメントします * gen(), printActivationState(), asmspilli(): which use _thisfrag->lirbuf->names, but only when verbose output is asked-for _thisfrag->lirbuf->names を使いますが、verbose ouput が求められたときだけです。 * assignSavedRegs(), reserveSavedRegs(), assignParamRegs(): where parts of _thisfrag->lirbuf are read And that's just one example, which I chose because I'd been thinking about this problem and then just this morning I had to hunt down all those uses of _thisfrag in order to understand its purpose and whether I could change some related code safely. I'm sure a similar story will hold for a lot of the fields in this class. そしてこれはわたしが選んだ単なる一つの例です。それはわたしがこの問題について考え続けて いて、ちょうど今朝、_thisfrag などを使っている目的をすべて理解して関係するコードを安全 に変更できるかどうかを hunt down しなければならなかったからです。わたしはこのクラスの フィールドの多くで同じようなストーリーがあることを確信しています。 #まとまりの悪い訳文だ・・・ Just imagine, if you were writing Assembler as a C module, would you make _thisfrag a (module-level) global variable? Almost certainly not, you'd pass it only to the functions that need it; actually you'd probably only pass parts of _thisfrag around. But C++ encourages you to make everything a class, and stick everything a class ever needs in as a data field, creating lots of non-local state that complicates everything. ちょっと考えてみて欲しいのですが、もしあなたが C のモジュールとしてこの Assembler を書 いたとしたら_thisfrag をモジュールレベルでのグローバル変数にしたでしょうか? 大抵の場合 はそうではなく、必要な関数にだけ渡すようにしたでしょう。実際ところ、おそらくあなたは _thisfrag 付近のパーツだけを渡すことでしょう。けれども C++ はすべてをクラスにしてしま うことを推奨していて、すべてがクラスということに固執するとデータフィールドが必要になっ てしまうのです。 全てが複雑な non-local state を数多く作り出させる (An aside: Assembler probably also isn't a very good basis for a class because it's a *process*. I figure that if you'd write something as a struct in C, then it makes for a good class in C++. But I need to think about that some more.) (An aside:Assembler はおそらく、クラスというものの good basis でもありません。なぜなら それは *プロセス* だからです。もし C の構造体としてなにかを記述できたのならそれは C++ の正しいクラスとすることができるということをわたしは理解しましたが、もう少し考える必要 があるようです) Non-local state beyond classes (クラスをまたがるローカルでない状態) But it gets even worse. Good C++ practice encourages everyone to create private fields and use public get/set methods to access class data fields from outside the class. But get/set methods are just lipstick on a pig; all too often you end up with something like this example, again from the Assembler class: But it gets even worse. Good C++ practice はすべてのひとにprivate フィールドを作ってク ラスの外側からクラスのデータフィールドにアクセスするためのpublic な get/set メソッドを 使うことをencourrages しいいます。けれども get/set メソッドというものは lipstick on a pig にすぎません。 all too often you end up with something like this example, again from the Assembler class: private: AssmError _err; public: void setError(AssmError e) { _err = e; } AssmError error() { return _err; } Oh great, I feel much safer now. ぐっと安全そうになりました。 It would be better to just make _err public and avoid the get/set obfuscation; at least then it would be obvious how exposed _err is. It also saves you from having to check the definitions of error() and setError(). 単に _err を public にしてget/set obfuscation を avoid してしまうのが良いでしょう。 そうすれば最低限、 error() や setError() の定義をチェックしなければならない手間も なくしてくれます。 Even better, in this case _err gets set from various places within class Assembler, but also from various places outside class Assembler. I've tried twice to simplify this, by passing error codes around explicitly instead of implicitly through this quasi-global variable, but both times I was defeated by the complexity of the control flow governing how _err is accessed, in particular the fact that's it's set on some control paths but not others. This is a big part of the reason why out-of-memory handling in Nanojit is a total nightmare. Even better, _err の set は Assembler クラスの様々な場所でセットされているだけでなく、クラスの外側 でも色々なところでセットされていたのです。わたしはこの quasi-global 変数を通してエラー コードを暗黙的にやり取りするのではなく明確な形で渡すようにすることでこのクラスを単純化 することに二度挑戦しましたが、_err がどのようにアクセスされるのかを決定する制御フロー の複雑さ特に、ある制御パスではセットされるのに別の制御パスではセットされないといったこ とが理由で二度とも defeated されましたこれが、Nanojit における out-of-memory handling がまったくの悪夢 (total nightmare)であることの理由の big part です。 The end result Currently Nanojit has a number of large, complex classes, and many of them link to other large complex classes. At many points in the code there is a bewildering amount of accessible non-local state. (And I haven't even mentioned how this can complicate memory management, if you end up with multiple pointers to objects.) The complexity caused by this is a tax on development that we are all paying daily. 現状で、Nanojit は大量の複雑なクラスを抱えていて、その多くがまた別の大規模で複雑なクラ スに対するリンクを持っているのです。そしてコードの至るところにアクセス可能な non-local state があります。 (And I haven't even mentioned how this can complicate memory management, if you end up with multiple pointers to objects.) わたしたちが日々全てを支払っている開発に対する税金によって complexity が引き起こされています。 A better way (よりよい方法) Before joining Mozilla, I spent three years programming in a functional language called Mercury. Mercury entirely lacks global variables (except for some very restricted cases which are rarely used). This means that you have to pass more data around as arguments than you do in C++. But it also means that when you look at a function, you know exactly what its inputs and outputs are, and so you can use purely local reasoning to understand what it does. This is an *enormous* help, and one that's easy to underestimate if you haven't experienced it. Mozilla に参加する以前に、わたしはMercury と呼ばれる関数型言語でのプログラミングを三年 ほどやっていました。Mercury にはグローバル変数と呼ばれるものが全くありませんでした(ほ とんど使われることのない非常に限定されたケースを除きます)。これはC++ でプログラムを書 いているときよりも引数としてより多くのデータを渡さなければならないということですが、そ れはある関数に注目したときにその関数に関する入力と出力がなんであるかを正確 (exactly) に知ることができるので、関数が何をしているのかを理解するために purely local reasoning を使うことができるということでもあります。 This is an *enormous* help, and one that's easy to underestimate if you haven't experienced it. Obviously we're not going to rewrite Firefox in a functional language any time soon. And of course non-local state is necessary sometimes. But even C is better than C++ in this respect, because at least in C global variables are obvious and everyone knows that you should minimise their use - the language doesn't actively encourage you to put non-local state everywhere and let you feel good about it. Information hiding is one of the fundamental principles of programming, and object-oriented programming is meant to promote it, but unless you are very disciplined it tends to do the opposite. わたしたちが近々に Firefox を関数型言語で書き直すことは予定されていませんし、そしても ちろん、non-local state が必要となることもあります。けれども C でさえ this respect の C++ よりも良いのです。なぜなら、C であればなにがグローバル変数なのかがはっきりとわかり ますし、誰もがその使用を最小限に留めておくべきだということを知っているからです - the language doesn't actively encourage you to put non-local state everywhere and let you feel good about it. 情報隠蔽 (Information hiding) はプログラミングにおける根本原則 (fundamental principles) の一つでありオブジェクト指向プログラミングはそれを推進しているのですが、あなたが very disciplined でなければ反対のことを行ってしまいがちなのです。 So next time you are thinking about adding a field to a class, ask yourself: is it really necessary? Could it be passed in as an argument instead, or something else? Can you make your life easier by avoiding some non-local state? ですから次回あなたがあるクラスにフィールドを追加することを検討する機会がきたときには 自分自身に問い掛けて欲しいのです: これは本当に必要なのだろうか? それは引数として渡すことはできないか? あるいは別の方法はないのか? 幾つかの non-local state を取り除くことで 人生を easier にできないか?
組み込み分野のCプログラマーのレベルが下がったとか何とかあるんですが Embedded systems programmers worldwide earn failing grades in C : programming Embedded C Quiz | Netrino
まとめている余裕がなっしんぐ。 どんな問題が出るのか知りたいのだけど、 試験を受けるにはユーザー登録しなければならないようで。 reddit のほうにそれらしいのが書かれてはいますがどうなんかなあ。
Embedded systems programmers worldwide earn failing grades in C : programming Embedded systems programmers worldwide earn failing grades in C (embedded.com)The test: Which of the following is a correct way to write the value 0x1234 to physical memory address 0x5678? * * (uint16_t * const) (0x5678) = 0x1234; * * (uint16_t * const) (0x1234) = 0x5678; * uint16_t * p = (uint16_t *) 0x5678; p = 0x1234; * uint16_t * p = (uint16_t *) 0x1234; p = 0x5678; Which ANSI C compilers allow a variable to be declared both volatile and const? * All ANSI C compilers allow this * No ANSI C compilers allow this; it is a K&R C holdover * Most ANSI C compilers allow this * Only the GNU C compiler allows this Which of the following code snippets can be used to reset the least-significant bit of x? * x &= ~0x01; * x | ~0x01; * x & 0x01; * x & ~0x01; Which of the following items should generally be declared using C's volatile keyword? * A memory-mapped peripheral status register * A global variable used within an interrupt service routine * A global variable used by multiple tasks in a multi-threaded application * All of the above Which of the following statements accurately describes the meaning of the declaration int * const x;? * x is a constant pointer to an integer * x is a pointer to a constant integer * x is a constant integer value * None of the above; it's an invalid C declaration Which of the following statements accurately describes a use of C's static keyword? * A variable declared static within the body of a function maintains its value between function invocations * A variable declared static outside the body of a function can only be accessed by functions within the same module. * Both * None; static is used for function declarations Which of the following statements accurately describes the intended effect of the declaration int (* a)[10];? * An array of ten integers * A pointer to an array of ten integers * An array of ten pointers to integers * An array of ten pointers to functions Which of the following constructs can be used to create a portable infinite loop in C? * while (1) { ... } * for (;;) { ... } * loop: ... goto loop; * All of the above Which of the following is the most flexible way to declare a C preprocessor macro that takes two arguments and returns the smaller of their two values? * #define MIN(A, B) ((A) < (B) ? (A) : (B)) * #define MIN(A, B) ((A < B) ? A : B) * #define MIN(A, B) A < B ? A : B; * #define MIN(A, B) { if (A < B) A; else B; } Which of the following is the most portable way to declare a C preprocessor constant for the number of seconds in a (non-leap) calendar year? * #define SECONDS_PER_YEAR (60 * 60 * 24 * 365) * #define SECONDS_PER_YEAR (60 * 60 * 24 * 365UL) * #define SECONDS_PER_YEAR 60 * 60 * 24 * 365 * #define SECONDS_PER_YEAR 60 * 60 * 24 * 365;
C++ のもあるらしいから、闇の反逆軍団の方々は受けてみるといいと思うよ! でも組み込み向けっぽいから、Boost とかは出てこないような希ガス。 Embedded C++ Quiz | Netrino
理由を見ると、こっち方向もありなのか。と思ったり。
AskHaskell: C++ for Haskell programmers? : haskell I'm trying to (re)learn C++ (the job market for Haskell programmers being pretty limited). However, 3 years of Haskell completely changed my habits and general view of programming. So my question is, is there a C++ book/text/tutorial/whatever aimed and/or well-suited for Haskell (or just functional) programmers? Lists of pitfalls, and ways to adapt functional designs to C++ are also welcome.
the job market for Haskell programmers being pretty limited
うーむ。
コンパイラさんだって皆のために頑張ってるんです。C の include を引きずってる上に template まで展開させられて、 コンパイラさんは本当に本当に頑張っているんです。皆のためなんです。頑張ってる人のこと、思ってみてくださいよ。 ようし、俺も皆のために頑張ろう!そんな気持ちになりませんか?ならない人は人間じゃなくて悪魔です。
実装者一身上の都合により、ブログの更新を停止いたします。
Welcome to the PC Game Programmer's Encyclopedia on the World Wide Web!
次回は2月27日です。第3章が対象。発表担当は高橋会長です。
Javaのチェック例外のユーザビリティが悪い、という事例を持って「検査例外という概念そのものが良くない」を語ることはできまい。
Javaにおけるthrows句は、メソッドシグネチャの一部であり、インターフェイスにも現れる情報である。 今まで「Javadocは仕様だ」と言い続けて来たが、正確にはインターフェイス(シグネチャ+Javadoc)が仕様だ。*1
・いいわけ
昨日のPHPの6ですけど、「Perlでも同じことできんじゃん」
という指摘がありました。その通りです ○| ̄|_
でまあ、すでに存在している変数をあのようにシンボリックリファレンスの形で
アクセスすることはできても、存在していない変数を作るのはできない
と思ってたんですね。なぜか。
まあ、いまどきは use strict されてて当然、シンボリックリファレンス
(ソフトリファレンス)はご法度という流れですし、ゆるしてちょんまげ。
・超電磁砲
OPが新しいのに替わりました。
が、どっちがいいかというのはさておいて、
2クール作品の途中で替えるってのはどんなもんなんですかねえ。
禁書目録のときも途中で替わったけど。
reddit のスレもコメントが400とかいっとるなあ。
I Have No Talent // RailsTips by John Nunemaker January 12, 2010 Posted by John RailsKits Peepcode I Have No Talent (僕に才能なんて無いよ) The other day someone sent me an IM and thanked me for my open source contributions. They then said something about wishing they had my gem/code creation talents. I didn't miss a beat and informed them that I have no talent. 何人もの人が僕にインスタントメッセージを送ってきて、オープンソースに対しての僕の貢献 (contiributions) にお礼の言葉を言ってくれた。そのあと彼らは、自分にも gem や コードを 書く才能があったらいいのにといった願望を口にした。僕はそれを見逃さず彼らに、僕には才 能なんてないんだということを知らせた。 It is true. I have no talent. What I do have is a lot of practice. And I am not talking about occasionally dabbling in Ruby on the weekends. I am talking about the kind of practice where I beat code that isn't working into submission (though often times the code wins). これは本当のことだ。僕には才能なんて無い。僕がやったことはたくさんの practice をこなす ことだ。週末 Ruby に手を出して遊んでいることについてのことではなく、 kind of practice where I beat code that isn't working into submission (though often times the code wins). についてお話しよう。 # beat code ってのはコーディングするってことなんだろうか The kind of practice where all of a sudden I realize that it is 2am and I'm exhausted physically so I should go to bed, but mentally I feel on fire so I let the code have me for another hour or two (I imagine this state to be like a marathon runner or ironman near the end of their race). # 午前二時くらいになると体は疲れきっているけれども精神面はまだ一、二時間は # できそうな感触だと。これはゴール間近のマラソンや鉄人レースのランナーと # 似たようなもんだろうとか何とか。 The kind of practice that leads to a GitHub profile stuffed with code I regret (and am embarrassed about, but don't delete to remind me of where I once was) and code I am proud of (not near as much as I am embarrassed about though). # githubのプロファイルに、不満足なコード(削除してはいけない)と満足いくコード # とを放り込んでいく。 Intelligence 知性 I am also not very smart. I have a good memory (though my wife will tell you it has some missing pieces) and I work really hard. Really hard. I get that from my dad. He is also not very smart (his words, not mine), with a good memory and works really hard. :) 僕はそれほど賢いわけでもない。僕には優れた記憶力があって(ただし妻に言わせるとちょっと 欠けてるピースがあるらしいのだけど)、一生懸命働いている。本当に一生懸命に。僕はこれを 父から教わった。父もまたとても賢くはなかったけれど(これは彼自身の弁で、僕がそう思って いるわけじゃない)、すごれた記憶力を持っていてとっても一生懸命に働いている。 :) I am sick of hearing people say, “Oh, I love your code, I wish I could do that.” You can. The only reason you can't is because you don't practice enough. I used to think that I wasn't smart enough. I was jealous of those that did crazy code stuff that I couldn't even comprehend. Then, one day, I ran into something I did not understand and instead of giving up, I pushed through. 「あなたのコードはとても素晴らしいですね。自分もこのようにできたらいいのに」と他人が言 ってくるのを聞くと僕はうんざりしてくる。キミにもできるんだ。キミが自分にはできないと言 ってしまうのは、キミが十分に practice していないだけのことなんだ。僕は自分がそれほど賢 くはないと思いつづけていた。僕が理解することさえできないようなイカれたコード書きの才能 に嫉妬していた。そしてある日のこと、僕は自分が理解できなかったことをあきらめずに突破し た (pushed through) んだ。自分のコンピューターの前に何時間も座り込んで、クラスやクラス のインスタンス変数と格闘したんだ。 That day was a turning point for me. It was the last time I thought that whether or not I was successful depended on my talent or intelligence. It really comes down to hard work people. Ever since then, I have attacked each thing that I do not understand until I understand it. その日が僕にとって転換点となる日だった。それは、僕が自分の才能やら知性に頼って成功でき るかどうかを考えた最後の瞬間だったそういった瞬間は一生懸命働く人に訪れる。それ以来僕は、 自分が理解できないことには理解できるようになるまで attack している。 I will close with this. I still suck. There are still so many people out there who are far better than I am, but that does not stop me anymore. I do not measure myself against the programming greats, but against those projects on my Github profile from years ago. この辺でこの話は終わりにしよう。I still suck. 僕よりもずっとずっとできのいい奴なんて幾らでもいる。 それでも僕はもう自分の歩みを止めたりはしない。 僕は programmiing greats (プログラミングの天才連中とでもする?) と 自分とを比べるようなことはしないけれど、数年前の自分との比較を github のプロファイルを使ってするんだ。
reddit での表現はこちらを→ I Have No Talent : programming
そゆこと。
10 PHP functions you (probably) never use When scripting in PHP, we often restrict ourselves to a limited number of API functions: the common ones, like print(), header(), define(), isset(), htmlspecialchars(), etc. If some needed functionality doesn’t exist, we often write it making use of these basic components which we have in mind. The PHP API actually offers a lot of functionality, some useless and some useful; often seldom used. I have been looking through the available functions and was interested to find some really cool functions that I should have known about. Here, I share my findings. 1. sys_getloadavg() 2. pack() 3. cal_days_in_month() 4. _() 5. get_browser() 6. debug_print_backtrace() 7. metaphone() 8. natsort() 9. levenshtein() 10. glob()
関数型プログラミング言語Haskell Part11 434 デフォルトの名無しさん [sage] 2010/01/15(金) 01:06:21 ID: Be: haskellやOcamelの系統で lispのstalinに相当する 処理速度が早いコンパイラはありませんか? 435 デフォルトの名無しさん [sage] 2010/01/15(金) 01:26:57 ID: Be: >>434 http://mlton.org/ 436 デフォルトの名無しさん [sage] 2010/01/15(金) 10:26:34 ID: Be: Haskellなら、 生成されるコードの性能なら普及率とかまで考えたら今のとこGHC。 だいぶ前に論文ではもっと高性能だという話だったGRINってのがあって、 それを使ったコンパイラUHCというのがちょっと前のハカソンでリリースに なってるようだ。 437 デフォルトの名無しさん [sage] 2010/01/15(金) 11:48:27 ID: Be: GHCという言語もあるんだがなぁ 名前変えろよボケ GlasgowやめたんならGlasgow Haskell Compilerなんて名前は変えればいいのに。 438 デフォルトの名無しさん [sage] 2010/01/15(金) 11:57:32 ID: Be: 死んだ言語のことなんて一々気にしてられない 439 デフォルトの名無しさん [sage] 2010/01/15(金) 13:09:16 ID: Be: >>438 カチンとくる書き込みするなぁ。並列処理の記述に関しては HaskellはGHCの足元にも及ばないよ。 440 デフォルトの名無しさん [sage] 2010/01/15(金) 14:07:09 ID: Be: 他言語のことなんてどうでもいいがね。 まずボクシングが思い浮かぶ俺もどうかと思うけどw 441 デフォルトの名無しさん [sage] 2010/01/15(金) 14:19:00 ID: Be: 論理言語スレとかならともかく、このスレで言っても意味ないこと言わんでくれ。 442 デフォルトの名無しさん [sage] 2010/01/15(金) 18:46:07 ID: Be: >>440 プロレスだろ。ノアの至宝だ
GHC → ボクシングってがわからん。
途中で面倒くさくなったw
Notation, and the 'business case' for Perl 6 Notation, and the 'business case' for Perl 6 [ #40052 ] A few days before Christmas, I was sitting in the car with my father. I decided to try to explain why I'm spending time doing Perl 6. クリスマスの数日前、わたしは父と同じ車にいました。 わたしはなぜ自分が Perl 6 に時間を費やしているのかを説明するのを試みました。 I compared the evolution of programming languages with the evolution of mathematical notation. In maths, it was tricky to imagine the concept of zero before it was formalized down to a number; the idea of derivatives was tossed around in vague forms before Newton and Leibniz made notations for it; we slowly but surely got a standard way of saying "is equal to". And so on. わたしはプログラミング言語の進化と数学的記法 (mathematical notation) の比較をしました。 数学において、ゼロが数字として形式化される以前には、ゼロというコンセプト(concept of zero)をイメージすることはtricky なことでした。また、derivatives のアイデアは、ニュート ンやライプニッツがその表記法を確立するまでは曖昧な表記で放置されていました。わたしたち はゆっくりと、しかし確実に "is equal to"などをあらわすための標準的な方法を得 てきたのです。 And so on. I was just about to connect this back to how each new programming language can be seen as a contribution to an ongoing, open debate about notation within the programming world, one that has only been going on in earnest for half a century or so. But I never got that far, because my father interrupted me and asked what the business case is for Perl 6. I was half stumped, half amused by this interjection. I didn't have a good answer for him, besides trying to explain FOSS and the fact that we're not developing Perl 6 with the expectation that someone will buy it from us. But I still felt he had a point; so, earlier today, I took the question to #perl6, and got a set of good replies and musings by Su-Shee++, moritz++, vorner++ and mdxi++. If you have time, do read it. わたしはこの interjection (不意の叫び、感嘆の声) によって困り果てたと同時に、半ば楽し んだのです。わたしは彼に対する良い回答を持ち合わせていませんでしたが、さらに FOSS (フ リーソフトウェアおよびオープンソースソフトウェア)がどういったものなのかや誰かがわたし たちから (Perl 6を) 購入することを期待して Perl 6 の開発をしているのではないことを説明 しようとしていました。 But I still felt he had a point; そこで今日の朝早くに #perl6 で質問してみたところ、Su-Shee++, moritz++, vorner++, mdxi++ から good replies and musings が返ってきました。時間があったらあなたも読んでみて ください。 I'll have to give the 'business case' train-of-thought a lot more time to mature before I can say anything coherent about it myself. But I'd like to say a bit more about notations. #成熟させるためのより一層の時間 #Train of thought≒つらつらと考え事をする Perl 6 isn't truly revolutionary in a lot of respects. It's mostly lots and lots of minor improvements. (The exception being, I think, things surrounding grammars. Those are truly revolutionary.) Perl 6 は truly revolutionary in a lot of respects ではなく、地道な改良の積み重ねです (文法に関してはその例外であるとわたしは確信しています。Perl 6 の文法は本当に 革命的 (revolutionary) なものです)。 What Perl 6 does do, is provide a 'strangely consistent' notation where a lot of thoughts, with practice, are easy to express. This is very much in the Perl spirit, and the main reason (according to me) to still call Perl 6 a language in the Perl family. Perl 6 が行っていることとは、実践的でありながら表現が容易な 'strangely consistent' な表記法を提供することです。これは Perl の精神 (Perl spirit) にとてもマッチしていると 同時に、Perl 6を Perlファミリーに属する言語と今でも呼んでいる主な理由です。 The notational convenience really consists of a thousand little things, but here are a few haphazardly chosen examples: notational convenience は本当にたくさんのこまごまとしたことがら (a thousand little things) からなりたっていますが、ここに幾つか haphazardly chosen examples しました: * The prefix symbols ?, + and ~ have been co-opted to signify conversion to the `contexts' Bool, Num and Str, respectively. This parallels their use in binary (infix) operators specific to those contexts, such as +, ~, ?&, +&, and ~& 前置シンボルの ? や + 、~ は Bool、Num、 Str といった“コンテキスト”に対する co-opted to signify conversion になっています。この同類である +, ~, ?&, +&, and ~& といった (中置型)二項演算子はそれが使われるコンテキストを特定します。 * The three short and common verbs is, has and does all do useful work in the OO system. Not only that, but they are a good fit for what they do, and summarize both established and modern OO research. 三つの短い一般的な動詞 (verb)は OOシステムにおいて便利に働きます。そればかりではなく、 それらは目的とすることに対して good fit しています。ここでは established and modern OO research の両方をまとめます。 * Some syntactic/semantic features are re-used where you least expect it, reducing the total number of independent components in the language. The left-hand side of a list assignment uses the same signature mechanism as do routines. (I.e. the (Bool $a, Int $b, Str $c) in my (Bool $a, Int $b, Str $c) = True, 42, 'foo'; is the same kind of beast as in sub foo(Bool $a, Int $b, Str $c) { ... }.) Smartmatching with ~~ is implicitly re-used in when expressions, and the given/when construct is re-used as the CATCH exception handling mechanism. And so on. いくつかの syntactic/semantic な機能は再利用されます。少なくともあなたが期待する場所で は言語における独立したコンポーネントの総数を少なくします。リスト代入の左辺はルーチンを 実行するときと同じシグネチャーの機構を使用します。たとえば my (Bool $a, Int $b, Str $c) = True, 42, 'foo'; という式での (Bool $a, Int $b, Str $c) は sub foo(Bool $a, Int $b, Str $c) { ... } と同類のものです。~~ を使ったスマートマッチングは when 式で暗黙のうちに再利用され、 given/when 構造は CATCH 例外ハンドリング機構として再利用されています。 It's things like these that I think make Perl 6 a convenient, attractive notation for thinking about programming. Seeing that notation come alive, and seeing people use it in cool new ways for amazing ends, is the main reason I spend time helping with Perl 6. こういったことは、 Perl 6 を便利にしてプログラミングについての思考を attractive する表 記であるとわたしは考えています。この表記が come alive するのを見たりを見ることが、わた しが Perl 6のために時間を費やしている主な理由なのです。
■雪だるまフェア始まるよ~
SQLが本当に簡単なら、なぜ本屋にあれほどの量の入門書が積まれているのでしょう?
・C++er
十数人? ついったで follow してたりしますが、元気だなあ。
・「チェンバロを鳴らせ」
謎。
・例の本
今日辺りが正式な発売日だったんで、ぼつぼつ見かけた人も出てきている模様。
まあもうちょっと時間をいただいてそれなりにまとめますが、
一言で言うと「良くも悪くも前世紀の本を思わせる内容」
であればこそ、ドラゴンやらタイガーよりもこの本のほうが役に立つ、身になるという
人もいるとは思います。が、(省略されました。続きを読むには…)
・DVDやらBDやら
ひだまりどーすっかなー。
p オプションて前からありましたっけ? 5.8.8 あたりで増えたっぽいのですが perldelta にそれらしき記載ないし。
Regexp Quote-Like Operators
Here are the quote-like operators that apply to pattern matching and
related activities.
qr/STRING/msixpo
This operator quotes (and possibly compiles) its STRING as a
regular expression. STRING is interpolated the same way as
PATTERN in "m/PATTERN/". If "'" is used as the delimiter, no
interpolation is done. Returns a Perl value which may be used
instead of the corresponding "/STRING/msixpo" expression. The
returned value is a normalized version of the original pattern.
It magically differs from a string containing the same
characters: "ref(qr/x/)" returns "Regexp", even though
dereferencing the result returns undef.
(略)
Options are:
m Treat string as multiple lines.
s Treat string as single line. (Make . match a newline)
i Do case-insensitive pattern matching.
x Use extended regular expressions.
p When matching preserve a copy of the matched string so
that ${^PREMATCH}, ${^MATCH}, ${^POSTMATCH} will be defined.
o Compile pattern only once.
でも手元の5.8.8のソースアーカイブとは内容違うんだよなあ。perlop。
=head2 Regexp Quote-Like Operators
(略)
Options are:
c Do not reset search position on a failed match when /g is in effect.
g Match globally, i.e., find all occurrences.
i Do case-insensitive pattern matching.
m Treat string as multiple lines.
o Compile pattern only once.
s Treat string as single line.
x Use extended regular expressions.
If "/" is the delimiter then the initial C<m> is optional. With the C<m>
you can use any pair of non-alphanumeric, non-whitespace characters
as delimiters. This is particularly useful for matching path names
that contain "/", to avoid LTS (leaning toothpick syndrome). If "?" is
the delimiter, then the match-only-once rule of C<?PATTERN?> applies.
If "'" is the delimiter, no interpolation is performed on the PATTERN.
まあ、勘違いとか思い違いもあって突っ込まれてますが。
DevtheWeb.NET's Blog » Blog Archive » Things You Probably Didn’t Know About PHP Things You Probably Didn't Know About PHP PHPに関してあなたがおそらくご存じないこと Date: 12 Jan 2010 Comments: 9 so far I've spend some time reading about cool things in PHP. I found some interesting functions and tricks. Here's the list: そして幾つかの興味深い機能とトリックを見つけました。 以下にご紹介しましょう: 1. You can compress/decompress long strings before storing them in a database. It can be done very easy using the built-in functions: gzcompress() and gzuncompress(). They use gzip algorithm and could compress a string up to 90%. 長い文字列を、データベースに格納する前に compress/decompress (圧縮/伸張) することができます。 それを行うのもとても簡単で、組み込み関数の gzcompress() と gzuncompress() を 使うだけです。 これらの関数は gzip アルゴリズムを使っているので文字列を90%くらいに圧縮できます。 2. You can check if a email is valid by the checkdnsrr() function. It checks the email's host address if it's a valid DNS record. あるメールアドレスが正当なものかどうかを checkdnsrr() 関数によって検査することができま す。この関数はそのメールのホストアドレスが正当な DNS レコードかどうかを検査します。 For ex. tihomir@devtheweb12782.com is semantically a valid e-mail, but devtheweb12782.com is not a valid host. That's why checkdnsrr() will return false. 3. Output formatted PHP code, you can do it by using the highlight_file() function. This function will return a HTML formatted string with nicely colored PHP inside it. highlight_file() 関数を使うことでフォーマットされた PHP コード (formatted PHP code) を 出力することが可能です。この関数はHTMLで書式化された文字列を返します 4. You don't need to store IP addresses as strings. IPアドレスを文字列として格納する必要がありません。 They can be stored as integers using the ip2long(). The integer converted IP addresses can be converted again to string using the long2ip() function. Storing IP address as integers has some advantages: ip2long() を使ってIPアドレスを整数として格納することが可能です。この整数値に変換された IPアドレスは long2ip() 関数を使って再度文字列に戻すことができます。IPアドレスを整数と して格納することには幾つかの利点があります: * reduce storage space – 4 bytes instead of 15 characters (15 bytes) 格納のためのスペースを縮小します * searching by IP address will be faster IPアドレスを使った検索が高速になります * easiest to check if IP address falls within IP ranges IPアドレスがあるIPレンジにあるかどうかを最も簡単に検査できます 5. Easily unpack numeric arrays using the well-know function … list :) Look at following code for swapping two variables' values: 数値配列を、良く知られた関数である list を使って簡単に unpack できます :) 二つの変数の値を交換する以下のコードに注目してください: $a = ‘value 1′; $b = ‘value 2′; list($a, $b) = array($b, $a); echo $a; // it will output value 2 echo $b; // it will output value 1 Have you ever seen better code for swapping two variables' values !? 二つの変数の値を交換するのにこれほど better なコードを見たことがありますか? 6. You can use composition of variables. I don't how it can be useful, but the following code is valid: 変数の合成ができます。わたしは有用な例を思いつきませんでしたが、 以下のコードは正しいPHPコードです: ${‘a' . ‘b'} = ‘c'; echo $ab; // it will output c c を出力 7. You can handle the situation when a class that doesn't exist is instantiated – just need to implement the __autoload function. This function is called transparently by PHP when a class that doesn't exist is instantiated. 存在していないクラスをインスタンス化しようというシチュエーションに対処することが可能で す。必要なのは __autoload 関数を実装するだけです。この関数は、存在していないクラスをイ ンスタンス化しようとしたときにtransparently に呼び出されます。 8. Split string to array of strings using preg_split function. It can be done using the explode function. But using preg_split function, the empty strings will be eliminated: preg_split 関数を使って文字列を文字列の配列に分割できます。これは explode 関数でもでき ることですが、preg_split 関数を使った場合には空文字列は削除されます: $str = “a,b,,c,,d,,e”; $strArr = preg_split(“~,~”, $str, -1, PREG_SPLIT_NO_EMPTY); // it will returns array(‘a','b','c','d','e') I hope you've found something useful in the examples above :)Copyright 2009 - 2010 © Tihomir Ivanov. All Rights Reserved. Follow Us on Twitter
6. はなんというか…これぞPHPという感が。
redditから。
What are programming lost arts? - Stack Overflow Have you ever programmed raw machine code (not for class)? Examined a hex dump with just a hex editor (or, heck, without)? Written your own software floating-point library? Division library? Written a non-school-assignment in Lisp or Forth? What sort of "lost arts" have been forgotten? And what reason (if any) would there be to resurrect them?
続きは明日っ(笑)
LTE(Long Term Evolution)とは現行の携帯電話の技術を発展させた次世代の無線技術のことであり、標準化団体3GPP (3rd Generation Partnership Project)においてリリース8として規定された通信規格のことを指します。
・とろける鉄工所
イブニングの、いつも巻末辺りに載っている作品。
今回のクレーン操作のエピソードは良かった。うん。
深夜アニメの時間帯でのCMで、R.O.D の BD BOXのがよくかかるのだけど、 やっぱあの曲良いなあ。
推薦図書/必読書のためのスレッド 53 944 デフォルトの名無しさん [sage] 2010/01/12(火) 16:05:47 ID: Be: 先輩方とPCの話をすると必ずといっていいほど PC-98、パソコン通信、TK-80あたりが話題に上ってくるので 日本のコンピューター史についてまとめてある本を紹介して貰いたいのですがあるでしょうか? 945 デフォルトの名無しさん [sage] 2010/01/12(火) 16:41:56 ID: Be: 今更そんなの勉強したってなんにもならないけど思うけど。 946 デフォルトの名無しさん [sage] 2010/01/12(火) 18:53:30 ID: Be: だな おっさんの昔話に付き合う暇があるのなら 新しいこと学んだ方がずっと有意義 947 デフォルトの名無しさん [] 2010/01/12(火) 19:29:48 ID: Be: >>944 日本のコンピュータ史を学ぶよりは 当時のパソゲーの情報を入手したほうが 話が合うと思うぞ koeiのナイトライフとか。 948 デフォルトの名無しさん [sage] 2010/01/12(火) 20:01:39 ID: Be: 中古の98くらいなら安く売ってたりしないのか? 949 デフォルトの名無しさん [sage] 2010/01/12(火) 20:14:51 ID: Be: >>944 研究者は多いはずだけど知らないなぁ。 「パソコン温故知新」っていう本は読んだことがある。意外におもしろかった。 950 デフォルトの名無しさん [sage] 2010/01/12(火) 20:22:14 ID: Be: へーそうなんですか~ って聞いてやればいいじゃん。おっさんは聞かせたがってるんだよ 951 デフォルトの名無しさん [sage] 2010/01/12(火) 20:40:49 ID: Be: 聞いてあげるのも社交辞令って奴だろ もしくはもっと最先端の話をすればいいんじゃないの? 952 デフォルトの名無しさん [sage] 2010/01/12(火) 21:01:27 ID: Be: 聞いてあげることができない奴は昇進しない 953 デフォルトの名無しさん [sage] 2010/01/12(火) 21:08:36 ID: Be: 余計な出世したくないから話を聞かない 954 デフォルトの名無しさん [sage] 2010/01/12(火) 23:47:21 ID: Be: おっさんが相手だと、同じ話を何回もしてくるから、 初めて聞いたフリをするのが大変だよな 955 デフォルトの名無しさん [sage] 2010/01/13(水) 00:39:02 ID: Be: 部長それ4回目ですよ^^ 956 デフォルトの名無しさん [sage] 2010/01/13(水) 01:05:04 ID: Be: >944 こんなのどうよ http://www.amazon.co.jp/dp/4756146783/ 茶飲み話のネタにはなるし、読んでてそこそこ面白かった 957 デフォルトの名無しさん [sage] 2010/01/13(水) 01:08:18 ID: Be: >>956 タイトルだけで象印賞が貰えるレベル 958 デフォルトの名無しさん [sage] 2010/01/13(水) 01:15:43 ID: Be: http://www.amazon.co.jp/dp/4822283194 こっちにしようぜ 959 デフォルトの名無しさん [sage] 2010/01/13(水) 01:33:43 ID: Be: PC88とか出てこないだろ 960 デフォルトの名無しさん [sage] 2010/01/13(水) 02:10:04 ID: Be: http://www.amazon.co.jp/dp/4756144195/ http://www.amazon.co.jp/dp/4756148832/ http://www.amazon.co.jp/dp/4756148832/ http://www.amazon.co.jp/dp/4756145914/ この辺は? TK80とかの話とかも多少書いてあったような気がしないでもない。 961 デフォルトの名無しさん [sage] 2010/01/13(水) 07:10:46 ID: Be: 最近の子はパソコン起動したらBASICが立ち上がる環境なんて 信じられんだろうね 962 デフォルトの名無しさん [sage] 2010/01/13(水) 07:37:30 ID: Be: ラジオやテレビで流された音をカセットテープ に録音して、パソコンに聞かせるとプログラムが ロードされるなんて、夢にも思わないだろうな。 963 デフォルトの名無しさん [sage] 2010/01/13(水) 09:42:51 ID: Be: >>944 昔のPC板へどうぞ http://gimpo.2ch.net/i4004/ 964 デフォルトの名無しさん [sage] 2010/01/13(水) 11:17:35 ID: Be: サッポロシティスタンダードかw いまでもMODEM端子残ってるPCなら似たようなことは出来るかな っつーか最近の子供は写真を現像する感覚が理解出来ないらしいぞ 一昔前はコード付きの電話を不思議がってたみたいだが 965 デフォルトの名無しさん [sage] 2010/01/13(水) 11:25:01 ID: Be: >>964 マイク or LINE入力 からサウンドカード経由でプログラムロードするソフトなら既にあるよ フィルムやフロッピーを見たことない子供が居ても不思議じゃないな 966 デフォルトの名無しさん [sage] 2010/01/13(水) 13:50:53 ID: Be: >>964 > っつーか最近の子供は写真を現像する感覚が理解出来ないらしいぞ こどもと言うより平成生まれかな。 大学生でもフィルムカメラ使ったことないってやついるぞ。 967 デフォルトの名無しさん [sage] 2010/01/13(水) 13:59:35 ID: Be: いいからスレタイ読めよ
956 が紹介しているのは「計算機屋かく戦えり」か。いいぞ、あれは(笑) まああの手のノリが(ってまあインタビューの集まりなんだけどね) 合わない人はいるかもしれない。
【Perl,PHP】LLバトルロワイヤル8【Ruby,Python】 364 デフォルトの名無しさん [sage] 2010/01/12(火) 15:57:30 ID: Be: 人気プログラミング言語ランキング ‐ PHP、C++を抜いて3位 http://journal.mycom.co.jp/news/2010/01/12/022/ 365 デフォルトの名無しさん [sage] 2010/01/12(火) 16:28:08 ID: Be: 不景気を反映してるなw 底辺PHPerはシェアくらいしか自慢できるものがないからな。 366 デフォルトの名無しさん [sage] 2010/01/12(火) 21:18:51 ID: Be: PHPerがシェアの多さを自慢なんて、聞いたことないな >>365はPerlerかい?涙拭けよ。 と言うか、それシェアを表したもんじゃねーじゃん。 367 デフォルトの名無しさん [sage] 2010/01/13(水) 00:03:59 ID: Be: >>363 スクリプター = ITドカタのイメージを払拭したいからつい必死になっちまうんだよ・・ 368 デフォルトの名無しさん [sage] 2010/01/13(水) 07:33:03 ID: Be: PHP研究所 369 デフォルトの名無しさん [sage] 2010/01/13(水) 07:54:36 ID: Be: >>366 他に自慢できるものがないから必死。 370 デフォルトの名無しさん [sage] 2010/01/13(水) 08:20:52 ID: Be: 俺は差別とPHPが大嫌いだ 371 デフォルトの名無しさん [sage] 2010/01/13(水) 08:38:22 ID: Be: なぜ楽したいやつが面倒臭い言語を選ぶのか 372 デフォルトの名無しさん [sage] 2010/01/13(水) 09:44:04 ID: Be: ・PHPは一概に人件費が安い ・PHPerは仕事には困らないが金は余らない。 ・PHPerは基本的に使い捨てなのでいずれ他の言語を覚えるはめになる ・ベテランPHPerほど悲しいものはない ・PHPは小型開発がすぐできる。お問い合わせフォームとかお手の物(CSRF脆弱性付き) ・PHPは大型案件には向かない(実際あまり見かけない) ・それでも勢いで作っちゃうとメンテナンスで泣くことになる。 ・上手く作れば・・・という奴がいるが、うまく作ってあるところを見たことがない ・Perlerは一概に人件費が高い ・Perlerはいつも仕事に困っている。が、単価はでかい ・なので安定大手に囲われたラッキーなベテランPerlerは家くらいすぐ建ててしまう。 ・しかしそんなラッキーな奴はごく少数。 ・Perlerは小型開発でもつい凝ってしまうので顧客に嫌われる(セキュリティばっちり)。 ・しかし現実にはCSRFなんてmixiとかアメーバレベルじゃなきゃそうそう起きない ・Perlは大型案件には向いている ・でも他人が作ったコードが全然読めなかったりするし今だにKENT的スパゲティコードは存在するので、 一概に保守性が高いとは言えない ・とはいえuse strictさえしていればPHPよりははるかにマシ。
PHP は…正直良くわからんな。
こういうことしたがる人って割と見かけるよなあ。 考え方としてはそれほど不自然ではないってことなんだろうか。
VBの変数をPHPの仕様みたく…… - Yahoo!知恵袋 変数上で文字列として扱っているデータを変数名として扱えないでしょうか? 例をあげると dim str as string = "anser" dim anser as string = "success" msgbox(XXX(str)) としてメッセージボックスにsuccessが表示されるような関数か、それ以外の実現方法が、もし あれば教えてください。 あるいは、PHP等のスクリプト系言語以外でこのような文字列の扱いができる言語があれば教え てください。 宜しくお願いします。
二日ほど前についったでも言及しているのを見かけたけど、 誰か訳してくれないかなあ。 自分でやるにはネタが難しすぎるw
The C Programming Language: 4.10 The C Programming Language Brian W Kernighan & Dennis M Ritchie & HP Lovecraft 4.10 Recursion C functions may be used recursively; that is, a function may call itself either directly or indirectly. Uninquiring souls may take this as just another peculiarity of those C folk, of whose ways their neighbours speak little to outsiders but much among themselves. (略) I never heard of C Recursion till the day before I saw it for the first and? so far? last time. They told me the steam train was the thing to take to Arkham; and it was only at the station ticket-office, when I demurred at the high fare, that I learned about C Recursion. The shrewd-faced agent, whose speech shewed him to be no local man, made a suggestion that none of my other informants had offered. (略) And yet I saw them in a limitless stream? flopping, hopping, croaking, bleating? sorting themselves inhumanly through the spectral moonlight in a grotesque, malignant saraband of fantastic nightmare. Their croaking, baying voices called out in the hideous language of the Old Ones: void Rlyeh (int mene[], int wgah, int nagl) { int Ia, fhtagn; if (wgah>=nagl) return; swap (mene,wgah,(wgah+nagl)/2); fhtagn = wgah; for (Ia=wgah+1; Ia<=nagl; Ia++) if (mene[Ia]<mene[wgah]) swap (mene,++fhtagn,Ia); swap (mene,wgah,fhtagn); Rlyeh (mene,wgah,fhtagn-1); Rlyeh (mene,fhtagn+1,nagl); } // PH'NGLUI MGLW'NAFH CTHULHU! Recursion may provide no salvation of storage, nor of human souls; somewhere, a stack of the values being processed must be maintained. But recursive code is more compact, perhaps more easily understood? and more evil and hideous than the darkest nightmares the human brain can endure. Exercise 4-12. Adapt the ideas of Cthulhu() to write a recursive version of the Forbidden Song of Hali; that is, to unravel the fibres of reality and allow the icy liquid darkness of Carcosa to devour your mind. Exercise 4-13. Write a function reverse(s) which reverses the string s by turning the mind inside out, converting madness into reality and opening the door to allow the Old Ones to creep forth once more from their sunken crypt beyond time.
訳すのにSAN値のチェックが必須だったりして。
その他の概念は、今まで積極的に日本語で解説された本が出ていないので、一般的な単語がないのです。
・例の本
今日はぜんぜん読めなかったでごじゃるよ○| ̄|_
Java to c++ guides - Stack Overflow Are there any good guides online to prime an advanced Java user for advanced C++ in a short period of time?
最初についたコメントが「ねーよ、そんなの」な感じだったけど、さて。
んー、マニュアル読めば二つ目の質問も解決するはずなんだけどねえ。
awk leaks memory on RHEL5_64 Hi, I have discovered that awk leaks memory on a rhel5_64 box awk '{if(FILENAME=="file1")interested[$1]=1; else if(interested[$1])print}' file1 file2 Here file1 is about 40MB in size, with about 500K records. file2 has about 220MM records and is about 9GB in size. awk process grows to 13GB + in size $ cat /etc/redhat-release Red Hat Enterprise Linux Server release 5 (Tikanga) $ uname -r 2.6.18-53.1.14.el5 $ awk --version GNU Awk 3.1.5 $ rpm -q gawk gawk-3.1.5-14.el5 $ rpm -q glibc glibc-2.5-12 Regards, Jeetu
Re: awk leaks memory on RHEL5_64 Greetings. Re this: (ry) Gawk is not leaking memory; your program is not doing what you think it's doing. Try: awk '{if(FILENAME=="file1")interested[$1]=1; else if($1 in interested)print}' Then read up about associative arrays in the gawk manual. Arnold
Re: awk leaks memory on RHEL5_64 Hi Aharon, Thanks for point out the mistake. I have been using gawk for 4-5 years now, and never realized that the array would initialize an element even if I referenced a non-existent member. Sorry about the incorrect bug report. But I have to say, this is very non-intuitive behavior. $ awk 'BEGIN{a[1]; a[2]; for(i in a){print i}}' 1 2 Regards, Jeetu
参照しただけでエントリが作成されるってことでいいはずだけどなあ。 if の条件式の中でもそれで作成されてるはずだから。
Why do stacks typically grow downwards? - Stack Overflow I know that in the architectures I'm personally familiar with (x86, 6502, etc), the stack typically grows downwards (i.e. every item pushed onto the stack results in a decremented SP, not an incremented one). I'm wondering about the historical rationale for this. I know that in a unified address space, it's convenient to start the stack on the opposite end of the data segment (say) so there's only a problem if the two sides collide in the middle. But why does the stack traditionally get the top part? Especially given how this is the opposite of the "conceptual" model? (And note that in the 6502 architecture, the stack also grows downwards, even though it is bounded to a single 256-byte page, and this direction choice seems arbitrary.) Thanks!
PA-RISC 位しかスタックの伸張方向が高位アドレスに向いているのを知らないけど、 ほかにもあるのかなあ。 二、三日追いかけてみるとしよう。
向井さんのところの衛星の名前を見てふと思ったのですが、 日本以外だとどんな傾向の名前なんでしょうか。 思い浮かぶ名前だと、スプートニクとか(笑)。 あと、ジオットとかいうのありませんでしたっけ?
http://www.jmuk.org/diary val it: α → α = fun 『コロぱた』の登場人物名元ネタを紹介するよ 『コロぱた』というゲームがありまして、面白そうだなと思ってたんですが、ふとその登場人物 一覧を見たらどう見ても人工衛星です本当にありがとうございました。でも、そうだということ はわかったとしても、実際のところどういう人工衛星かまでは案外知られていないんじゃないで しょうか。私もそんな詳しくないんですが、軽く調べたので紹介したいとおもいます。
ひまわり あすか もも こだま つばさ きらり のぞみ しんせい はるか おおすみ ひのとり ふじ2号 ジオテール
最近のNASAAが飛ばしているやつはあまり面白みがないような気もする。
BASIC 派からの反論。
BASIC-256 - Programming for Kids Why BASIC is Still Relevant When anyone asks if their children should learn BASIC, there is always a vocal group that says "NO! It teaches all the wrong things! Learn a modern language like (insert favorite language here)." But this is nonsense. 誰かに対してその人の子供たちに BASIC を学ばせるべきかを尋ねると、「とんでもない! BASIC を教えるなんてことはまったく間違ったことです! (あなたの好きな言語名をどうぞ) のような modern な言語を教えるべきです」と主張する vocal gourp が常に存在します。しかしその主張 は nonsense なのです。 Just as spoken languages are tools we use to communicate ideas to other people, computer languages communicate ideas to a computer. What's really important is knowing what you want the computer to do, what idea to comunicate. The language you use to express that is largely irrelevant, as long as it works for your purposes. For the purposes of writing simple programs and games, BASIC works just fine, and has for years. 普段会話に使っている言語が、わたしたちが別の人と考えをやり取りするのに使うものであるよ うにコンピューター言語はコンピューターと考えをやり取りするためのものなのです本当に重要 なことはあなたがコンピューターにさせたいことを知ることでありコミュニケートのための考え です。 The language you use to express that is largely irrelevant, as long as it works for your purposes. 簡単なプログラムやゲームを書くという目的のためにはBASIC はもってこいであり、 何年もの間使われてきているのです。 But as for the argument that learning BASIC will hinder further progress in learning about computers, why would that be true? It's not true for spoken languages. Nobody ever said, "I wish I never learned English, because I had to un-learn so many bad habits to learn Japanese." People who learn many spoken languages say it gets easier the more you learn, because you can relate them to each other and recognize patterns. It's the same for computer language, probably even more so, since computer languages are much more similar to each other than spoken languages are. ではなぜ、BASIC を学ぶことがコンピューターの学習のさらなる進歩を妨げてしまうのだ といった主張がなぜ真になるのでしょうか? それは自然言語については真ではありません。 今まで、"I wish I never learned English, because I had to un-learn so many bad habits to learn Japanese." のように言った人はいません。 複数の spoken languages を学ぶ人は学ぶ言語が増えるほど言語は習得しやすくなると言ってい ます。それは、各々を関連付けることとパターンを認識することが可能になるからです。それは コンピューター言語についても同じことであり、おそらくはそういった傾向がより強いものでし ょう。なぜならコンピューター言語は自然言語同士よりも互いによく似たものだからです。 The problem is, "What programming language should my child learn?" is not the right question to be asking. The ultimate goal is not to teach students "how to program." The goal should be to teach them how computers work. Once you understand how computers work, you get the "how to program" part almost for free. At that point, it's just a matter of syntax. 問題は、"What programming language should my child learn?" (わたしの子供が学 ぶべきプログラミング言語って何?) ということが尋ねるべきことではないことにあります。最 終的な目標 (ultimate goal) は学生たちに "how to program."(プログラムの書き方) を教えることではなく、コンピューターがどのように動作しているのかを教えることなのです。 コンピューターの動作を一度理解できれば、「プログラムの書き方」の大部分をものにしていま す。ここで重要なのは単にその構文なのです。 So how do you make someone understand these ideas that make computers work? Well, it's an interesting question. I guess it would depend on your audience, how much time you had, and probably a thousand other factors. Currently there are about three distinct methods for teaching computer science. あなたなら、コンピューターを動作させるという考え方をどのように理解させますか?それは興 味深い疑問です。わたしは、それはあなたの audience や、どのくらいの時間をあなたが持って いるのか、その他にも数多くの要素によって決まるものではないかと思っています。現時点では、 コンピューター科学を教えるための手法には大まかに云って三種類あります。 The first the traditional approach, which teaches students how to program in the latest industry standard language. My college used this approach. Prior to when I enrolled, students learned C. I learned C++, and now they teach in Java. I struggled, like everyone else, with classes and pointers. I don't know what the current students struggle with, but I'm sure it's not pointers, because they don't exist in Java. I'm not sure when the current students learn pointers, or if they're expected to learn that later on their own, like we were expected to learn how linkers worked, what the compiler was actually doing when we hit the green button, etc. Maybe they never learn what pointers are. 第一が伝統的なアプローチであり最新の industry standard language を使ってどのようにプロ グラミングをするのかを学生に教えるというものです。わたしの通っていた大学ではこのアプロ ーチを採用していて、わたしが入学する以前には、学生たちは C を学んでいました。わたしは C++ を学び、現在の学生たちは Java を教えられています。誰もがそうであったように、わたし もクラスとポインターとに苦戦しました。今の学生たちが何に苦戦しているのかわたしにわかり ませんが、それはポインターではないだろうと確信しています。なぜなら Java にはポインター が存在しないからです。わたしには、現在の学生たちがいつポインターを学んでいるのかはよく わかりませんし、どのようにリンカーが動作しているのかとか自分たちが緑のボタンを押したと きにコンパイラーが実際に何をしているのかなどといった、わたしたちが学ぶことを期待してい たようなことを彼らが後に学ぶことを期待していいのかすらわかりません。おそらく彼らはポイ ンターが一体なんであるかを学ぶことは決してないことなのでしょう。 This brings up a dilemna. Either pointers are obsolete, or they're being glossed over in the current computer science curricula. If they're obsolete, my college did a disservice to me by teaching me a faddish programming construct like pointers in CompSci 101. But if they're still valuable, then the current students are getting the short end of the stick by not learning them early. これはジレンマを引き起こします。ポインターとは、時代遅れ (obsolete) の代物か、さもなけ れば現在のコンピューター科学の curriclua における glossed over (曲解、誤解) されたもの であるかのいずれかです。もしポインターが時代遅れの代物であるのならわたしが通った大学は、 ComSci 101 でポインターのような fadissh なプログラミングの構造をわたしに教えることによ って、ひどい仕打ちをしたことになります。そうではなく、未だ価値のあるものであるのなら、 早くにポインターを学ばないことで現在の学生たちは getting the short end of the stick してしまうということになります。 The traditional approach will always have this drawback. The higher the level at which they teach, the more stuff they have to leave out, by necessity. Now, a good program will cover a range of topics, including how the hardware works. But if the range continues to grow, something's going to get left out. 伝統的なアプローチには常にこの drawback (欠点、障害) がついてまわります。 The higher the level at which they teach, the more stuff they have to leave out, by necessity. 現時点では、優れたプログラムはハードウェアがどのように動作するのかといったことも含めた 範囲のトピックをカバーしているでしょうが、しかしその範囲が広がり続けていけば、何かがそ こからはみ出してしまうことになるでしょう。 The second approach is the MIT approach. MIT uses an excellent book which teaches the mathematical model of how computer languages and algorithms are structured. It's very theoretical and complete. Any student taking that course will gain a complete understanding of how computer programming works, and be able to implement the entire process from the source code to machine code generation. Interesting to note is that the computer language they use to teach it (scheme) has its roots in Lisp (which is over 40 years old) and will probably never change. This is an indication that what they're teaching is universally valuable. It's not just this year's industry concensus. 二番目のアプローチはMIT式アプローチです。MIT では、コンピューター言語とアルゴリズムを structured して数学的モデルを教えるすばらしい教科書を使っていますそれはとても理論的か つ完全なものです。学生たちはみな、コンピュータープログラミングがどのように行われるのを 完全に理解し、ソースコードからの機械語コードの生成のプロセス全体を実装することができる ようななるコースを履修します、特筆すべきなのは、彼らの教育に使われている言語の Scheme は40年以上前空存在している言語であるLisp をそのルーツに持っているということ、それが決 して変わらないであろうということです。このことが示しているのは彼らが教わっていることは 普遍的な価値があるということなのです。 It's not just this year's industry concensus. So why not just use the MIT approach? Well, consider MIT's audience. I'd wager that nobody in the MIT computer science curriculum is taking CompSci 101 and writing their first computer program. These people have probably lived and breathed computers all of their lives, and want to learn something that's difficult to learn on their own. They want deep understanding, and probably already have all the motivation they need. ではなぜ MIT アプローチを使わないのでしょう? さて MIT の audience を考えてみましょう。 賭けてもいいですが、MIT のコンピューター科学のカリキュラム (computer science curriculum) には初めてコンピュータープログラムを書くような学生もいないはずです。 These people have probably lived and breathed computers all of their lives, and want to learn something that's difficult to learn on their own. 彼らは深く理解することを望み、 おそらくはすでに彼ら自身が必要とするだけの motivation のすべてを持っていることでしょう。 Now consider the audience we'd like to teach, young children. The approach MIT takes is going to fail with them. It's abstract, mathematically challenging, and you don't get to draw pictures on the screen. ここで、わたしたちが教えようとしている対象である young children を考えてみましょう。 彼らに対して MIT 的アプローチを取ることはすなわち失敗に向かうことです。 MIT 的アプローチは抽象的で、数学的な challenging であり、 そして you don't get to draw pictures on the screen. There's a third method, and while no college uses it, I'm fairly certain that my generation would find it familiar. It's the bottom-up approach. In the bottom-up approach, you'd start with a machine that has a small subset of functionality. I had a Commodore 64, which had a BASIC on it that was just a step above assembly language. You would write your first program and run it: 大学では使われていない三番目の手法があります。 I'm fairly certain that my generation would find it familiar. それはボトムアップアプローチです。ボトムアップアプローチでは、機能の小さなサブセットを 持ったマシンから始めます。わたしの場合は Commodore 64でした。このマシンはアセンブリ言 語のちょうど一段上となる BASIC を搭載していました。 Ian Rules! And then you'd add more. You use a GOTO statement to print that over and over. You'd see exactly how the computer jumped around in memory doing things in the order you specified. あなたは何度も何度も出力するために GOTO 文を使うでしょう。あなたが命令したことを行うた めにコンピューターがメモリーの中を飛び回るのをみることになるはずです。 What's the point? Well, one of the most necessary things when teaching Computer Science is to de-mystify the machinery. High level languages like Java or Python don't do this. What's needed is a language that's directly analagous to how computers actually work, like assembly language. What's the point? コンピューター科学を教えるときに最も必要となることの一つがmachinery (機械の構造、仕掛 け) を明らか (de-mystify) にすることです。Java や Python のような高水準言語 (high level languages) ではそれができません。ここで必要となるプログラミング言語とは、アセン ブリ言語のようにコンピューターがどのように動作しているのかを直接 analagous (analogous?) する言語なのです。 Once you learn assembly language, nothing else is ever too difficult. Is that because assembly language is so much harder than everything else? Well, not really. Compared to Java and its libraries, assembly language is tiny -- learning it all is simple. It's because when you understand assembly, you understand computers. You know that "functions" are nothing more than a jump with some stack manipulation to make it look like you're not using GOTO. You know that "objects" are nothing more than a collection of function pointers and data with compiler-enforced rules about how it all can be accessed. アセンブリ言語を学んでしまえば、それより難しいものはありません。では、それはアセンブリ 言語が何よりも難しいからなのかというとそうでもありません。Java とそのライブラリとアセ ンブリ言語とを比較すると、アセンブリ言語はとても小さく、全てを学ぶには単純なものです。 アセンブリ言語を理解したときにあなたはコンピューターを理解するです。あなたは“関数”が GOTO を使ったように見えないようにしているスタック操作を伴ったジャンプ以上のものでない ことを知っているでしょうし、“オブジェクト”が、コンパイラーが定めたルールに沿ってアク セスが可能となる関数ポインターとデータを集めた以上のものではないこともご存知でしょう。 So should children learn assembly language first? Certainly not. It's way too difficult to do fun things that a child would want to do, like write games, in assembly. They'd get bored and go do something else. Ninety percent of teaching children is keeping them interested long enough for them to absorb information. But if assembly language were easier and more fun, wouldn't it be an ideal language to teach children? では、子供たちは最初にアセンブリ言語を学ぶべきなのでしょうか? そうではありません。アセ ンブリ言語でプログラミングを学ぶということは、ゲームをつくるといった子供たちがやりたい と考えていることを楽しんで行うには難しすぎるのです。アセンブリ言語を使って教えていたら、 子供たちはすぐに飽きてほかのことを始めてしまうでしょう。子供に教えることの九割は、情報 を伝えるのに十分なだけの時間、子供の興味を保ちつづけることなのです。でももし、アセンブ リ言語がもっと簡単で、より楽しいものであったなら、それは子供たちにプログラミングを教える ための理想的な言語ではないでしょうか? The truth is, the BASIC most of us grew up with was hopelessly low-level. At the same time, it was simple enough for a 7 year old child to understand. Why is that? Well, it's because computers are inherintly stupid, simple machines. There's no magic in there, despite what the Intel ads say. Making the transition from Commodore BASIC to Commodore assembly language was simple, because Commodore BASIC was so limited, just like assembly. They even had the same control constructs, like GOTO. 実際には、BASIC はわたしたちの大半を hopelessly low-level から成長させました。 と同時に七歳児にも理解できるほど単純なものなのです。 なぜでしょうか? それは、コンピューターは inherintly stupid で単純な機械だからです。 そこは Intel が広告で言っているような magic なんてものはありません。 Commodore BASIC はとても制限されたほとんどアセンブリ言語のようなものなので、 Commodore のアセンブリ言語への変換は単純です。 Commodore BASIC が持っている制御構造らしきものといったら GOTO くらいしかないのです。 That's where BASIC comes in. It's as close to the computer hardware as you can get and still do fun things. It's the highest level low-level language there is. BASIC が存在しているのは正にそこです。BASIC はあなたがコンピューターをいじくりまわして 楽しむことができるほどにそのハードウェアに密着した言語であり、最も高水準な低水準言語な のです。 So don't listen to the traditional approach folks. To teach someone how to program, he first has to understand how computers work. BASIC will teach him that easily, bottom-up, and he'll stay interested. Then, when he's got that down, he'll easily be able to learn more the MIT way. ですから、伝統的アプローチ主義者 (traditional approach folks) の言うことを聞いてはいけ ません。誰かにプログラミングを教えるには、教えられる人がまず初めにコンピューターがどの ように動作するのかを理解しなければなりません。BASIC はそれを簡単にボトムアップで楽しみ ながら教えることができます。 そして、もし Then, when he's got that down, 簡単に MIT 方式でさらに学ぶこともできるのです。
元は例のExcelマクロで仕事を片付けるとどうのというやつですが
マクロを組んで仕事をしていたら先輩に怒られた 25 仕様書無しさん [sage] 2010/01/11(月) 03:43:18 ID: Be: 「マクロを組んで作業するのは実力ではないですか?」 GNU m4のマニュアルを参考に、マクロを組んで事務処理作業をしたところ、 職場の同僚にズルをしていると怒られました。 マクロとは、プログラム中の文字列を、あらかじめ定義された規則に従って置換すること。 コーディングする際にこれを組んでおくと、定型的な入力をすぐに終わらせられたりします。 同僚も、私と同様にマクロを用いて手早く事務処理作業を終えていたようですが、 そこで職場の先輩から言われたのは、 「仕事が早いというのは同じ環境でどれだけ間違いがなく効率よく作業ができるか」 や 「マクロを組むのはズルをしているのと同じ」などの言葉だったとのこと。 divert(-1) define(_CHAR,`Shift-JIS') define(_LANG,`ja') define(_HTML,`<?xml version="1.0" encoding="_CHAR"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="_LANG" lang="_LANG"> ') divert(0)dnl
m4 なんてレベル高すぎw
・全巻購入特典にひかれて某所で某タイトルのBDを予約。
・書評的な何か
Amazon.co.jp: 明快入門コンパイラ・インタプリタ開発 C処理系を作りながら学ぶ: 林 晴比古: 本
を某所でふらげったのですが、別の某所でちょっとだけつぶやいたらわっふるわっふるされてしまったので
なんかいろいろ書かないといけないみたいです(笑)
乞うご期待?
イロイロと脱力。 肝心のところが手付かずなのに「大半はできた」って…(^^;
簡易grep関数ができません。助けてください>< | OKWave 解決済みの質問 簡易grep関数ができません。助けてください>< はじめまして。 C言語初級者の大学生です。 このたび、大学で出た課題で、Perlで製作した簡易grep関数 プログラムを元に、C言語で同様の内容をプログラミングせよ、 という課題が出題されました。 大半はできたのですが、肝心の文字列検索アルゴリズム(特定のワードを含んだ文章の検出) がわかりません。やり方教えてください、お願いします>< OS:Mac OS X 10.8.5 エディタ:vi Editor 【参考】 Perlで製作した簡易grep関数 #grep for perl version #usage:mygrep pattern file1,file2,... if(@ARGV<1) {die:"Usage mygrep pattern [file.]\n";} $pattern=shift foreach $file (@ARGV) { open(FILE,$file); $line=1; while(<FILE>){ #--------------------------------------------- print "$file $line:$_" if /$pattern/o; #--------------------------------------------- # ↑この部分をC言語で表したいです $line++;} close(FILE); } 投稿日時 - 2010-01-09 23:52:45質問者が選んだベストアンサー これって初心者には難しい問題なので回答することにします。 なお、引数の取り方やファイルの読み込み方は定番中の定番ですから覚えておいてください。 また、while{} 中の if{} 文節内を改良すれば、様々なパターン検索に拡張できますので、 是非トライしてみてください。 /* A simple grep by Mac OSX * file name: gunofkid.c * compile: gcc gunofkid.c * execution: ./a.out 'key word' <file1 <file2 <file...>>> */ #include <stdio.h> #include <string.h> // strstr() #include <stdlib.h> // exit() #define SIZE 256 int main(int argc, char *argv[]) { int line; char *file_name, *key_word, *temp, read_buff[SIZE]; FILE *fp; (略) return 0; } お礼 ありがとうございました。 おかげで、解決できそうです。^^ANo.3 元のPerl版のプログラムだと、 > perl mygrep.pl while ./*.c このwhileのところに代わりに正規表現を書いて検索することができるので、本当に同等のこと ができるC言語のプログラムを一から書こうとするとかなりの分量になります。 だから、皆さん「どのくらいの簡易?」と尋ねているわけです。 正規表現でない固定文字列の検索を自力で作成するのであれば、Boyer-Moore法あたりを使うの がいいでしょう。 http://ja.wikipedia.org/w/index.php?title=BM%E6%B3%95 投稿日時 - 2010-01-10 19:21:31 お礼 そういうことでしたか>< 思いっきり勘違いしておりました。 正していただきありがとうございます>< コマンドライン引数を用いた簡単な繰り返し (実行名 繰り返しオプション 数字 文章コピーオプション 文章 で入力し、数字の数だけ繰り返し文章を出力する。オプションの順番は問わない。)ルーチン 構造体メンバ他、C言語入門編の内容を一通り習っている人間が、 プログラミング可能な範囲、ということになります。ANo.1 Tacosan えぇと, 「簡易」というのはどこまで「簡易」なんでしょうか? fgrep なら簡単だけど, そうじゃないと (ものによっては) やっぱり面倒だよ. ちなみに「特定の文字列を検索する」だけなら, ちょっと調べればすぐにわかると思う. 人間が やるような「自然」な (だけど遅いこともある) アルゴリズムでよければ, 「調べる」までもな いかもしれん. 例えば, あなたなら「ある文章から特定の文字列を探す」ときにどのようにしま すか? 投稿日時 - 2010-01-10 00:24:02 補足 すいません>< 内容で通じるとばかり・・・ 参考ファイルの実行形式は以下の通り perl mygrep.pl while ./*.c 「while」という単語を含む文章をカレントディレクトリ内の.cの拡張子を もつファイルから抜き出し表示するだけ。 ここまで簡易化しております。 えーと、「特定の文字列を検索する」なら・・・ やはりしらみつぶしに、アルファベットを見比べる・・・くらいでしょうか?
fgrep が簡単。ねえ。 あれ、力任せに固定文字列探しているわけじゃなくて エイホ-コラシック法 - Wikipedia を使ってたりするんだけどねえ。 まあ検索対象文字列がひとつだけだったら、力任せでやっても同じ動きだと強弁できなくも。
もいっこ。
正規表現で「高」という文字を含まない文字列を | OKWave 正規表現で「高」という文字を含まない文字列を 正規表現で「高」という文字を含まない文字列を Wiki を使っているのですが、その中で、正規表現を利用して、ページのテンプレートを変える ことができるものがあります。 ページのタイトルに、「高」が含まれない場合ということを書くのはどうすればいいのか、教え てください。ネットを調べてみると、 [^高] か / ^高 / でいいのではないかと分かったのですが、うまく動作しません。 よろしくお願いいたします。正規表現で、「〜〜を含まない」ということは表現できません。 通常は、正規表現を使うプログラムの方で、 if(〜〜を含むかどうかチェック) { ... } else{ 〜〜を含まない処理を記述 } のようにします。
「表現できない」ってこたないんだけどなあ。すごーくしちめんどくさくなるだけ。 まあ、「ある文字列を含まない」じゃなくて、「あるパターンにマッチする文字列を含まない」 だと無理ぽたんかも知れない。
古くは fj あたりでも見られたような?
ふらっとC#,C♯,C#(初心者用) Part53 5 デフォルトの名無しさん [sage] 2010/01/10(日) 12:55:45 ID: Be: 質問者には丁寧に教えてくれるけど その後回答者同士が共食いを始めるのですが どうしたらいいのでしょうか 6 デフォルトの名無しさん [sage] 2010/01/10(日) 12:57:07 ID: Be: 諦めましょう 回答が付いたのだから、それでいいじゃないですか その後で戦争が起きたとしても気を揉む事はありません 7 デフォルトの名無しさん [sage] 2010/01/10(日) 13:03:37 ID: Be: 比率としては 質問、捕捉を含めて4レス 回答、重複を含めて3レス そのあとのいざこざ、だいたい100~200レス ってところか。 スレッドを1000まで使い切っても、まともな質問は数個しかない計算だな
Posted September 1 2004 ってあるんですが、なぜか今頃redditで話題に。 日本だけじゃないんだなあ、これで盛り上がるの。
PHP Must Die PHP Must Die A comparison of how different scripting languages treat their users. /tmp$ perl -le 'print 07' 7 /tmp$ perl -le 'print 08' Illegal octal digit '8' at -e line 1, at end of line Execution of -e aborted due to compilation errors. /tmp$ python -c 'print 07' 7 /tmp$ python -c 'print 08' File "", line 1 print 08 ^ SyntaxError: invalid token /tmp$ php -r 'print 07' Parse error: parse error in Command line code on line 1 /tmp$ php -r 'print 07;' 7/tmp$ /tmp$ php -r 'print 08;' 0 Indeed. A less idiotic thing to do would be to give the user a warning, or fail. Just using the wrong number is dangerous; the user might think this works after checking a few values: $magic_dates = array(stamp(01,01,1980), stamp(12,31,1980), stamp(08,11,1950)); # fails silently! PHP doesn't report that anything is wrong even at the most pedantic warning level: error_reporting(E_ALL); eval("print 028;"); # prints 2 without warning Why? Laziness, ignorance or both. PHP only supports octal numbers by accident, as evidenced by the following snippet from zend_language_scanner.l: <ST_IN_SCRIPTING>{LNUM} { errno = 0; zendlval->value.lval = strtol(yytext, NULL, 0); if (errno == ERANGE) { /* overflow */ zendlval->value.dval = zend_strtod(yytext, NULL); zendlval->type = IS_DOUBLE; return T_DNUMBER; } else { zendlval->type = IS_LONG; return T_LNUMBER; } } strtol() sees the first 0, decides to use octal, and eats as much of the number as it can. Because PHP completely ignores the endptr argument, it throws away the rest of the number. Another lexer bug Guess what this program prints? error_reporting(E_ALL); # doesn't help :) foreach(array(0xffffff, 0xfffffff, 0xffffffff, 0xfffffffff, 0xffffffffff) as $x) { printf("%s (%s)\n", $x, gettype($x)); } Output: 16777215 (integer) 268435455 (integer) 4294967295 (double) 2147483647 (integer) 2147483647 (integer) A fun parser bug This is almost as impressive. The ternary operator should be right associative, so you can do this: function getcolor($errors = 0, $warnings = 0) { return $errors ? "red" : $warnings ? "yellow" : "green"; } PHP is the only language in which ?: is left associative. In PHP, the expression above never returns red. /tmp$ perl -le 'print 1 ? 2 : 3 ? 4 : 5' 2 /tmp$ ruby -e 'print 1 ? 2 : 3 ? 4 : 5' 2 /tmp$ php -r 'print 1 ? 2 : 3 ? 4 : 5' Parse error: syntax error, unexpected $end in Command line code on line 1 /tmp$ php -r 'print 1 ? 2 : 3 ? 4 : 5;' 4 This was most likely an accident as well; the correct behavior could have been restored with a single-line change to language-parser.y, but of course it's too late now (for backwards compatibility).
最初の 08 は今でも同じみたいですね。ほかのは確認してませんけど同じなのかなあ。
PHP Must Die : programming $ php -r 'print 08;' 0$ $ php --version PHP 5.2.10-2ubuntu6.1 with Suhosin-Patch 0.9.7 (cli) (built: Oct 29 2009 19:28:39) Copyright (c) 1997-2009 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend TechnologiesOTOH: $ php -r 'print intval("08") . "\n";' 8 $ php -r 'print intval("042") . "\n";' 42 $ php -v PHP 5.2.10 (cli) (built: Sep 9 2009 11:22:55) Copyright (c) 1997-2009 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies This is a critical distinction the article fails to make. Unless you are embedding hex and octal constants in your PHP (god knows why you would be doing that) these issues are irrelevant. Conversion from string to int, which is the 99% use case, does not consider bases other than 10. Javascript is worse about this than php. parseInt() does in fact treat leading 0's as an octal prefix.As a PHP programmer, I'd probably rather be using something else. I don't think it's a bad language, and never once as one of these problem articles ever shown me a problem I've actually experienced in real code. But lets face it, PHP is no Python. It's got it's problems. But what's real annoying that is no other language has really come along and replaced it. With PHP I can just hop onto almost any random server, created a simple file with the .php extension and get some results. If PHP is to die, it needs more than just a new "PHP must die" article every few days. Other languages need to step up and do what PHP does well.
流行に乗って。というわけではなく(笑) reddit で、これだからオレは検査例外がキライなんだ。といったトピックがありまして。 This is why I hate checked exceptions : programming そこで紹介されていたのがこれ。
a REST helper class for java by flyswat | foo(book): import java.io.BufferedReader; (略) /** * Base class for REST Clients */ public class RESTClient { (略) /** * Makes a POST request to the specified URL and passes the provided JSON Object * @param url URL Endpoint * @param contents JSON Object to post to URL * @return a JSON encoded response * @throws JSONException */ protected JSONObject makePOSTRequest(String url, JSONObject contents) throws JSONException { HttpClient httpclient = new DefaultHttpClient(); HttpPost post = new HttpPost(url); try { post.setEntity(new StringEntity(contents.toString())); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } HttpResponse response; String resultText = ""; try { response = httpclient.execute(post); HttpEntity entity = response.getEntity(); if (entity != null) { InputStream instream = null; try { instream = entity.getContent(); resultText = convertStreamToString(instream); } finally { instream.close(); } } } catch (ClientProtocolException e) { throw new RuntimeException(e); } catch (IOException e) { throw new RuntimeException(e); } return new JSONObject(resultText); } }
COM 扱うときのコードのような。あっちは if のネストがひたすら深くなるというパターンですが。
†プログラマ聖書 410 仕様書無しさん [] 2010/01/05(火) 00:54:56 ID: Be: >>43 "ぬるぽしてはならない"と言われたのを、あなたがたは聞いています。 しかし、わたしはあなたがたに言います。 誰でも、投げられる可能性のある例外を キャッチするのをサボったメソッドをコードした者は、 すでに心の中でぬるぽを犯したのです。
pythonをダウンロードしましたけどうまく使えません、簡単な操作方法と日本語版で良い(今使っているのは英語版なので)pythonありませんか?
ErlyvideoはErlang製のオープンソース・ソフトウェア。
一つ前へ
2009年12月(上旬)
一つ後へ
2010年1月(下旬)
メールの宛先はこちら