Today's Question:  What does your personal desk look like?        GIVE A SHOUT

SEARCH KEYWORD -- Wrong



  Ways to undo wrong Git operations

While using Git to version code, programmers would inevitably perform some invalid operations which are not expected. Sometimes it's difficult to deal with this kind of awkward situations. If the programmer chooses to undo the operation, the programmer needs to bear the risk of deleting something which is not supposed to be deleted if the undo is done improperly. If the programmer leaves it as is, the file needs to be updated again manually with a new commit. In this post, we will try to pr...

   GIT,GIT COMMIT,GIT RESET     2018-07-07 03:28:21

  Implementing DESede/ECB/NoPadding cipher algorithm in GoLang

By default, GoLang doesn't provide the ECB mode cipher for DESede though there is CBC mode provided. In cases we need to encrypt/decrypt data with ECB mode, we need to implement those by ourselves. This mode is frequently used when encrypting/decrypting PIN block which is small block data less than 16 bytes. In this post, we will introduce how to implement the DESede/ECB/NoPadding algorithm in GoLang by using the existing cipher support. Here we will not cover how DESede works in detail, instead...

   SECURITY,SAMPLE,GOLANG,DES,DESEDE,3DES     2019-07-29 06:43:50

  Why does it take Task Manager longer to appear when you start it from the Ctrl+Alt+Del dialog?

Amit was curious why it takes longer for Task Manager to appear when you start it from the Ctrl+Alt+Del dialog compared to launching it from the taskbar. Well, you can see the reason right there on the screen: You're launching it the long way around. If you launch Task Manager from the taskbar, Explorer just launches taskmgr.exe via the usual Create­Process mechanism, and Task Manager launches under the same credentials on the same desktop. On the other hand, when you use the secure ...

   Windows,Task manager,Start time,Ctrl+Alt+Del     2012-02-02 07:06:56

  Introducing the for-if anti-pattern

Over the years, I've seen a bunch of coding anti-patterns. I figured maybe I'll share a few. Today, I'll introduce what I'm calling the for-if anti-pattern, also known as "We'll sell you the whole seat, but you'll only need the edge." This is a special case of the for-case anti-pattern, where all but one of the cases is null. for (int i = 0; i < 100; i++) { if (i == 42) { do_something(i); } } This can naturally be simplified to do_something(42); The for-if anti-pattern arises in ma...

   Programming,Anti-pattern,for-if,efficiency     2012-02-02 10:18:15

  The Web Is Wrong

The Analogies Are Wrong Originally, web pages were static documents, and web browsers were static document viewers; there was text, some formatting, and images—if you could pay for the bandwidth to serve them. Hyperlinks were the really big thing, because they were the main point of user interaction—but what a powerful thing they were, and still are. Then along came CGI and Java, and the web was transformed: all of a sudden, a web browser became a way to serve interactive co...

   Web,Feature,Static document,CSS,Text     2011-12-31 15:43:53

  JavaScript Is Not A Language

Recently people presented arguments for and against using CoffeeScript. I felt the argument against was pointless and obviously wrong, but I couldn't figure out why, and I thought the counterargument for was kind of toothless and irrelevant. I've figured out the real issue.The real argument for CoffeeScript is that JavaScript is not really a language.Years ago I read something which explained, in my opinion, why Lisp has never achieved the mainstream adoption its passionate advocates belie...

   JavaScript,Not a language,CoffeeScript,Model     2011-12-29 08:46:15

  Everything You Thought You Knew About Learning Is Wrong

Taking notes during class? Topic-focused study? A consistent learning environment? All are exactly opposite the best strategies for learning. Really, I recently had the good fortune to interview Robert Bjork, director of the UCLA Learning and Forgetting Lab, distinguished professor of psychology, and massively renowned expert on packing things in your brain in a way that keeps them from leaking out. And it turns out that everything I thought I knew about learning is wrong. Here’s wh...

   Learning,Thought,Before,Wrong     2012-01-30 05:45:36

  How deep should unit test go?

There is a question on Stackoverflow which says "How deep are your unit tests?". It is asked by a guy named John Nolan. The question is not too new, but what catches me is the Best Answer given by Kent Beck, who is the creator of Extreme programming(XP) and Test Driven Development(TDD). Let's look at the question first. The thing I've found about TDD is that its takes time to get your tests set up and being naturally lazy I always want to write as little code as possible. The first thing I seem ...

   Unit test,TDD,XP     2012-09-03 10:11:27

  Signature sign/verification demo in Java

Digital signature is commonly used in areas where data authentication and integrity are required. It is extremely important to have signature while transferring sensitive data from one peer to other peers through network since there might be malicious applications or man-in-the-middle attacks which may alter the data along the way. Java provides some APIs to generate and verify digital signature. One important class is Signature.  When generating the signature, a private key needs to be pa...

   SECURITY,JAVA,SIGNATURE     2015-11-21 09:48:12

  How to undo git changes?

When using git for version control, there is frequent need on undoing commits due to some unexpected changes. This post will introduce how to undo changes with git command in different cases. Undo commit A common undo case is that some commit needs to be reverted as the commit contains error. In this case, the code is already committed. The command to revert the commit is git revert HEAD This command will add new a commit to the existing head to undo the previous commit. It will not change the p...

   GIT,GIT RESET,GIT REVERT,GIT CHECKOUT     2019-12-28 02:21:47