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

SEARCH KEYWORD -- Method



  Deep clone of JavaScript object

In JavaScript world, it's frequently seen object clone. Normally when creating a clone of an object, it's only the reference being cloned but not all contents. In some scenarioes, it's desired to clone all the content instead of just the reference such that any change made to the cloned object will not change the original object. Differences between shallow clone and deep clone can be as simple as: Shallow clone : Only the object reference is cloned but not the content Deep clone : Clone all co...

   JAAVSCRIPT,DEEP CLONE,DEEP COPY,SHALLOW CLONE,SHALLOW COPY     2016-10-31 00:27:24

  How to handle ES6 modules in NodeJS

In modern JavaScript, there are two types of modules: ES6 module and CommonJS module used by NodeJS. These two types of module are not compatible. Many people would wonder how to load ES6 modules in their NodeJS project. This post will show how this can be done. Difference The syntax of the module being loaded is different. CommonJS modules are loaded with require() and exported with module.exports. ES6 modules are loaded and exported using import and export respectively. Merchanismwise require(...

   NODEJS,COMMONJS,ES6     2020-08-28 22:01:33

  Why Objective-C is Hard

As an active member of "The Internet" and vocal Objective-C coder, I get a lot of questions surrounding the language. They're often framed around thinking about learning the language or trying to write an app, but they also usually involve a phrase like "Objective-C looks really hard" or "what are all those minus signs about?" Both of these are pretty good questions, and I'd like to address why someone might be more hesitant to jump into iOS or OS X development compared to, say, Ruby or J...

   Objective-C,difficult,hard,reason,analysis     2012-03-07 05:11:28

  Language Complexity?

Some languages are complex, others are simple … right?  C++ versus just about anything else is a good example here.  But, it begs the question: what makes a language complex? So, I’ve just been reading Bruce Eckel’s Artima article on Scala.  It’s actually a nice article, and I enjoyed it.  But, one thing bugged me — and, it’s nicely summarised in this quote: But you can see from the code above that learning Scala should be a lot eas...

   Programming language,complexity     2011-06-15 02:16:05

  Convert HTML to DOM elements using JavaScript

In some cases, one would want to convert a HTML string to the DOM elements so that JavaScript can handle them easily. This is frequently used when one get some data from third party APIs where the data is in HTML format. In JavaScript, there are a couple of ways one can use to convert HTML to DOM elements. DOMParser document.createElement DOMParser DOMParser can parse XML or HTML source stored in a string into a DOM Document. After the conversion, the normal JavaScript call of h...

   JAVASCRIPT,DOMPARSER,DOCUMENT.CREATEELEMENT,HTML,DOM     2017-08-18 22:51:46

  Check file readability in Java

File operation is quite platform dependent. Although Java is a cross platform programming language, the file operation in Java is also platform dependent. The obvious evidence is the file permission check. In Java, we can call canRead(), canWrite() and canExecutable() to check whether the program can read, write or execute the file specified. However, on Windows, when we call canRead() on a File object, we may get unexpected result. Actually, on Windows, when we call canRead() on a File object, ...

   Java,Files,Readable,Check     2013-12-05 06:10:15

  Java Interview Questions

Currently there are many articles online which summarize the list of Java interview questions. Some cover lots of basic questions and some cover some specific questions in specific area such as multithreading. In this post, we will not cover the really basic questions, we will cover something different. For basic question, you can read Java Interview Questions。 Basic What is primitive data type? How many primitive data types in Java? What are they? -- A primitive type is prede...

   JAVA,SECURITY,INTERVIEW,CAREER,MULTITHREADING,QUESTION,JAVA INTERVIEW,JAVA CORE     2019-01-21 07:07:08

  What is the use of empty struct in GoLang

In Go, an empty struct struct{} is a struct with no fields that may appear to be of little use, but in reality, it can be useful in certain situations and become a simple and efficient solution in code. As a semaphore or lock Because the empty struct has no fields, it can be conveniently used to implement some concurrency control functions, such as mutex locks, read-write locks. We can use chan struct{} to implement an unbuffered channel for controlling concurrent access. package main import ( ...

   GOLANG,EMPTY STRUCT     2023-02-25 18:37:30

  Tomcat vs. Apache: Why One Over the Other?

When determining which type of web server to use, the differences and technical details can be daunting. It can be a difficult task to compare web servers and make the decision on which is best for you and your project. Since Apache is currently the most popular web server, this article will discuss the differences between the Apache Web Server and Apache Tomcat, which are very different and fulfill different needs.The Apache Web Server, often just called “Apache” or â€...

   Apache,Tomcat,Choice,Web server     2012-03-23 12:01:25

  Including Related Objects in Queries

Every time you hit a mobile network, it slows your users down and introduces another point of failure. So when you're designing your application, you need to take advantage of every opportunity to omit needless requests. Parse's philosophy is to help make this easier by providing standard ways to reduce network requests. One example is caching queries, which lets you avoid resending requests you've already sent. Another example, which we've launched in the most recent version of the...

   Software design,Request,Network load,Resource manage,Mobile     2011-12-07 08:51:56