-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
661 lines (600 loc) · 24 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
<!DOCTYPE HTML>
<!--[if IE 6]>
<html id="ie6" lang="en-US" class="ie ie6 lt-ie9">
<![endif]-->
<!--[if IE 7]>
<html id="ie7" lang="en-US" class="ie ie7 lt-ie9">
<![endif]-->
<!--[if IE 8]>
<html id="ie8" lang="en-US" class="ie ie8 lt-ie9">
<![endif]-->
<!--[if gte IE 9]>
<html lang="en-US" class="ie ie9">
<![endif]-->
<!--[if !(IE)]><!-->
<html lang="en-US" class="">
<!--<![endif]-->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="initial-scale=1.0 minimal-ui">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="author" content="marcolago">
<meta property="og:title" content="Monads">
<meta property="og:site_name" content="FMonads">
<title>Monads</title>
<link rel="stylesheet" href="assets/css/reset.css">
<link rel="stylesheet" href="css/flowtime.css">
<link rel="stylesheet" href="css/themes/default.css">
<link rel="stylesheet" href="assets/css/prism.css">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<link rel="icon" href="favicon.ico" type="image/x-icon">
<link rel="apple-touch-icon-precomposed" href="img/touch-icon-iphone.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="img/touch-icon-ipad.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="img/touch-icon-iphone-retina.png">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="img/touch-icon-ipad-retina.png">
<link rel="apple-touch-startup-image" href="img/startup-640x920.png" media="(device-width: 320px) and (device-height: 480px) and (-webkit-device-pixel-ratio: 2)">
<link rel="apple-touch-startup-image" href="img/startup-640x1096.png" media="(device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2)">
</head>
<body class="">
<div class="flowtime">
<div class="ft-section" data-id="section-1">
<div id="/section-1/page-1" class="ft-page" data-id="page-1" data-title="Monads">
<div class="stack-center">
<div class="stacked-center">
<h1>Monads</h1>
<span>based on</span>
<h3>FUNCTIONAL PROGRAMING AND EVENT SOURCING - A PAIR MADE IN HEAVEN by Paweł Szulc</h3>
<span>and</span>
<h3>MonadicJava by MarioFusco</h3>
</div>
</div>
</div>
<div id="/section-1/page-2" class="ft-page" data-id="page-2">
<div class="stack-center">
<h1 class="stacked-center">WTF Monads?</h1>
</div>
</div>
<div id="/section-1/page-3" class="ft-page" data-id="page-3">
<div class="stack-center">
<div class="stacked-center">
<h2>Burrito?</h2>
<img src="img/pdp_cantina_burrito_steak.png">
</div>
</div>
</div>
<div id="/section-1/page-4" class="ft-page" data-id="page-4">
<div class="stack-center">
<img class="stacked-center" src="img/monad_science_cat.jpg">
</div>
</div>
<div id="/section-1/page-5" class="ft-page" data-id="page-5">
<div class="stack-center">
<ul class="stacked-center">
<li>We understand code</li>
<li class="ft-fragment">It is easier to talk about related ideas and then abstract to something more general</li>
<li class="ft-fragment">Having abstract model created, we tend to create metaphors</li>
<li class="ft-fragment">Having all above we can formalize</li>
</ul>
</div>
</div>
</div>
<div class="ft-section" data-id="section-2">
<div id="/section-2/page-1" class="ft-page" data-id="page-1">
<div class="stack-center">
<h1 class="stacked-center">Let's talk code</h1>
</div>
</div>
<div id="/section-2/page-2" class="ft-page" data-id="page-2">
<h1>Finding car insurance's name</h1>
<p class="ft-fragment">Model</p>
<pre class="ft-fragment line-numbers"><code class="language-java">public class Person {
private Car car;
public Car getCar() {
return car;
}
}</code></pre>
<pre class="ft-fragment line-numbers"><code class="language-java">public class Car {
private Insurance insurance;
public Insurance getInsurance() {
return insurance;
}
}</code></pre>
</div>
<div id="/section-2/page-3" class="ft-page" data-id="page-3">
<h1>Finding car insurance's name</h1>
<p>Model p.2</p>
<pre class="line-numbers"><code class="language-java">public class Insurance {
private String name;
public String getName() {
return name;
}
}</code></pre>
</div>
<div id="/section-2/page-4" class="ft-page" data-id="page-4">
<h1>Finding car insurance's name</h1>
<p>Implementation</p>
<pre class="ft-fragment line-numbers"><code class="language-java">public interface InsuranceFinder {
String findInsuranceName(Person person);
}</code></pre>
<pre class="ft-fragment line-numbers"><code class="language-java">public class NaiveInsuranceFinder implements InsuranceFinder {
public String findInsuranceName(Person person) {
return person.getCar().getInsurance().getName();
}
}</code></pre>
</div>
<div id="/section-2/page-5" class="ft-page" data-id="page-5">
<div class="stack-center">
<h2 class="stacked-center">Problem?</h2>
</div>
</div>
<div id="/section-2/page-6" class="ft-page" data-id="page-6">
<pre class="line-numbers"><code class="language-java">Person notInsured = new Person(new Car(null));
InsuranceFinder finder = new NaiveInsuranceFinder();
finder.findInsuranceName(notInsured);
</code></pre>
</div>
<div id="/section-2/page-7" class="ft-page" data-id="page-7">
<pre class="line-numbers" data-line="3"><code class="language-java">Person notInsured = new Person(new Car(null));
InsuranceFinder finder = new NaiveInsuranceFinder();
finder.findInsuranceName(notInsured);
</code></pre>
<pre><code>java.lang.NullPointerException
at org.insurance.finder.impl.NaiveInsuranceFinder.findInsuranceName(NaiveInsuranceFinder.java:9)
at org.insurance.finder.impl.NaiveInsuranceFinderTest.testFindInsurance(NaiveInsuranceFinderTest.java:21)
</code></pre>
</div>
<div id="/section-2/page-8" class="ft-page" data-id="page-8">
<div class="stack-center">
<h2 class="stacked-center">Solution?</h2>
</div>
</div>
<div id="/section-2/page-9" class="ft-page" data-id="page-9">
<pre class="line-numbers"><code class="language-java">public class DeepDoubtsInsuranceFinder implements InsuranceFinder {
public String findInsuranceName(Person person) {
if (person != null) {
Car car = person.getCar();
if (car != null) {
Insurance insurance = car.getInsurance();
if (insurance != null) {
String insuranceName = insurance.getName();
if (insuranceName != null) {
return insuranceName;
}
}
}
}
return "Unknown";
}
}</code></pre>
</div>
<div id="/section-2/page-10" class="ft-page" data-id="page-10">
<pre class="line-numbers"><code class="language-java">public class TooManyChoicesInsuranceFinder implements InsuranceFinder {
private static final String UNKNOWN = "Unknown";
public String findInsuranceName(Person person) {
if (person == null)
return UNKNOWN;
Car car = person.getCar();
if (car == null)
return UNKNOWN;
Insurance insurance = car.getInsurance();
if (insurance == null)
return UNKNOWN;
String insuranceName = insurance.getName();
if (insuranceName == null)
return UNKNOWN;
return insuranceName;
}
}</code></pre>
</div>
</div>
<div class="ft-section" data-id="section-3">
<div id="/section-3/page-1" class="ft-page" data-id="page-1">
<div class=stack-center>
<h1 class="stacked-center">Call me: Maybe</h1>
</div>
</div>
<div id="/section-3/page-2" class="ft-page" data-id="page-2">
<pre class="line-numbers"><code class="language-java">public class Optional<T> {
private static final Optional<?> EMPTY = new Optional<>(null);
private T value;
private Optional(T value) { this.value = value; }
public static <T> Optional<T> of(T value) {
return value == null ? EMPTY : new Optional<>(value);
}
public boolean isPresent() {
return value != null;
}
public T get() {
if (value == null)
throw new NoSuchElementException("No value");
return value;
}
</code></pre>
</div>
<div id="/section-3/page-3" class="ft-page" data-id="page-3">
<pre class="line-numbers" data-start="21"><code class="language-java"> public T orElse(T elseValue) {
return isPresent() ? value : elseValue;
}
public <U> Optional<U> flatMap(Function<T, Optional<U>> function) {
Objects.requireNonNull(function);
if (isPresent())
return Objects.requireNonNull(function.apply(value));
return EMPTY;
}
public <U> Optional<U> map(Function<T, U> function) {
Objects.requireNonNull(function);
if (isPresent())
return of(function.apply(value));
return EMPTY;
}
}</code></pre>
</div>
<div id="/section-3/page-4" class="ft-page" data-id="page-4">
<h1>Rethinking the model</h1>
<pre class="ft-fragment line-numbers"><code class="language-java">public class Person {
private Optional<Car> car;
public Optional<Car> getCar() {
return car;
}
}</code></pre>
<pre class="ft-fragment line-numbers"><code class="language-java">public class Car {
private Optional<Insurance> insurance;
public Optional<Insurance> getInsurance() {
return insurance;
}
}</code></pre>
</div>
<div id="/section-3/page-5" class="ft-page" data-id="page-5">
<h1>Rethinking the model p.2</h1>
<pre class="ft-fragment line-numbers"><code class="language-java">public class Insurance {
private final String name;
public Insurance(final String name) {
Objects.requireNonNull(name);
this.name = name;
}
public String getName() {
return name;
}
}</code></pre>
<pre class="ft-fragment line-numbers"><code class="language-java">public interface InsuranceFinder {
String findInsuranceName(Optional<Person> person);
}</code></pre>
</div>
<div id="/section-3/page-6" class="ft-page" data-id="page-6">
<div class="stack-center">
<h2 class="stacked-center">How use it?</h2>
</div>
</div>
<div id="/section-3/page-7" class="ft-page" data-id="page-7">
<h1>Implementation</h1>
<pre class="ft-fragment line-numbers"><code class="language-java">public class NotExactlyCorrectInsuranceFinder implements InsuranceFinder {
@Override
public String findInsuranceName(Optional<Person> person) {
if (person.isPresent()) {
Optional<Car> car = person.get().getCar();
if (car.isPresent()) {
Optional<Insurance> insurance = car.get().getInsurance();
if (insurance.isPresent()) {
return insurance.get().getName();
}
}
}
return "Unknown";
}
}</code></pre>
</div>
<div id="/section-3/page-8" class="ft-page" data-id="page-8">
<h1>Implementation</h1>
<pre class="ft-fragment line-numbers"><code class="language-java">public class MonadicInsuranceFinder implements InsuranceFinder {
public String findInsuranceName(Optional<Person> person) {
return person.flatMap(new Function<Person, Optional<Car>>() {
public Optional<Car> apply(Person person1) {
return person1.getCar();
}
}).flatMap(new Function<Car, Optional<Insurance>>() {
public Optional<Insurance> apply(Car car) {
return car.getInsurance();
}
}).map(new Function<Insurance, String>() {
public String apply(Insurance insurance) {
return insurance.getName();
}
}).orElse("Unknown");
}
}</code></pre>
</div>
<div id="/section-3/page-9" class="ft-page" data-id="page-9">
<h1>... or in Java 8</h1>
<div class="stack">
<div class="stacked">
<pre class="ft-fragment line-numbers"><code class="language-java">public class MonadicInsuranceFinder implements InsuranceFinder {
@Override
public String findInsuranceName(Optional<Person> person) {
return person
.flatMap(Person::getCar)
.flatMap(Car::getInsurance)
.map(Insurance::getName)
.orElse("Unknown");
}
}</code></pre></div>
</div>
</div>
</div>
<div class="ft-section" data-id="section-4">
<div id="/section-4/page-1" class="ft-page" data-id="page-1">
<h1>How does it works?</h1>
<pre class="line-numbers" style="display:block;"data-line="2-3"><code class="language-java">public class MonadicInsuranceFinder implements InsuranceFinder {
public String findInsuranceName(Optional<Person> person) {
return person
.flatMap(Person::getCar)
.flatMap(Car::getInsurance)
.map(Insurance::getName)
.orElse("Unknown");
}
}</code></pre>
<div class="stack">
<div class="stack-center" style="top: 0rem;">
<div class="ft-fragment stacked stacked-center">
<img class="stacked-center" src="img/Optional.png">
</div>
</div>
</div>
</div>
<div id="/section-4/page-2" class="ft-page" data-id="page-2">
<h1>How does it works?</h1>
<pre class="line-numbers" style="display:block;"data-line="4"><code class="language-java">public class MonadicInsuranceFinder implements InsuranceFinder {
public String findInsuranceName(Optional<Person> person) {
return person
.flatMap(Person::getCar)
.flatMap(Car::getInsurance)
.map(Insurance::getName)
.orElse("Unknown");
}
}</code></pre>
<div class="stack">
<div class="stack-center" style="top: 0rem;">
<div class="stacked stacked-center">
<img class="stacked-center" src="img/map_person.png">
</div>
<div class="ft-fragment stacked stacked-center">
<img class="stacked-center" src="img/flat_person.png">
</div>
</div>
</div>
</div>
<div id="/section-4/page-3" class="ft-page" data-id="page-3">
<h1>How does it works?</h1>
<pre class="line-numbers" style="display:block;"data-line="5"><code class="language-java">public class MonadicInsuranceFinder implements InsuranceFinder {
public String findInsuranceName(Optional<Person> person) {
return person
.flatMap(Person::getCar)
.flatMap(Car::getInsurance)
.map(Insurance::getName)
.orElse("Unknown");
}
}</code></pre>
<div class="stack">
<div class="stack-center" style="top: 0rem;">
<div class="stacked stacked-center">
<img class="stacked-center" src="img/map_car.png">
</div>
<div class="ft-fragment stacked stacked-center">
<img class="stacked-center" src="img/flat_car.png">
</div>
</div>
</div>
</div>
<div id="/section-4/page-4" class="ft-page" data-id="page-4">
<h1>How does it works?</h1>
<pre class="line-numbers" style="display:block;"data-line="6"><code class="language-java">public class MonadicInsuranceFinder implements InsuranceFinder {
public String findInsuranceName(Optional<Person> person) {
return person
.flatMap(Person::getCar)
.flatMap(Car::getInsurance)
.map(Insurance::getName)
.orElse("Unknown");
}
}</code></pre>
<div class="stack">
<div class="stack-center" style="top: 0rem;">
<div class="stacked stacked-center">
<img class="stacked-center" src="img/map_insurance.png">
</div>
</div>
</div>
</div>
<div id="/section-4/page-5" class="ft-page" data-id="page-5">
<h1>How does it works?</h1>
<pre class="line-numbers" style="display:block;"data-line="7"><code class="language-java">public class MonadicInsuranceFinder implements InsuranceFinder {
public String findInsuranceName(Optional<Person> person) {
return person
.flatMap(Person::getCar)
.flatMap(Car::getInsurance)
.map(Insurance::getName)
.orElse("Unknown");
}
}</code></pre>
<div class="stack">
<div class="stack-center" style="top: 0rem;">
<div class="stacked stacked-center">
<img class="stacked-center" src="img/or_else.png">
</div>
</div>
</div>
</div>
</div>
<div class="ft-section" data-id="section-5">
<div id="/section-5/page-1" class="ft-page" data-id="page-1">
<div class="stack-center">
<h1 class="stacked-center">What else?</h1>
</div>
</div>
<div id="/section-5/page-2" class="ft-page" data-id="page-2">
<h2>Model</h2>
<pre class="line-numbers">public class Dish {
private int calories;
private String name;
public int getCalories() {
return calories;
}
public String getName() {
return name;
}
}<code class="language-java"></code></pre>
</div>
<div id="/section-5/page-3" class="ft-page" data-id="page-3">
<h2>Task</h2>
<pre class="line-numbers"><code class="language-java">public class Java7DishFinder {
public List<String> findOrderedLowCaloriesDishesNames(List<Dish> menu) {
List<Dish> lowCaloriesDishes = new ArrayList<>();
for (Dish dish : menu) {
if (dish.getCalories() < 400)
lowCaloriesDishes.add(dish);
}
Collections.sort(lowCaloriesDishes, new Comparator<Dish>() {
public int compare(Dish d1, Dish d2) {
return Integer.compare(d1.getCalories(), d2.getCalories());
}
});
List<String> lowCaloriesDishesNames = new ArrayList<>();
for (Dish dish : lowCaloriesDishes) {
lowCaloriesDishesNames.add(dish.getName());
}
return lowCaloriesDishesNames;
}
}
</code></pre>
</div>
<div id="/section-5/page-4" class="ft-page" data-id="page-4">
<h2>Task - Stream Monad</h2>
<pre class="line-numbers"><code class="language-java">public class DishFinder {
public List<String> findOrderedLowCaloriesDishes(List<Dish> menu) {
return menu
.stream()
.filter(d -> d.getCalories() < 400)
.sorted(Comparator.comparing(Dish::getCalories))
.map(Dish::getName)
.collect(Collectors.toList());
}
}</code></pre>
</div>
</div>
<div class="ft-section" data-id="section-6">
<div id="/section-6/page-1" class="ft-page" data-id="page-1">
<ul>
<li>We've seen two wrapping classes</li>
<li class="ft-fragment">All have mapping methods</li>
<li class="ft-fragment">Each can take a function that can be called on a value wrapped by the structure</li>
<li class="ft-fragment">Both are MONADS so...</li>
</ul>
</div>
<div id="/section-6/page-2" class="ft-page" data-id="page-2">
<div class="stack-center">
<h1 class="stacked-center">WTF Monads?</h1>
</div>
</div>
<div id="/section-6/page-3" class="ft-page" data-id="page-3">
<ul>
<li>It is a container, a box</li>
<li class="ft-fragment">A box that can store a value</li>
<li class="ft-fragment">A box that has a common interface that allows us to do one thing: connect sequence of operations on the content of the box</li>
<li class="ft-fragment">But the way it is done depends on a box</li>
</ul>
</div>
<div id="/section-6/page-3" class="ft-page" data-id="page-3">
<h2>Or by definition</h2>
<p class="ft-fragment">Monad is an abstract data type that has two operations: unit and bind</p>
<pre class="ft-fragment line-numbers"><code class="language-java">M<A> unit(A, a);
M<B> bind(M<A> ma, Function<A, M<B>> f);</code></pre>
<pre class="ft-fragment line-numbers"><code class="language-java">interface M {
default M<B> map(Function<A, B> f) {
return bind(x -> unit(f.apply(x)));
}
M<B> bind(Function<A, M<B>> f)
}</code></pre>
</div>
<div id="/section-6/page-4" class="ft-page" data-id="page-4">
<h1>Profit?</h1>
<ul>
<li class="ft-fragment">Reduce code duplication</li>
<li class="ft-fragment">Improve maintainability</li>
<li class="ft-fragment">Increase readibility</li>
<li class="ft-fragment">Remove side effects</li>
<li class="ft-fragment">Hide complexity</li>
<li class="ft-fragment">Encapsulate implementation details</li>
</ul>
</div>
<div id="/section-6/page-5" class="ft-page" data-id="page-5">
<h1>Using monads...</h1>
<h2 class="ft-fragment">with Java < 8</h2>
<ul>
<li class="ft-fragment">Use Guava's Optional</li>
<li class="ft-fragment">has transform - something between map and flatMap</li>
<li class="ft-fragment">For manipulating collections use <a href="http://www.slideshare.net/mariofusco/no-more-loops-with-lambdaj">lambdaj</a></li>
</ul>
<h2 class="ft-fragment">with Java ≥ 8</h2>
<ul>
<li class="ft-fragment">Java's Optional, Stream, ComputableFuture</li>
<li class="ft-fragment">com.jason-goodwin:better-monads - has Try monad (!) and stream od ComputableFuture</li>
<li class="ft-fragment">write your own?</li>
</ul>
</div>
<div id="/section-6/page-6" class="ft-page" data-id="page-6">
<div class="stack-center">
<h1 class="stacked-center">Thank you</h1>
</div>
</div>
</div>
</div>
<script src="js/brav1toolbox.js"></script>
<script src="js/flowtime.js"></script>
<script src="assets/js/prism.js"></script>
<script type="text/javascript">
var cacheTitle = document.title.replace("Flowtime.js | ", "");
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-1228618-10']);
_gaq.push(['_trackPageview']);
_gaq.push(['_trackEvent', 'Flowtime', 'Landing', document.title]);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
// Configuration API test
Flowtime.showProgress(true);
Flowtime.fragmentsOnSide(true);
// Flowtime.fragmentsOnBack(true);
// Flowtime.useHistory(false);
Flowtime.slideInPx(true);
Flowtime.sectionsSlideToTop(true);
// Flowtime.gridNavigation(false);
// Flowtime.useOverviewVariant(true);
// Flowtime.parallaxInPx(true);
//
// event management
// Flowtime.addEventListener("flowtimenavigation", onNavigation, false);
Flowtime.onNavigation(onNavigation);
function onNavigation(e)
{
_gaq.push(['_trackEvent', 'Flowtime', 'Navigation', cacheTitle + ' > ' + document.title.replace("Flowtime.js | ", "")]);
// console.log(cacheTitle + ' > ' + document.title.replace("Flowtime.js | ", ""));
cacheTitle = document.title.replace("Flowtime.js | ", "");
//console.log('section', e.section, 'sectionIndex', e.sectionIndex);
//console.log('page', e.page, 'pageIndex', e.);
//console.log('pastSectionIndex', e.pastSectionIndex, 'pastPageIndex', e.pastPageIndex);
//console.log('prevSection', e.prevSection);
//console.log('nextSection', e.nextSection);
//console.log('prevPage', e.prevPage);
//console.log('nextPage', e.nextPage);
//console.log('fragment', e.fragment, + 'fragmentIndex', e.fragmentIndex);
//console.log("isOverview", e.isOverview);
//console.log('progress:', e.progress, 'total:', e.total);
// var value = Math.round(e.progress * 100 / e.total);
// console.log('Completion: ' + value + '%');
}
// starts the application with configuration options
Flowtime.start();
</script>
<script type="text/javascript" src="http://slidemote.jit.su/slidemote.js#flowtime"></script>
</body>
</html>