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

SEARCH KEYWORD -- diff



  Understand diff in Unix

diff is an important tool program in Unix. It is used to compare differences of two files, it is the foundation for code version control. If you type : $ diff <file_before_change> <file_after_change> diff will tell you what's the difference between these two files. The result may not be so easy to understand, so now I will show you how to understand diff. 1. 3 formats of diff diff has 3 formats due to historic reasons. normal diff context diff unified diff 2. Demo files For easy d...

   diff,Unix,version control,git     2012-09-03 10:49:36

  Frequently used Git commands

Git configuration git config --global user.name "robbin" git config --global user.email "fankai@gmail.com" git config --global color.ui true git config --global alias.co checkout git config --global alias.ci commit git config --global alias.st status git config --global alias.br branch git config --global core.editor "mate -w" # Configure Editor to use textmate git config -l #List all configurations User's git configuration file : ~/.gitconfig Frequently used Git commands Check、add...

   Git,Command     2013-03-11 19:41:06

  Using DateInterval class in PHP

DateInterval is (amongst others) a relatively new addition to the date extension in PHP 5.3. It allows to describe an interval in time, and you can perform actions with that interval. Basically, it allows to calculate with dates in a very easy way, and do even more fun stuff with it.Unfortunately no documentation exists today for DateInterval and friends, but PHP is open-source so you can easily have a peek at the code to see what’s happening under the engine. This is more or less what th...

   PHP,DateInterval,Class,PHP 5.3,Demo     2011-10-21 10:35:54

  gethostbyname vs getaddrinfo

getaddrinfo is slower than ping when resolving domain names. I think ping uses gethostbyname to resolve a domain name. The question becomes whether getaddrinfo is slower than gethostbyname. After testing with both functions, we find that getaddrinfo is really slow compared to gethostbyname. By strace tracking,  we find getaddrinfo will communicate with DNS server 10 times and gethostbyname will communicate with DNS server communication twice.gethostbyname is an old way to resolve domain nam...

   C++,network,DNS     2012-08-15 14:06:34

  Understand Virtual DOM

With the popularity of React, the internals and implementation of Virtual DOM has becoming top discussed topic in tech communities and interviews. This post will give an introduction of Virtual DOM and how to implement a simple Virtual DOM logic. How to understand Virtual DOM In early days, front end developers would update a webpage view based on the data status change(usually after making AJAX call). But it brings performance penalties when there is frequent update as it would cause page reflo...

   JAVASCRIPT,DOM,VIRTUAL DOM     2019-12-07 23:43:04

  How GitHub Works: Be Asynchronous

This is — by far — my favorite aspect of working at GitHub. Everything is asynchronous. Chat GitHub didn’t have an office for the first two years. Chat rooms (in our case, Campfire) is where things got done. Today we’ve moved into our second office, and Campfire is still where we get things done. There’s a reason for that: chat is asynchronous. Asynchronous communication means I can take a step out for lunch and catch up on transcripts when I get back. Async...

   GitHub,Work,Style,Asynchronous,Efficienc     2011-08-19 07:44:20

  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

  Comparing Floating Point Numbers, 2012 Edition

We’ve finally reached the point in this series that I’ve been waiting for. In this post I am going to share the most crucial piece of floating-point math knowledge that I have. Here it is:[Floating-point] math is hard.You just won’t believe how vastly, hugely, mind-bogglingly hard it is. I mean, you may think it’s difficult to calculate when trains from Chicago and Los Angeles will collide, but that’s just peanuts to floating-point math.Seriously. Each ti...

   Floating point number,Comparison,True value     2012-02-23 07:11:03

  Why localStorage only allows to store string values

localStorage allows data to be stored in browsers across sessions, the data will be there even though the session is expired. It is frequently used to store static data so that they can be loaded when needed. But as per spec, it says that the keys and the values are always strings (note that, as with objects, integer keys will be automatically converted to strings). Why cannot store the object as it is? Take a look at an example: var str = "test"; localStorage.setItem("str", str); cons...

   JAVASCRIPT,LOCALSTORAGE     2020-04-05 00:54:29

  Something you may not know about Shell

Shell is also called command line interface, it is the interface between *nix users and computer. Shell is a program which provides service to access OS kernel services. This article is to introduce some not so well known but useful and interesting knowledge about shell. Wiki shell was born almost at the same time as Unix. The first UNIX shell was written by Ken Thompson in 1971 and its name is Thompson sh. It's older than Linux kernel. The default Shell in most *nix and MacOS is bash, bash was...

   Linux, Unix,Shell,Command     2012-11-24 07:19:47