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

SEARCH KEYWORD -- NULL safe



  <=> operator in MySQL

Have you ever seen "<=>" in a SQL query while using MySQL? Does it mean less and equals to and greater than? Actually if you consider it as the union of <= and =>, great, you are close to it. This is one form of equal operator in MySQL, it has the similar meaning to the = operator with some subtle difference. According to MySQL documentation, <=> is NULL-safe equal. This operator performs an equality comparison like the = operator, but returns 1 rather than NULL if both operand...

   MySQL,NULL safe,<=>     2014-03-24 06:23:22

  Why should we keep column as NOT NULL instead of NULL in MySQL?

Keep table column as NOT NULL instead of NULL except in some special cases. This statement is cited by many articles of MySQL optimization, but they don't say why we should do this. Here we discuss about this. First why are there many people using NULL when defining table? The reasons may be: NULL the the default when defining table, the rookies or people who don't want to have much troubles will keep this default setting Many people think NOT NULL will require more space Many people don't want...

   MySQL,NULL,reason     2012-10-27 03:21:27

  A trick of building multithreaded application on Solaris

Firstly, Let’s see a simple multithreaded application: #include <stdio.h> #include <pthread.h> #include <errno.h> void *thread1_func(void *p_arg) { errno = 0; sleep(3); errno = 1; printf("%s exit, errno is %d\n", (char*)p_arg, errno); } void *thread2_func(void *p_arg) { errno = 0; sleep(5); printf("%s exit, errno is %d\n", (char*)p_arg, errno); } int main(void) { pthread_t t1, t2; ...

   C, Solaris     2014-10-14 02:59:40

  Remove duplicated elements in JavaScript array

During interviews, one frequent question asked would be something like how to remove duplicated elements in a JavaScript array and how many different ways you can think of. The interviewee would also be asked to write the code down. In real applications, normally front end would not need to handle this case since normally it would be done by backend, but still it's necessary for front end developers to know different ways of doing this. This post will share some of the common ways to remove dupl...

   JAVASCRIPT,ARRAY,DUPLICATED ELEMENT     2018-09-21 22:32:10

  Why exception would be thrown when deleting element while looping through HashMap in Java

HashMap and other Collection types are frequently used in Java application programming. This post will explain why exception would be thrown when deleting element with Map.remove() while looping through a Map using Iterator. This issue would also occur to other Collection types such as Set, List. Below is a sample code snippet demonstrating the exception thrown. Map<String,String> map = Collections.synchronizedMap(new TreeMap<String,String>()); map.put("key1","value1"); map.put("ke...

   JAVA,HASHMAP,CONCURRENTMODIFICATIONEXCEPTION     2018-06-30 12:49:09

  Algorithm : Delete middle node from singly linked list

Questions about singly linked list are frequently asked during technical interviews. Today we will share with you one algorithm question about singly linked list. Here is the problem description. Assuming the only information you are giving is there is a pointer to a middle node of a singly linked list, no other information about the linked list is given. Please delete this node and don't affect the structure of the linked list. Initially you may think this question is easy if you know the hea...

   ALGORITHM,C,LINKED LIST     2015-10-30 05:21:25

  Tips and tricks about JavaScript from Google

JavaScript is now a very popular client side language. It's flexible, powerful but easy to make mistakes. So good programming style is better for you to write efficient and readable JavaScript codes. Here are some tips and tricks about JavaScript from Google. True and False Boolean Expressions The following are all false in boolean expressions: null undefined '' the empty string 0 the number But be careful, because these are all true: '0' the string [] the empty array {}&n...

   JavaScript, Google, Coding standard     2013-02-26 23:11:03

  Binary tree iterator algorithm

Binary tree pre-order,in-order and post-order traversal are basics in algorithm and data structure.And the recursive binary tree traversal is a classical application of recursion. We define a binary tree node as : // C++ struct Node { int value; Node *left; Node *right; } In order binary tree traversal can be: // C++ void inorder_traverse(Node *node) { if (NULL != node->left) { inorder_traverse(node->left); } do_something(node); if (NULL != node->righ...

   Binary tree,Iterator,Traversal     2013-07-14 21:51:09

  Algorithm : Reverse singly linked list

Questions about singly linked list are the lovers of interviewers during interviews given the characteristic that singly linked list is one-directional list and it's difficult to get the previous node of one node without some buffering tricks.  In this post, we will demonstrate one of the most frequently asked question about singly linked list -- Reversing the singly list. Given the first node of a singly linked list, reverse the singly linked list. For example : A->B->C->D After ...

   ALGORITHM,INTERVIEW,C     2015-10-31 11:38:35

  Different types of keystore in Java -- Windows-MY

Windows-MY is a type of keystore on Windows which is managed by the Windows operating system. It stores the user keys and certificates which can be used to perform cryptographic operations such as signature verification, data encryption etc. Since it's a kind of native keystore, Java doesn't have a general API to access it. To help Java applications access the keys and certificates stored in Windows-MY keystore, Java provides a separate API -- SunMSCAPI. The SunMSCAPI provider is ...

   JAVA,KEYSTORE,WINDOWS-MY,SUNMSCAPI     2016-01-09 05:45:59