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

SEARCH KEYWORD -- Structure



  How big is sizeof structure?

First let's see the codes of a structure: struct node{ int a; int b; }; Question : What's sizeof(node)? The answer is very simple, on a 32 bit machine, an int will take 4 bytes and two ints will take 8 bytes. So sizeof(node) is 8. The answer for the above codes is 8, then how about the following structure: struct node{ char a; int b; }; Question : Then what's sizeof(node) now? int takes 4 bytes, char takes 1 bytes, is the answer 5? Now the answer may not be 5, on some mac...

   Data structure alignment, pack     2012-10-29 12:13:37

  How DNS lookup works

When accessing a website, a domain name would be needed normally. To get to the actual web server, the domain name must be mapped to an actual IP address and the IP address will be used to reach the web server. The process of finding the IP address from a domain name is called DNS lookup.  How does DNS lookup work? There are tons of domain name and IP address around the world, there must be some well-designed architecture to support fast lookup. This post will explain how this works. DNS Se...

   DNS,DNS LOOKUP     2022-09-09 23:11:03

  The Erlang Design Pattern

Over the last couple of weeks I did an OO programming experiment. I call it the Erlang design pattern. It is based on the Actor model but goes some steps further. At its core just like the Actor model there are active entities (objects) that have a thread and a message queue with the thread waiting on the message queue to do some stuff. The Erlang design pattern extends the Actor model by first dividing the software program into active (actors, that have their own thread) and passive ...

   Erlang,Thread,Pattern,OS Threads     2012-02-06 07:47:56

  Productivity tips for freelance web designers

There are lots of great things about freelance, such as not being tied to a desk, flexible working hours and little, if any, supervision. All freelance web designers probably realize that one of the biggest challenges of their job is the issue of productivity. How to motivate yourself and stay productive every day with no external supervisors telling us to complete a task right now? Here are five practical productivity hacks for all freelance web designers who want to boost their performance. 1....

   productivity tips, freelance, web designers, productivity hacks     2015-02-13 01:40:29

  How to choose JavaScript template engine?

With the increase of density of web front end development, AJAX and JSON are used more and more frequently, it's necessary to use many tags in front end development. You may have a JSON object as below: var data={  email: 'terry.li@gbin1.com,  gender: 'male'  } Then you need to organize the JSON data into page elements. var email, gender;email= ' ' + data.email+ '; gender= ' ' + data.gender + '; $('#contentwrapper‘).append(content).append(gender); The output is very simple: ...

   JavaScript template engine,Template     2012-10-07 07:03:58

  Tricks with Direct Memory Access in Java

Java was initially designed as a safe managed environment. Nevertheless, Java HotSpot VM contains a “backdoor” that provides a number of low-level operations to manipulate memory and threads directly. This backdoor – sun.misc.Unsafe â€“ is widely used by JDK itself in packages like java.nio or java.util.concurrent. It is hard to imagine a Java developer that uses this backdoor in any regular development because this API is extremely dangerous...

   Java,Directly memory access,Tricks,JVM     2012-02-13 05:31:19

  Beauty of code : How to write graceful PHP code

Writing good code is an art. In order to achieve this, it is necessary to develop good programming habits at the beginning. Good programming habits not only contributes to the early project design (modular),but also allows you to the code easier to understand, so that the maintenance of the code is easier. Bad programming habits will result in more code bugs, and will make future maintenance work difficult. We introduce some good programming habits taking PHP as example. Hope this will help you....

   PHP,Good code     2012-08-26 12:23:03

  Microsoft announces new Microsoft Band

Microsoft just announced a new Microsoft Band on a new product release event held in New York today. This new device is the second generation of the smart wearable device since the first generation announced around 1 year back(29 October, 2014). The biggest change of the new Microsoft Band is that it has a whole new design with curved screen. It now can be better adept to our body structure. In addition to this, there are a few other features as well. Below is a list of the features this new Mi...

   MICROSOFT BAND 2,MICROSOFT     2015-10-06 09:51:41

  GCC is compiled with C++ compiler

On 15 Aug, 2012, GCC merged a patch--Merge from cxx-conversion branch . This means GCC will be compiled with C++ compiler in the future, it also means that GCC will be implemented using C++. You may have following two puzzles: Why does GCC turn to C++? Without C++ compiler, how can we compile C++ codes? Why using C++? In GNU's C++ Conversion, we can find this description in the background section: Whether we use C or C++, we need to try to ensure that interfaces are easy to understan...

   GCC,C++,Compiler     2012-09-04 02:36:06

  Text editor vs IDE

A meaningless editor war Many people like to debate which editor is the best. The biggest controversy is between Emacs and vi. vi supporters like to say: "Look it's very fast to type in vi, our fingers no need to leave the keyboard, we even no need to use the up,down,left and right keys" Emacs supporters often downplayed this and said: "What's the use of typing fast if I just need to press one key and it equals to dozens keys you type in vi?"In fact, there is another group of people who like to ...

   Editor,IDE,Structured editor,vi     2013-05-20 12:03:39