■_
・本の処分に困る
スキャンするとかゆー話ではなく、
置き場所がないんだけどすぐに読む余裕はなくて
でも読まずに捨てるのはどーよって話で、さてどうしよう。
Head First Statistics とか
Java のデザインパターン本とか
Effective C# とか
More Effective C# とか。
あ、今日もなんだかんだで shibuya.lisp#5 の話を書く時間がががが ○| ̄|_
>
I'd just be the catcher in the rye and all. I know it's crazy, but that's the only thing I'd really like to be. I know it's crazy.
The catcher in the rye
J. D. Salinger
このページの内容は日々更新されます。 そのため、検索エンジンに引っかかったものがここに残っているとは限りません。 同じ内容のものは zakkicho[0-9]+.html なページに多分あります。 特に逆ポーランド記法←→中置記法の変換に関して探している人は ここ とか ここ にあります。
・本の処分に困る
スキャンするとかゆー話ではなく、
置き場所がないんだけどすぐに読む余裕はなくて
でも読まずに捨てるのはどーよって話で、さてどうしよう。
Head First Statistics とか
Java のデザインパターン本とか
Effective C# とか
More Effective C# とか。
あ、今日もなんだかんだで shibuya.lisp#5 の話を書く時間がががが ○| ̄|_
Google がそれを採用するのは,それが優れているからではなくて,「いつでも捨てれる」からじゃないのか?
「あのー、ワードやエクセルが入っているのはいいんだけど、パワーポイントって入ってないの?」
昔から数千部しか出ない学術書なんて大して儲かっていなかった。電子書籍やオンディマンド出版によるサンクコストや在庫リスクの低減は、古き良き出版文化や多様性を守り抜く上で、寧ろ福音となる可能性もあるのではないか。
もし iPad が Mac OS X を採用していたら、デベロッパはソフト開発の意欲を失い、かつ満足できるユーザー体験も提供できなかっただろうと Daniel Eran Dilger はいう。
まあ、そのサイトのソースを参考にして、とりあえず作ってみて、どうにも躓くようなら、どの箇所が、どのようにうまくいかないのか、 具体的に質問をすると、アドバイスが得られやすかろう…と想像します。
_tcscpy_s(wcscpy_s)の第二引数って(1/1) | OKWave の話のつづき。
#define _UNICODE
#define UNICODE
#define WIN32_MEAN_AND_LEAN
#include <windows.h>
#include <tchar.h>
TCHAR *fn;
void
OMG(LPCTSTR c)
{
int bytes = (_tcslen(c) + 1 )*sizeof(TCHAR);
int ret;
printf("bytes=%d\n", bytes);
if ( fn = (TCHAR*)malloc( bytes ) ) {
ret = _tcscpy_s(fn, bytes, c ); //実行しないでください
printf("ret=%d\n", ret);
}
else {
return;
}
/* fnを使用 */
free(fn);
fn=0;
}
int
_tmain()
{
OMG(_TEXT("HELLO"));
}
と、テキトーに _tmain() やら追加して試してみると、_UNICODEでもそうでなくても パラメーターによっては「_tcscpy_s()の中で落っこちる」(実態は strcpy_s か wcscpy_s) のが確認できました。んで、ソースをみると(2005のものです)
/*** *strcpy_s.c - contains strcpy_s() * * Copyright (c) Microsoft Corporation. All rights reserved. * *Purpose: * strcpy_s() copies one string onto another. * *******************************************************************************/ #include <string.h> #include <internal_securecrt.h> #define _FUNC_PROLOGUE #define _FUNC_NAME strcpy_s #define _CHAR char #define _DEST _Dst #define _SIZE _SizeInBytes #define _SRC _Src #include <tcscpy_s.inl>
/***
*tcscpy_s.inl - general implementation of _tcscpy_s
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file contains the general algorithm for strcpy_s and its variants.
*
****/
_FUNC_PROLOGUE
errno_t __cdecl _FUNC_NAME(_CHAR *_DEST, size_t _SIZE, const _CHAR *_SRC)
{
_CHAR *p;
size_t available;
/* validation section */
_VALIDATE_STRING(_DEST, _SIZE);
_VALIDATE_POINTER_RESET_STRING(_SRC, _DEST, _SIZE);
p = _DEST;
available = _SIZE;
while ((*p++ = *_SRC++) != 0 && --available > 0)
{
}
if (available == 0)
{
_RESET_STRING(_DEST, _SIZE);
_RETURN_BUFFER_TOO_SMALL(_DEST, _SIZE);
}
_FILL_STRING(_DEST, _SIZE, _SIZE - available + 1);
_RETURN_NO_ERROR;
}
となっていて、どーしたってオーバーラン起こして落ちるようには見えない。 なんだろなあと思いつつ、デバッグモードでコンパイルして落ちた場所を確認すると
_VALIDATE_STRING(_DEST, _SIZE);
で、例外ハンドラーに飛んでいました。んじゃあとさらにソースを追いかけると
/***
*internal_securecrt.h - contains declarations of internal routines and variables for securecrt
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* Declares routines and variables used internally in the SecureCRT implementation.
* In this include file we define the macros needed to implement the secure functions
* inlined in the *.inl files like tcscpy_s.inl, etc.
* Note that this file is used for the CRT implementation, while internal_safecrt is used
* to build the downlevel library safecrt.lib.
*
* [Internal]
*
****/
#pragma once
#ifndef _INC_INTERNAL_SECURECRT
#define _INC_INTERNAL_SECURECRT
#include <internal.h>
(略)
/* validations */
#define _VALIDATE_STRING_ERROR(_String, _Size, _Ret) \
_VALIDATE_RETURN((_String) != NULL && (_Size) > 0, EINVAL, (_Ret))
#define _VALIDATE_STRING(_String, _Size) \
_VALIDATE_STRING_ERROR((_String), (_Size), EINVAL)
(略)
_VALIDATE_RETURN は別のファイルにあって、
internal.h
/*
* Assert in debug builds.
* set errno and return value
*/
#ifndef _VALIDATE_RETURN
#define _VALIDATE_RETURN( expr, errorcode, retexpr ) \
{ \
int _Expr_val=!!(expr); \
_ASSERT_EXPR( ( _Expr_val ), _CRT_WIDE(#expr) ); \
if ( !( _Expr_val ) ) \
{ \
errno = errorcode; \
_INVALID_PARAMETER(_CRT_WIDE(#expr) ); \
return ( retexpr ); \
} \
}
#endif /* _VALIDATE_RETURN */
こんなの。コメントを信じると、 リリースモードなら例外を送出しそうにないんですが、うーむ。
strcpy_s really safe? in VC Language strcpy_s really safe? richard posted on Thursday, February 15, 2007 10:21 AM I get a fatal error in both debug and release mode using strcpy_s function with the following code. Same problem in VS2005 and VS2005 SP1 char sTest[5]; strcpy_s(sTest,5,"0123456789"); I think it should in this case only copy the 4th first characters together with a '\0' character at the end...but having my application crashing is quirte unexpected!strcpy_s really safe? P.J. Plauger posted on Thursday, February 15, 2007 11:58 AM strcpy_s in this case should report a runtime constraint violation, which may be the "crash" you're witnessing. If the constraint handler returns, the function stores a null character at sTest[0] and returns a nonzero value. At least that's the behavior required by TR24731, and I think Microsoft conforms in this regard. P.J. Plauger Dinkumware, Ltd. http://www.dinkumware.comI cannot believe it's a normal behaviour getting a fatal error from strcpy_s richard posted on Thursday, February 15, 2007 12:39 PM The strcpy_s doens't returns anything, it just crashes This function is quite easy to understand, it copies bytes by bytes as long it doesn't overlap. In case of buffer overlap, that is the case in my sample, it should return something, at least a return value .... I never saw so far a function that voluntarily make the program crash with a fatal error! This is not an exception, it cannot be even catched by try method strcpy_s function : _FUNC_PROLOGUE errno_t __cdecl _FUNC_NAME(_CHAR *_DEST, size_t _SIZE, const _CHAR *_SRC) { _CHAR *p; size_t available; /* validation section */ _VALIDATE_STRING(_DEST, _SIZE); _VALIDATE_POINTER_RESET_STRING(_SRC, _DEST, _SIZE); p = _DEST; available = _SIZE; while ((*p++ = *_SRC++) != 0 && --available > 0) { } if (available == 0) { _RESET_STRING(_DEST, _SIZE); _RETURN_BUFFER_TOO_SMALL(_DEST, _SIZE); } _FILL_STRING(_DEST, _SIZE, _SIZE - available + 1); _RETURN_NO_ERROR; }reply strcpy_s really safe? Arnie posted on Thursday, February 15, 2007 3:26 PM Tou're misunderstanding how it's supposed to work. Check the VS 2005 documentation for strcpy_s. Especially the part that says: If strDestination or strSource is a null pointer, or if the destination string is too small, the invalid parameter handler is invoked as described in Parameter Validation. If execution is allowed to continue, these functions return EINVAL and set errno to EINVAL. - Arniereply strcpy_s really safe? Tamas Demjen posted on Thursday, February 15, 2007 5:41 PM The behavior that you're looking for can be implemented using strncpy. Note, however, that strncpy won't NUL terminate your string if it runs out of the buffer. Take a look at this: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_strncpy.2c_.wcsncpy.2c_._mbsncpy.asp The strncpy function copies the initial count characters of strSource to strDest and returns strDest. If count is less than or equal to the length of strSource, a null character is not appended automatically to the copied string. If count is greater than the length of strSource, the destination string is padded with null characters up to length count. What Microsoft calls a null character is actually a NUL (the '\0'). What you want to achieve can be done this way: char sTest[5]; strncpy(sTest, "0123456789", 5); sTest[4] = '\0'; // <- yes, this is necessary too! Finally, there's also an strncpy_s function. TomI cannot believe it's a normal behaviour getting a fatal error from strcpy_s Tim Roberts posted on Friday, February 16, 2007 1:24 AM No, it shouldn't. strcpy_s is merely an implementation of strcpy, and the ISO definition of strcpy says that the behavior when the strings overlap is undefined. That means it can do anything it wants, including crashing the program. What are you expecting it to do? No, but it can certainly be detected before calling the function. If you need to strcpy overlapping strings, you'll need to do this: int x = strlen(src); memmove( dst, src, x+1 ); -- Tim Roberts, timr@probo.com Providenza & Boekelheide, Inc.I cannot believe it's a normal behaviour getting a fatal error from strcpy_s Ulrich Eckhardt posted on Friday, February 16, 2007 3:26 AM Firstly, did you read and understand what this 'constraint handler' is? Now, two things: 1. It's not strcpy_s that makes your program not work but it is your code. You are simply supplying invalid parameters that, if used with strcpy, would have invoked undefined behaviour but are caught by strcpy_s. It doesn't change the fact that your code is buggy though. 2. When strcpy_s detects that the calling code is buggy (as it is the case in your example), what should it do? Should it just do "something" and then return to the caller, possibly facing buffer overruns and the resulting exploits? No, when it detects this, it simply aborts the process, because when the process is already in an inconsistent state, there is nothing left it could do. Without looking at TR24731, I guess that it first calls the constraint handler, which still gives you a way to customise what happens. Ah well, how many people check the returnvalue of functions that "obviously can't fail" because "no user will ever enter something that is longer than 200 characters". Then take a look at the assert() macro. Aborting when nothing is left to be saved is the only sane way to handle such errors. An exception in C? Or are you using C++, then I wonder why you aren't using std::string anyway. UliThanks for your help tamas demjen, tim roberts and Ulrich, indeed your are all richard posted on Friday, February 16, 2007 4:08 AM Thanks for your help tamas demjen, tim roberts and Ulrich, indeed your are all right. I simply misunderstood the function
ぷろーがー先生のリプライに
At least that's the behavior required by TR24731, and I think Microsoft conforms in this regard.
ってあるんですよねえ。
そらまあ、忘れた頃にこけるよりは百倍ましなんでしょうけども。
でもそうだとしても、MSDNにある記述とつじつま合ってないんじゃなかろうか…
遠藤諭の東京カレー日記: パソコンの元祖TK-80・実演とシンポジウム 東京理科大学近代科学資料館が、情報処理学会の「分散コンピュータ博物館」に認定されたの を記念した一連の催しがあるのですが、これの第一弾が3月27日(土)の「パソコンの元祖TK-80・ 実演とシンポジウム」です。この日の詳細がようやく決まってきました。 第一部:パネルディスカッション「TK-80とは何だったのか?」 登壇者:後藤富雄(TK-80開発者) 渡辺和也(TK-80プロジェクト責任者) 榊正憲(『復活!TK‐80』著者) ※敬称略 司会:遠藤諭(元『月刊アスキー』編集長/アスキー総研) (略) 個人的には、一連の催しの中で6月5日(土)・6日(日)に「タイガー計算機実演指導」も、 お勧め。これをやられるのが、機械式計算機の会(http://keisanki.on.coocan.jp/)の渡辺祐 三さんです。今回も、渡辺さんのお誘いでこのイベントに関わらせてもらうことになりました。 (略)
3/27 って次の土曜日かっ
・いってきました
Shibuya.lispテクニカル・トーク#5 : ATND
あー。あとで(^^;
とりあえず、「Clojure大流行」とだけ(笑)
ご本人の blog にもありますが、実際には Clojure ネタのセッションでした。
詳しくはスライドで。
こういう形式の方が自分は参加しやすかったです。
運営の皆様ありがとうございます。
…おっと、λ神社にお賽銭入れるの忘れた(笑)
・地下鉄サリン15年
あの日、日本にいなかったんだよなあ。
CNNで知ったのだけど、英語のリスニング能力が足りないので
事態がなかなか把握できなかった(苦笑)
地下鉄でガスが~とかは聴き取れたんだけど、
「毒ガス」とはなかなか理解できなかった。
・三銃士
実は「三銃士」ってきちんと読んだことがない(もちろんデュマのあれよ?)。
岩波ジュニア新書あたりで読んでみようかなあ。
ふらっとC#,C♯,C#(初心者用) Part56 972 デフォルトの名無しさん [sage] 2010/03/20(土) 01:30:44 ID: Be: Directoryみたいな機能があって それプラスitem追加した順番に並ぶようなクラスは どうすれば作れますか? 973 デフォルトの名無しさん [] 2010/03/20(土) 01:31:56 ID: Be: >>972 >Directoryみたいな機能があって >それプラスitem追加した順番に並ぶようなクラスは >どうすれば作れますか? えw 自分で文字にしたのがすでに仕様じゃん 974 デフォルトの名無しさん [sage] 2010/03/20(土) 01:38:25 ID: Be: >>940 >>941 こういうことしたいんですけど foge<obj1,obj2> こんな感じで 975 デフォルトの名無しさん [sage] 2010/03/20(土) 01:39:32 ID: Be: >>974 で? 976 デフォルトの名無しさん [] 2010/03/20(土) 01:40:49 ID: Be: えw DirectoryじゃくDictionaryなの? 977 デフォルトの名無しさん [sage] 2010/03/20(土) 01:50:11 ID: Be: って972=974なのか Directoryとか言うから関連があるとは思わんかった 内部にDictionary<TKey,TValue>とList<TKey>持ったIDictionary<TKey,TValue>実装クラス作ればいいよ 978 デフォルトの名無しさん [] 2010/03/20(土) 01:51:43 ID: Be: こういう小さいクラスも作れないのはキツイな・・・ 979 デフォルトの名無しさん [sage] 2010/03/20(土) 01:56:39 ID: Be: おっと 書いてる途中で正解が書き込まれてた 980 デフォルトの名無しさん [sage] 2010/03/20(土) 02:00:39 ID: Be: すいませんDirectoryじゃなくてDictionaryで 途中から追加した順番に要素を検索するクラスが 作りたいのです と言わなくても理解してくれた超能力者がいたので助かりました >>977のようなクラスは例えば class foge { Dictionary<TKey,TValue> List<TKey> } みたいになるんですよね? そうじゃなくて Foge<string,myclass> f=new Foge<string,myclass>(); for(int idx=9;idx<f.Count;idx++ ) { myclass mc=f.items[idx]; } のようにしたいのです 981 デフォルトの名無しさん [sage] 2010/03/20(土) 02:02:46 ID: Be: そこまでやりたいこと見えてるんなら 自分でできそうなもんだが 982 デフォルトの名無しさん [sage] 2010/03/20(土) 02:06:02 ID: Be: できることはできるんですが、 自分がやるとオシャレじゃないので もっとスマートに実現してくれるひとはいるかなと 思いまして 983 デフォルトの名無しさん [sage] 2010/03/20(土) 02:07:26 ID: Be: すいません間違いました こういう感じにしたいのです for(int idx=9;idx<f.Count;idx++ ) { myclass mc=f[idx]; } 984 デフォルトの名無しさん [] 2010/03/20(土) 02:07:58 ID: Be: >>980 そこまで分かってるなら検索ワードも浮かびそうだし ぐぐれば出てきそうだけどな というかその程度の実装で答えもらってると後で苦労しそうだけどな・・・・ 985 デフォルトの名無しさん [sage] 2010/03/20(土) 02:10:38 ID: Be: 誰か作ってくれるまで続けるつもりなのか? 986 デフォルトの名無しさん [sage] 2010/03/20(土) 02:12:10 ID: Be: 頭悪いな 987 デフォルトの名無しさん [sage] 2010/03/20(土) 02:12:28 ID: Be: >>1 >>980を踏んだ人は新スレを建てて下さい。 988 デフォルトの名無しさん [sage] 2010/03/20(土) 02:15:54 ID: Be: Foge<string,myclass> f=new Foge<string,myclass>(); List<string> g = new List<string>(); for(int idx=9;idx<f.Count;idx++ ) { myclass mc=f[g[idx]]; } 989 980 [sage] 2010/03/20(土) 02:17:06 ID: Be: ふらっとC#,C♯,C#(初心者用) Part57 http://pc12.2ch.net/test/read.cgi/tech/1269018938/ 立てたので教えてくださいお願いします 990 980 [sage] 2010/03/20(土) 02:18:46 ID: Be: >>988 それだとスマートじゃないですよね ひとつの自作クラスだけで実現したいんです 991 デフォルトの名無しさん [sage] 2010/03/20(土) 02:20:44 ID: Be: そう思うのはお前の頭が悪いから 992 980 [sage] 2010/03/20(土) 02:22:18 ID: Be: >>988 これだとアイテム追加する度に 二つの変数にそれぞれキーとかインデックスとか入れないとだめですよね f.Add(string,item) だけで済むようにしたいんです >>991 ひとつの行いをするのに二つのクラスを使うなんてスマートじゃないです 993 デフォルトの名無しさん [] 2010/03/20(土) 02:23:54 ID: Be: >>992 そこまで分かってるならクラス自分で実装しろよ お前がわからないのはクラスの作り方だろ? 994 980 [sage] 2010/03/20(土) 02:25:17 ID: Be: >>993 そうです 作り方がわからないので教えてください 995 デフォルトの名無しさん [] 2010/03/20(土) 02:25:52 ID: Be: 自分でわかってる範囲でクラス作って ふらっとC#,C♯,C#(初心者用) Part57 http://pc12.2ch.net/test/read.cgi/tech/1269018938/2 のサイトに貼って添削してもらう形で動け 996 980 [sage] 2010/03/20(土) 02:26:41 ID: Be: >>995 ではそうします 997 デフォルトの名無しさん [sage] 2010/03/20(土) 02:27:33 ID: Be: >ひとつの行い いや二つだよ 998 デフォルトの名無しさん [] 2010/03/20(土) 02:42:20 ID: Be: まあがんばれ このくらいはできるようにならんと
次のスレもみると、どうも OrderedHashMap というかそういうのを欲していたらしい。 しかし最近の丸投げ(か?)は手が込んでるというかやり方が迂遠というか。
【Perl,PHP】LLバトルロワイヤル9【Ruby,Python】 410 デフォルトの名無しさん [sage] 2010/03/20(土) 00:04:17 ID: Be: まぁ何だ、ミッションクリティカルなシステムに使われないうちは、玩具ではあるな。 411 デフォルトの名無しさん [sage] 2010/03/20(土) 00:21:18 ID: Be: 富士通ミッションクリティカルシステムズって会社ができたときはちょっとふいたけど 412 デフォルトの名無しさん [sage] 2010/03/20(土) 00:27:05 ID: Be: そのうち富士通エターナルフォースブリザードって会社ができてもおかしくないな 413 デフォルトの名無しさん [sage] 2010/03/20(土) 00:55:52 ID: Be: 富士通火消し&リビルドソリューションズって会社も作ればいいのに 414 デフォルトの名無しさん [sage] 2010/03/20(土) 01:02:01 ID: Be: そのうちクラウドなんとかテクノロジーズとかあふれてくるんだろうな。 最近この業界も安っぽい話が多いよな。twitterとかミニブログとか ミニゲームとかクラウド対応とかIT評論家とか自称ギークプログラマーとか、 ばかじゃね?みたいなのが まあそれだけ業界が成熟してきて、もう技術より企画営業宣伝のダークサイドの 世界になりつつあるんだろうな 415 デフォルトの名無しさん [sage] 2010/03/20(土) 01:07:24 ID: Be: どーでもいいけど顧客を言葉の魔術でまどわしたあとこっちに丸投げはやめてくれ・・・ 416 デフォルトの名無しさん [sage] 2010/03/20(土) 04:30:07 ID: Be: 凄腕で研究熱心なプログラマがmixiアプリとか作って才能潰してるのはもったいないな 417 デフォルトの名無しさん [sage] 2010/03/20(土) 04:35:08 ID: Be: なんでそれが才能潰してることになるんだ? 418 デフォルトの名無しさん [sage] 2010/03/20(土) 05:20:15 ID: Be: 高学歴だが渋谷でねーちゃんにつかまって絵買わされちゃう感じだな 419 デフォルトの名無しさん [sage] 2010/03/20(土) 05:49:21 ID: Be: タケルンバがPHP始めるらしい ブログで頻繁に取り上げるだろうか国内シェア倍増するな rubyの敗北は既定路線
渋谷に絵売りアンいたっけ?(そこか?)
クラウドなんたらって名前の会社。確かに出てきそうだ(笑)
意外に伸びなかったな。 しかしいい意見が並んでるように思う (適当に抜き出しました。全部ではありません)。
Is learning haskell worth it? : haskell Is learning haskell worth it? (self.haskell) I am an undergrad math and physic major and the mathematical "niceness" of haskell seems quite appealing to me. I have some knowledge of java and C (and category theory haha). Is it worth it to take the plunge and learn haskell? Is it a worthwhile language to know in those fields? * 16個のコメントChances are, if you're not specifically choosing projects so as to use Haskell, then you won't use Haskell "in the large" on any of your work in physics or math. That said, I'm a graduate student in mathematics, and I use Haskell all the time just to check conjectures, find examples, and just do exploratory computations. I'd also urge you to learn Haskell just for the reason that it will, to be a bit cliche, make you a better mathematician. It will give you a concrete area in which build nice abstract formalisms is helpful and commonplace. Haskell is really the only widely used programming language where this advice is reasonable; in any other language, the messy environment in which your programs run tends to get in the way of being able to reason about them, so that writing code is a bit too isolated from mathematical thinking.After learning Haskell, I suggest you also learn Agda. #…いけがみさん!?Do you like to broaden your mind? Do you like to get a glimpse of the fundamental structures underlying computing? As a math and physics major, I'm sure you enjoy learning about fundamental principles that make our universe tick. In Java and C, it is hard to see the forest for the trees, but in Haskell, you have a chance of getting an idea of what computing is really about.As a physicist, you might need to calculate some eigenvalues every now and then, which is a pain in Fortran/LAPACK. The hmatrix library is much more pleasant to use!Unless you plan on going the agda/coq route instead, definitely yes.I'm going to echo most of cdsmith's sentiments but I want to add that Haskell has a reputation for being difficult among programmers. I only know one mathematician personally who has learned it, and he knew a few other languages going in (at least Python, I think also some Java or C) but he found it to be much easier to learn Haskell than I have found. It will help that the parts of Haskell that are hard for programmers aren't particularly important to you. I doubt you'll be much concerned about the lack of an excellent web framework or that the database interaction is still at this point mostly SQL (a factor I like, but it isn't for everyone). If you wind up doing visualization, you won't find it harder to do GL in Haskell than anywhere else but the rest of the program will be simpler and clearer to you. I recommend Haskell to you because you will find that you fit in better to the Haskell community than to any other language community. You probably could find a fair number of like-minded people in some niche of another language, but Haskell's core group are mathematically and scientifically inclined folk. Kin, if you will. So you will find that the things that you get stuck dealing with are things that others are likely to get stuck dealing with, and things that you don't need explained are the kinds of things that aren't over explained (except for monads, of course). You should learn Haskell because, like cdsmith said, you will find it a great scratchpad for your research. Writing a large-scale physical simulation is a daunting task in any language. You have to ask yourself if you'd rather deal with optimizing performance at the end or slogging through mud through the whole process. Even if you embark on a large coding project and can't finish it, using Haskell for a prototype will help make the core of the system clearer. You will probably also find it easier to get help from the Haskell community on the subject of optimizing a program than from another language community for holistic help, if for no other reason than that it will be less help you'll need. Because Haskell is a rising star in the math and physics world, I think you'll also find yourself at the forefront of a positive trend. If the Fortress project were a little further along I might suggest taking a look at it, but I think it's stagnated somewhat and the Sun/Oracle situation has probably slowed development.I for my own must say that it's a very steep learning curve. Unlike many other programming languages it's one of those where you really have to understand most of it's syntax AND idioms to get productive. Reading only the first chapters of whatever Haskell book or tutorial out there, then think about a problem you feel like to solve and continue reading as needed will get you nowhere. Looking back, the only thing you need not understand (for easy problems) at the beginning are monads. Simply start using the IO monad and think about how the bit's and pieces fit together later.1. A language that doesn't affect the way you think about programming, is not worth knowing. -- Alan Perlis Haskell will most certainly change how you think about coding. It has a number of nice features that make math very nice in it - list comprehensions come to mind as an example. Also, Haskell has a REPL (read-eval-print loop), which is a nice change from C and Java. Basically, you type Haskell expressions into ghci, and it evaluates them and spits out the answer. It has some limitations compared to a Lisp REPL, mostly because Haskell is compiled.
自分ももっとがんばらねば。
πの日(3/14)に見つけたものですが、せっかくなので。
imagine27 - 2010-03-14 happy pi day in asm Happy π day/night (in assembly) ! Posted by jgrant, 2010-03-14 07:22:00 // pi_x64.s - calculates Pi using the Leibniz formula. // Each iteration prints a closer approximation to 50 digits. // This is not an optimal implementation and it runs forever. // // x86-64/SSE3 with for Linux, Intel, gnu assembler, gcc // // assemble: as pi_x64.s -o pi_x64.o // link: gcc -o pi_x64 pi_x64.o // run: ./pi_x64 // output: 3.14159264858204423376264458056539297103881835937500 // 3.14159265108366625440794450696557760238647460937500 // 3.14159265191852199450295302085578441619873046875000 // 3.14159265233600137889879988506436347961425781250000 // .... and on forever ... .section .data .align 16 denom: .double 1.0, 3.0 numer: .double 4.0, -4.0 add4: .double 4.0, 4.0 zero: .double 0.0, 0.0 msg: .string "%1.50f\n" .section .text .globl main .type main, @function .align 64 main: pushq %rbp movq %rsp, %rbp movdqa (numer), %xmm2 movdqa (denom), %xmm6 movdqa (add4), %xmm3 movdqa %xmm2, %xmm4 movdqa (zero), %xmm5 movq $100000000, %r12 loop: divpd %xmm6, %xmm2 addpd %xmm2, %xmm5 movdqa %xmm4, %xmm2 addpd %xmm3, %xmm6 subq $1, %r12 jnz loop movq $100000000, %r12 movdqa %xmm5, %xmm0 movdqa %xmm6, %xmm1 haddpd %xmm0, %xmm0 movq $1, %rax movq $msg, %rdi call printf movdqa (add4), %xmm3 jmp loop movq $0, %rax popq %rbp ret © 2005, 2006, 2007, 2008, 2009 imagine27 - justin at imagine twenty seven dot com
double の精度(桁数)で計算させるなら、 ループ回数こんなにいらないような気もするんだけどどうなんだろう。 って、どの公式使ってんのかよくわからんなあ(苦笑)
とあるついったらー のついっとから
isNaNを「数値かどうか調べる」って説明してるのはどこからの文化なんだろうと思ったらMozilla Developer Centerでもそう書いてる、えー…"Evaluates an argument to determine if it is not a number."が "引数が数でないかどうかを評価します。"に訳されてるのか、非数と訳すべきか迷う感じだhttps://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Predefined_Functions/isNaN_ Function だったら非数の意味なのが明らかだけどECMAの規格にはNaNって書いてるんだからJavaScriptリファレンスを作って公開するサイトが そっちを見て書いてくれればこんなことにはならなかった
この英文だけ見てやったら自分も「非数」とか「NaN」に考えが及ぶか自信がない(^^; が、isNaN の動作を考えると「数でないかどうか」というのは直した方がよさげだなあ。 「匿名メソッド」みたいなもんだろうか(まだ云うか)。
この質問なんですが。
_tcscpy_s(wcscpy_s)の第二引数って(1/1) | OKWave _tcscpy_s(wcscpy_s)の第二引数って _tcscpy_s(wcscpy_s)の第二引数って http://msdn.microsoft.com/ja-jp/library/td1esda9%28VS.80%29.aspx を見て、たとえば以下のような関数を書いたとします。 TCHAR* fn; void OMG(LPCTSTR c){ int bytes( ( _tcslen(c) + 1 )*sizeof(TCHAR) ); if ( fn = (TCHAR*)malloc( bytes ) ) _tcscpy_s( fn, bytes, c ); //実行しないでください else return; /* fnを使用 */ free(fn); fn=0; } これ、マルチバイトだと正常に出来るのですが なぜかUnicodeだと落ちてしまいました。 (略)
質問者の勘違いだか貼り付けた部分以外のコードのバグだろうと思ったんですが、 ちょっと調べてみると(省略されました)
明日以降続きを書きます。 つか誰か事情知ってたら解説して~
・パトレイバー
ついったで
こちら特車二課 (patlabor_info) on Twitter
こういうIDをみつけたのと、
TVアニメーション 乃木坂春香の秘密ぴゅあれっつあ♪
の今週の配信で、パトレイバーが話題に出たり。
いま考えると「バビロンプロジェクト」ってとんでもない代物のような。
なんたって東京湾を丸ごと干拓しようってんだから。
バブルそのものの計画(笑)
やっぱ後藤隊長いいわあ。
・SD
ソフトウェアデザイン というか
Karetta|『帰ってきたCプログラミング診断室』発売
は読んでおくべき。古田島さんの話とかは泣ける。
・Fireman → Fire Fighter
PCな言い換えがされた単語はたくさんあると思うんですが、
この Fireman から Fire Fighter は言い換えたものの方が好きだなあ。
そして消防士といえば
テーマ曲を聴くと「アレ・キュイジーヌ」な別の番組を連想するような気もするけど(笑)
【Perl,PHP】LLバトルロワイヤル9【Ruby,Python】 403 デフォルトの名無しさん [sage] 2010/03/19(金) 02:31:55 ID: Be: (a+b)(a-b) を因数分解してくれる電卓が欲しい 404 デフォルトの名無しさん [sage] 2010/03/19(金) 03:34:14 ID: Be: >>403 これ以上因数分解できねぇw つisympy 405 デフォルトの名無しさん [sage] 2010/03/19(金) 03:59:56 ID: Be: フリーの数値計算ソフトがあるぞ 406 デフォルトの名無しさん [sage] 2010/03/19(金) 04:08:54 ID: Be: Mathematicaとか、フリーならMaximaとかさ ときおり、呆然とするような結果を吐くから いじるのが楽しい 407 デフォルトの名無しさん [sage] 2010/03/19(金) 04:14:32 ID: Be: これかMaximaだな http://www.ecl.hiroshima-u.ac.jp/~ohno/scilab/introscilab/introscilab.html 408 デフォルトの名無しさん [sage] 2010/03/19(金) 08:21:11 ID: Be: 因数分解や展開ならasirでもいける 409 デフォルトの名無しさん [sage] 2010/03/19(金) 11:51:59 ID: Be: >>399 まあ、まともな選択だけどね。スレタイ言語1つ入ってるし。PHPはずしてPerlでもいいと思うけど。 PerlはやっぱUnix管理系で多く使われてるからできると便利。
ネットワークプログラミング相談室 Port25 935 デフォルトの名無しさん [sage] 2010/03/11(木) 08:10:57 ID: Be: WebDBの話、この子か書いたの。 http://d.hatena.ne.jp/viver/20100224/p1 日記読んでれば解るけど、ここ2年ぐらいでKVSとかに興味持ち出して 自分でライブラリ書いてた子だね・・・ 学習スピードが恐ろしく早い子だな 936 デフォルトの名無しさん [sage] 2010/03/11(木) 15:34:30 ID: Be: >>935 筑波大がすばらしいのか、こいつだけが特別なのか。 937 デフォルトの名無しさん [sage] 2010/03/11(木) 16:33:44 ID: Be: 世界で唯一、開発者の名前を冠されたウイルス(Trojan.Hirofu)の 開発者(古田泰大)も筑波。 938 デフォルトの名無しさん [sage] 2010/03/11(木) 18:35:51 ID: Be: >>935 学生なんだな。かなり優秀だな 優秀な学生はアメリカの優秀な大学院に行って、そこの恵まれた環境でさらに 能力を伸ばして欲しいものだな 939 デフォルトの名無しさん [sage] 2010/03/11(木) 18:40:04 ID: Be: そういえば、Rubyやソフトイーサーを作ったのも筑波だよな 940 デフォルトの名無しさん [sage] 2010/03/11(木) 18:45:10 ID: Be: ____ /__.))ノヽ .|ミ.l _ ._ i.) (^'ミ/.´・ .〈・ リ .しi r、_) | 筑波大は(ry | `ニニ' / ノ `ー―i´ 943 デフォルトの名無しさん [sage] 2010/03/12(金) 16:33:17 ID: Be: 筑波は隔離されてて俗世間の誘惑が少ないからなw 研究にはいい所かもしれん。若い時にしか出来ない大切な機会を失う気もするけど。 944 デフォルトの名無しさん [sage] 2010/03/12(金) 23:20:34 ID: Be: 筑波の3Sって言葉もあるが。 945 デフォルトの名無しさん [sage] 2010/03/13(土) 04:21:34 ID: Be: まあ田舎はほとんど3Sだろう。大した娯楽も無いし。 946 デフォルトの名無しさん [sage] 2010/03/13(土) 13:45:54 ID: Be: >>23 筑波の先生は よく未到のマネージャーもやってたりするね 947 デフォルトの名無しさん [sage] 2010/03/14(日) 18:17:53 ID: Be: >>944 4Sだろ。
つくばこわい
ファイルの20行目から30行目までを取り出すには? - 今日の腕試し!:ITpro ファイルsampleは50行の長さがあるとします。LinuxなどのUNIX系OSで、このファイルの20行目 から30行目までを取り出して表示するコマンドはどれでしょう? ●解答を送信いただくと,すぐに正解と詳しい解説をご覧いただけます。 1. head -30 sample | tail -10 2. tail -30 sample | head -10 3. cat sample | head +20 | tail -10 4. tail +30 sample | head -11 5. head -30 sample | tail -11
なんでsedとかawkつかわないんだろう。
sed -ne '20,30p' awk 'NR==20,NR==30'
これだとでかいファイルも無駄に読んじゃうけど、30行目の処理が終わったら終了とかできるし。
昨日も書いたようにぜんぜん追いかけられていないのだけど
[bug #14472] grep is slow in multibyte locales From: Paolo Bonzini Subject: [bug #14472] grep is slow in multibyte locales Date: Tue, 16 Mar 2010 14:40:27 +0000 Update of bug #14472 (project grep): Status: Confirmed => Fixed Open/Closed: Open => Closed _______________________________________________________ Follow-up Comment #8: There are more queued patches which will improve speed further; however, the roughly-quadratic cases should be fixed. Thank you for the bug report. This bug has been fixed in the development sources, which can be downloaded using git from git://git.sv.gnu.org/grep.git _______________________________________________________ Reply to this item at: http://savannah.gnu.org/bugs/?1447 _______________________________________________ Message sent via/by Savannah http://savannah.gnu.org/
いろいろパッチを適用してるみたいですねえ。
こっちも大変そうだなあ
Perl6/Parrotスレ - Part2 [chaika] 305 nobodyさん [sage] 2010/02/23(火) 01:22:08 ID:??? Be: なにげにParrot 2.1.1。 風も温んできた。4月も近い。 306 nobodyさん [sage] 2010/03/05(金) 22:03:05 ID:??? Be: やっぱりエイプリルフール当日発表かねぇ。 307 nobodyさん [sage] 2010/03/18(木) 00:31:38 ID:??? Be: Late April を目指してるらしいよ 4月の定期リリースの後くらい ただ中心的開発者の pmichaud の奥さんが最近入院して看病に時間を取られてるとかで、 リリースを遅らせることも視野に入れてるとか ttp://use.perl.org/~pmichaud/journal/40248 308 nobodyさん [sage] 2010/03/19(金) 11:20:57 ID:??? Be: Rakudo Star は5月か6月リリースになったっぽい ttp://github.com/rakudo/rakudo/blob/master/docs/ROADMAP
ソースコードやっと取ってきた。 バージョン管理ツールから入れないといけないと取ってこれないとは。
2010/03/20 02:18 <DIR> .
2010/03/20 02:18 <DIR> ..
2010/03/20 02:18 <DIR> .hg
2010/03/20 02:18 51 .hgignore
2010/03/20 02:18 337 AUTHORS
2010/03/20 02:18 <DIR> benchlog
2010/03/20 02:18 1,251 CONTRIBUTORS
2010/03/20 02:18 <DIR> doc
2010/03/20 02:18 <DIR> lib
2010/03/20 02:18 1,558 LICENSE
2010/03/20 02:18 3,826 Makefile
2010/03/20 02:18 <DIR> re2
2010/03/20 02:18 350 README
2010/03/20 02:18 267 runtests
2010/03/20 02:18 189 testinstall.cc
2010/03/20 02:18 <DIR> util
(略)
2010/03/20 02:18 11,035 bitstate.cc
2010/03/20 02:18 27,168 compile.cc
2010/03/20 02:18 70,583 dfa.cc
2010/03/20 02:18 2,774 filtered_re2.cc
2010/03/20 02:18 3,127 filtered_re2.h
2010/03/20 02:18 1 Makefile
2010/03/20 02:18 2,597 make_perl_groups.pl
2010/03/20 02:18 2,733 make_unicode_casefold.py
2010/03/20 02:18 2,845 make_unicode_groups.py
2010/03/20 02:18 5,930 mimics_pcre.cc
2010/03/20 02:18 20,925 nfa.cc
2010/03/20 02:18 22,064 onepass.cc
2010/03/20 02:18 53,290 parse.cc
2010/03/20 02:18 4,680 perl_groups.cc
2010/03/20 02:18 16,182 prefilter.cc
2010/03/20 02:18 2,932 prefilter.h
2010/03/20 02:18 11,907 prefilter_tree.cc
2010/03/20 02:18 4,750 prefilter_tree.h
2010/03/20 02:18 7,822 prog.cc
2010/03/20 02:18 13,180 prog.h
2010/03/20 02:18 33,607 re2.cc
2010/03/20 02:18 31,891 re2.h
2010/03/20 02:18 14,645 regexp.cc
2010/03/20 02:18 17,834 regexp.h
2010/03/20 02:18 11,765 simplify.cc
2010/03/20 02:18 5,781 stringpiece.h
2010/03/20 02:18 <DIR> testing
2010/03/20 02:18 8,018 tostring.cc
2010/03/20 02:18 7,908 unicode.py
2010/03/20 02:18 6,416 unicode_casefold.cc
2010/03/20 02:18 2,254 unicode_casefold.h
2010/03/20 02:18 86,922 unicode_groups.cc
2010/03/20 02:18 1,416 unicode_groups.h
2010/03/20 02:18 16,675 variadic_function.h
2010/03/20 02:18 7,709 walker-inl.h
34 個のファイル 539,366 バイト
(略)
2010/03/20 02:18 <DIR> .
2010/03/20 02:18 <DIR> ..
2010/03/20 02:18 6,162 arena.cc
2010/03/20 02:18 3,484 arena.h
2010/03/20 02:18 811 atomicops.h
2010/03/20 02:18 2,923 benchmark.cc
2010/03/20 02:18 1,263 benchmark.h
2010/03/20 02:18 994 flags.h
2010/03/20 02:18 8,510 hash.cc
2010/03/20 02:18 444 hash_map.h
2010/03/20 02:18 1,990 logging.h
2010/03/20 02:18 7,085 mutex.h
2010/03/20 02:18 34,081 pcre.cc
2010/03/20 02:18 27,498 pcre.h
2010/03/20 02:18 776 random.cc
2010/03/20 02:18 622 random.h
2010/03/20 02:18 4,874 rune.cc
2010/03/20 02:18 13,702 sparse_array.h
2010/03/20 02:18 4,585 sparse_array_test.cc
2010/03/20 02:18 2,549 stringpiece.cc
2010/03/20 02:18 1,927 stringprintf.cc
2010/03/20 02:18 3,386 strutil.cc
2010/03/20 02:18 826 test.cc
2010/03/20 02:18 1,353 test.h
2010/03/20 02:18 756 thread.cc
2010/03/20 02:18 482 thread.h
2010/03/20 02:18 1,530 utf.h
2010/03/20 02:18 3,012 util.h
26 個のファイル 135,625 バイト
ファイルの総数:
235 個のファイル 1,849,345 バイト
さて読む時間があるか。
ただ、現在の技術革新をすべて自前開発で担うのは無理。特にサービスの分野はオープンな方針でやるべきです。IT業界の「エコシステム」はどんどん変わっています。
C++ にひさびさに噛まれた
サロゲート対応は、従来の文字列処理アルゴリズムに対して、局所的に専用APIへ置き換えることで解決する場合がほとんどです。
shibuya.lisp#5 か。 とっと寝よう。
メールの宛先はこちら