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

SEARCH KEYWORD -- arguments



  this in JavaScript in detail

this in JavaScript is always confusing, it is one of the most frequently seen traps in JavaScript. this is not a good design in JavaScript(You can refer some other design flaws of JavaScript here), since it's lazy binding feature, it can be a global object, the current object or.... Some people even avoid using this in JavaScript. Actually if you master how this works, then you will know how to stay away from these traps. Let's take a look at what this points to in below situations. 1. In global...

   JavaScript,this,bind     2013-05-09 18:35:12

  ECMAScript 6 looks promising

I am quite excited about ECMAScript 6, after watching David Herman’s talk at YUIConf 2011. I am especially looking forward to seeing some of these features landing up on V8 soon, so that I can use it on node.js. These additions will solve many common sources of frustration that newcomers face when working with JavaScript. Although the spec is not expected to be finalized till 2013 (so says David in the video), a lot of these features are expected to hit Chrome and Firefox much befor...

   ECMAScript 6,JavaScript,new feature,let,template     2011-12-07 03:21:40

  Latest PHP patch cannot fix the bug

On Wednesday(2012-05-02), a remote code execution vulnerability in PHP was accidentally exposed to the Web, prompting fears that it may be used to target vulnerable websites on a massive scale. The bug itself was traced back to 2004, and came to light during a recent CTF competition.A CERT advisory on the flaw explains: “When PHP is used in a CGI-based setup (such as Apache's mod_cgid), the php-cgi receives a processed query string parameter as command line arguments which allows com...

   PHP,bug,patch,bypassed     2012-05-08 11:20:56

  Carriage return and line feed

In programming and document editing, we may frequently encounter carriage return and line feed, i.e the well known CRLF.  But do you know about the history and difference of carriage return and line feed? Before computer came out, there was a type of teleprinter called Teletype Model 33. It can print 10 characters each second. But there is one problem with this, after finishing printing each line, it will take 0.2 second to move to next line, which is time of printing 2 characters. If a new...

   CR,CARRIAGE RETURN,LINE FEED,LF,NEW LINE,CRLF     2017-02-19 08:29:23

  golangci-lint to enable comment check for exported functions

golangci-lint is a command line tool which aggregates a list of different go linters to check whether the source code is in correct condition from different aspects. It is built to run during the CI pipeline so that there is no obvious coding issues before compiling and building the program. It is easy to run it with just below command $ golangci-lint run -v INFO [config_reader] Config search paths: [./ /Users /] INFO [config_reader] Used config file .golangci.yml INFO [lintersdb] Active 10 li...

   EXPORTED COMMENT,GOLINT,REVIVE,GOLANGCI-LINT,GOLANG     2022-04-15 20:21:34

  The ugliest C feature:

<tgmath.h> is a header provided by the standard C library, introduced in C99 to allow easier porting of Fortran numerical software to C. Fortran, unlike C, provides “intrinsic functions”, which are a part of the language and behave more like operators. While ordinary (“external”) functions behave similarly to C functions with respect to types (the types of arguments and parameters must match and the restult type is fixed), intrinsic functions accept arguments of...

   C,,Fortran,Intrinsic functions,C99,Ugly     2011-12-26 08:33:27

  Name resolution order in JavaScript

To understand what value a variable has in JavaScript, we need to understand some concepts such as scope and name resolution order. JavaScript has two scopes; one is program level and the other one is function level. Unlike in C,C++ or Java, JavaScript has no block level scope. So a variable defined in a if block will still be available outside. For example, the below example: var foo = 1; function bar() { if (true) { var foo = 10; } alert(foo); } bar(); The alert will display 10 since the ...

   JavaScript,Scope,Name resolution     2013-07-10 01:29:28

  Clojure & Java Interop

About a year ago I got a phone call asking if I wanted to join another team at DRW. The team supports a (primarily) Java application, but the performance requirements would also allow it to be written in a higher level language. I'd been writing Clojure (basically) full-time at that point - so my response was simple: I'd love to join, but I'm going to want to do future development using Clojure. A year later we still have plenty of Java, but the vast majority of the new code I add is Cloj...

   Java,Clojure,Interoprability,Commit,Function call     2011-12-29 09:11:22

  Currying in Python

What is Currying? Currying is like a kind of incremental binding of function arguments. Let’s define a simple function which takes 5 arguments: 1def f(a, b, c, d, e):2    print(a, b, c, d, e) In a language where currying is supported, f is a function which takes one argument (a) and returns a function which takes 4 arguments. This means that f(5) is the following function: 1def g(b, c, d, e):2    f(5, b, c, d, e) We could emulate this behavior the...

   Python,Curring,Binding,Implement     2012-03-19 12:59:10

  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