SlideShare a Scribd company logo
Deck
a Go package for presentations
DECK: a package for presentations

Deck is a package written in Go
That uses a singular markup language
With elements for text, lists, code, and graphics
All layout and sizes are expressed as percentages
Clients are interactive or create formats like PDF or SVG
Elements
Hello, World
A block of text, word-wrapped to a specified
width. You may specify size, font, color,
and opacity.

package main
import "fmt"
func main() {
fmt.Println("Hello, World")
}

<text>...</text>
bullet

plain

number

Point A

First item

1. This

Point B

Second item

2. That

Point C

The third item

3. The other

Point D

the last thing

4. One more

<list>...</list>
height

x, y

width

<image .../>
height (relative
to element
or canvas
width)

x, y

width

<rect .../>
height (relative
to element
or canvas
width)

x, y

width

<ellipse .../>
end

start

<line .../>
angle2 (90 deg)

x, y

angle1 (0 deg)

<arc .../>
control

start

end

<curve .../>
Markup and Layout
Start the deck

<deck>

Set the canvas size

<canvas width="1024" height="768" />

Begin a slide

<slide bg="white" fg="black">

Place an image

<image xp="70" yp="60" width="256" height="179" name="work.png" caption="Desk"/>

Draw some text

<text

xp="20" yp="80" sp="3">Deck uses these elements</text>

Make a bullet list

<list

xp="20" yp="70" sp="2" type="bullet">

<li>text, list, image</li>
<li>line, rect, ellipse</li>
<li>arc, curve</li>
End the list

</list>

Draw a line

<line

xp1="20" yp1="10" xp2="30" yp2="10"/>

Draw a rectangle

<rect

xp="35"

yp="10" wp="4" hr="75" color="rgb(127,0,0)"/>

Draw an ellipse

<ellipse xp="45"

yp="10" wp="4" hr="75" color="rgb(0,127,0)"/>

Draw an arc

<arc

xp="55"

yp="10" wp="4" hp="3" a1="0" a2="180" color="rgb(0,0,127)"/>

Draw a quadratic bezier

<curve

xp1="60" yp1="10" xp2="75" yp2="20" xp3="70" yp3="10" />

End the slide
End of the deck

</slide>
</deck>

Anatomy of a Deck
Deck uses these elements

text, list, image
line, rect, ellipse
arc, curve

Desk
Text and List Markup

Position, size

<text xp="..." yp="..." sp="...">

Block of text

<text ... type="block">

Lines of code

<text ... type="code">

Attributes

<text ... color="..." opacity="..." font="..." align="...">

Position, size

<list xp="..." yp="..." sp="...">

Bullet list

<list ... type="bullet">

Numbered list

<list ... type="number">

Attributes

<list ... color="..." opacity="..." font="..." align="...">
Common Attributes for text and list

xp

horizontal percentage

yp

vertical percentage

sp

font size percentage

type

"bullet", "number" (list), "block", "code" (text)

align

"left", "middle", "end"

color

SVG names ("maroon"), or RGB "rgb(127,0,0)"

opacity percent opacity (0-100, transparent - opaque)
font

"sans", "serif", "mono"
Graphics Markup

<line xp1="5" yp1="75" xp2="20" yp2="70" sp="0.2"/>

<rect xp="10" yp="60" wp="15" hr="66.6" color="red"/>
<rect xp="15" yp="55" wp="10" hr="100" color="blue" opacity="30"/>

<ellipse xp="10" yp="35" wp="15" hr="66.66" color="green"/>
<ellipse xp="15" yp="30" wp="10" hr="100" color="blue" opacity="30"/>

<curve xp1="5" yp1="10" xp2="15" yp2="20" xp3="15" yp3="10" sp="0.3" color="red"/>
<arc xp="22" yp="10" wp="10" wp="10" a1="0" a2="180" sp="0.2" color="blue"/>
10

20

30

40

50

60

90

80

70

60

50

40

30

20

10

Percent Grid

70

80

90
10%, 50%

50%, 50%

Hello

Percentage-based layout

90%, 50%
bullet

plain

number

Point A

First item

1. This

Point B

Second item

2. That

Point C

The third item

3. The other

Point D

the last thing

4. One more

<list>...</list>
Clients
package main
import (
"log"
"github.com/ajstarks/deck"
)
func main() {
presentation, err := deck.Read("deck.xml", 1024, 768) // open the deck
if err != nil {
log.Fatal(err)
}
for _, slide := range presentation.Slide {
// for every slide...
for _, t := range slide.Text {
// process the text elements
x, y, size := deck.Dimen(presentation.Canvas, t.Xp, t.Yp, t.Sp)
slideText(x, y, size, t)
}
for _, l := range slide.List {
// process the list elements
x, y, size := deck.Dimen(presentation.Canvas, l.Xp, l.Yp, l.Sp)
slideList(x, y, size, l)
}
}
}

A Deck Client
interactive

Process

deck code

PDF

SVG
func main() {
benchmarks := []Bardata{
{"Macbook Air", 154.701},
{"MacBook Pro (2008)", 289.603},
{"BeagleBone Black", 2896.037},
{"Raspberry Pi", 5765.568},
}
ts := 2.5
hts := ts / 2
x := 10.0
bx1 := x + (ts * 12)
bx2 := bx1 + 50.0
y := 60.0
maxdata := 5800.0
linespacing := ts * 2.0
text(x, y+20, "Go 1.1.2 Build and Test Times", ts*2, "black")
for _, data := range benchmarks {
text(x, y, data.label, ts, "rgb(100,100,100)")
bv := vmap(data.value, 0, maxdata, bx1, bx2)
line(bx1, y+hts, bv, y+hts, ts, "lightgray")
text(bv+0.5, y+(hts/2), fmt.Sprintf("%.1f", data.value), hts, "rgb(127,0,0)")
y -= linespacing
}
}

Generating a Barchart
Go 1.1.2 Build and Test Times
Macbook Air
MacBook Pro (2008)
BeagleBone Black
Raspberry Pi

154.7
289.6

$ (echo '<deck><slide>'; go run deckbc.go; echo '</slide></deck>')

2896.0
5765.6
go get github.com/ajstarks/deck/cmd/vgdeck

go get github.com/ajstarks/deck/cmd/pdfdeck

go get github.com/ajstarks/deck/cmd/svgdeck
pdfdeck [options] file.xml...
-sans, -serif, -mono [font] specify fonts
-pagesize [w,h, or Letter, Legal, Tabloid, A2-A5, ArchA, Index, 4R, Widescreen]
-stdout (output to standard out)
-outdir [directory] directory for PDF output
-fontdir [directory] directory containing font information
-author [author name] set the document author
-title [title text] set the document title
-grid [percent] draw a percent grid on each slide
svgdeck [options] file.xml...
-sans, -serif, -mono [font] specify fonts
-pagesize [Letter, Legal, A3, A4, A5]
-pagewidth [canvas width]
-pageheight [canvas height]
-stdout (output to standard out)
-outdir [directory] directory for PDF output
-title [title text] set the document title
-grid [percent] draw a percent grid on each slide
vgdeck [options] file.xml...
-loop [duration] loop, pausing [duration] between slides
-slide [number] start at slide number
-w [width] canvas width
-h [height] canvas height
-g [percent] draw a percent grid
vgdeck Commands
+, Ctrl-N, [Return]

Next slide

-, Ctrl-P, [Backspace]

Previous slide

^, Ctrl-A

First slide

$, Ctrl-E

Last slide

r, Ctrl-R

Reload

x, Ctrl-X

X-Ray

/, Ctrl-F [text]

Search

s, Ctrl-S

Save

q

Quit
Deck Web API

sex -dir [start dir] -listen [address:port] -maxupload [bytes]

GET

/

List the API

GET

/deck/

List the content on the server

GET

/deck/?filter=[type]

List content filtered by deck, image, video

POST

/deck/content.xml?cmd=1s

Play a deck with the specified duration

POST

/deck/content.xml?cmd=stop

Stop playing a deck

POST

/deck/content.xml?slide=[num]

Play deck starting at a slide number

DELETE

/deck/content.xml

Remove content

POST

/upload/ Deck:content.xml

Upload content

POST

/table/ Deck:content.txt

Generate a table from a tab-separated list

POST

/table/?textsize=[size]

Specify the text size of the table

POST

/media/ Media:content.mov

Play the specified video
deck [command] [argument]
deck play file [duration]

Play a deck

deck stop

Stop playing a deck

deck list [deck|image|video]

List contents

deck upload file...

Upload content

deck remove file...

Remove content

deck video file

Play video

deck table file [textsize]

Make a table

$ deck upload *.jpg

# upload images

$ mkpicdeck *.jpg | deck upload /dev/stdin

# generate the slide show deck

$ deck play stdin

# play it
Display

is innovative
makes a product useful

Server

is aesthetic
makes a product understandable
is unobtrusive

Good Design

is honest
is long-lasting
is thorough down to the last detail
is environmentally-friendly
is as little design as possible

Controller
> list
> upload
> play/stop
> delete

HDMI
RESTful API
Design Examples
hello, world
Top

Left

Right

Bottom
20%

30%

70%

20%
Header (top 20%)

Summary
(30%)

Detail
(70%)

Footer (bottom 20%)
bullet

plain

number

Point A

First item

1. This

Point B

Second item

2. That

Point C

The third item

3. The other

Point D

the last thing

4. One more

<list>...</list>
BOS
SFO

Virgin America 351
Gate B38
8:35am
On Time
JFK
IND

US Airways 1207
Gate C31C
5:35pm
Delayed
AAPL

503.73

-16.57 (3.18%)

AMZN

274.03

+6.09 (2.27%)

GOOG

727.58

-12.41 (1.68%)
Two Columns

One

Five

Two

Six

Three

Seven

Four

Eight

Tree and Sky

Rocks
build
clean

remove object files

env

print Go environment information

fix

run go tool fix on packages

fmt

go

compile packages and dependencies

run gofmt on package sources

get

download and install packages and dependencies

install

compile and install packages and dependencies

list

list packages

run

compile and run Go program

test

test packages

tool

run specified go tool

version

print Go version

vet

run go tool vet on packages
This is not a index card
Rich

Can't buy me love

Bliss

Worse

Better

Misery

We have each other

Poor
Code

package main
import (
"github.com/ajstarks/svgo"
"os"
)
func main() {
canvas := svg.New(os.Stdout)
width, height := 500, 500
a, ai, ti := 1.0, 0.03, 10.0
canvas.Start(width, height)
canvas.Rect(0, 0, width, height)
canvas.Gstyle("font-family:serif;font-size:144pt")
for t := 0.0; t <= 360.0; t += ti {
canvas.TranslateRotate(width/2, height/2, t)
canvas.Text(0, 0, "i", canvas.RGBA(255, 255, 255, a))
canvas.Gend()
a -= ai
}
canvas.Gend()
canvas.End()
}

Output
A few months ago, I had a look at the brainchild of
a few serious heavyweights working at Google. Their
project, the Go programming language, is a static
typed, c lookalike, semicolon-less, self formatting,
package managed, object oriented, easily parallelizable,
cluster fuck of genius with an unique class inheritance
system. It doesn't have one.
The Go Programming Language
is a static typed,
c lookalike,
semicolon-less,
self formatting,
package managed,
object oriented,
easily parallelizable,
cluster fuck of genius
with an unique class inheritance system.

Andrew Mackenzie-Ross, OBJECTIVE-C LESSONS FROM GO
The Go Programming Language
is a static typed,
c lookalike,
semicolon-less,
self formatting,
package managed,
object oriented,
easily parallelizable,
cluster fuck of genius
with an unique class inheritance system.

Andrew Mackenzie-Ross, OBJECTIVE-C LESSONS FROM GO
The Go Programming Language

is a static typed, c lookalike, semicolon-less, self formatting,
package managed, object oriented, easily parallelizable,
cluster fuck of genius with an unique class inheritance system.

It doesn't have one.

Andrew Mackenzie-Ross, OBJECTIVE-C LESSONS FROM GO
So, the next time you're about
to make a subclass, think hard
and ask yourself

what would Go do

Andrew Mackenzie-Ross, http://pocket.co/sSc56
Python and Ruby programmers come to
Go because they don't have to surrender
much expressiveness, but gain performance
and get to play with concurrency.

Less is exponentially more
Rob Pike
You must not blame me if I do talk to the clouds.
FOR, LO,
the winter is past,
the rain is over and gone;
The flowers appear on the earth;
the time for the singing of birds is come,
and the voice of the turtle is heard in our land.

Song of Solomon 2:11-12
Good Design

is innovative
makes a product useful
is aesthetic
makes a product understandable
is unobtrusive
is honest
is long-lasting
is thorough down to the last detail
is environmentally-friendly
is as little design as possible

Dieter Rams
github.com/ajstarks/deck

ajstarks@gmail.com
@ajstarks

More Related Content

Similar to Deck: A Go Package for Presentations

Introduction to d3js (and SVG)
Introduction to d3js (and SVG)Introduction to d3js (and SVG)
Introduction to d3js (and SVG)
zahid-mian
 
A Shiny Example-- R
A Shiny Example-- RA Shiny Example-- R
A Shiny Example-- R
Dr. Volkan OBAN
 
AfterGlow
AfterGlowAfterGlow
AfterGlow
Raffael Marty
 
Poetry with R -- Dissecting the code
Poetry with R -- Dissecting the codePoetry with R -- Dissecting the code
Poetry with R -- Dissecting the code
Peter Solymos
 
Foliumcheatsheet
FoliumcheatsheetFoliumcheatsheet
Foliumcheatsheet
Nishant Upadhyay
 
SVGo: a Go Library for SVG generation
SVGo: a Go Library for SVG generationSVGo: a Go Library for SVG generation
SVGo: a Go Library for SVG generation
Anthony Starks
 
Svcc 2013-d3
Svcc 2013-d3Svcc 2013-d3
Svcc 2013-d3
Oswald Campesato
 
SVCC 2013 D3.js Presentation (10/05/2013)
SVCC 2013 D3.js Presentation (10/05/2013)SVCC 2013 D3.js Presentation (10/05/2013)
SVCC 2013 D3.js Presentation (10/05/2013)
Oswald Campesato
 
R (Shiny Package) - Server Side Code for Decision Support System
R (Shiny Package) - Server Side Code for Decision Support SystemR (Shiny Package) - Server Side Code for Decision Support System
R (Shiny Package) - Server Side Code for Decision Support System
Maithreya Chakravarthula
 
用 OPENRNDR 將 Chatbot 訊息視覺化
用 OPENRNDR 將 Chatbot 訊息視覺化用 OPENRNDR 將 Chatbot 訊息視覺化
用 OPENRNDR 將 Chatbot 訊息視覺化
Shengyou Fan
 
Cpp tutorial
Cpp tutorialCpp tutorial
Cpp tutorial
Vikas Sharma
 
RDataMining slides-r-programming
RDataMining slides-r-programmingRDataMining slides-r-programming
RDataMining slides-r-programming
Yanchang Zhao
 
Visual Exploration of Large Data sets with D3, crossfilter and dc.js
Visual Exploration of Large Data sets with D3, crossfilter and dc.jsVisual Exploration of Large Data sets with D3, crossfilter and dc.js
Visual Exploration of Large Data sets with D3, crossfilter and dc.js
Florian Georg
 
HTML5 - A Whirlwind tour
HTML5 - A Whirlwind tourHTML5 - A Whirlwind tour
HTML5 - A Whirlwind tour
Lohith Goudagere Nagaraj
 
Getting Visual with Ruby Processing
Getting Visual with Ruby ProcessingGetting Visual with Ruby Processing
Getting Visual with Ruby Processing
Richard LeBer
 
Osmit2009 Mapnik
Osmit2009 MapnikOsmit2009 Mapnik
Osmit2009 Mapnik
luca delucchi
 
Html Tags
Html TagsHtml Tags
Html Tags
Rodel Barcenas
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with Clojure
Dmitry Buzdin
 
CppTutorial.ppt
CppTutorial.pptCppTutorial.ppt
CppTutorial.ppt
HODZoology3
 
MayTheForceBeWithYou II.pdf
MayTheForceBeWithYou II.pdfMayTheForceBeWithYou II.pdf
MayTheForceBeWithYou II.pdf
Gerrit Grunwald
 

Similar to Deck: A Go Package for Presentations (20)

Introduction to d3js (and SVG)
Introduction to d3js (and SVG)Introduction to d3js (and SVG)
Introduction to d3js (and SVG)
 
A Shiny Example-- R
A Shiny Example-- RA Shiny Example-- R
A Shiny Example-- R
 
AfterGlow
AfterGlowAfterGlow
AfterGlow
 
Poetry with R -- Dissecting the code
Poetry with R -- Dissecting the codePoetry with R -- Dissecting the code
Poetry with R -- Dissecting the code
 
Foliumcheatsheet
FoliumcheatsheetFoliumcheatsheet
Foliumcheatsheet
 
SVGo: a Go Library for SVG generation
SVGo: a Go Library for SVG generationSVGo: a Go Library for SVG generation
SVGo: a Go Library for SVG generation
 
Svcc 2013-d3
Svcc 2013-d3Svcc 2013-d3
Svcc 2013-d3
 
SVCC 2013 D3.js Presentation (10/05/2013)
SVCC 2013 D3.js Presentation (10/05/2013)SVCC 2013 D3.js Presentation (10/05/2013)
SVCC 2013 D3.js Presentation (10/05/2013)
 
R (Shiny Package) - Server Side Code for Decision Support System
R (Shiny Package) - Server Side Code for Decision Support SystemR (Shiny Package) - Server Side Code for Decision Support System
R (Shiny Package) - Server Side Code for Decision Support System
 
用 OPENRNDR 將 Chatbot 訊息視覺化
用 OPENRNDR 將 Chatbot 訊息視覺化用 OPENRNDR 將 Chatbot 訊息視覺化
用 OPENRNDR 將 Chatbot 訊息視覺化
 
Cpp tutorial
Cpp tutorialCpp tutorial
Cpp tutorial
 
RDataMining slides-r-programming
RDataMining slides-r-programmingRDataMining slides-r-programming
RDataMining slides-r-programming
 
Visual Exploration of Large Data sets with D3, crossfilter and dc.js
Visual Exploration of Large Data sets with D3, crossfilter and dc.jsVisual Exploration of Large Data sets with D3, crossfilter and dc.js
Visual Exploration of Large Data sets with D3, crossfilter and dc.js
 
HTML5 - A Whirlwind tour
HTML5 - A Whirlwind tourHTML5 - A Whirlwind tour
HTML5 - A Whirlwind tour
 
Getting Visual with Ruby Processing
Getting Visual with Ruby ProcessingGetting Visual with Ruby Processing
Getting Visual with Ruby Processing
 
Osmit2009 Mapnik
Osmit2009 MapnikOsmit2009 Mapnik
Osmit2009 Mapnik
 
Html Tags
Html TagsHtml Tags
Html Tags
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with Clojure
 
CppTutorial.ppt
CppTutorial.pptCppTutorial.ppt
CppTutorial.ppt
 
MayTheForceBeWithYou II.pdf
MayTheForceBeWithYou II.pdfMayTheForceBeWithYou II.pdf
MayTheForceBeWithYou II.pdf
 

Recently uploaded

一比一原版(USQ毕业证书)南昆士兰大学毕业证如何办理
一比一原版(USQ毕业证书)南昆士兰大学毕业证如何办理一比一原版(USQ毕业证书)南昆士兰大学毕业证如何办理
一比一原版(USQ毕业证书)南昆士兰大学毕业证如何办理
p74xokfq
 
一比一原版(Rice毕业证)美国莱斯大学毕业证如何办理
一比一原版(Rice毕业证)美国莱斯大学毕业证如何办理一比一原版(Rice毕业证)美国莱斯大学毕业证如何办理
一比一原版(Rice毕业证)美国莱斯大学毕业证如何办理
oabn3692
 
欧洲杯买球-欧洲杯买球买球网好的网站-欧洲杯买球哪里有正规的买球网站|【​网址​🎉ac123.net🎉​】
欧洲杯买球-欧洲杯买球买球网好的网站-欧洲杯买球哪里有正规的买球网站|【​网址​🎉ac123.net🎉​】欧洲杯买球-欧洲杯买球买球网好的网站-欧洲杯买球哪里有正规的买球网站|【​网址​🎉ac123.net🎉​】
欧洲杯买球-欧洲杯买球买球网好的网站-欧洲杯买球哪里有正规的买球网站|【​网址​🎉ac123.net🎉​】
jafiradnan336
 
Practical eLearning Makeovers for Everyone
Practical eLearning Makeovers for EveryonePractical eLearning Makeovers for Everyone
Practical eLearning Makeovers for Everyone
Bianca Woods
 
Introduction to User experience design for beginner
Introduction to User experience design for beginnerIntroduction to User experience design for beginner
Introduction to User experience design for beginner
ellemjani
 
一比一原版美国哥伦比亚大学毕业证Columbia成绩单一模一样
一比一原版美国哥伦比亚大学毕业证Columbia成绩单一模一样一比一原版美国哥伦比亚大学毕业证Columbia成绩单一模一样
一比一原版美国哥伦比亚大学毕业证Columbia成绩单一模一样
881evgn0
 
一比一原版肯特大学毕业证UKC成绩单一模一样
一比一原版肯特大学毕业证UKC成绩单一模一样一比一原版肯特大学毕业证UKC成绩单一模一样
一比一原版肯特大学毕业证UKC成绩单一模一样
tobbk6s8
 
一比一原版(Coventry毕业证)英国考文垂大学毕业证如何办理
一比一原版(Coventry毕业证)英国考文垂大学毕业证如何办理一比一原版(Coventry毕业证)英国考文垂大学毕业证如何办理
一比一原版(Coventry毕业证)英国考文垂大学毕业证如何办理
tobbk6s8
 
Best Digital Marketing Strategy Build Your Online Presence 2024.pptx
Best Digital Marketing Strategy Build  Your Online Presence 2024.pptxBest Digital Marketing Strategy Build  Your Online Presence 2024.pptx
Best Digital Marketing Strategy Build Your Online Presence 2024.pptx
pavankumarpayexelsol
 
一比一原版(LSE毕业证书)伦敦政治经济学院毕业证如何办理
一比一原版(LSE毕业证书)伦敦政治经济学院毕业证如何办理一比一原版(LSE毕业证书)伦敦政治经济学院毕业证如何办理
一比一原版(LSE毕业证书)伦敦政治经济学院毕业证如何办理
340qn0m1
 
一比一原版南安普顿索伦特大学毕业证Southampton成绩单一模一样
一比一原版南安普顿索伦特大学毕业证Southampton成绩单一模一样一比一原版南安普顿索伦特大学毕业证Southampton成绩单一模一样
一比一原版南安普顿索伦特大学毕业证Southampton成绩单一模一样
3vgr39kx
 
一比一原版亚利桑那大学毕业证(UA毕业证书)如何办理
一比一原版亚利桑那大学毕业证(UA毕业证书)如何办理一比一原版亚利桑那大学毕业证(UA毕业证书)如何办理
一比一原版亚利桑那大学毕业证(UA毕业证书)如何办理
21uul8se
 
一比一原版(NU毕业证书)诺森比亚大学毕业证如何办理
一比一原版(NU毕业证书)诺森比亚大学毕业证如何办理一比一原版(NU毕业证书)诺森比亚大学毕业证如何办理
一比一原版(NU毕业证书)诺森比亚大学毕业证如何办理
21uul8se
 
ADESGN3S_Case-Study-Municipal-Health-Center.pdf
ADESGN3S_Case-Study-Municipal-Health-Center.pdfADESGN3S_Case-Study-Municipal-Health-Center.pdf
ADESGN3S_Case-Study-Municipal-Health-Center.pdf
GregMichaelTapawan
 
一比一原版(CSUEB毕业证)美国加州州立大学东湾分校毕业证如何办理
一比一原版(CSUEB毕业证)美国加州州立大学东湾分校毕业证如何办理一比一原版(CSUEB毕业证)美国加州州立大学东湾分校毕业证如何办理
一比一原版(CSUEB毕业证)美国加州州立大学东湾分校毕业证如何办理
stgq9v39
 
原版制作(MDIS毕业证书)新加坡管理发展学院毕业证学位证一模一样
原版制作(MDIS毕业证书)新加坡管理发展学院毕业证学位证一模一样原版制作(MDIS毕业证书)新加坡管理发展学院毕业证学位证一模一样
原版制作(MDIS毕业证书)新加坡管理发展学院毕业证学位证一模一样
hw2xf1m
 
一比一原版(Teesside毕业证)英国提赛德大学毕业证如何办理
一比一原版(Teesside毕业证)英国提赛德大学毕业证如何办理一比一原版(Teesside毕业证)英国提赛德大学毕业证如何办理
一比一原版(Teesside毕业证)英国提赛德大学毕业证如何办理
mfria419
 
一比一原版(ututaustin毕业证书)美国德克萨斯大学奥斯汀分校毕业证如何办理
一比一原版(ututaustin毕业证书)美国德克萨斯大学奥斯汀分校毕业证如何办理一比一原版(ututaustin毕业证书)美国德克萨斯大学奥斯汀分校毕业证如何办理
一比一原版(ututaustin毕业证书)美国德克萨斯大学奥斯汀分校毕业证如何办理
yqyquge
 
一比一原版(LSBU毕业证书)伦敦南岸大学毕业证如何办理
一比一原版(LSBU毕业证书)伦敦南岸大学毕业证如何办理一比一原版(LSBU毕业证书)伦敦南岸大学毕业证如何办理
一比一原版(LSBU毕业证书)伦敦南岸大学毕业证如何办理
k7nm6tk
 
一比一原版(Deakin毕业证书)澳洲迪肯大学毕业证文凭如何办理
一比一原版(Deakin毕业证书)澳洲迪肯大学毕业证文凭如何办理一比一原版(Deakin毕业证书)澳洲迪肯大学毕业证文凭如何办理
一比一原版(Deakin毕业证书)澳洲迪肯大学毕业证文凭如何办理
k4krdgxx
 

Recently uploaded (20)

一比一原版(USQ毕业证书)南昆士兰大学毕业证如何办理
一比一原版(USQ毕业证书)南昆士兰大学毕业证如何办理一比一原版(USQ毕业证书)南昆士兰大学毕业证如何办理
一比一原版(USQ毕业证书)南昆士兰大学毕业证如何办理
 
一比一原版(Rice毕业证)美国莱斯大学毕业证如何办理
一比一原版(Rice毕业证)美国莱斯大学毕业证如何办理一比一原版(Rice毕业证)美国莱斯大学毕业证如何办理
一比一原版(Rice毕业证)美国莱斯大学毕业证如何办理
 
欧洲杯买球-欧洲杯买球买球网好的网站-欧洲杯买球哪里有正规的买球网站|【​网址​🎉ac123.net🎉​】
欧洲杯买球-欧洲杯买球买球网好的网站-欧洲杯买球哪里有正规的买球网站|【​网址​🎉ac123.net🎉​】欧洲杯买球-欧洲杯买球买球网好的网站-欧洲杯买球哪里有正规的买球网站|【​网址​🎉ac123.net🎉​】
欧洲杯买球-欧洲杯买球买球网好的网站-欧洲杯买球哪里有正规的买球网站|【​网址​🎉ac123.net🎉​】
 
Practical eLearning Makeovers for Everyone
Practical eLearning Makeovers for EveryonePractical eLearning Makeovers for Everyone
Practical eLearning Makeovers for Everyone
 
Introduction to User experience design for beginner
Introduction to User experience design for beginnerIntroduction to User experience design for beginner
Introduction to User experience design for beginner
 
一比一原版美国哥伦比亚大学毕业证Columbia成绩单一模一样
一比一原版美国哥伦比亚大学毕业证Columbia成绩单一模一样一比一原版美国哥伦比亚大学毕业证Columbia成绩单一模一样
一比一原版美国哥伦比亚大学毕业证Columbia成绩单一模一样
 
一比一原版肯特大学毕业证UKC成绩单一模一样
一比一原版肯特大学毕业证UKC成绩单一模一样一比一原版肯特大学毕业证UKC成绩单一模一样
一比一原版肯特大学毕业证UKC成绩单一模一样
 
一比一原版(Coventry毕业证)英国考文垂大学毕业证如何办理
一比一原版(Coventry毕业证)英国考文垂大学毕业证如何办理一比一原版(Coventry毕业证)英国考文垂大学毕业证如何办理
一比一原版(Coventry毕业证)英国考文垂大学毕业证如何办理
 
Best Digital Marketing Strategy Build Your Online Presence 2024.pptx
Best Digital Marketing Strategy Build  Your Online Presence 2024.pptxBest Digital Marketing Strategy Build  Your Online Presence 2024.pptx
Best Digital Marketing Strategy Build Your Online Presence 2024.pptx
 
一比一原版(LSE毕业证书)伦敦政治经济学院毕业证如何办理
一比一原版(LSE毕业证书)伦敦政治经济学院毕业证如何办理一比一原版(LSE毕业证书)伦敦政治经济学院毕业证如何办理
一比一原版(LSE毕业证书)伦敦政治经济学院毕业证如何办理
 
一比一原版南安普顿索伦特大学毕业证Southampton成绩单一模一样
一比一原版南安普顿索伦特大学毕业证Southampton成绩单一模一样一比一原版南安普顿索伦特大学毕业证Southampton成绩单一模一样
一比一原版南安普顿索伦特大学毕业证Southampton成绩单一模一样
 
一比一原版亚利桑那大学毕业证(UA毕业证书)如何办理
一比一原版亚利桑那大学毕业证(UA毕业证书)如何办理一比一原版亚利桑那大学毕业证(UA毕业证书)如何办理
一比一原版亚利桑那大学毕业证(UA毕业证书)如何办理
 
一比一原版(NU毕业证书)诺森比亚大学毕业证如何办理
一比一原版(NU毕业证书)诺森比亚大学毕业证如何办理一比一原版(NU毕业证书)诺森比亚大学毕业证如何办理
一比一原版(NU毕业证书)诺森比亚大学毕业证如何办理
 
ADESGN3S_Case-Study-Municipal-Health-Center.pdf
ADESGN3S_Case-Study-Municipal-Health-Center.pdfADESGN3S_Case-Study-Municipal-Health-Center.pdf
ADESGN3S_Case-Study-Municipal-Health-Center.pdf
 
一比一原版(CSUEB毕业证)美国加州州立大学东湾分校毕业证如何办理
一比一原版(CSUEB毕业证)美国加州州立大学东湾分校毕业证如何办理一比一原版(CSUEB毕业证)美国加州州立大学东湾分校毕业证如何办理
一比一原版(CSUEB毕业证)美国加州州立大学东湾分校毕业证如何办理
 
原版制作(MDIS毕业证书)新加坡管理发展学院毕业证学位证一模一样
原版制作(MDIS毕业证书)新加坡管理发展学院毕业证学位证一模一样原版制作(MDIS毕业证书)新加坡管理发展学院毕业证学位证一模一样
原版制作(MDIS毕业证书)新加坡管理发展学院毕业证学位证一模一样
 
一比一原版(Teesside毕业证)英国提赛德大学毕业证如何办理
一比一原版(Teesside毕业证)英国提赛德大学毕业证如何办理一比一原版(Teesside毕业证)英国提赛德大学毕业证如何办理
一比一原版(Teesside毕业证)英国提赛德大学毕业证如何办理
 
一比一原版(ututaustin毕业证书)美国德克萨斯大学奥斯汀分校毕业证如何办理
一比一原版(ututaustin毕业证书)美国德克萨斯大学奥斯汀分校毕业证如何办理一比一原版(ututaustin毕业证书)美国德克萨斯大学奥斯汀分校毕业证如何办理
一比一原版(ututaustin毕业证书)美国德克萨斯大学奥斯汀分校毕业证如何办理
 
一比一原版(LSBU毕业证书)伦敦南岸大学毕业证如何办理
一比一原版(LSBU毕业证书)伦敦南岸大学毕业证如何办理一比一原版(LSBU毕业证书)伦敦南岸大学毕业证如何办理
一比一原版(LSBU毕业证书)伦敦南岸大学毕业证如何办理
 
一比一原版(Deakin毕业证书)澳洲迪肯大学毕业证文凭如何办理
一比一原版(Deakin毕业证书)澳洲迪肯大学毕业证文凭如何办理一比一原版(Deakin毕业证书)澳洲迪肯大学毕业证文凭如何办理
一比一原版(Deakin毕业证书)澳洲迪肯大学毕业证文凭如何办理
 

Deck: A Go Package for Presentations

  • 1. Deck a Go package for presentations
  • 2. DECK: a package for presentations Deck is a package written in Go That uses a singular markup language With elements for text, lists, code, and graphics All layout and sizes are expressed as percentages Clients are interactive or create formats like PDF or SVG
  • 4. Hello, World A block of text, word-wrapped to a specified width. You may specify size, font, color, and opacity. package main import "fmt" func main() { fmt.Println("Hello, World") } <text>...</text>
  • 5. bullet plain number Point A First item 1. This Point B Second item 2. That Point C The third item 3. The other Point D the last thing 4. One more <list>...</list>
  • 7. height (relative to element or canvas width) x, y width <rect .../>
  • 8. height (relative to element or canvas width) x, y width <ellipse .../>
  • 10. angle2 (90 deg) x, y angle1 (0 deg) <arc .../>
  • 13. Start the deck <deck> Set the canvas size <canvas width="1024" height="768" /> Begin a slide <slide bg="white" fg="black"> Place an image <image xp="70" yp="60" width="256" height="179" name="work.png" caption="Desk"/> Draw some text <text xp="20" yp="80" sp="3">Deck uses these elements</text> Make a bullet list <list xp="20" yp="70" sp="2" type="bullet"> <li>text, list, image</li> <li>line, rect, ellipse</li> <li>arc, curve</li> End the list </list> Draw a line <line xp1="20" yp1="10" xp2="30" yp2="10"/> Draw a rectangle <rect xp="35" yp="10" wp="4" hr="75" color="rgb(127,0,0)"/> Draw an ellipse <ellipse xp="45" yp="10" wp="4" hr="75" color="rgb(0,127,0)"/> Draw an arc <arc xp="55" yp="10" wp="4" hp="3" a1="0" a2="180" color="rgb(0,0,127)"/> Draw a quadratic bezier <curve xp1="60" yp1="10" xp2="75" yp2="20" xp3="70" yp3="10" /> End the slide End of the deck </slide> </deck> Anatomy of a Deck
  • 14. Deck uses these elements text, list, image line, rect, ellipse arc, curve Desk
  • 15. Text and List Markup Position, size <text xp="..." yp="..." sp="..."> Block of text <text ... type="block"> Lines of code <text ... type="code"> Attributes <text ... color="..." opacity="..." font="..." align="..."> Position, size <list xp="..." yp="..." sp="..."> Bullet list <list ... type="bullet"> Numbered list <list ... type="number"> Attributes <list ... color="..." opacity="..." font="..." align="...">
  • 16. Common Attributes for text and list xp horizontal percentage yp vertical percentage sp font size percentage type "bullet", "number" (list), "block", "code" (text) align "left", "middle", "end" color SVG names ("maroon"), or RGB "rgb(127,0,0)" opacity percent opacity (0-100, transparent - opaque) font "sans", "serif", "mono"
  • 17. Graphics Markup <line xp1="5" yp1="75" xp2="20" yp2="70" sp="0.2"/> <rect xp="10" yp="60" wp="15" hr="66.6" color="red"/> <rect xp="15" yp="55" wp="10" hr="100" color="blue" opacity="30"/> <ellipse xp="10" yp="35" wp="15" hr="66.66" color="green"/> <ellipse xp="15" yp="30" wp="10" hr="100" color="blue" opacity="30"/> <curve xp1="5" yp1="10" xp2="15" yp2="20" xp3="15" yp3="10" sp="0.3" color="red"/> <arc xp="22" yp="10" wp="10" wp="10" a1="0" a2="180" sp="0.2" color="blue"/>
  • 20. bullet plain number Point A First item 1. This Point B Second item 2. That Point C The third item 3. The other Point D the last thing 4. One more <list>...</list>
  • 22. package main import ( "log" "github.com/ajstarks/deck" ) func main() { presentation, err := deck.Read("deck.xml", 1024, 768) // open the deck if err != nil { log.Fatal(err) } for _, slide := range presentation.Slide { // for every slide... for _, t := range slide.Text { // process the text elements x, y, size := deck.Dimen(presentation.Canvas, t.Xp, t.Yp, t.Sp) slideText(x, y, size, t) } for _, l := range slide.List { // process the list elements x, y, size := deck.Dimen(presentation.Canvas, l.Xp, l.Yp, l.Sp) slideList(x, y, size, l) } } } A Deck Client
  • 24. func main() { benchmarks := []Bardata{ {"Macbook Air", 154.701}, {"MacBook Pro (2008)", 289.603}, {"BeagleBone Black", 2896.037}, {"Raspberry Pi", 5765.568}, } ts := 2.5 hts := ts / 2 x := 10.0 bx1 := x + (ts * 12) bx2 := bx1 + 50.0 y := 60.0 maxdata := 5800.0 linespacing := ts * 2.0 text(x, y+20, "Go 1.1.2 Build and Test Times", ts*2, "black") for _, data := range benchmarks { text(x, y, data.label, ts, "rgb(100,100,100)") bv := vmap(data.value, 0, maxdata, bx1, bx2) line(bx1, y+hts, bv, y+hts, ts, "lightgray") text(bv+0.5, y+(hts/2), fmt.Sprintf("%.1f", data.value), hts, "rgb(127,0,0)") y -= linespacing } } Generating a Barchart
  • 25. Go 1.1.2 Build and Test Times Macbook Air MacBook Pro (2008) BeagleBone Black Raspberry Pi 154.7 289.6 $ (echo '<deck><slide>'; go run deckbc.go; echo '</slide></deck>') 2896.0 5765.6
  • 26. go get github.com/ajstarks/deck/cmd/vgdeck go get github.com/ajstarks/deck/cmd/pdfdeck go get github.com/ajstarks/deck/cmd/svgdeck
  • 27. pdfdeck [options] file.xml... -sans, -serif, -mono [font] specify fonts -pagesize [w,h, or Letter, Legal, Tabloid, A2-A5, ArchA, Index, 4R, Widescreen] -stdout (output to standard out) -outdir [directory] directory for PDF output -fontdir [directory] directory containing font information -author [author name] set the document author -title [title text] set the document title -grid [percent] draw a percent grid on each slide
  • 28. svgdeck [options] file.xml... -sans, -serif, -mono [font] specify fonts -pagesize [Letter, Legal, A3, A4, A5] -pagewidth [canvas width] -pageheight [canvas height] -stdout (output to standard out) -outdir [directory] directory for PDF output -title [title text] set the document title -grid [percent] draw a percent grid on each slide
  • 29. vgdeck [options] file.xml... -loop [duration] loop, pausing [duration] between slides -slide [number] start at slide number -w [width] canvas width -h [height] canvas height -g [percent] draw a percent grid
  • 30. vgdeck Commands +, Ctrl-N, [Return] Next slide -, Ctrl-P, [Backspace] Previous slide ^, Ctrl-A First slide $, Ctrl-E Last slide r, Ctrl-R Reload x, Ctrl-X X-Ray /, Ctrl-F [text] Search s, Ctrl-S Save q Quit
  • 31. Deck Web API sex -dir [start dir] -listen [address:port] -maxupload [bytes] GET / List the API GET /deck/ List the content on the server GET /deck/?filter=[type] List content filtered by deck, image, video POST /deck/content.xml?cmd=1s Play a deck with the specified duration POST /deck/content.xml?cmd=stop Stop playing a deck POST /deck/content.xml?slide=[num] Play deck starting at a slide number DELETE /deck/content.xml Remove content POST /upload/ Deck:content.xml Upload content POST /table/ Deck:content.txt Generate a table from a tab-separated list POST /table/?textsize=[size] Specify the text size of the table POST /media/ Media:content.mov Play the specified video
  • 32. deck [command] [argument] deck play file [duration] Play a deck deck stop Stop playing a deck deck list [deck|image|video] List contents deck upload file... Upload content deck remove file... Remove content deck video file Play video deck table file [textsize] Make a table $ deck upload *.jpg # upload images $ mkpicdeck *.jpg | deck upload /dev/stdin # generate the slide show deck $ deck play stdin # play it
  • 33. Display is innovative makes a product useful Server is aesthetic makes a product understandable is unobtrusive Good Design is honest is long-lasting is thorough down to the last detail is environmentally-friendly is as little design as possible Controller > list > upload > play/stop > delete HDMI RESTful API
  • 39. bullet plain number Point A First item 1. This Point B Second item 2. That Point C The third item 3. The other Point D the last thing 4. One more <list>...</list>
  • 40. BOS SFO Virgin America 351 Gate B38 8:35am On Time
  • 41. JFK IND US Airways 1207 Gate C31C 5:35pm Delayed
  • 44. build clean remove object files env print Go environment information fix run go tool fix on packages fmt go compile packages and dependencies run gofmt on package sources get download and install packages and dependencies install compile and install packages and dependencies list list packages run compile and run Go program test test packages tool run specified go tool version print Go version vet run go tool vet on packages
  • 45. This is not a index card
  • 46. Rich Can't buy me love Bliss Worse Better Misery We have each other Poor
  • 47. Code package main import ( "github.com/ajstarks/svgo" "os" ) func main() { canvas := svg.New(os.Stdout) width, height := 500, 500 a, ai, ti := 1.0, 0.03, 10.0 canvas.Start(width, height) canvas.Rect(0, 0, width, height) canvas.Gstyle("font-family:serif;font-size:144pt") for t := 0.0; t <= 360.0; t += ti { canvas.TranslateRotate(width/2, height/2, t) canvas.Text(0, 0, "i", canvas.RGBA(255, 255, 255, a)) canvas.Gend() a -= ai } canvas.Gend() canvas.End() } Output
  • 48. A few months ago, I had a look at the brainchild of a few serious heavyweights working at Google. Their project, the Go programming language, is a static typed, c lookalike, semicolon-less, self formatting, package managed, object oriented, easily parallelizable, cluster fuck of genius with an unique class inheritance system. It doesn't have one.
  • 49. The Go Programming Language is a static typed, c lookalike, semicolon-less, self formatting, package managed, object oriented, easily parallelizable, cluster fuck of genius with an unique class inheritance system. Andrew Mackenzie-Ross, OBJECTIVE-C LESSONS FROM GO
  • 50. The Go Programming Language is a static typed, c lookalike, semicolon-less, self formatting, package managed, object oriented, easily parallelizable, cluster fuck of genius with an unique class inheritance system. Andrew Mackenzie-Ross, OBJECTIVE-C LESSONS FROM GO
  • 51. The Go Programming Language is a static typed, c lookalike, semicolon-less, self formatting, package managed, object oriented, easily parallelizable, cluster fuck of genius with an unique class inheritance system. It doesn't have one. Andrew Mackenzie-Ross, OBJECTIVE-C LESSONS FROM GO
  • 52. So, the next time you're about to make a subclass, think hard and ask yourself what would Go do Andrew Mackenzie-Ross, http://pocket.co/sSc56
  • 53. Python and Ruby programmers come to Go because they don't have to surrender much expressiveness, but gain performance and get to play with concurrency. Less is exponentially more Rob Pike
  • 54. You must not blame me if I do talk to the clouds.
  • 55. FOR, LO, the winter is past, the rain is over and gone; The flowers appear on the earth; the time for the singing of birds is come, and the voice of the turtle is heard in our land. Song of Solomon 2:11-12
  • 56. Good Design is innovative makes a product useful is aesthetic makes a product understandable is unobtrusive is honest is long-lasting is thorough down to the last detail is environmentally-friendly is as little design as possible Dieter Rams