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

SEARCH KEYWORD -- Method



  4 ways to obtain access token in OAuth 2.0

OAuth 2.0 is an authorization mechanism, it's ,mainly used for issuing access token. There are 4 ways to obtain access token as per RFC 6749. Authorization code Implicit Password Client credentials The third party application must obtain a client id and client secret from the target service before obtaining access token no matter which method to use. This is to prevent token to be used maliciously. Authorization code With this method, the third party application must first get an authorization...

   OAUTH2,ACCESS TOKEN,REFRESH TOKEN     2019-06-29 07:12:03

  How to write your own DSL in Ruby

DSL(Domain Specific Language) is a language defined to fulfill some domain specific requirements to ease people's work. It can be used to define attributes and actions of a domain easily and cleanly. And it is often created based on some common observations or micro patterns of some domain. In Ruby world, there are quite a few places people can find DSL. For example, Ruby itself, Chef recipes. To create a class in Ruby, the traditional OOP way would look like. class User @name = nil @email =...

   RUBY,DSL,TUTORIAL     2017-03-04 09:40:34

  Difference between Enumeration and Iterator in java interview question and answer

This tutorial explains about what are the differences between Iterators and Enumeration and similarity of both interface which may be asked in a core java interview. Functionalities of both Iterator & Enumeration interfaces are similar that means both generates a series of all elements of the object which is to have its values iterated that can be traversed one at a time using next() method incase of Iterator and nextElement() method incase of Enumeration. The more powe...

   Java,Iterator,Enumeration     2012-05-01 07:41:52

  Access control in Java -- doPrivileged

Previously we have introduced how Java performs permission check to protect resource access. What if sometimes we need to give some class the temporary access to some resource which it initially doesn't have? AccessController provides six doPrivileged methods to fulfill this requirement. These six methods have below signatures : static T doPrivileged(PrivilegedAction action)static T doPrivileged(PrivilegedAction action, AccessControlContext context)static T doPrivileged(PrivilegedExceptionA...

   JAVA,SECURITY,DOPRIVILEGED     2016-03-08 05:46:42

  PHP function overloading puzzle clearer

PHP's meaning of overloading is different than Java's. In PHP, overloading means that you are able to add object members at runtime, by implementing some of the __magic methods, like __get, __set, __call, __callStatic. You load objects with new members. Overloading in PHP provides means to dynamically "create" properties and methods. These dynamic entities are processed via magic methods one can establish in a class for various action types. Some example:class Foo{    p...

   PHP,function overloading,OOP,default val     2011-07-11 03:24:30

  A C++ program puzzle

Recently I came across a question asked by wang2191195 on a Chinese IT forum CSDN which asks about a C++ program puzzle. He has a code snippet which cannot be compiled. The code is:#include <cstdlib> #include <iostream> using namespace std; class Base{ public: virtual void func(){ cout << "Base::func()" << endl; } virtual int func( int num ){ cout << "Base::func( int " << num << " )" << endl; return 0; ...

   C++,Puzzle,Hide,Overload     2012-05-13 02:31:26

  Converting Decimal Fractions to Binary

Converting Decimal Fractions to Binary In the text proper, we saw how to convert the decimal number 14.75 to a binary representation. In this instance, we \"eyeballed\" the fractional part of the binary expansion; 3/4 is obviously 1/2 + 1/4. While this worked for this particular example, we\'ll need a more systematic approach for less obvious cases. In fact, there is a simple, step-by-step method for computing the binary expansion on the right-hand side of the point. We will illustrate the metho...

   Decimal,Fractional,Binary     2011-03-19 06:45:35

  How to Convert Images on Mac Finder

If you have a lot of images in different formats and you want to convert them to a common format, you can use the Mac Finder to do it easily and quickly. Here are the steps to follow: 1. Open the Finder and navigate to the folder where your images are stored. 2. Select the images that you want to convert. You can use the Shift key or the Command key to select multiple images at once. 3. Right-click on the selected images and choose Services > Preview from the context menu. This will open the ...

   MACOS,FINDER,IMAGE CONVERSION     2023-04-16 02:09:54

  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

  Javascript motion tracking

It is very often that I have to do video motion tracking for interactive video campaign in my daily work. If I’m used used to do that in Flash, I made a quick experiment to do the same in javascript. Thanks to Olof Storm who made me a perfect corner pin motion tracking in After Effects, and I’ve been using some code from Steven Wittens to draw an image in perspective. Click here to see the motion tracking demo (give it a bit of time to fully load). What I’m doing in this dem...

   JavaScript,Motion tracking,Flash     2012-03-20 07:43:46