Skip to content

Instantly share code, notes, and snippets.

{
Double [] [] p = (Double [] []) (new Double [numPoints] [dim]);
int i = 0;
while (i < numPoints) {
labeled : {
((Double [] []) p) [i] = (Double []) (new Double [dim]);
int j = 0;
while (j < dim) {
labeled : {
((Double []) ((Double [] []) p) [i]) [j] = Double.valueOf (Math.random ());
{
int nbConcreteActivitiesSisters = _nbExistingConcreteActivitiesChildren;
int i = _nbExistingConcreteActivitiesChildren + 1;
while (i <= _nbExistingConcreteActivitiesChildren + _occ) {
labeled : {
wilos.model.misc.concreteactivity.ConcreteActivity cact = new wilos.model.misc.concreteactivity.ConcreteActivity ();
java.util.List < wilos.model.spem2.breakdownelement.BreakdownElement > bdes = new java.util.ArrayList < wilos.model.spem2.breakdownelement.BreakdownElement > ();
bdes.addAll (this.getAllBreakdownElements (_activity));
if (_occ != 1 || _nbExistingConcreteActivitiesChildren != 0) {
if (_activity.getPresentationName ().equals ("")) cact.setConcreteName (_activity.getName () + "#" + i);
@remysucre
remysucre / fn.java
Last active April 10, 2018 17:18
false negatives
/Users/rem/metalift/txl/qbs/allbench//WorkProductSExpTableBean.java
{
int numberOfFinishedActivity = 0;
wilos.model.misc.project.Project project = this.projectService.getProject(((java.lang.String) wilos.presentation.web.utils.WebSessionService.getAttribute(wilos.presentation.web.utils.WebSessionService.PROJECT_ID)));
if (this.concreteActivityService.getConcreteActivitiesFromProject(project).size() != 0)
{
labeled_1: {
java.util.Iterator extfor$iter = this.concreteActivityService.getConcreteActivitiesFromProject(project).iterator();
while (extfor$iter.hasNext())
{
@remysucre
remysucre / fp.java
Created April 10, 2018 17:17
false positives
/Users/rem/metalift/txl/qbs/allbench//GuidanceService.java
{
java.util.Set<wilos.model.spem2.activity.Activity> tmp = new java.util.HashSet<wilos.model.spem2.activity.Activity>();
this.guidanceDao.getSessionFactory().getCurrentSession().saveOrUpdate(_guidance);
java.util.Iterator extfor$iter = _guidance.getActivities().iterator();
while (extfor$iter.hasNext())
{
wilos.model.spem2.activity.Activity act = (wilos.model.spem2.activity.Activity) extfor$iter.next();
tmp.add(act);
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Examples of D3 transitions</title>
<style>
svg {
border: 1px solid black;
}
fieldset {
@remysucre
remysucre / index.html
Last active June 27, 2018 18:42
move
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Examples of D3 transitions</title>
<style>
svg {
border: 1px solid black;
}
fieldset {
âPNG

IHDR ~¶QÏ}IDATx⁄Ì¡Äê˛ØÓ
ĨèÓ˘tjIENDÆB`Ç

Entropy

Entropy can be understood as the minimum amount of data needed to be transmitted in order to communicate a piece of information. Concretely, this is the average number of bits needed to encode a message. For example, imagine a spaceship sends a status code every minute to indicate if it has found any alien civilization. The code is any letter from the English alphabet, with $A$ meaning "nothing new", and some other letter describing the alien. For example $F$ means the alien is friendly, and $B$ means the alien is blue, etc. For simplicity assume every code is only 1-letter long. Then we can simply encode this status

@remysucre
remysucre / main.rs
Last active October 7, 2024 18:37
merge-only rules in egg
use egg::*;
/// A [`Condition`] that checks if a pattern is already in the egraph.
pub struct ConditionExists<L> {
p: Pattern<L>,
}
impl<L: Language> ConditionExists<L> {
/// Create a new [`ConditionExists`] condition given a pattern.
pub fn new(p: Pattern<L>) -> Self {
@remysucre
remysucre / eq.sql
Last active July 27, 2023 03:50
Check if two SQL tables are the same
CREATE TABLE t1 (x INTEGER);
CREATE TABLE t2 (x INTEGER);
INSERT INTO t1 VALUES (1), (1), (2), (3);
INSERT INTO t2 VALUES (2), (1), (3), (2);
-- If t1=t2 (meaning they are the same bag/multiset), then the following should return nothing.
-- Sanity check: do they contain the same *set* of elements (ignoring duplicates)?