Explaining to laypeople why bootstrapping works

You want to ask a question of a population but you can’t. So you take a sample and ask the question of it instead. Now, how confident you should be that the sample answer is close to the population answer obviously depends on the structure of population. One way you might learn about this is to take samples from the population again and again, ask them the question, and see how variable the sample answers tended to be. Since this isn’t possible you can either make some assumptions about the shape of the population, or you can use the information in the sample you actually have to learn about it.

Read More

Share Comments

梯形法、龙格库塔法求解微分方程 数值解


图1 微分方程中微分表达式中tm与tm+1与坐标中组成阴影面积图

Read More

Share Comments

Understand how bitwise operators work


In this article, I tell you how bitwise operators work.

All operators in this article:

  • OR (Inclusive OR) ( | sign in C#, Or in VB.NET )
  • AND ( & sign in C#,And in VB.NET )
  • XOR (Exclusive OR) ( ^ sign in C#, Xor in VB.NET)
  • NOT ( ~ sign in C#, Not in VB.NET)
  • Left Shift ( << sign in C# and VB.NET)
  • Right Shift ( >> sign in C# and VB.NET)
  • Circular Shift
    • Circular Left Shift (no operator in C# and VB.NET)
    • Circular Right Shift (no operator in C# and VB.NET)

Bitwise operators are used for numbers. Bitwise operators perform an action on the bits of a number, so if you want to understand how bitwise operators work, then you should first learn to convert from decimal to binary and from binary to decimal. I tell you how to do that in Converting from decimal to binary and from binary to decimal. In this article, I give examples mostly with Bytes. But the examples will also work for other types, such as an Int32 or an Int16

Bitwise operators are used in more languages than C# and VB.NET, but in this article, I give examples in C# and VB.NET.

Read More

Share Comments

JSON schema example

Example data

Let’s pretend we’re interacting with a JSON based product catalog. This catalog has a product which has an id, a name, a price, and an optional set of tags.

Example JSON data for a product API

An example product in this API is:

"id": 1,
"name": "A green door",
"price": 12.50,
"tags": ["home", "green"]

While generally straightforward, that example leaves some open questions. For example, one may ask:

  • What is id?
  • Is name required?
  • Can price be 0?
  • Are all tags strings?

When you’re talking about a data format, you want to have metadata about what fields mean, and what valid inputs for those fields are. JSON schema is a specification for standardizing how to answer those questions for JSON data.

Read More

Share Comments

JSON schema draft v4 specification

JSON schema draft v4 specification
{"$schema": "http://json-schema.org/draft-04/schema#"}

Read More

Share Comments

微软发布全新Power BI JavaScript API:智能双向交互

微软发布了全新Power BI JavaScript API,能提供在Power BI报告和你的应用之间的双向联系。它可以让你轻松地嵌入到你的应用程序中,并且以编程方式与报告进行交互,从而实现应用和报告集成度更高。你的应用可以正确的语境为你的用户打开报告,就算报告已经打开,也可以改变语境内容。例如您可以向一个特定的客户打开一个报表,用户与应用的其他部分进行交互后,用户信息将自动更新。

Power BI - Sample - Client - Javascript

Read More

Share Comments

Javascript 中的String对象、Array对象、Dictionary


  • length属性
  • charAt(index)方法
  • indexOf(‘字符串’,startIndex)方法
  • split(‘分隔符’,limit);
  • substr(startIndex,len)
  • substring(startIndex,stopIndex)
  • match()replace()search()方法

Read More

Share Comments

R语言实现 广义加性模型 Generalized Additive Models(GAM) 入门

In statistics, a generalized additive model (GAM) is a generalized linear model in which the linear predictor depends linearly on unknown smooth functions of some predictor variables, and interest focuses on inference about these smooth functions. GAMs were originally developed by Trevor Hastie and Robert Tibshirani to blend properties of generalized linear models with additive models.

The model relates a univariate response variable, Y, to some predictor variables, xi. An exponential family distribution is specified for Y (for example normal, binomial or Poisson distributions) along with a link function g (for example the identity or log functions) relating the expected value of Y to the predictor variables via a structure such as


The functions fi may be functions with a specified parametric form (for example a polynomial, or a spline depending on the levels of a factor variable) or may be specified non-parametrically, or semi-parametrically, simply as ‘smooth functions’, to be estimated by non-parametric means. So a typical GAM might use a scatterplot smoothing function, such as a locally weighted mean, for f1(x1), and then use a factor model for f2(x2). This flexibility to allow non-parametric fits with relaxed assumptions on the actual relationship between response and predictor, provides the potential for better fits to data than purely parametric models, but arguably with some loss of interpretability.

Read More

Share Comments

Save file in HTML5


Simple solution for HTML5 ready browsers…

function download(filename, text) {

var pom = document.createElement('a');
var contentType = 'data:text/plain;charset=utf-8,';

pom.setAttribute('href', contentType + encodeURIComponent(text));
pom.setAttribute('download', filename);

if (document.createEvent) {
var event = document.createEvent('MouseEvents');
event.initEvent('click', true, true);
else {


download('test.txt', 'Hello world!');

Read More

Share Comments

cytoscape.js events

Event object

Events passed to handler callbacks are similar to jQuery event objects in that they wrap native event objects, mimicking their API.


  • cy : a reference to the corresponding core instance
  • cyTarget : indicates the element or core that first caused the event
  • type : the event type string (e.g. “tap”)
  • namespace : the event namespace string (e.g. “foo” for “foo.tap”)
  • data : additional data object passed by .trigger()
  • timeStamp : Unix epoch time of event

Fields for only user input device events:

  • cyPosition : indicates the model position of the event
  • cyRenderedPosition : indicates the rendered position of the event
  • originalEvent : the original user input device event object

Fields for only layout events:

  • layout : indicates the corresponding layout that triggered the event (useful if running multiple layouts simultaneously)

    Read More

Share Comments