jayrambhia/SimpleCV2 — pull request #33 by vighneshbirodkar (2013-09-04 20:41:44+00:00)
Title: Notebook Display

Only a single display works as of now and all it does is show images, no drawings etc.
However the caching is working as expected.

The browser caches by the URL name. If the URL is the same, the browser will first look into it's cache to see of of has a previous copy of the image.

The images are being hosted from a temporary folder. Each image has been given a unique ID. It's necessary that the ID remains same throughout the life time of the program. Images are stored in the temporary folder with ID % 10 ( 234 maps to 4, 45 maps to 5 ). This way at any given time, the temporary folder will not contain more than 10 images.

When the client is told to load the image with a UID, it loads the file with the name ID % 10. To make the URL unique the ID is appended at the end
+ 345 -> /display/5.png?ref=345
+ 23 -> /display/3.png?ref=23

Here is a code snippet
```python
from SimpleCV.Display.Notebook.Display import NBDisplay
from SimpleCV import Image,Camera
from time import sleep

nb = NBDisplay()

lenna = Image('lenna')
logo = Image('logo')
lyle = Image('lyle')

nb.showImage(lenna)
sleep(1)
nb.showImage(logo)
sleep(1)
nb.showImage(lyle)
sleep(1)
nb.showImage(lenna)
sleep(1)
nb.showImage(logo)
sleep(1)
nb.showImage(lyle)

```

Here is Chromium's statistics, notice that for the last 3 loads, very few data has to be transmitted

![cache](https://f.cloud.github.com/assets/3823490/1083869/266f12f2-15a2-11e3-9ef1-a6f70174d93f.png)