My Blog
随着常数 m 和 n 的变化,参数方程 x = sin(m · t), y = sin(n · t) 将会画出一系列漂亮的曲线。法国物理学家 Jules Antoine Lissajous 曾在 1857 年研究过这类曲线,因此人们把它叫做 Lissajous 曲线。我在 reddit 上看到了一个 Lissajous 曲线的动画演示,觉得看起来确实非常爽;但那个动画里没有解释曲线的生成方法,很多细节也有让人不太满意的地方,于是决定自己制作一个。 2016 年 7 月 30 日至 8 月 7 日,第 39 届欧洲杂耍大会(European Juggling Convention)在荷兰的阿尔梅勒举行, 8 月 3 日凌晨的搏击之夜(Fight Night)自然再度成为了众人关注的焦点——它是杂耍斗(combat juggling)这项运动最大的赛事。 杂耍斗是一种两人对战类的体育运动。 典型的一局比赛大致就像下面这样。 Read more… 下面这个趣题出自 Using your Head is Permitted 谜题站 2016 年 8 月的题目,稍有改动。 屋子里有若干个人,任意两个人都有恰好 1 个共同的朋友。 除了上图展示的情况之外,我们还能构造出很多别的同样满足要求的情况。 Read more… 无穷多个相同大小的正方形格子排成一排,向左右两边无限地延伸。 选择某个格子,保证该格子内至少含有 1 个原子。 初始时,某个格子里有 1 个原子。 Read more… 2016 年 IMO 的第 6 题(也就是第二天比赛的第 3 题)非常有趣,这恐怕算得上是近十年来 IMO 的所有题目中最有趣的题目之一。 证明:当 n 为奇数时, Geoff 一定有办法实现他的要求。
Martin Fowler
c# 扩展方法奇思妙用基础篇五:Dictionary<TKey, TValue> 扩展 - 鹤冲天
Dictionary<TKey, TValue> 类是常用的一个基础类,但用起来有时确不是很方便。本文逐一讨论,并使用扩展方法解决。 添加键和值使用 Add 方法,但很多时候,我们是不敢轻易添加的,因为 Dictionary<TKey, TValue> 不允许重复,尝试添加重复的键时 Add 方法引发 ArgumentException。 大多时候,我们都会写成以下的样子: var dict = new Dictionary<int, string>(); // ...// 情形一:不存在才添加if (dict.ContainsKey(2) == false) dict.Add(2, "Banana"); // 情形二:不存在添加,存在则替换if (dict.ContainsKey(3) == false) dict.Add(3, "Orange"); else dict[3] = "Orange"; 其实,第二种情形可以写如下书写(请参见 dict[3] = "Orange"; 不过好多朋友都会对这种方式表示疑虑,不太确定这样会不会出问题。 不管是上面的哪种写法,用字典时最大的感觉就是担心,怕出异常,因此代码会写的很罗嗦。 我每次用字典时都这样,时间长了,实在是厌烦了,索性扩展一下,用以下两个方法来应对上面两种情形: TryAdd 和 AddOrReplace 这两个方法具有较强自我描述能力,用起来很省心,而且也简单: dict.TryAdd(2, "Banana"); dict.AddOrReplace(3, "Orange"); 或者像 Linq 或 jQuery 一样连起来写: dict.TryAdd(1, "A") .TryAdd(2, "B") .AddOrReplace(3, "C") .AddOrReplace(4, "D") .TryAdd(5, "E"); 再来看另外一个问题: 从字典中获取值通常使用如下方式: string v = "defaultValue"; // 方式一if (dict.ContainsKey(3)) v = dict[3]; // 方式二bool isSuccess = dict.TryGetValue(3, out v); 使用方便:
Seth's Blog
Aaron Swartz
The Simple Guide to Growing Some @#$%ing Balls
You may have them. You may not. You may have had them (at one point). Hey, you may even have had them surgically removed. Gentle sir/madam, I am here today to present to you an eternal truth. If you have balls, my friend… you’re going to have a good life. Balls are everything. How do I know this? But I’m not bitter. It made me earn and appreciate it. Whether your balls are real or metaphorical doesn’t matter. Women often have more balls then men, because they learn to fight for them. Whatever your gender, it’s never too late to get them. The Truth About Balls FACT 1. You cannot be born with balls. Therefore, you have to understand that you cannot grow balls until you act as if you already have balls! FACT 2. “Balls” sounds like a noun, but its actually a verb– and so you can practice it. Example! There, I feel better. FACT 3. FACT 4. Many people would think that the life is taken out of a person as they age. DO NOT LET THE FORMER HAPPEN TO YOU. READ IT AGAIN. FACT 5.
Splinter Software - Chris Hulbert's iPhone apps and curious thoughts...
外刊IT评论网
Joel on Software
Rands In Repose
MSDN Blogs - MSDN Blogs
If you were looking for MSDN or TechNet blogs, please know that MSDN and TechNet blog sites have been retired, and blog content has been migrated and archived here. How to use this site Archived blogs are grouped alphabetically by the initial letter of the blog name. You can also type the name of the blog or the title of the blog post in the "search" box at the upper-right corner of this page to search for it. If you have any questions or issues, please share your feedback here. All Blogs 0-9, Non-Alphabet Characters
刘未鹏 | Mind Hacks | 思维改变生活
Related:
Related: