Skip to content

Instantly share code, notes, and snippets.

@esfand-r
esfand-r / gist:7690e92334daacb99f9b
Created October 22, 2015 16:33 — forked from debasishg/gist:8172796
A collection of links for streaming algorithms and data structures
  1. General Background and Overview
@esfand-r
esfand-r / Detect Popup in Chrome
Created August 20, 2013 02:55
With the latest version of chrome, when the popup blocked, the chrome crashes while trying to print. This is some weird workaround that worked for me! Useful also when trying to detect popup blocker in Chrome.
function popupPrint(html) {
var width = 1100;
var height = 700;
var left = (screen.width / 2) - (width / 2);
var top = (screen.height / 2) - (height / 2);
var printWindow = window.open("", "PrintWindow", 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=' + width + ', height=' + height + ', top=' + top + ', left=' + left);
setTimeout(function () {
if (!printWindow || printWindow.closed || printWindow.closed == "undefined" || printWindow == "undefined" || parseInt(printWindow.innerWidth) == 0 || printWindow.document.documentElement.clientWidth != 1100 || printWindow.document.documentElement.clientHeight != 700) {
@esfand-r
esfand-r / Note1:Normal Order vs Applicative order
Created August 8, 2013 12:15
Notes from Structure and interpretation of computer programs.
Applicative order: To apply a compound procedure to arguments, evaluate the body of the procedure with each formal parameter replaced by the corresponding argument.
example:(sum-of-squares (+ a 1) (* a 2))
Then we replace the formal parameter a by the argument 5:
(sum-of-squares (+ 5 1) (* 5 2))
Thus the problem reduces to the evaluation of a combination with two operands and an operator sum-of-squares. Evaluating this combination involves three subproblems. We must evaluate the operator to get the procedure to be applied, and we must evaluate the operands to get the arguments. Now (+ 5 1) produces 6 and (* 5 2) produces 10, so we must apply the sum-of-squares procedure to 6 and 10. These values are substituted for the formal parameters x and y in the body of sum-of-squares, reducing the expression to
@esfand-r
esfand-r / DragVM.java
Last active December 10, 2015 21:08 — forked from dennischen/DragVM.java
package org.zkoss.mvvm.examples.duallistbox;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.zkoss.bind.annotation.BindingParam;
import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.NotifyChange;