Skip to main content

Posts

Showing posts with the label c#

杂记 20120107 | Misc Notes 20120107

1. 让c#程序崩溃时的堆栈信息显示行号: 把相应的pdb文件放到同一目录 2. Ubuntu 莫名启动慢,硬盘无反应 我的原因是这个 https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/839595 需要在 /etc/network/interfaces 文件中删除 "auto eth0" 3 .Firefox 词典插件推荐 Dictionary Tooltip。配合我常用的dict.cn效果不错 参数 site url: http://dict.cn/mini.php?q=$$ scroll to element: word-key 4. Firefox 显示 MathML 最好安装 STIX 字体, 另推荐安装 Asana 字体 5. gnome-raw-thumbnailer 不能给 Nautilus 正确创建缩略图: 根据 https://bugs.launchpad.net/ubuntu/+source/gnome-raw-thumbnailer/+bug/852923 添加/修改文件 /usr/share/thumbnailers/raw.thumbnailer 为 [Thumbnailer Entry] Exec=/usr/bin/gnome-raw-thumbnailer -s %s %u %o MimeType=image/x-canon-cr2; 按自己需要另添加 MimeType 进去 6.GMail 的 Preview Pane 右边阅读区域过于狭窄 在AdBlock里添加规则 mail.google.com##.Bu:last-child 推荐使用 Element Hiding Helper 1. To show line numbers in the backtrace when a C# program crashes: put the corresponding pdb file into the same directory. 2. Ubuntu starts very slow, and seems that it's not working, but simply waiting M...

交换两个int值的最短代码

CSDN上的帖子http://community.csdn.net/Expert/TopicView3.asp?id=4899577 比较好的是它着重考虑了“极端情况”----防止溢出 总结起来有如下几个 a^=b^=a^=b; b=a+(a=b)*0; a=b|a&~(b=a); 这三个在C#下应该都行,但是在C++下只有第一个行 原因是C#和C++对表达式求值顺序上不同, 如a=f(i)+g(i++)+h(i);中f,g用的都是i旧值,h则用的新值,C++则是未应义。 又如c=a+(a=1);C#中c应该是a旧值加1,C++则是2 C#中一个表达式中一个变量取值是按照从左至右的,C++则是按运算优先级的。 我觉得还是C#的顺序比较好,不过用C++多了总觉得它怪怪的。 另外C++未定义的那个太不好了,据说是因为编译器先于标准出现