- 博客(101)
- 资源 (1)
- 收藏
- 关注
原创 vimrc
" CUDA syntax highlight {au BufNewFile,BufRead *.cu set ft=cudaau BufNewFile,BufRead,BufEnter *.cpp,*.hpp,*.c,*.h,*.cu set omnifunc=omni#cpp#complete#Main" }set nuset cindentlet &termencoding=&encodi
2013-11-23 14:31:03 494
原创 Linus:利用二级指针删除单向链表
Linus大婶在slashdot上回答一些编程爱好者的提问,其中一个人问他什么样的代码是他所喜好的,大婶表述了自己一些观点之后,举了一个指针的例子,解释了什么才是core low-level coding。Linus举了一个单向链表的例子,但给出的代码太短了,一般的人很难搞明白这两个代码后面的含义。已经有几位牛人对代码作了解释,具体如下:http://wordaligned.org/art
2013-05-23 16:23:06 633
原创 合并两个git仓库,并保留每个仓库的历史
问题:有两个git仓库 repository1和repository2,想把repository2合并到repository1,并在repository1中保留repository2的所有分支历史 方案: 1.在repository1中添加远程分支,,跟踪repository2,并把repository2全部分支拉到repository1中,命令为:
2013-04-22 20:07:03 1938
原创 Ubuntu 12.10 软件更新后进不去桌面
问题描述:某一日,手贱,更新Ubuntu 12.10 软件后进不去桌面,只能看到ubuntu的欢迎界面,输入密码登录就只能看到ubuntu经典的背景,右键会出现菜单,但unity的界面不见了 解决方法:这个问题是由于装了第三方的显卡驱动Nvidia的显卡驱动,更新软件后出现不兼容的问题导致的。只要重新安装Nvidia显卡驱动即可,具体操作如下 进入u
2013-04-05 08:51:58 1555
转载 Your Customers Do not Mean What They Say
I've never met a customer yet that wasn't all too happy to tell me what they wanted — usually in great detail. The problem is that customers don't always tell you the whole truth. They generally don't
2013-04-04 09:28:16 497
转载 You Gotta Care about the Code
It doesn't take Sherlock Holmes to work out that good programmers write good code. Bad programmers... don't. They produce monstrosities that the rest of us have to clean up. You want to write the good
2013-04-04 09:27:44 467
转载 Write Tests for People
You are writing automated tests for some or all of your production code. Congratulations! You are writing your tests before you write the code? Even better!! Just doing this makes you one of the early
2013-04-04 09:27:14 368
转载 Write Small Functions Using Examples
We would like to write code that is correct, and have evidence on hand that it is correct. It can help with both issues to think about the "size" of a function. Not in the sense of the amount of code
2013-04-04 09:26:41 348
转载 Write Code as If You Had to Support It for the Rest of Your Life
You could ask 97 people what every programmer should know and do, and you might hear back 97 distinct answers. This could be both overwhelming and intimidating at the same time. All advice is good, al
2013-04-04 09:26:04 797
转载 When Programmers and Testers Collaborate
Something magical happens when testers and programmers start to collaborate. There is less time spent sending bugs back and forth through the defect tracking system. Less time is wasted trying to figu
2013-04-04 09:25:27 342
转载 WET Dilutes Performance Bottlenecks
The importance of the DRY principle (Don't Repeat Yourself) is that it codifies the idea that every piece of knowledge in a system should have a singular representation. In other words, knowledge shou
2013-04-04 09:24:54 460
转载 Verbose Logging Will Disturb Your Sleep
When I encounter a system that has already been in development or production for a while, the first sign of real trouble is always a dirty log. You know what I'm talking about. When clicking a single
2013-04-04 09:24:17 441
转载 Use the Right Algorithm and Data Structure
A big bank with many branch offices complained that the new computers it had bought for the tellers were too slow. This was in the time before everyone used electronic banking and ATMs were not as wid
2013-04-04 09:23:35 374
转载 The Unix Tools Are Your Friends
If on my way to exile on a desert island I had to choose between an IDE and the Unix toolchest, I'd pick the Unix tools without a second thought. Here are the reasons why you should become proficient
2013-04-04 09:23:03 433
转载 Ubuntu Coding for Your Friends
So often we write code in isolation and the code reflects our personal interpretation of a problem, as well as a very personalized solution. We may be part of the team, yet we are isolated, as is the
2013-04-04 09:22:27 442
转载 Two Wrongs Can Make a Right (and Are Difficult to Fix)
Code never lies, but it can contradict itself. Some contradictions lead to those "How can that possibly work?" moments.In an interview, the principal designer of the Apollo 11 Lunar Module softwar
2013-04-04 09:21:53 417
转载 Two Heads Are Often Better than One
Programming requires deep thought, and deep thought requires solitude. So goes the programmer stereotype.This "lone wolf" approach to programming has been giving way to a more collaborative approach
2013-04-04 09:21:21 397
转载 Thinking in States
People in the real world have a weird relationship with state. This morning I stopped by the local store to prepare for another day of converting caffeine to code. Since my favorite way of doing that
2013-04-04 09:20:48 326
转载 Testing Is the Engineering Rigor of Software Development
Developers love to use tortured metaphors when trying to explain what it is they do to family members, spouses, and other non-techies. We frequently resort to bridge building and other "hard" engineer
2013-04-04 09:20:00 390
转载 Test While You Sleep (and over Weekends)
Relax. I am not referring to offshore development centers, overtime on weekends, or working the night shift. Rather, I want to draw your attention to how much computing power we have at our disposal.
2013-04-04 09:19:19 328
转载 Test Precisely and Concretely
It is important to test for the desired, essential behavior of a unit of code, rather than test for the incidental behavior of its particular implementation. But this should not be taken or mistaken a
2013-04-04 09:18:31 400
转载 Step Back and Automate, Automate, Automate
I worked with programmers who, when asked to produce a count of the lines of code in a module, pasted the files into a word processor and used its "line count" feature. And they did it again next week
2013-04-04 09:17:44 378
转载 Take Advantage of Code Analysis Tools
The value of testing is something that is drummed into software developers from the early stages of their programming journey. In recent years the rise of unit testing, test-driven development, and ag
2013-04-04 09:17:33 376
转载 Test for Required Behavior, not Incidental Behavior
A common pitfall in testing is to assume that exactly what an implementation does is precisely what you want to test for. At first glance this sounds more like a virtue than a pitfall. Phrased another
2013-04-04 09:17:22 305
转载 Start from Yes
Recently I was at a grocery store searching high and low for "edamame" (which I only vaguely knew was some kind of a vegetable). I wasn't sure whether this was something I'd find in the vegetable sect
2013-04-03 08:59:43 406
转载 The Single Responsibility Principle
One of the most foundational principles of good design is:Gather together those things that change for the same reason, and separate those things that change for different reasons.This principle i
2013-04-03 08:59:07 312
转载 Simplicity Comes from Reduction
"Do it again...," my boss told me as his finger pressed hard on the delete key. I watched the computer screen with an all too familiar sinking feeling, as my code — line after line — disappeared into
2013-04-03 08:58:27 358
转载 The Road to Performance Is Littered with Dirty Code Bombs
More often than not, performance tuning a system requires you to alter code. When we need to alter code, every chunk that is overly complex or highly coupled is a dirty code bomb laying in wait to der
2013-04-03 08:57:47 413
转载 Resist the Temptation of the Singleton Pattern
The Singleton pattern solves many of your problems. You know that you only need a single instance. You have a guarantee that this instance is initialized before it's used. It keeps your design simple
2013-04-03 08:57:09 418
转载 Reinvent the Wheel Often
"Just use something that exists — it's silly to reinvent the wheel..."Have you ever heard this or some variation thereof? Sure you have! Every developer and student probably hears comments like this
2013-04-03 08:56:34 493
转载 Read the Humanities
In all but the smallest development project people work with people. In all but the most abstracted field of research people write software for people to support them in some goal of theirs. People wr
2013-04-03 08:55:50 389
转载 Read Code
We programmers are weird creatures. We love writing code. But when it comes to reading it we usually shy away. After all, writing code is so much more fun, and reading code is hard — sometimes almost
2013-04-03 08:55:04 582
转载 Put the Mouse Down and Step Away from the Keyboard
You've been focused for hours on some gnarly problem and there's no solution in sight. So you get up to stretch your legs, or to hit the vending machines, and on the way back the answer suddenly becom
2013-04-03 08:54:24 426
转载 Put Everything Under Version Control
Put everything in all your projects under version control. The resources you need are there: free tools, like Subversion, Git, Mercurial, and CVS; plentiful disk space; cheap and powerful servers; ubi
2013-04-03 08:53:22 472
转载 The Professional Programmer
What is a professional programmer?The single most important trait of a professional programmer is personal responsibility. Professional programmers take responsibility for their career, their estima
2013-04-03 08:51:18 414
转载 Prevent Errors
Error messages are the most critical interactions between the user and the rest of the system. They happen when communication between the user and the system is near breaking point.It is easy to thi
2013-04-03 08:50:28 455
转载 Prefer Domain-Specific Types to Primitive Types
On 23rd September 1999 the $327.6 million Mars Climate Orbiter was lost while entering orbit around Mars due to a software error back on Earth. The error was later called themetric mix-up. The groun
2013-04-03 08:49:47 309
转载 Pair Program and Feel the Flow
Imagine that you are totally absorbed by what you are doing — focused, dedicated, and involved. You may have lost track of time. You probably feel happy. You are experiencing flow. It is difficult to
2013-04-03 08:49:04 275
转载 Own (and Refactor) the Build
It is not uncommon for teams that are otherwise highly disciplined about coding practices to neglect build scripts, either out of a belief that they are merely an unimportant detail or from a fear tha
2013-04-03 08:48:28 397
转载 Only the Code Tells the Truth
The ultimate semantics of a program is given by the running code. If this is in binary form only, it will be a difficult read! The source code should, however, be available if it is your program, any
2013-04-03 08:47:31 366
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人