This handy tool visualizes loose comparison (`==`

) in JavaScript works:

Below you can provide two values to compare, and see which steps of the “Abstract Equality Algorithm” as defined in Section 7.2.14 of the ECMAScript specification are executed.

Skip to content
# Tag Archives: algorithm

## JavaScript “loose” comparison, step by step

## When Algorithms Design a Concert Hall

## Extracting Looping GIFs From Videos

## Why is a Raven Like a Writing Desk?

## Apple, Apps and Algorithmic Glitches

## Stacksort

## PathFinding.js – A comprehensive path-finding library for grid based games

## Convert LAMBERT 1972 to WGS84

**Did this help you out? Like what you see?**

Consider donating.
## Pinterest’s div stacking layout algorithm

## Paper: Selecting good still frames from a video

A rather geeky/technical weblog, est. 2001, by Bramus

This handy tool visualizes loose comparison (`==`

) in JavaScript works:

Below you can provide two values to compare, and see which steps of the “Abstract Equality Algorithm” as defined in Section 7.2.14 of the ECMAScript specification are executed.

The auditorium of Hamburg’s newly opened concert hall, the Elbphilharmonie, looks amazing.

The auditorium is a product of parametric design, a process by which designers use algorithms to develop an object’s form. In the case of the Elbphilharmonie, Herzog and De Meuron used algorithms to generate a unique shape for each of the 10,000 gypsum fiber acoustic panels that line the auditorium’s walls like the interlocking pieces of a giant, undulating puzzle.

Finding and extracting well-looping segments from a movie requires much attention and patience […] To make things easier I wrote a Python script which automates the task. This post explains the math behind the algorithm and provides a few examples of use.

Fuck yeah, math! Or, as the author states:

Yet another big problem of the Internet era tackled by Mathematics.

An Algorithm to Extract Looping GIFs From Videos →

*(via @patrickdebois)*

A reanimation of the tea party & riddle scene from Alice in Wonderland (1951), restyled by 17 paintings.

Here are the instructions for making a Neural-Style movie, in case you want to do it yourself 😉

On October 29th and December 18th, 2014, something very strange happened to the iTunes top apps chart. Like an earthquake shaking up the region, all app positions in the chart were massively rearranged, some booted off completely. These two extremely volatile days displayed rank changes that are orders of magnitude higher than the norm — lots of apps moving around, lots of uncertainly.

Highly interesting analysis and conclusion.

Apple, Apps and Algorithmic Glitches: A data analysis of iTunes’ top chart algorithm →

Stacksort: a sort that searches StackOverflow for sorting functions and runs them until it returns the correct answer.

@see XKCD’s Ineffective Sorts to get this one 😉

The aim of this project is to provide a path-finding library that can be easily incorporated into web games. It may run on Node.js or the browser.

PathFinding.js Demo →

PathFinding.js source →

Related: A* Pathfinding for Beginners →

Needed to convert LAMBERT 1972 (EPSG:31370) coordinates to WGS84 (EPSG:4326) for a project I’m working on in order to use the coordinates with Google Maps *(which uses a SphericalMercator (EPSG:900913) projection)*.

Took me quite a while to find the needed algorithm, so hereby I’m listing them (and am providing the JavaScript implementation):

JavaScript:

```
var lambert72toWGS84 = function(x, y){
var newLongitude, newLatitude;
var n = 0.77164219,
F = 1.81329763,
thetaFudge = 0.00014204,
e = 0.08199189,
a = 6378388,
xDiff = 149910,
yDiff = 5400150,
theta0 = 0.07604294;
var xReal = xDiff - x,
yReal = yDiff - y;
var rho = Math.sqrt(xReal * xReal + yReal * yReal),
theta = Math.atan(xReal / -yReal);
newLongitude = (theta0 + (theta + thetaFudge) / n) * 180 / Math.PI;
newLatitude = 0;
for (var i = 0; i < 5 ; ++i) {
newLatitude = (2 * Math.atan(Math.pow(F * a / rho, 1 / n) * Math.pow((1 + e * Math.sin(newLatitude)) / (1 - e * Math.sin(newLatitude)), e / 2))) - Math.PI / 2;
}
newLatitude *= 180 / Math.PI;
return [newLatitude, newLongitude];
}
```

Java:

```
public static Point lambert72toWGS84(double x, double y) {
double newLongitude;
double newLatitude;
double n = 0.77164219;
double F = 1.81329763;
double thetaFudge = 0.00014204;
double e = 0.08199189;
double a = 6378388;
double xDiff = 149910;
double yDiff = 5400150;
double theta0 = 0.07604294;
double xReal = xDiff - x;
double yReal = yDiff - y;
double rho = Math.sqrt(xReal * xReal + yReal * yReal);
double theta = Math.atan(xReal / -yReal);
newLongitude = (theta0 + (theta + thetaFudge) / n) * 180 / Math.PI;
newLatitude = 0;
for (int i = 0; i < 5 ; ++i) {
newLatitude = (2 * Math.atan(Math.pow(F * a / rho, 1 / n) * Math.pow((1 + e * Math.sin(newLatitude)) / (1 - e * Math.sin(newLatitude)), e / 2))) - Math.PI / 2;
}
newLatitude *= 180 / Math.PI;
return new Point(newLatitude, newLongitude);
}
```

C/C++:

```
void LambertToLongLat(double x,double y, double& longt, double& lat){
double n = 0.77164219;
double F = 1.81329763;
double thetaFudge = 0.00014204;
double e= 0.08199189;
double a= 6378388;
double xDiff= 150000;
double yDiff = 5400088.44;
double theta0 = 0.07604294;
double xReal = xDiff-x;
double yReal = yDiff-y;
double rho = sqrt(xReal*xReal + yReal * yReal);
double theta = atan(xReal/-yReal);
longt = (theta0 + (theta+thetaFudge) /n)*180/PI;
lat =0;
for(size_t i=0; i<5; ++i){
lat =(2*atan(pow(F*a/rho,1/n)* pow((1+ e*sin(lat))/(1-e*sin(lat)),e/2)))-PI/2;
}
lat *=180/PI;
}
```

Hope this helps!

Related: if you want to do other transforms (or flip the transorm), check out Transformation between datum’s in JavaScript. Thanks for the tip, Ibrahim (via e-mail)!

Consider donating.

I don't run ads on my blog nor do I do this for profit. A donation however would always put a smile on my face though. Thanks!

The number of columns adjusts to fit more/less on browser resize and the vertical stacking is not dependent on adjacent column heights. The source code shows that each

`div`

is positioned absolute. I would love to know how to accomplish this.

What technology is used to generate pinterest.com’s absolute div stacking layout? →

In this paper, we train a computer to select still frames from video that work well as candid portraits. Because of the subjective nature of this task, we conduct a human subjects study to collect ratings of video frames across multiple videos. Then, we compute a number of features and train a model to predict the average rating of a video frame.

Pretty neat results!