# Camera camera = Camera.open(); Camera camera - - PowerPoint PPT Presentation
# Camera camera = Camera.open(); Camera camera - - PowerPoint PPT Presentation
# Camera camera = Camera.open(); Camera camera = Camera.open(); camera.setDisplayOrientation(90); camera.setDisplayOrientation(90); camera.unlock(); SurfaceHolder holder = getHolder();
#
∈
camera.unlock(); SurfaceHolder holder = getHolder(); holder.addCallback(this); holder.setType(SurfaceHolder.STP); MediaRecorder r = new MediaRecorder(); r.setCamera(camera); r.setAudioSource(MediaRecorder.AS); r.setVideoSource(MediaRecorder.VS); r.setOutFormat(MediaRecorder.MPEG4); Camera camera = Camera.open(); camera.setDisplayOrientation(90); Camera camera = Camera.open(); camera.setDisplayOrientation(90);
Console.WriteLine("Hi") … System.out.println("Hi"); …
C# Java
function FZ(e, t) { var n = []; var r = e.length; var i = 0; for (; i < r; i += t) if (i + t < r) n.push(e.substring(i, i + t)); else n.push(e.substring(i, r)); return n; } function chunkData(str, step) { var colNames = []; var len = str.length; var i = 0; for (; i < len; i += step) if (i + step < len) colNames.push(str.substring(i, i + step)); else colNames.push(str.substring(i, len)); return colNames; }
JSNice: over a year of usage
May 2015 – May 2016
function chunkData(str, step) var colNames = []; var len = str.length; var i = 0; for (; i < len; i += step) if (i + step < len) colNames.push(str.substring(i, i + step)); else colNames.push(str.substring(i, len)); return colNames; function chunkData(e, t) var n = []; var r = e.length; var i = 0; for (; i < r; i += t) if (i + t < r) n.push(e.substring(i, i + t)); else n.push(e.substring(i, r)); return n;
function chunkData(e, t) var n = []; var r = e.length; var i = 0; for (; i < r; i += t) if (i + t < r) n.push(e.substring(i, i + t)); else n.push(e.substring(i, r)); return n;
function chunkData(e, t) var n = []; var r = e.length; var i = 0; for (; i < r; i += t) if (i + t < r) n.push(e.substring(i, i + t)); else n.push(e.substring(i, r)); return n;
t r i
length
i t r
length
… …
t r i
length
i t r
length
i t w i step 0.5 j step 0.4 i r w i len 0.6 i length 0.3 r length w length length 0.5 len length 0.3
… … i t r
length function chunkData(e, t) var n = []; var r = e.length; var i = 0; for (; i < r; i += t) if (i + t < r) n.push(e.substring(i, i + t)); else n.push(e.substring(i, r)); return n;
t r i
length
i t r
length
i t w i step 0.5 j step 0.4 i r w i len 0.6 i length 0.3 r length w length length 0.5 len length 0.3
… … i t r
length
𝒙𝑈𝒈(𝑗, 𝑢, 𝑠, 𝑚𝑓𝑜𝑢ℎ)
function chunkData(e, t) var n = []; var r = e.length; var i = 0; for (; i < r; i += t) if (i + t < r) n.push(e.substring(i, i + t)); else n.push(e.substring(i, r)); return n;
t r i
length
i t r
length
i t w i step 0.5 j step 0.4 i r w i len 0.6 i length 0.3 r length w length length 0.5 len length 0.3
… … i t r
length
i len step
𝒙𝑈𝒈(𝑗, 𝑢, 𝑠, 𝑚𝑓𝑜𝑢ℎ)
function chunkData(e, t) var n = []; var r = e.length; var i = 0; for (; i < r; i += t) if (i + t < r) n.push(e.substring(i, i + t)); else n.push(e.substring(i, r)); return n;
t r i
length
i t r
length
i t w i step 0.5 j step 0.4 i r w i len 0.6 i length 0.3 r length w length length 0.5 len length 0.3
… …
function chunkData(str, step) var colNames = []; var len = str.length; var i = 0; for (; i < len; i += step) if (i + step < len) colNames.push(str.substring(i, i + step)); else colNames.push(str.substring(i, len)); return colNames;
i t r
length
i len step
𝒙𝑈𝒈(𝑗, 𝑢, 𝑠, 𝑚𝑓𝑜𝑢ℎ)
function chunkData(e, t) var n = []; var r = e.length; var i = 0; for (; i < r; i += t) if (i + t < r) n.push(e.substring(i, i + t)); else n.push(e.substring(i, r)); return n;
∀j ∀y Σ 𝑥ifi(x(j),y(j)) ≥ Σ 𝑥ifi(x(j),y) + 𝚬(y,y(j))
𝒙𝑈
𝑎(𝑦)
𝑄 𝑧 𝑦 =
1 𝑎(𝑦) exp(𝒙𝑈𝒈(𝑧, 𝑦))
…
var n = []; var r = e.length; var i = 0; for (; i < r; i += t) if (i + t < r) n.push(e.subs(i, i + t)); else n.push(e.subs(i, r)); return n; var colNames = []; var len = str.length; var i = 0; for (; i < len; i += step) if (i + step < len) colNames.push(str.subs(i, i + step)); else colNames.push(str.subs(i, len)); return colNames;
150MB
𝑄 𝑧 𝑦
package a.b.c class a extends SQLiteHelper { SQLiteDatabase b; public a(Context ctx) { b = getWritableDatabase(); } Cursor c(String str) { return b.rawQuery(str); }} package com.example.dbhelper class DBHelper extends SQLiteHelper { SQLiteDatabase db; public DBHelper(Context ctx) { db = getWritableDatabase(); } Cursor execSQL(String str) { return db.rawQuery(str); } }
Fundamental Problem
f.open(“file” | “r”);
- f. ?
D
f.open(“f2” | “r”); f.read(); f.open(“f1” | “r”); f.read(); f.open(“f2” | “w”); f.write(“c”);
f.open(“file” | “r”);
- f. ?
P(open | f. ) ~ 3/6 P(read | f. ) ~ 2/6 P(write | f. ) ~ 1/6
𝜹
f.open(“f2” | “r”); f.read();
D
f.open(“f1” | “r”); f.read(); f.open(“f2” | “w”); f.write(“c”);
f.open(“file” | “r”);
- f. open
P(open | f. ) ~ 3/6 P(read | f. ) ~ 2/6 P(write | f. ) ~ 1/6
𝜹
f.open(“f2” | “r”); f.read();
D
f.open(“f1” | “r”); f.read(); f.open(“f2” | “w”); f.write(“c”);
f.open(“file” | “r”);
- f. ?
P(read | open ) ~ 2/3 P(write | open ) ~ 1/3
𝜹
P(open | f. ) ~ 3/6 P(read | f. ) ~ 2/6 P(write | f. ) ~ 1/6
𝜹
D
f.open(“f2” | “r”); f.read(); f.open(“f1” | “r”); f.read(); f.open(“f2” | “w”); f.write(“c”);
f.open(“file” | “r”);
- f. read
P(read | open ) ~ 2/3 P(write | open ) ~ 1/3
𝜹
P(open | f. ) ~ 3/6 P(read | f. ) ~ 2/6 P(write | f. ) ~ 1/6
𝜹
D
f.open(“f2” | “r”); f.read(); f.open(“f1” | “r”); f.read(); f.open(“f2” | “w”); f.write(“c”);
f.open(“file” | “r”);
- f. ?
P(read | open ) ~ 2/3 P(write | open ) ~ 1/3
𝜹
P(open | f. ) ~ 3/6 P(read | f. ) ~ 2/6 P(write | f. ) ~ 1/6
𝜹
D
f.open(“f2” | “r”); f.read(); f.open(“f1” | “r”); f.read(); f.open(“f2” | “w”); f.write(“c”);
key idea: synthesize a function f:
→ 𝜹
( )
fbest
fbest ∊ D fbest
fbest = argmin cost(D, f)
f ∊
𝜹
elem.notify({ position: ‘top’, autoHide: false, delay: 100 });
Identifier elem Property notify Property position Property autoHide MemberExpression ObjectExpression CallExpression Property delay String ‘top’ Boolean false
TCond ::= 𝜁 | WriteOp TCond | MoveOp TCond MoveOp ::= Up, Left, Right, DownFirst, DownLast, NextDFS, PrevDFS, NextLeaf, PrevLeaf,PrevNodeType, PrevNodeValue, PrevNodeContext WriteOp ::= WriteValue, WriteType, WritePos
Up Left WriteValue
𝜹 ← 𝜹 ∙
fbest
fbest = argmin cost(D, f) f ∊
fbest = argmin cost(D, f) f ∊
TCond ::= 𝜁 | WriteOp TCond | MoveOp TCond MoveOp ::= Up, Left, Right, ... WriteOp ::= WriteValue, WriteType, ...
P D
≈ 108
f cost(D, f) = (P)
D f P(element | f ( ))
𝑃( 𝐸 )
fbest
elem.notify( ... , ... , { position: ‘top’, hide: false, ? } );
fbest to predict
Left WriteValue Up WritePos Up DownFirst DownLast WriteValue {} {hide} {hide} {hide, 3} {hide, 3} {hide, 3} {hide, 3} {hide, 3, notify} program
fbest
𝜹
22.2% 30.4% 66.6%
D: fbest
D: fbest
Hutter Prize Wikipedia Dataset uses a char-level DSL with state
1.62 1.67 51% 1.60 51% 1.44 51% 1.40 1.94
:
function isBig(v) { return v < this.length } [12, 5].filter(isBig); VarPtsTo(“global”, h) checkIfInsideMethodCall checkMethodCallName checkReceiverType checkNumberOfArguments ... VarPtsTo(this, h)
∈
( ) fbest
fbest ∊ fbest
TCond ::= 𝜁 | WriteOp TCond | MoveOp TCond MoveOp ::= Up, Left, Right, DownFirst, DownLast, NextDFS, PrevDFS, NextLeaf, PrevLeaf, PrevNodeType, PrevNodeValue, WriteOp ::= WriteValue, WriteType, WritePosfbest = argmin cost(D, f) f ∊ 𝜹