Created
April 30, 2014 10:20
-
-
Save robbielynch/0cace5572d82f0ed9d84 to your computer and use it in GitHub Desktop.
IErlang_Project_Demo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"metadata": { | |
"name": "", | |
"signature": "sha256:08250657796be295d72c628fd79fb4af4994ef463c8871d83ee7f5a91bd5ad96" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"<div align='center'>\n", | |
" <img src=\"http://i.imgur.com/7rr6Tbr.png\" title=\"IErlang Notebook\" width='70%'/>\n", | |
" \n", | |
" <hr />\n", | |
" \n", | |
" <img src='http://media.kclr96fm.com/media/it-carlow-logo.jpg' width='250' height='250'/> \n", | |
" <h3 color='#525252'>INSTITUTE OF TECHNOLOGY, CARLOW</h3>\n", | |
" \n", | |
" <hr />\n", | |
" \n", | |
" <h3 color='#525252'> Developed By **Robbie Lynch** </h3>\n", | |
" <h3 color='#525252'>Supervised By **Paul Barry**</h3>\n", | |
" \n", | |
" <hr />\n", | |
" \n", | |
"</div>\n" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"#1. Cells" | |
] | |
}, | |
{ | |
"cell_type": "raw", | |
"metadata": {}, | |
"source": [ | |
"This is a cell\n", | |
"\n", | |
"This is where we edit and execute erlang, HTML and Markdown code." | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"----" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"#2. Operating System Commands\n", | |
">Just prepend `;;` before the command\n", | |
"\n", | |
"---" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
";;pwd" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"html": [ | |
"<pre>/home/robbie/dev/ierlang/src<br /></pre>" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 1, | |
"text": [ | |
"/home/robbie/dev/ierlang/src\n" | |
] | |
} | |
], | |
"prompt_number": 1 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
";;date" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"html": [ | |
"<pre>Tue Apr 29 15:12:41 BST 2014<br /></pre>" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 2, | |
"text": [ | |
"Tue Apr 29 15:12:41 BST 2014\n" | |
] | |
} | |
], | |
"prompt_number": 2 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
";;ls *.erl" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"html": [ | |
"<pre>code_manager.erl<br />control_server.erl<br />greetings.erl<br />heartbeat_server.erl<br />ipython_kernel.erl<br />lynch.erl<br />message_builder.erl<br />message_parser.erl<br />message_sender.erl<br />mochijson2.erl<br />mochinum.erl<br />restrictions.erl<br />robbie.erl<br />sandbox.erl<br />shell_server.erl<br />uuid.erl<br />zmq_manager.erl<br /></pre>" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 3, | |
"text": [ | |
"code_manager.erl\n", | |
"control_server.erl\n", | |
"greetings.erl\n", | |
"heartbeat_server.erl\n", | |
"ipython_kernel.erl\n", | |
"lynch.erl\n", | |
"message_builder.erl\n", | |
"message_parser.erl\n", | |
"message_sender.erl\n", | |
"mochijson2.erl\n", | |
"mochinum.erl\n", | |
"restrictions.erl\n", | |
"robbie.erl\n", | |
"sandbox.erl\n", | |
"shell_server.erl\n", | |
"uuid.erl\n", | |
"zmq_manager.erl\n" | |
] | |
} | |
], | |
"prompt_number": 3 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
";;ping -c 5 google.com" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"html": [ | |
"<pre>PING google.com (74.125.24.139) 56(84) bytes of data.<br />64 bytes from de-in-f139.1e100.net (74.125.24.139): icmp_req=1 ttl=52 time=4.09 ms<br />64 bytes from de-in-f139.1e100.net (74.125.24.139): icmp_req=2 ttl=52 time=4.12 ms<br />64 bytes from de-in-f139.1e100.net (74.125.24.139): icmp_req=3 ttl=52 time=4.09 ms<br />64 bytes from de-in-f139.1e100.net (74.125.24.139): icmp_req=4 ttl=52 time=4.11 ms<br />64 bytes from de-in-f139.1e100.net (74.125.24.139): icmp_req=5 ttl=52 time=4.10 ms<br /><br />--- google.com ping statistics ---<br />5 packets transmitted, 5 received, 0% packet loss, time 4005ms<br />rtt min/avg/max/mdev = 4.092/4.104/4.121/0.071 ms<br /></pre>" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 4, | |
"text": [ | |
"PING google.com (74.125.24.139) 56(84) bytes of data.\n", | |
"64 bytes from de-in-f139.1e100.net (74.125.24.139): icmp_req=1 ttl=52 time=4.09 ms\n", | |
"64 bytes from de-in-f139.1e100.net (74.125.24.139): icmp_req=2 ttl=52 time=4.12 ms\n", | |
"64 bytes from de-in-f139.1e100.net (74.125.24.139): icmp_req=3 ttl=52 time=4.09 ms\n", | |
"64 bytes from de-in-f139.1e100.net (74.125.24.139): icmp_req=4 ttl=52 time=4.11 ms\n", | |
"64 bytes from de-in-f139.1e100.net (74.125.24.139): icmp_req=5 ttl=52 time=4.10 ms\n", | |
"\n", | |
"--- google.com ping statistics ---\n", | |
"5 packets transmitted, 5 received, 0% packet loss, time 4005ms\n", | |
"rtt min/avg/max/mdev = 4.092/4.104/4.121/0.071 ms\n" | |
] | |
} | |
], | |
"prompt_number": 4 | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"---\n", | |
"#3. Erlang Code\n", | |
"---\n", | |
"###3.1 Erlang Expressions" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"1000 * 2." | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"html": [ | |
"2000" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 5, | |
"text": [ | |
"2000" | |
] | |
} | |
], | |
"prompt_number": 5 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"99 div 5. %%integer division" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"html": [ | |
"19" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 6, | |
"text": [ | |
"19" | |
] | |
} | |
], | |
"prompt_number": 6 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"99/5. %%float division" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"html": [ | |
"19.8" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 7, | |
"text": [ | |
"19.8" | |
] | |
} | |
], | |
"prompt_number": 7 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"\"hello, \" ++ \"world\"." | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"html": [ | |
"<pre>hello, world</pre>" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 8, | |
"text": [ | |
"hello, world" | |
] | |
} | |
], | |
"prompt_number": 8 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"[1,2,3,4] ++ [5,6,7,8]." | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"html": [ | |
"[1, 2, 3, 4, 5, 6, 7, 8]" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 9, | |
"text": [ | |
"[1, 2, 3, 4, 5, 6, 7, 8]" | |
] | |
} | |
], | |
"prompt_number": 9 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"2#11111111." | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"html": [ | |
"255" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 10, | |
"text": [ | |
"255" | |
] | |
} | |
], | |
"prompt_number": 10 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"'This is an atom with spaces'." | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"html": [ | |
"<pre>'This is an atom with spaces'</pre>" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 11, | |
"text": [ | |
"'This is an atom with spaces'" | |
] | |
} | |
], | |
"prompt_number": 11 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"atom_with_no_spaces." | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"html": [ | |
"<pre>atom_with_no_spaces</pre>" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 12, | |
"text": [ | |
"atom_with_no_spaces" | |
] | |
} | |
], | |
"prompt_number": 12 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"{tuples, are, great, {and_so, are, nested, {tuples}}}." | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"html": [ | |
"<pre>{tuples,are,great,{and_so,are,nested,{tuples}}}</pre>" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 13, | |
"text": [ | |
"{tuples,are,great,{and_so,are,nested,{tuples}}}" | |
] | |
} | |
], | |
"prompt_number": 13 | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"###3.2 Built in Functions" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"lists:reverse([1,2,3,4,5,6,7,8,9,10])." | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"html": [ | |
"[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 14, | |
"text": [ | |
"[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]" | |
] | |
} | |
], | |
"prompt_number": 14 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"is_binary(<<\"Hello\">>)." | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"html": [ | |
"<pre>true</pre>" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 15, | |
"text": [ | |
"true" | |
] | |
} | |
], | |
"prompt_number": 15 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"math:pow(2,10)." | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"html": [ | |
"1024.0" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 16, | |
"text": [ | |
"1024.0" | |
] | |
} | |
], | |
"prompt_number": 16 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"node()." | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"html": [ | |
"<pre>nonode@nohost</pre>" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 17, | |
"text": [ | |
"nonode@nohost" | |
] | |
} | |
], | |
"prompt_number": 17 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"list_to_binary(\"Hello, World\")." | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"html": [ | |
"<pre><<\"Hello, World\">></pre>" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 18, | |
"text": [ | |
"<<\"Hello, World\">>" | |
] | |
} | |
], | |
"prompt_number": 18 | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"###3.3 Variable Bindings" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"erlang:localtime()." | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"html": [ | |
"<pre>{{2014,4,29},{15,13,27}}</pre>" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 19, | |
"text": [ | |
"{{2014,4,29},{15,13,27}}" | |
] | |
} | |
], | |
"prompt_number": 19 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"{{Year, Month, Day},{Hour, Minute, Seconds}} = erlang:localtime()." | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"html": [ | |
"<pre>{{2014,4,29},{15,13,28}}</pre>" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 20, | |
"text": [ | |
"{{2014,4,29},{15,13,28}}" | |
] | |
} | |
], | |
"prompt_number": 20 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"Year." | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"html": [ | |
"2014" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 21, | |
"text": [ | |
"2014" | |
] | |
} | |
], | |
"prompt_number": 21 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"Month." | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"html": [ | |
"4" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 22, | |
"text": [ | |
"4" | |
] | |
} | |
], | |
"prompt_number": 22 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"Day." | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"html": [ | |
"29" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 23, | |
"text": [ | |
"29" | |
] | |
} | |
], | |
"prompt_number": 23 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"MyNumber = 99." | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"html": [ | |
"99" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 24, | |
"text": [ | |
"99" | |
] | |
} | |
], | |
"prompt_number": 24 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"Answer = MyNumber + Year." | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"html": [ | |
"2113" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 25, | |
"text": [ | |
"2113" | |
] | |
} | |
], | |
"prompt_number": 25 | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"###3.4 Errors\n", | |
"When things go wrong, we can see what the problem was." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"E1 = 888 div 33.3333." | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"html": [ | |
"<pre>badarith</pre>" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 26, | |
"text": [ | |
"badarith" | |
] | |
} | |
], | |
"prompt_number": 26 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"{{Year, Month, Day},{Hour, Minute, Seconds}} = erlang:localtime()." | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"html": [ | |
"<pre>{badmatch,{{2014,4,29},{15,13,57}}}</pre>" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 27, | |
"text": [ | |
"{badmatch,{{2014,4,29},{15,13,57}}}" | |
] | |
} | |
], | |
"prompt_number": 27 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"Year = 0.1." | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"html": [ | |
"<pre>{badmatch,0.1}</pre>" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 28, | |
"text": [ | |
"{badmatch,0.1}" | |
] | |
} | |
], | |
"prompt_number": 28 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"made_up_module:get_something()." | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"html": [ | |
"<pre>undef</pre>" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 29, | |
"text": [ | |
"undef" | |
] | |
} | |
], | |
"prompt_number": 29 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"this line will throw an error" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"html": [ | |
"<pre>{badmatch,{error,{1,erl_parse,[\"syntax error before: \",\"line\"]}}}</pre>" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 30, | |
"text": [ | |
"{badmatch,{error,{1,erl_parse,[\"syntax error before: \",\"line\"]}}}" | |
] | |
} | |
], | |
"prompt_number": 30 | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"---\n", | |
"#4. Erlang Modules\n", | |
"---" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"###4.1 Creating Modules" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"-module(robbie).\n", | |
"-export([\n", | |
" my_favorite_numbers/0, \n", | |
" unlucky_number/0\n", | |
"]).\n", | |
"\n", | |
"%%Return Robbie's favorite numbers\n", | |
"my_favorite_numbers()->\n", | |
" [1, 2, 3, 4, 5].\n", | |
"\n", | |
"%%Return Robbie's unlucky number\n", | |
"unlucky_number()->\n", | |
" ((278346287 * 98324928374) - (829437 * 3476) - (27368378729560724309 + (2 * 2)))." | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"html": [ | |
"<pre>Successfully Compiled</pre>" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 31, | |
"text": [ | |
"Successfully Compiled" | |
] | |
} | |
], | |
"prompt_number": 31 | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
">After execution, the module is saved and compiled.\n", | |
"\n", | |
">The result of the compilation is then shown to the user." | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"###4.2 Introducing errors and warnings to erlang modules" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"-module(greetings).\n", | |
"-export([\n", | |
" hello/0, \n", | |
" goodbye/0\n", | |
"]).\n", | |
"\n", | |
"hello()->\n", | |
"%%%%%%%%%%%THIS IS WHERE THE ERROR IS%%%%%%%%%%%%%\n", | |
"\n", | |
"goodbye()->\n", | |
"\"Goodbye\"." | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"html": [ | |
"<pre>greetings.erl:10: syntax error before: '->'<br />greetings.erl:2: function goodbye/0 undefined<br />greetings.erl:2: function hello/0 undefined<br /></pre>" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 32, | |
"text": [ | |
"greetings.erl:10: syntax error before: '->'\n", | |
"greetings.erl:2: function goodbye/0 undefined\n", | |
"greetings.erl:2: function hello/0 undefined\n" | |
] | |
} | |
], | |
"prompt_number": 32 | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"###4.3 Module Execution" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
">We can also execute the exported functions of each compiled module." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"robbie:my_favorite_numbers()." | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"html": [ | |
"[1, 2, 3, 4, 5]" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 33, | |
"text": [ | |
"[1, 2, 3, 4, 5]" | |
] | |
} | |
], | |
"prompt_number": 33 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"robbie:unlucky_number()." | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"html": [ | |
"13" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 34, | |
"text": [ | |
"13" | |
] | |
} | |
], | |
"prompt_number": 34 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"lists:reverse(robbie:my_favorite_numbers() ++ lists:sort([4,3,56456,23,hello,454,656,324,45,5,65]))." | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"html": [ | |
"[u'hello', 56456, 656, 454, 324, 65, 45, 23, 5, 4, 3, 5, 4, 3, 2, 1]" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 35, | |
"text": [ | |
"[u'hello', 56456, 656, 454, 324, 65, 45, 23, 5, 4, 3, 5, 4, 3, 2, 1]" | |
] | |
} | |
], | |
"prompt_number": 35 | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"---\n", | |
"#5. Multiple notebooks \n", | |
"* ###Running on separate kernel processes \n", | |
"* ###On one server\n", | |
"\n", | |
"---" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"#6. Rendering Latex in IErlang Notebook" | |
] | |
}, | |
{ | |
"cell_type": "raw", | |
"metadata": {}, | |
"source": [ | |
"We can render latex.\n", | |
"For example, we can render the following:\n", | |
"\n", | |
"$$\\frac{dy}{dx}=\\frac{y_{2}-y_{1}}{x_2{2}-x_{1}}$$" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"$\\frac{dy}{dx}=\\frac{y_{2}-y_{1}}{x_{2}-x_{1}}$" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"$$\\frac{dy}{dx}=\\frac{y_{2}-y_{1}}{x_{2}-x_{1}}$$\n", | |
"\n", | |
"---" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"#7. View Notebooks on IPython's NBViewer\n", | |
"---\n", | |
"* Save notebook as a gist on Github\n", | |
"* Go to [nbviewer](http://nbviewer.ipython.org/) \n", | |
"* Paste gist URL into page and press ***GO***\n", | |
"* [View This Notebook In NBViewer]()" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"---\n", | |
"#8. Convert notebooks into HTML, PDF and even Slideshows.\n", | |
"---\n", | |
"###8.1 Demo slide show for Joe's erlang notes" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"Create slides and host on your localhost server:\n", | |
"```\n", | |
"ipython nbconvert Joe.ipynb --to slides --post serve\n", | |
"```" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"---\n", | |
"#9. Demo IErlang Console\n", | |
"---" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"---\n", | |
"#10. Demo RESTRICTED_MODE\n", | |
"---\n", | |
"* Set the `RESTRICTED_MODE` macro in **ierlang/src/code_manager.erl** to **true**\n", | |
"* Start IErlang" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"---\n", | |
"#11. Other Cool Stuff\n", | |
"---" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"###11.1 Youtube" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"<iframe width=\"640\" height=\"390\" src=\"//www.youtube.com/embed/XI7S2NwFPOE\" frameborder=\"0\" allowfullscreen></iframe>" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"###11.2 Spotify" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"<iframe src=\"https://embed.spotify.com/?uri=spotify:track:1iXBApi39l5r6lJj9WEXXS\" width=\"300\" height=\"380\" frameborder=\"0\" allowtransparency=\"true\"></iframe>" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"###11.3 Embed anything inside IErlang Notebook\n", | |
"#####Even the Erlang Documentation" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"<iframe src=\"http://www.erlang.org/doc/\" width=\"100%\" height=\"600\" frameborder=\"0\" allowtransparency=\"true\"></iframe>" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"***\n", | |
"#12. Questions?\n", | |
"***" | |
] | |
} | |
], | |
"metadata": {} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment