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

SEARCH KEYWORD -- Array



  PHP to integrate with Sign in with Google

Google has a huge user base and hence it provides an authentication service for third party service to integrate with them so that people can sign in with Google in their services. Google also adopts OAuth 2 to provide this kind of Open ID connect service. This post will introduce how to integrate with sign in with Google functionality in your PHP website.  Create a client app on Google The first step you should follow is to create a Google app, you can follow the post here to create the p...

   PHP,GOOGLE API,OPEN API,SIGN IN WITH GOOGLE     2019-03-03 02:00:09

  10 Reasons Why Visual Basic is Better Than C#

Visual Basic is a better programming language than Visual C#. Who says so? This article! Here are 10 reasons why you should always choose VB over C#. 1 – “Rose is a rose is a rose is a rose” This is a quotation from Gertrude Stein’s 1922 play Geography and Plays. However, the poetry wouldn’t work in C#, because – unforgivably – it’s a cASe-SeNSitIvE language. This is madness! Before I start ranting, let me just acknowledge that case-sens...

   Visual basci,C#,Advantage,Comparison     2012-03-10 04:24:03

  Eight C++ programming mistakes the compiler won’t catch

C++ is a complex language, full of subtle traps for the unwary. There is an almost infinite number of ways to screw things up. Fortunately, modern compilers are pretty good at detecting a large number of these cases and notifying the programmer via compile errors or warnings. Ultimately, any error that is compiler-detectable becomes a non-issue if properly handled, as it will be caught and fixed before the program leaves development. At worst, a compiler-detectable error results in los...

   C++,Compiler,Error detection     2012-04-08 09:55:20

  Is Java Set ordered or not?

“Is Java Set ordered or not? ” is the most popular question asked when you interview for a Java Developer position. Many fail to answer it, and I have to admit I was one of the many. I have known the answer is “Yes and No” for a long time. No. HashSet is not ordered. Yes.TreeSet is ordered. If the interviewer continues with some follow up questions, I’m not confident that I know the answer then. Why is TreeSet ordered? Are there any other ordered S...

   ORDER,SORTEDSET,HASHSET,JAVA     2021-02-11 06:55:00

  A String is not an Error

I decided to write a little article to discourage an unfortunately common pattern in Node.JS modules (and browser JavaScript, to a lesser extent) that can boil down to these two examples: // A:function myFunction () {  if (somethingWrong) {    throw 'This is my error'  }  return allGood;} and // B: async Node.JS-style callback with signature `fn(err, …)`function myFunction (callback) {  doSomethingAsync(function () {    // …    if (...

   JavaScript,Node.js,String,Error object     2011-12-23 08:00:32

  Notes on Programming in C

Introduction       Kernighan and Plauger's The Elements of Programming Style was an important and rightly influential book.  But sometimes I feel its concise rules were taken as a cookbook approach to good style instead of the succinct expression of a philosophy they were meant to be.  If the book claims that variable names should be chosen meaningfully, doesn't it then follow that variables whose names are small essays on their use are even better?  Isn't MaximumV...

   C,Notes,Tips     2011-12-09 07:55:47

  Understanding the "this" keyword in JavaScript

Many people get tripped up by the this keyword in JavaScript. I think the confusion comes from people reasonably expecting this to work like “this” does in Java or the way people use “self” in Python. Although this is sometimes used to similar effect, it’s nothing like “this” in Java or other languages. And while it’s a little harder to understand, its behavior isn’t magic. In fact, this follows a relatively small set of simple rules. This...

   JavaScript,this,understanding     2012-03-29 13:48:59

  ConcurrentHashMap vs Collections.synchronizedMap()

ConcurrentHashMap and Collections.synchronizedMap() both provide thread-safe operations of collections of data. They are used in multithreaded programs to provide both thread safety and performance improvements. In many cases, we can use either of them. But the realization of thread safety is different for these two implementations. ConcurrentHashMap will create an HashEntry[] array internally to store the elements passed in from a Map, while Collections.synchronizedMap() will return a Synchroni...

   ConcurrentHashMap,Collections.synchronizedMap     2014-09-18 05:04:59

  C Macro Tips and Tricks

Preprocessor vs Compiler To properly understand C macros, you must understand how a C program is compiled. In particular, you must understand the different things that happen in the preprocessor and in the compiler. The preprocessor runs first, as the name implies. It performs some simple textual manipulations, such as: Stripping comments. Resolving #include directives and replacing them with the contents of the included file. Evaluating #if and #ifdef directives. Evaluating #defin...

   C,Macro,Preprocessor,Trick     2012-05-01 06:49:05

  Arrays.equals() vs MessageDigest.isEqual()

Both Arrays.equals() and MessageDigest.isEqual() are used to compare the equality of two arrays. They can be interchangeably in many cases. However, they do have some differences which lead to different use cases in real applications. One difference is that the arrays passed to MessageDigest.isEqual() cannot be null while it's ok for Arrays.equals(). The one major difference between these two methods is that Arrays.equals() is not time-constant while MessageDigest.isEqual() is time-constant. Thi...

   Arrays.equal(),MessageDigest.isEqual(),Java,Security     2015-05-14 22:03:29