magic_mirror 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5a1414e7bfa5467e60f05646f0370beeeb326f95
4
- data.tar.gz: beaef4c2e0344799dbf286cfd0c3de8df32c98bf
3
+ metadata.gz: 2680e984bec0cb5e027dbaf97c9a0261435bb90a
4
+ data.tar.gz: 56166179a96730b628b0c4bc8e38c501fcdf67a4
5
5
  SHA512:
6
- metadata.gz: c1037e1c5af6c5d9922fff78f7b65cb339ad6e4be78b1c2d508c989f6112ba24b8f2ae02300e2045a00174d52d5714cf3d02408da6e332b758a38a6dbfa30054
7
- data.tar.gz: 49eb5c2feba9d7a60bfbca86800e47c0bf3a5a6737ba48a36e066638a451a9affe57012756439917ce70c2648385c188867d78289a49ab1e71a0eb968e4407ba
6
+ metadata.gz: af99477479b7398e6fcc14e2c73e23cfa07f4c14904c7760f92cbf123cff98f612b96b652fa29b7105f84b16293878d3726bc8f9f8f6cdc803ca82a3cb80b425
7
+ data.tar.gz: b0345ddff87ffc66df6f557a31800077ce75319f71415c06625253b285c5ff73c3d0f1f8e6fc0b46cbdef4186264ba6c4e847c0e5490f3750f2a418322ead494
data/changelog CHANGED
@@ -1,6 +1,4 @@
1
1
  ** 0.0.x **
2
- TODO: List off what features you'll be including at some point in the
3
- future.
4
2
 
5
3
  - Test against port in use problem.
6
4
 
@@ -15,67 +13,21 @@ future.
15
13
  but ppl shouldn't directly eval the strings coming in over httpPost...
16
14
 
17
15
  - limitation: Can only have one rendering display at a time *per computer*
18
- > Solution: Clean up the output and make ports random
16
+ > Solution: Make ports random?
17
+ > Solution: Make 1 port, but make things accessible as /roots/myRoot
19
18
 
20
- - Bug: If faye server goes offline for a second, and misses commands, then comes back online,
21
- the command_cache variable will be out of sync with that of the server
22
- > Solutions: Javascript Function periodically checks in to see the
23
- md5 checksum of server's command_cache and if the browser's is out of date
24
- it performs a reset
25
19
 
26
20
  - Think of other popular uses for rendering...
27
- - secure by making servers listen only on localhost
28
21
 
29
- - I noticed some missing parts to the tree...
30
- > Oh... right when you load the page, you'll get
31
- [command_cache] - [changes to command_cache since page load innitated]
32
- so a small gap in commands will exist...
33
- SOLUTION
34
-
35
- * Architecturally: add an index number to each message sent over faye
36
- * Client-wise: Calculate
37
- [Index of first faye message] - [length of the command cache] = [gap]
38
- * request the gap from the server on receipt of first message from faye /gap?command_cache=95&first_faye=100
22
+ - secure by making servers listen only on localhost for websockets
39
23
 
40
24
 
41
25
 
42
26
  Currently:
43
27
 
44
- - The tree example takes forever to draw
45
- > Cache commands before sending through websockets:
46
- cache websockets commands and wait 0.1 seconds between each
47
- message sent...
48
- ... it's also just a hell of a lot of data...
49
-
50
- > Compress the command_cache: if the commands can be condensed so they
51
- take up fewer characters, performance will improve dramatically.
52
- *
53
- *
54
-
55
- > Dynamically build the tree function in javascript and reduce the command
56
- to 1 function definition plus an invocation...
57
-
58
- > What if command_cache SVG data instead of function calls?
59
-
60
- - The javascript chokes up... possibly because it's iterating over the command cache,
61
- and also responding to the websocket requests at the same time?
62
-
63
- - Use webworker??
64
-
65
28
  - Small discrepencies in bigish trtl lines in the tree example
66
29
 
67
30
 
68
- - Hmmm.... why don't I steam the command_cache over websockets?
69
- > The reason this is good is that it allows the client to get the data
70
- in incriments and then deal with the data, and then wait for more.
71
- This way the data never exceedes more than several kilobytes in memory...
72
-
73
- - EFFICIENTLY TRANSFER THE COMMAND_CACHE ARRAY:
74
- * embedded in html
75
-
76
- * embedded in html, but split into chunks!!! after each chunk is finished and
77
- processed/ deleted, the next chunk is gotten to until all the chunks are
78
- deleted!!!!!!! !!!!!!!!!!!!!!!!!!!!
79
31
 
80
32
  Finished:
81
33
 
@@ -13,15 +13,22 @@ module MagicMirror
13
13
  self
14
14
  end
15
15
 
16
-
16
+ # what if I cached this value?...
17
17
  def to_embedded_javascript
18
18
  string = ""
19
19
 
20
20
  string += "<script>"
21
- string += "window.command_cache = [];"
22
21
 
22
+ time_offset = 40
23
23
  self.each_slice(100) do |a|
24
+ string += "setTimeout(function(){"
24
25
  string += "z(#{a.to_json});"
26
+ if time_offset == 40
27
+ string += "}, #{0});"
28
+ time_offset+=5
29
+ else
30
+ string += "}, #{time_offset+=5});"
31
+ end
25
32
  end
26
33
 
27
34
  string += "</script>"
@@ -4,10 +4,8 @@ module SinatraSilver
4
4
  class App < Sinatra::Base
5
5
  set :root, MagicMirror.sinatra_root
6
6
  # set :app_file, MagicMirror.sinatra_root
7
- # set :views, MagicMirror.sinatra_root
8
7
  set :views, Proc.new { File.join(MagicMirror.sinatra_root, "lib", "views") }
9
8
  #set :public_folder, Proc.new { File.join(MagicMirror.sinatra_root, "lib", "views") }
10
- #set :logging, false
11
9
  set :logging, false
12
10
  set :bind, '127.0.0.1'
13
11
 
@@ -17,12 +15,23 @@ module SinatraSilver
17
15
 
18
16
  get '/' do
19
17
  @command_cache = MagicMirror.command_cache.to_json
18
+ @command_cache_length = MagicMirror.command_cache.length
20
19
  @command_cache_fast_evaluator = MagicMirror.command_cache.to_embedded_javascript
21
- erb :index # 'Hello world!'
20
+ erb :index
22
21
  end
23
22
 
24
23
  get '/webworker.js' do
25
24
  erb :webworker
26
25
  end
26
+
27
+ # There's a gap in the client's command cache, right after page load and
28
+ # right before faye is connected, you will be missing commands.
29
+ # This action is called when faye is connected to fill in the gap.
30
+ get '/missing_cache' do
31
+ l = params[:command_cache_length].to_i
32
+ start_index = l-1
33
+
34
+ MagicMirror.command_cache[start_index..-1].to_json
35
+ end
27
36
  end
28
37
  end
@@ -1,3 +1,3 @@
1
1
  module MagicMirror
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: magic_mirror
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - TheNotary