sandbox-2
| rev 32 | rev 33 | ||||
|---|---|---|---|---|---|
| 47 | ========================================== | 47 | ========================================== | ||
| 48 | 48 | ||||
| t | 49 | .. code-block:: pytho | t | 49 | .. code-block:: python |
| 50 | 50 | ||||
| 51 | class Bread( object ): | 51 | class Bread( object ): | ||
| rev 31 | rev 32 | ||||
|---|---|---|---|---|---|
| 47 | ========================================== | 47 | ========================================== | ||
| 48 | 48 | ||||
| t | 49 | .. code-block:: python | t | 49 | .. code-block:: pytho |
| 50 | 50 | ||||
| 51 | class Bread( object ): | 51 | class Bread( object ): | ||
| rev 28 | rev 29 | ||||
|---|---|---|---|---|---|
| 94 | 94 | ||||
| 95 | ['foxhop.net', 'os', 'linux', 'ubuntu'] | 95 | ['foxhop.net', 'os', 'linux', 'ubuntu'] | ||
| t | 96 | ['<a href="http://foxhop.net/">foxhop.net</a>', '<a href="http://foxhop.net/os/ | t | 96 | |
| > | ">os</a>', '<a href="http://foxhop.net/os/linux/">linux</a>', '<a href="http://f | ||||
| > | oxhop.net/os/linux/ubuntu/">ubuntu</a>'] | ||||
| 97 | ['<a href="http://foxhop.net/">foxhop.net</a>', '<a href="http://foxhop.net/os/ | ||||
| > | ">os</a>', | ||||
| 98 | '<a href="http://foxhop.net/os/linux/">linux</a>', '<a href="http://foxhop.net/ | ||||
| > | os/linux/ubuntu/">ubuntu</a>'] | ||||
| 97 | 99 | ||||
| 98 | 100 | ||||
| rev 27 | rev 28 | ||||
|---|---|---|---|---|---|
| 54 | ---------------------------------------- | 54 | ---------------------------------------- | ||
| 55 | >>> from bread import Bread | 55 | >>> from bread import Bread | ||
| n | 56 | >>> bread = Bread("http://foxhop.net/os/linux/ubuntu") | n | 56 | >>> bread = Bread("http://www.foxhop.net/samsung/HL-T5087SA/red-LED-failure" |
| > | ) | ||||
| 57 | >>> print bread.crumbs | 57 | >>> print bread.crumbs | ||
| n | 58 | >>> print bread.links() | n | 58 | >>> print bread.links |
| 59 | 59 | ||||
| 60 | """ | 60 | """ | ||
| n | 61 | def __init__( self, url ): | n | 61 | def __init__( self, url=None ): |
| 62 | if url: self.url = url # invoke url.setter | ||||
| 63 | else: self._url = url # set _url to none | ||||
| 64 | |||||
| 65 | @property | ||||
| 66 | def url( self ): | ||||
| 67 | return self._url | ||||
| 68 | |||||
| 69 | @url.setter | ||||
| 70 | def url( self, url ): | ||||
| 71 | if url.startswith( 'http://' ): url = url[ 7: ] # remove http:// if exis | ||||
| > | ts | ||||
| 72 | if url.startswith( 'https://' ): url = url[ 8: ] # remove https:// if ex | ||||
| > | ists | ||||
| 73 | |||||
| 62 | self.url = url.strip('http://') | 74 | self._url = url.rstrip('/') | ||
| 63 | self.crumbs = self.url.split('/') | 75 | self.crumbs = self._url.split('/') | ||
| 64 | 76 | ||||
| n | n | 77 | @property | ||
| 65 | def links( self ): | 78 | def links( self ): | ||
| n | 66 | self.list = [] | n | 79 | links = [] |
| 67 | count = 0 | 80 | count = 0 | ||
| 68 | for crumb in self.crumbs: | 81 | for crumb in self.crumbs: | ||
| 71 | string = string + self.crumbs[c] + '/' | 84 | string = string + self.crumbs[c] + '/' | ||
| 72 | count += 1 | 85 | count += 1 | ||
| n | n | 86 | string = string.rstrip('/') | ||
| 73 | self.list.append('<a href="http://' + string + '">' + crumb + '</a>' | 87 | links.append('<a href="http://' + string + '">' + crumb + '</a>') | ||
| > | ) | ||||
| 74 | 88 | ||||
| t | 75 | return self.list | t | 89 | return links |
| 76 | 90 | ||||
| 77 | **EXAMPLE OUTPUT** | 91 | **EXAMPLE OUTPUT** | ||
| rev 26 | rev 27 | ||||
|---|---|---|---|---|---|
| f | 1 | This is another sandbox for new users to test functionality | f | 1 | This is another sandbox for new users to test functionality |
| 2 | ====================================================================== | 2 | ====================================================================== | ||
| n | n | 3 | |||
| 4 | Mako template for city index | ||||
| 3 | 5 | ||||
| 4 | .. code-block:: mako | 6 | .. code-block:: mako | ||
| 14 | <% letters = 'abcdefghijklmnopqrstuvwxyz'%> | 16 | <% letters = 'abcdefghijklmnopqrstuvwxyz'%> | ||
| 15 | 17 | ||||
| n | 16 | <div style="text-align: center font-weight: bold color: #888888" id="index"> | n | 18 | <div id="index"> |
| 17 | % for letter in letters: | 19 | % for letter in letters: | ||
| 18 | % if cities[letter]: | 20 | % if cities[letter]: | ||
| n | 19 | <a href="#${letter}">${letter.upper()}</a> | n | 21 | <a href="#${letter}">${letter.upper()}</a> |
| 20 | % else: | 22 | % else: | ||
| 21 | ${letter.upper()} | 23 | ${letter.upper()} | ||
| 26 | % for letter in letters: | 28 | % for letter in letters: | ||
| 27 | % if cities[letter]: | 29 | % if cities[letter]: | ||
| n | 28 | <a href="#index" id="${letter}" style="padding-left: 35px font-size: 1.5 | n | 30 | <a href="#index" id="${letter}" class="letter-link">${letter.upper()}</a |
| > | em">${letter.upper()}</a> | > | > | ||
| 29 | <ul> | 31 | <ul> | ||
| 30 | % for city in cities[letter]: | 32 | % for city in cities[letter]: | ||
| 37 | 39 | ||||
| 38 | </div> | 40 | </div> | ||
| t | t | 41 | |||
| 42 | |||||
| 43 | |||||
| 39 | 44 | ||||
| 40 | 45 | ||||
| rev 25 | rev 26 | ||||
|---|---|---|---|---|---|
| 2 | ====================================================================== | 2 | ====================================================================== | ||
| 3 | 3 | ||||
| n | 4 | .. image:: http://www.foxhop.net/attachment/yohdah.png | n | 4 | .. code-block:: mako |
| 5 | 5 | ||||
| n | 6 | "That dress looks wonderful on you," I said as she looked at herself in the mirr | n | 6 | <%inherit file="base.mako" /> |
| > | or, turning prettily. She was wearing a slinky form-fitting black dress. It was | ||||
| > | one piece, coming down only to mid-thigh, with an elaborate sleeve and collar ar | ||||
| > | rangement that showed off intriguing glimpses of shoulder. It just vaguely sugge | ||||
| > | sted that her neck was bound. The one-piece little black dress was a new look fo | ||||
| > | r her, and it made her nervous. | ||||
| 7 | 7 | ||||
| n | 8 | .. pull-quote:: | n | 8 | <div class="grid="15"> |
| 9 | 9 | ||||
| n | 10 | "I could never wear this," she pouted. "I'm still too self-conscious about my t | n | 10 | <em> There are ${count} cities in ${state['name'].title()} to browse:</em> |
| > | ummy." | ||||
| 11 | 11 | ||||
| n | 12 | She kept turning sideways and checking to see if she had sprouted an extra stoma | n | 12 | <br /> |
| > | ch recently. | ||||
| 13 | 13 | ||||
| n | 14 | "You don't have a tummy. You look wonderful." She did look wonderful. She has a | n | 14 | <% letters = 'abcdefghijklmnopqrstuvwxyz'%> |
| > | hot body that you can break bricks on, and everyone thinks so except her. She st | ||||
| > | ill sees herself forty pounds ago. | ||||
| 15 | 15 | ||||
| n | 16 | "I have a belt that would look great with that, back in a sec," the sales girl s | n | 16 | <div style="text-align: center font-weight: bold color: #888888" id="index"> |
| > | aid, dashing off to the accessories rack. She came back with an elegant chrome b | ||||
| > | elt made of large metal rings strung together with short lengths of chain. She c | ||||
| > | ouldn't possibly have known how appropriate that choice was. | ||||
| 17 | % for letter in letters: | ||||
| 18 | % if cities[letter]: | ||||
| 19 | <a href="#${letter}">${letter.upper()}</a> | ||||
| 20 | % else: | ||||
| 21 | ${letter.upper()} | ||||
| 22 | % endif | ||||
| 23 | % endfor | ||||
| 24 | </div> | ||||
| 17 | 25 | ||||
| t | 18 | .. image:: http://russell.ballestrini.net/wp-content/uploads/2011/04/onion.png | t | 26 | % for letter in letters: |
| 27 | % if cities[letter]: | ||||
| 28 | <a href="#index" id="${letter}" style="padding-left: 35px font-size: 1.5 | ||||
| > | em">${letter.upper()}</a> | ||||
| 29 | <ul> | ||||
| 30 | % for city in cities[letter]: | ||||
| 31 | <% city = city.lower() %> | ||||
| 32 | <li><a href="/${state['short'].lower()}/${city.replace(' ','-')}">${c | ||||
| > | ity.title()}</a></li> | ||||
| 33 | % endfor | ||||
| 34 | </ul> | ||||
| 35 | % endif | ||||
| 36 | % endfor | ||||
| 37 | |||||
| 38 | </div> | ||||
| 39 | |||||
| 19 | 40 | ||||
| 20 | breadcrumb algorithm | 41 | breadcrumb algorithm | ||
| rev 24 | rev 25 | ||||
|---|---|---|---|---|---|
| f | 1 | This is another sandbox for new users to test functionality | f | 1 | This is another sandbox for new users to test functionality |
| 2 | ====================================================================== | 2 | ====================================================================== | ||
| t | t | 3 | |||
| 4 | .. image:: http://www.foxhop.net/attachment/yohdah.png | ||||
| 3 | 5 | ||||
| 4 | "That dress looks wonderful on you," I said as she looked at herself in the mirr | 6 | "That dress looks wonderful on you," I said as she looked at herself in the mirr | ||
| > | or, turning prettily. She was wearing a slinky form-fitting black dress. It was | > | or, turning prettily. She was wearing a slinky form-fitting black dress. It was | ||
| > | one piece, coming down only to mid-thigh, with an elaborate sleeve and collar ar | > | one piece, coming down only to mid-thigh, with an elaborate sleeve and collar ar | ||
| > | rangement that showed off intriguing glimpses of shoulder. It just vaguely sugge | > | rangement that showed off intriguing glimpses of shoulder. It just vaguely sugge | ||
| > | sted that her neck was bound. The one-piece little black dress was a new look fo | > | sted that her neck was bound. The one-piece little black dress was a new look fo | ||
| > | r her, and it made her nervous. | > | r her, and it made her nervous. | ||
| rev 22 | rev 23 | ||||
|---|---|---|---|---|---|
| 14 | "I have a belt that would look great with that, back in a sec," the sales girl s | 14 | "I have a belt that would look great with that, back in a sec," the sales girl s | ||
| > | aid, dashing off to the accessories rack. She came back with an elegant chrome b | > | aid, dashing off to the accessories rack. She came back with an elegant chrome b | ||
| > | elt made of large metal rings strung together with short lengths of chain. She c | > | elt made of large metal rings strung together with short lengths of chain. She c | ||
| > | ouldn't possibly have known how appropriate that choice was. | > | ouldn't possibly have known how appropriate that choice was. | ||
| 15 | 15 | ||||
| t | 16 | | .. image:: http://russell.ballestrini.net/wp-content/uploads/2011/04/onion.png | t | 16 | .. image:: http://russell.ballestrini.net/wp-content/uploads/2011/04/onion.png |
| 17 | 17 | ||||
| 18 | breadcrumb algorithm | 18 | breadcrumb algorithm | ||
| rev 21 | rev 22 | ||||
|---|---|---|---|---|---|
| 14 | "I have a belt that would look great with that, back in a sec," the sales girl s | 14 | "I have a belt that would look great with that, back in a sec," the sales girl s | ||
| > | aid, dashing off to the accessories rack. She came back with an elegant chrome b | > | aid, dashing off to the accessories rack. She came back with an elegant chrome b | ||
| > | elt made of large metal rings strung together with short lengths of chain. She c | > | elt made of large metal rings strung together with short lengths of chain. She c | ||
| > | ouldn't possibly have known how appropriate that choice was. | > | ouldn't possibly have known how appropriate that choice was. | ||
| 15 | 15 | ||||
| t | 16 | .. image:: http://russell.ballestrini.net/wp-content/uploads/2011/04/onion.png | t | 16 | | .. image:: http://russell.ballestrini.net/wp-content/uploads/2011/04/onion.png |
| 17 | 17 | ||||
| 18 | breadcrumb algorithm | 18 | breadcrumb algorithm | ||
| rev 20 | rev 21 | ||||
|---|---|---|---|---|---|
| 14 | "I have a belt that would look great with that, back in a sec," the sales girl s | 14 | "I have a belt that would look great with that, back in a sec," the sales girl s | ||
| > | aid, dashing off to the accessories rack. She came back with an elegant chrome b | > | aid, dashing off to the accessories rack. She came back with an elegant chrome b | ||
| > | elt made of large metal rings strung together with short lengths of chain. She c | > | elt made of large metal rings strung together with short lengths of chain. She c | ||
| > | ouldn't possibly have known how appropriate that choice was. | > | ouldn't possibly have known how appropriate that choice was. | ||
| 15 | 15 | ||||
| t | t | 16 | .. image:: http://russell.ballestrini.net/wp-content/uploads/2011/04/onion.png | ||
| 16 | 17 | ||||
| 17 | breadcrumb algorithm | 18 | breadcrumb algorithm | ||
| rev 17 | rev 18 | ||||
|---|---|---|---|---|---|
| 122 | 122 | ||||
| 123 | 123 | ||||
| n | n | 124 | Some linux commands for server monitoring | ||
| 125 | ================================================ | ||||
| 124 | 126 | ||||
| t | t | 127 | http://www.shanghaiwebhosting.com/web-hosting-tips/a-few-useful-linux-ssh-comman | ||
| > | ds-to-show-and-monitor-server-resources-memory-disk-usage | ||||
| 128 | |||||
| 129 | uptime | ||||
| 130 | |||||
| 131 | df | ||||
| 132 | |||||
| 133 | free or free -m | ||||
| 134 | |||||
| 135 | ps -ef | ||||
| 136 | |||||
| rev 16 | rev 17 | ||||
|---|---|---|---|---|---|
| t | 1 | http://www.allcarinsurancequotes.net/ cheap auto insurance dmneih http://www.ch | t | 1 | This is another sandbox for new users to test functionality |
| > | eapautosinsurance.net/ insurance auto auctions 931114 | ||||
| 2 | ====================================================================== | ||||
| 3 | |||||
| 4 | "That dress looks wonderful on you," I said as she looked at herself in the mirr | ||||
| > | or, turning prettily. She was wearing a slinky form-fitting black dress. It was | ||||
| > | one piece, coming down only to mid-thigh, with an elaborate sleeve and collar ar | ||||
| > | rangement that showed off intriguing glimpses of shoulder. It just vaguely sugge | ||||
| > | sted that her neck was bound. The one-piece little black dress was a new look fo | ||||
| > | r her, and it made her nervous. | ||||
| 5 | |||||
| 6 | .. pull-quote:: | ||||
| 7 | |||||
| 8 | "I could never wear this," she pouted. "I'm still too self-conscious about my t | ||||
| > | ummy." | ||||
| 9 | |||||
| 10 | She kept turning sideways and checking to see if she had sprouted an extra stoma | ||||
| > | ch recently. | ||||
| 11 | |||||
| 12 | "You don't have a tummy. You look wonderful." She did look wonderful. She has a | ||||
| > | hot body that you can break bricks on, and everyone thinks so except her. She st | ||||
| > | ill sees herself forty pounds ago. | ||||
| 13 | |||||
| 14 | "I have a belt that would look great with that, back in a sec," the sales girl s | ||||
| > | aid, dashing off to the accessories rack. She came back with an elegant chrome b | ||||
| > | elt made of large metal rings strung together with short lengths of chain. She c | ||||
| > | ouldn't possibly have known how appropriate that choice was. | ||||
| 15 | |||||
| 16 | |||||
| 17 | breadcrumb algorithm | ||||
| 18 | ========================================== | ||||
| 19 | |||||
| 20 | .. code-block:: python | ||||
| 21 | |||||
| 22 | class Bread( object ): | ||||
| 23 | """ | ||||
| 24 | Create a list of URL parts or crumbs | ||||
| 25 | ---------------------------------------- | ||||
| 26 | >>> from bread import Bread | ||||
| 27 | >>> bread = Bread("http://foxhop.net/os/linux/ubuntu") | ||||
| 28 | >>> print bread.crumbs | ||||
| 29 | >>> print bread.links() | ||||
| 30 | |||||
| 31 | """ | ||||
| 32 | def __init__( self, url ): | ||||
| 33 | self.url = url.strip('http://') | ||||
| 34 | self.crumbs = self.url.split('/') | ||||
| 35 | |||||
| 36 | def links( self ): | ||||
| 37 | self.list = [] | ||||
| 38 | count = 0 | ||||
| 39 | for crumb in self.crumbs: | ||||
| 40 | string = "" | ||||
| 41 | for c in range( count + 1 ): | ||||
| 42 | string = string + self.crumbs[c] + '/' | ||||
| 43 | count += 1 | ||||
| 44 | self.list.append('<a href="http://' + string + '">' + crumb + '</a>' | ||||
| > | ) | ||||
| 45 | |||||
| 46 | return self.list | ||||
| 47 | |||||
| 48 | **EXAMPLE OUTPUT** | ||||
| 49 | |||||
| 50 | .. code-block:: python | ||||
| 51 | |||||
| 52 | ['foxhop.net', 'os', 'linux', 'ubuntu'] | ||||
| 53 | ['<a href="http://foxhop.net/">foxhop.net</a>', '<a href="http://foxhop.net/os/ | ||||
| > | ">os</a>', '<a href="http://foxhop.net/os/linux/">linux</a>', '<a href="http://f | ||||
| > | oxhop.net/os/linux/ubuntu/">ubuntu</a>'] | ||||
| 54 | |||||
| 55 | |||||
| 56 | |||||
| 57 | Game DB Schema | ||||
| 58 | ================ | ||||
| 59 | |||||
| 60 | .. code-block:: sql | ||||
| 61 | |||||
| 62 | CREATE TABLE game ( | ||||
| 63 | id VARCHAR(16) NOT NULL, | ||||
| 64 | user1_id VARCHAR(16), | ||||
| 65 | user2_id VARCHAR(16), | ||||
| 66 | token CHAR(1), | ||||
| 67 | turn_id VARCHAR(16), | ||||
| 68 | winner_id VARCHAR(16), | ||||
| 69 | createdate DATETIME, | ||||
| 70 | modifydate DATETIME, | ||||
| 71 | board BLOB NOT NULL, | ||||
| 72 | PRIMARY KEY (id), | ||||
| 73 | FOREIGN KEY(user1_id) REFERENCES user (id), | ||||
| 74 | FOREIGN KEY(user2_id) REFERENCES user (id), | ||||
| 75 | FOREIGN KEY(turn_id) REFERENCES user (id), | ||||
| 76 | FOREIGN KEY(winner_id) REFERENCES user (id) | ||||
| 77 | ) | ||||
| 78 | |||||
| 79 | CREATE TABLE user ( | ||||
| 80 | id VARCHAR(16) NOT NULL, | ||||
| 81 | name VARCHAR(32), | ||||
| 82 | email VARCHAR(32), | ||||
| 83 | PRIMARY KEY (id) | ||||
| 84 | ) | ||||
| 85 | |||||
| 86 | |||||
| 87 | |||||
| 88 | Game DB Schema2 | ||||
| 89 | ================ | ||||
| 90 | |||||
| 91 | .. code-block:: sql | ||||
| 92 | |||||
| 93 | CREATE TABLE game ( | ||||
| 94 | id VARCHAR(16) NOT NULL, | ||||
| 95 | token CHAR(1), | ||||
| 96 | turn_id VARCHAR(16), | ||||
| 97 | winner_id VARCHAR(16), | ||||
| 98 | createdate DATETIME, | ||||
| 99 | modifydate DATETIME, | ||||
| 100 | board BLOB NOT NULL, | ||||
| 101 | PRIMARY KEY (id), | ||||
| 102 | FOREIGN KEY(turn_id) REFERENCES user (id), | ||||
| 103 | FOREIGN KEY(winner_id) REFERENCES user (id) | ||||
| 104 | ) | ||||
| 105 | |||||
| 106 | CREATE TABLE user ( | ||||
| 107 | id VARCHAR(16) NOT NULL, | ||||
| 108 | name VARCHAR(32), | ||||
| 109 | email VARCHAR(32), | ||||
| 110 | PRIMARY KEY (id) | ||||
| 111 | ) | ||||
| 112 | |||||
| 113 | CREATE TABLE usergame( | ||||
| 114 | id VARCHAR(16) NOT NULL, | ||||
| 115 | user_id VARCHAR(16), | ||||
| 116 | game_id VARCHAR(16), | ||||
| 117 | PRIMARY KEY (id) | ||||
| 118 | FOREIGN KEY(user_id) REFERENCES user (id), | ||||
| 119 | FOREIGN KEY(game_id) REFERENCES game (id), | ||||
| 120 | ) | ||||
| 121 | |||||
| 122 | |||||
| 123 | |||||
| 124 | |||||
| rev 14 | rev 15 | ||||
|---|---|---|---|---|---|
| t | 1 | http://www.viagra-advice.com/ cheap viagra 994 http://www.protectoraceuta.com/v | t | 1 | http://www.allcarinsurancequotes.net/ cheap auto insurance dmneih http://www.ch |
| > | alium.html valium online dvkapz http://www.protectoraceuta.com/xanax.html xanax | > | eapautosinsurance.net/ insurance auto auctions 931114 | ||
| > | :-[[[ | ||||
| rev 12 | rev 13 | ||||
|---|---|---|---|---|---|
| t | 1 | This is another sandbox for new users to test functionality | t | 1 | http://www.viagra-advice.com/ cheap viagra 994 http://www.protectoraceuta.com/v |
| > | alium.html valium online dvkapz http://www.protectoraceuta.com/xanax.html xanax | ||||
| > | :-[[[ | ||||
| 2 | ====================================================================== | ||||
| 3 | |||||
| 4 | "That dress looks wonderful on you," I said as she looked at herself in the mirr | ||||
| > | or, turning prettily. She was wearing a slinky form-fitting black dress. It was | ||||
| > | one piece, coming down only to mid-thigh, with an elaborate sleeve and collar ar | ||||
| > | rangement that showed off intriguing glimpses of shoulder. It just vaguely sugge | ||||
| > | sted that her neck was bound. The one-piece little black dress was a new look fo | ||||
| > | r her, and it made her nervous. | ||||
| 5 | |||||
| 6 | .. pull-quote:: | ||||
| 7 | |||||
| 8 | "I could never wear this," she pouted. "I'm still too self-conscious about my t | ||||
| > | ummy." | ||||
| 9 | |||||
| 10 | She kept turning sideways and checking to see if she had sprouted an extra stoma | ||||
| > | ch recently. | ||||
| 11 | |||||
| 12 | "You don't have a tummy. You look wonderful." She did look wonderful. She has a | ||||
| > | hot body that you can break bricks on, and everyone thinks so except her. She st | ||||
| > | ill sees herself forty pounds ago. | ||||
| 13 | |||||
| 14 | "I have a belt that would look great with that, back in a sec," the sales girl s | ||||
| > | aid, dashing off to the accessories rack. She came back with an elegant chrome b | ||||
| > | elt made of large metal rings strung together with short lengths of chain. She c | ||||
| > | ouldn't possibly have known how appropriate that choice was. | ||||
| 15 | |||||
| 16 | |||||
| 17 | breadcrumb algorithm | ||||
| 18 | ========================================== | ||||
| 19 | |||||
| 20 | .. code-block:: python | ||||
| 21 | |||||
| 22 | class Bread( object ): | ||||
| 23 | """ | ||||
| 24 | Create a list of URL parts or crumbs | ||||
| 25 | ---------------------------------------- | ||||
| 26 | >>> from bread import Bread | ||||
| 27 | >>> bread = Bread("http://foxhop.net/os/linux/ubuntu") | ||||
| 28 | >>> print bread.crumbs | ||||
| 29 | >>> print bread.links() | ||||
| 30 | |||||
| 31 | """ | ||||
| 32 | def __init__( self, url ): | ||||
| 33 | self.url = url.strip('http://') | ||||
| 34 | self.crumbs = self.url.split('/') | ||||
| 35 | |||||
| 36 | def links( self ): | ||||
| 37 | self.list = [] | ||||
| 38 | count = 0 | ||||
| 39 | for crumb in self.crumbs: | ||||
| 40 | string = "" | ||||
| 41 | for c in range( count + 1 ): | ||||
| 42 | string = string + self.crumbs[c] + '/' | ||||
| 43 | count += 1 | ||||
| 44 | self.list.append('<a href="http://' + string + '">' + crumb + '</a>' | ||||
| > | ) | ||||
| 45 | |||||
| 46 | return self.list | ||||
| 47 | |||||
| 48 | **EXAMPLE OUTPUT** | ||||
| 49 | |||||
| 50 | .. code-block:: python | ||||
| 51 | |||||
| 52 | ['foxhop.net', 'os', 'linux', 'ubuntu'] | ||||
| 53 | ['<a href="http://foxhop.net/">foxhop.net</a>', '<a href="http://foxhop.net/os/ | ||||
| > | ">os</a>', '<a href="http://foxhop.net/os/linux/">linux</a>', '<a href="http://f | ||||
| > | oxhop.net/os/linux/ubuntu/">ubuntu</a>'] | ||||
| 54 | |||||
| 55 | |||||
| 56 | |||||
| 57 | Game DB Schema | ||||
| 58 | ================ | ||||
| 59 | |||||
| 60 | .. code-block:: sql | ||||
| 61 | |||||
| 62 | CREATE TABLE game ( | ||||
| 63 | id VARCHAR(16) NOT NULL, | ||||
| 64 | user1_id VARCHAR(16), | ||||
| 65 | user2_id VARCHAR(16), | ||||
| 66 | token CHAR(1), | ||||
| 67 | turn_id VARCHAR(16), | ||||
| 68 | winner_id VARCHAR(16), | ||||
| 69 | createdate DATETIME, | ||||
| 70 | modifydate DATETIME, | ||||
| 71 | board BLOB NOT NULL, | ||||
| 72 | PRIMARY KEY (id), | ||||
| 73 | FOREIGN KEY(user1_id) REFERENCES user (id), | ||||
| 74 | FOREIGN KEY(user2_id) REFERENCES user (id), | ||||
| 75 | FOREIGN KEY(turn_id) REFERENCES user (id), | ||||
| 76 | FOREIGN KEY(winner_id) REFERENCES user (id) | ||||
| 77 | ) | ||||
| 78 | |||||
| 79 | CREATE TABLE user ( | ||||
| 80 | id VARCHAR(16) NOT NULL, | ||||
| 81 | name VARCHAR(32), | ||||
| 82 | email VARCHAR(32), | ||||
| 83 | PRIMARY KEY (id) | ||||
| 84 | ) | ||||
| 85 | |||||
| 86 | |||||
| 87 | |||||
| 88 | Game DB Schema2 | ||||
| 89 | ================ | ||||
| 90 | |||||
| 91 | .. code-block:: sql | ||||
| 92 | |||||
| 93 | CREATE TABLE game ( | ||||
| 94 | id VARCHAR(16) NOT NULL, | ||||
| 95 | token CHAR(1), | ||||
| 96 | turn_id VARCHAR(16), | ||||
| 97 | winner_id VARCHAR(16), | ||||
| 98 | createdate DATETIME, | ||||
| 99 | modifydate DATETIME, | ||||
| 100 | board BLOB NOT NULL, | ||||
| 101 | PRIMARY KEY (id), | ||||
| 102 | FOREIGN KEY(turn_id) REFERENCES user (id), | ||||
| 103 | FOREIGN KEY(winner_id) REFERENCES user (id) | ||||
| 104 | ) | ||||
| 105 | |||||
| 106 | CREATE TABLE user ( | ||||
| 107 | id VARCHAR(16) NOT NULL, | ||||
| 108 | name VARCHAR(32), | ||||
| 109 | email VARCHAR(32), | ||||
| 110 | PRIMARY KEY (id) | ||||
| 111 | ) | ||||
| 112 | |||||
| 113 | CREATE TABLE usergame( | ||||
| 114 | id VARCHAR(16) NOT NULL, | ||||
| 115 | user_id VARCHAR(16), | ||||
| 116 | game_id VARCHAR(16), | ||||
| 117 | PRIMARY KEY (id) | ||||
| 118 | FOREIGN KEY(user_id) REFERENCES user (id), | ||||
| 119 | FOREIGN KEY(game_id) REFERENCES game (id), | ||||
| 120 | ) | ||||
| 121 | |||||
| 122 | |||||
| 123 | |||||
| 124 | |||||
| rev 11 | rev 12 | ||||
|---|---|---|---|---|---|
| 86 | 86 | ||||
| 87 | 87 | ||||
| t | t | 88 | Game DB Schema2 | ||
| 89 | ================ | ||||
| 90 | |||||
| 91 | .. code-block:: sql | ||||
| 92 | |||||
| 93 | CREATE TABLE game ( | ||||
| 94 | id VARCHAR(16) NOT NULL, | ||||
| 95 | token CHAR(1), | ||||
| 96 | turn_id VARCHAR(16), | ||||
| 97 | winner_id VARCHAR(16), | ||||
| 98 | createdate DATETIME, | ||||
| 99 | modifydate DATETIME, | ||||
| 100 | board BLOB NOT NULL, | ||||
| 101 | PRIMARY KEY (id), | ||||
| 102 | FOREIGN KEY(turn_id) REFERENCES user (id), | ||||
| 103 | FOREIGN KEY(winner_id) REFERENCES user (id) | ||||
| 104 | ) | ||||
| 105 | |||||
| 106 | CREATE TABLE user ( | ||||
| 107 | id VARCHAR(16) NOT NULL, | ||||
| 108 | name VARCHAR(32), | ||||
| 109 | email VARCHAR(32), | ||||
| 110 | PRIMARY KEY (id) | ||||
| 111 | ) | ||||
| 112 | |||||
| 113 | CREATE TABLE usergame( | ||||
| 114 | id VARCHAR(16) NOT NULL, | ||||
| 115 | user_id VARCHAR(16), | ||||
| 116 | game_id VARCHAR(16), | ||||
| 117 | PRIMARY KEY (id) | ||||
| 118 | FOREIGN KEY(user_id) REFERENCES user (id), | ||||
| 119 | FOREIGN KEY(game_id) REFERENCES game (id), | ||||
| 120 | ) | ||||
| 121 | |||||
| 122 | |||||
| 123 | |||||
| 124 | |||||
| rev 10 | rev 11 | ||||
|---|---|---|---|---|---|
| 55 | 55 | ||||
| 56 | 56 | ||||
| t | t | 57 | Game DB Schema | ||
| 58 | ================ | ||||
| 59 | |||||
| 60 | .. code-block:: sql | ||||
| 61 | |||||
| 62 | CREATE TABLE game ( | ||||
| 63 | id VARCHAR(16) NOT NULL, | ||||
| 64 | user1_id VARCHAR(16), | ||||
| 65 | user2_id VARCHAR(16), | ||||
| 66 | token CHAR(1), | ||||
| 67 | turn_id VARCHAR(16), | ||||
| 68 | winner_id VARCHAR(16), | ||||
| 69 | createdate DATETIME, | ||||
| 70 | modifydate DATETIME, | ||||
| 71 | board BLOB NOT NULL, | ||||
| 72 | PRIMARY KEY (id), | ||||
| 73 | FOREIGN KEY(user1_id) REFERENCES user (id), | ||||
| 74 | FOREIGN KEY(user2_id) REFERENCES user (id), | ||||
| 75 | FOREIGN KEY(turn_id) REFERENCES user (id), | ||||
| 76 | FOREIGN KEY(winner_id) REFERENCES user (id) | ||||
| 77 | ) | ||||
| 78 | |||||
| 79 | CREATE TABLE user ( | ||||
| 80 | id VARCHAR(16) NOT NULL, | ||||
| 81 | name VARCHAR(32), | ||||
| 82 | email VARCHAR(32), | ||||
| 83 | PRIMARY KEY (id) | ||||
| 84 | ) | ||||
| 85 | |||||
| 86 | |||||
| 87 | |||||
| rev 9 | rev 10 | ||||
|---|---|---|---|---|---|
| t | 1 | bZeMx2 <a href="http://bornulhjtiwo.com/">bornulhjtiwo</a>, [url=http://jaxsljv | t | 1 | This is another sandbox for new users to test functionality |
| > | wtgrk.com/]jaxsljvwtgrk[/url], [link=http://xbdecmpprbqh.com/]xbdecmpprbqh[/link | ||||
| > | ], http://nhoksqjqbtxy.com/ | ||||
| 2 | ====================================================================== | ||||
| 3 | |||||
| 4 | "That dress looks wonderful on you," I said as she looked at herself in the mirr | ||||
| > | or, turning prettily. She was wearing a slinky form-fitting black dress. It was | ||||
| > | one piece, coming down only to mid-thigh, with an elaborate sleeve and collar ar | ||||
| > | rangement that showed off intriguing glimpses of shoulder. It just vaguely sugge | ||||
| > | sted that her neck was bound. The one-piece little black dress was a new look fo | ||||
| > | r her, and it made her nervous. | ||||
| 5 | |||||
| 6 | .. pull-quote:: | ||||
| 7 | |||||
| 8 | "I could never wear this," she pouted. "I'm still too self-conscious about my t | ||||
| > | ummy." | ||||
| 9 | |||||
| 10 | She kept turning sideways and checking to see if she had sprouted an extra stoma | ||||
| > | ch recently. | ||||
| 11 | |||||
| 12 | "You don't have a tummy. You look wonderful." She did look wonderful. She has a | ||||
| > | hot body that you can break bricks on, and everyone thinks so except her. She st | ||||
| > | ill sees herself forty pounds ago. | ||||
| 13 | |||||
| 14 | "I have a belt that would look great with that, back in a sec," the sales girl s | ||||
| > | aid, dashing off to the accessories rack. She came back with an elegant chrome b | ||||
| > | elt made of large metal rings strung together with short lengths of chain. She c | ||||
| > | ouldn't possibly have known how appropriate that choice was. | ||||
| 15 | |||||
| 16 | |||||
| 17 | breadcrumb algorithm | ||||
| 18 | ========================================== | ||||
| 19 | |||||
| 20 | .. code-block:: python | ||||
| 21 | |||||
| 22 | class Bread( object ): | ||||
| 23 | """ | ||||
| 24 | Create a list of URL parts or crumbs | ||||
| 25 | ---------------------------------------- | ||||
| 26 | >>> from bread import Bread | ||||
| 27 | >>> bread = Bread("http://foxhop.net/os/linux/ubuntu") | ||||
| 28 | >>> print bread.crumbs | ||||
| 29 | >>> print bread.links() | ||||
| 30 | |||||
| 31 | """ | ||||
| 32 | def __init__( self, url ): | ||||
| 33 | self.url = url.strip('http://') | ||||
| 34 | self.crumbs = self.url.split('/') | ||||
| 35 | |||||
| 36 | def links( self ): | ||||
| 37 | self.list = [] | ||||
| 38 | count = 0 | ||||
| 39 | for crumb in self.crumbs: | ||||
| 40 | string = "" | ||||
| 41 | for c in range( count + 1 ): | ||||
| 42 | string = string + self.crumbs[c] + '/' | ||||
| 43 | count += 1 | ||||
| 44 | self.list.append('<a href="http://' + string + '">' + crumb + '</a>' | ||||
| > | ) | ||||
| 45 | |||||
| 46 | return self.list | ||||
| 47 | |||||
| 48 | **EXAMPLE OUTPUT** | ||||
| 49 | |||||
| 50 | .. code-block:: python | ||||
| 51 | |||||
| 52 | ['foxhop.net', 'os', 'linux', 'ubuntu'] | ||||
| 53 | ['<a href="http://foxhop.net/">foxhop.net</a>', '<a href="http://foxhop.net/os/ | ||||
| > | ">os</a>', '<a href="http://foxhop.net/os/linux/">linux</a>', '<a href="http://f | ||||
| > | oxhop.net/os/linux/ubuntu/">ubuntu</a>'] | ||||
| 54 | |||||
| 55 | |||||
| 56 | |||||
| rev 7 | rev 8 | ||||
|---|---|---|---|---|---|
| t | 1 | UdQC5I <a href="http://muvovknbxgti.com/">muvovknbxgti</a>, [url=http://cbmruww | t | 1 | bZeMx2 <a href="http://bornulhjtiwo.com/">bornulhjtiwo</a>, [url=http://jaxsljv |
| > | bifwp.com/]cbmruwwbifwp[/url], [link=http://inskfvubynqc.com/]inskfvubynqc[/link | > | wtgrk.com/]jaxsljvwtgrk[/url], [link=http://xbdecmpprbqh.com/]xbdecmpprbqh[/link | ||
| > | ], http://qepogyqtymal.com/ | > | ], http://nhoksqjqbtxy.com/ | ||
| rev 5 | rev 6 | ||||
|---|---|---|---|---|---|
| t | 1 | This is another sandbox for new users to test functionality | t | 1 | UdQC5I <a href="http://muvovknbxgti.com/">muvovknbxgti</a>, [url=http://cbmruww |
| > | bifwp.com/]cbmruwwbifwp[/url], [link=http://inskfvubynqc.com/]inskfvubynqc[/link | ||||
| > | ], http://qepogyqtymal.com/ | ||||
| 2 | ====================================================================== | ||||
| 3 | |||||
| 4 | "That dress looks wonderful on you," I said as she looked at herself in the mirr | ||||
| > | or, turning prettily. She was wearing a slinky form-fitting black dress. It was | ||||
| > | one piece, coming down only to mid-thigh, with an elaborate sleeve and collar ar | ||||
| > | rangement that showed off intriguing glimpses of shoulder. It just vaguely sugge | ||||
| > | sted that her neck was bound. The one-piece little black dress was a new look fo | ||||
| > | r her, and it made her nervous. | ||||
| 5 | |||||
| 6 | .. pull-quote:: | ||||
| 7 | |||||
| 8 | "I could never wear this," she pouted. "I'm still too self-conscious about my t | ||||
| > | ummy." | ||||
| 9 | |||||
| 10 | She kept turning sideways and checking to see if she had sprouted an extra stoma | ||||
| > | ch recently. | ||||
| 11 | |||||
| 12 | "You don't have a tummy. You look wonderful." She did look wonderful. She has a | ||||
| > | hot body that you can break bricks on, and everyone thinks so except her. She st | ||||
| > | ill sees herself forty pounds ago. | ||||
| 13 | |||||
| 14 | "I have a belt that would look great with that, back in a sec," the sales girl s | ||||
| > | aid, dashing off to the accessories rack. She came back with an elegant chrome b | ||||
| > | elt made of large metal rings strung together with short lengths of chain. She c | ||||
| > | ouldn't possibly have known how appropriate that choice was. | ||||
| 15 | |||||
| 16 | |||||
| 17 | breadcrumb algorithm | ||||
| 18 | ========================================== | ||||
| 19 | |||||
| 20 | .. code-block:: python | ||||
| 21 | |||||
| 22 | class Bread( object ): | ||||
| 23 | """ | ||||
| 24 | Create a list of URL parts or crumbs | ||||
| 25 | ---------------------------------------- | ||||
| 26 | >>> from bread import Bread | ||||
| 27 | >>> bread = Bread("http://foxhop.net/os/linux/ubuntu") | ||||
| 28 | >>> print bread.crumbs | ||||
| 29 | >>> print bread.links() | ||||
| 30 | |||||
| 31 | """ | ||||
| 32 | def __init__( self, url ): | ||||
| 33 | self.url = url.strip('http://') | ||||
| 34 | self.crumbs = self.url.split('/') | ||||
| 35 | |||||
| 36 | def links( self ): | ||||
| 37 | self.list = [] | ||||
| 38 | count = 0 | ||||
| 39 | for crumb in self.crumbs: | ||||
| 40 | string = "" | ||||
| 41 | for c in range( count + 1 ): | ||||
| 42 | string = string + self.crumbs[c] + '/' | ||||
| 43 | count += 1 | ||||
| 44 | self.list.append('<a href="http://' + string + '">' + crumb + '</a>' | ||||
| > | ) | ||||
| 45 | |||||
| 46 | return self.list | ||||
| 47 | |||||
| 48 | **EXAMPLE OUTPUT** | ||||
| 49 | |||||
| 50 | .. code-block:: python | ||||
| 51 | |||||
| 52 | ['foxhop.net', 'os', 'linux', 'ubuntu'] | ||||
| 53 | ['<a href="http://foxhop.net/">foxhop.net</a>', '<a href="http://foxhop.net/os/ | ||||
| > | ">os</a>', '<a href="http://foxhop.net/os/linux/">linux</a>', '<a href="http://f | ||||
| > | oxhop.net/os/linux/ubuntu/">ubuntu</a>'] | ||||
| 54 | |||||
| 55 | |||||
| 56 | |||||
| rev 4 | rev 5 | ||||
|---|---|---|---|---|---|
| f | 1 | This is another sandbox for new users to test functionality | f | 1 | This is another sandbox for new users to test functionality |
| n | n | 2 | ====================================================================== | ||
| 2 | 3 | ||||
| 3 | "That dress looks wonderful on you," I said as she looked at herself in the mirr | 4 | "That dress looks wonderful on you," I said as she looked at herself in the mirr | ||
| > | or, turning prettily. She was wearing a slinky form-fitting black dress. It was | > | or, turning prettily. She was wearing a slinky form-fitting black dress. It was | ||
| > | one piece, coming down only to mid-thigh, with an elaborate sleeve and collar ar | > | one piece, coming down only to mid-thigh, with an elaborate sleeve and collar ar | ||
| > | rangement that showed off intriguing glimpses of shoulder. It just vaguely sugge | > | rangement that showed off intriguing glimpses of shoulder. It just vaguely sugge | ||
| > | sted that her neck was bound. The one-piece little black dress was a new look fo | > | sted that her neck was bound. The one-piece little black dress was a new look fo | ||
| > | r her, and it made her nervous. | > | r her, and it made her nervous. | ||
| 12 | 13 | ||||
| 13 | "I have a belt that would look great with that, back in a sec," the sales girl s | 14 | "I have a belt that would look great with that, back in a sec," the sales girl s | ||
| > | aid, dashing off to the accessories rack. She came back with an elegant chrome b | > | aid, dashing off to the accessories rack. She came back with an elegant chrome b | ||
| > | elt made of large metal rings strung together with short lengths of chain. She c | > | elt made of large metal rings strung together with short lengths of chain. She c | ||
| > | ouldn't possibly have known how appropriate that choice was. | > | ouldn't possibly have known how appropriate that choice was. | ||
| t | t | 15 | |||
| 16 | |||||
| 17 | breadcrumb algorithm | ||||
| 18 | ========================================== | ||||
| 19 | |||||
| 20 | .. code-block:: python | ||||
| 21 | |||||
| 22 | class Bread( object ): | ||||
| 23 | """ | ||||
| 24 | Create a list of URL parts or crumbs | ||||
| 25 | ---------------------------------------- | ||||
| 26 | >>> from bread import Bread | ||||
| 27 | >>> bread = Bread("http://foxhop.net/os/linux/ubuntu") | ||||
| 28 | >>> print bread.crumbs | ||||
| 29 | >>> print bread.links() | ||||
| 30 | |||||
| 31 | """ | ||||
| 32 | def __init__( self, url ): | ||||
| 33 | self.url = url.strip('http://') | ||||
| 34 | self.crumbs = self.url.split('/') | ||||
| 35 | |||||
| 36 | def links( self ): | ||||
| 37 | self.list = [] | ||||
| 38 | count = 0 | ||||
| 39 | for crumb in self.crumbs: | ||||
| 40 | string = "" | ||||
| 41 | for c in range( count + 1 ): | ||||
| 42 | string = string + self.crumbs[c] + '/' | ||||
| 43 | count += 1 | ||||
| 44 | self.list.append('<a href="http://' + string + '">' + crumb + '</a>' | ||||
| > | ) | ||||
| 45 | |||||
| 46 | return self.list | ||||
| 47 | |||||
| 48 | **EXAMPLE OUTPUT** | ||||
| 49 | |||||
| 50 | .. code-block:: python | ||||
| 51 | |||||
| 52 | ['foxhop.net', 'os', 'linux', 'ubuntu'] | ||||
| 53 | ['<a href="http://foxhop.net/">foxhop.net</a>', '<a href="http://foxhop.net/os/ | ||||
| > | ">os</a>', '<a href="http://foxhop.net/os/linux/">linux</a>', '<a href="http://f | ||||
| > | oxhop.net/os/linux/ubuntu/">ubuntu</a>'] | ||||
| 54 | |||||
| 55 | |||||
| 56 | |||||
| rev 3 | rev 4 | ||||
|---|---|---|---|---|---|
| 3 | "That dress looks wonderful on you," I said as she looked at herself in the mirr | 3 | "That dress looks wonderful on you," I said as she looked at herself in the mirr | ||
| > | or, turning prettily. She was wearing a slinky form-fitting black dress. It was | > | or, turning prettily. She was wearing a slinky form-fitting black dress. It was | ||
| > | one piece, coming down only to mid-thigh, with an elaborate sleeve and collar ar | > | one piece, coming down only to mid-thigh, with an elaborate sleeve and collar ar | ||
| > | rangement that showed off intriguing glimpses of shoulder. It just vaguely sugge | > | rangement that showed off intriguing glimpses of shoulder. It just vaguely sugge | ||
| > | sted that her neck was bound. The one-piece little black dress was a new look fo | > | sted that her neck was bound. The one-piece little black dress was a new look fo | ||
| > | r her, and it made her nervous. | > | r her, and it made her nervous. | ||
| 4 | 4 | ||||
| t | 5 | "I could never wear this," she pouted. "I'm still too self-conscious about my tu | t | 5 | .. pull-quote:: |
| > | mmy." She kept turning sideways and checking to see if she had sprouted an extra | ||||
| > | stomach recently. | ||||
| 6 | |||||
| 7 | "I could never wear this," she pouted. "I'm still too self-conscious about my t | ||||
| > | ummy." | ||||
| 8 | |||||
| 9 | She kept turning sideways and checking to see if she had sprouted an extra stoma | ||||
| > | ch recently. | ||||
| 6 | 10 | ||||
| 7 | "You don't have a tummy. You look wonderful." She did look wonderful. She has a | 11 | "You don't have a tummy. You look wonderful." She did look wonderful. She has a | ||
| > | hot body that you can break bricks on, and everyone thinks so except her. She st | > | hot body that you can break bricks on, and everyone thinks so except her. She st | ||
| > | ill sees herself forty pounds ago. | > | ill sees herself forty pounds ago. | ||
| rev 2 | rev 3 | ||||
|---|---|---|---|---|---|
| f | 1 | This is another sandbox for new users to test functionality | f | 1 | This is another sandbox for new users to test functionality |
| 2 | 2 | ||||
| t | 3 | test | t | 3 | "That dress looks wonderful on you," I said as she looked at herself in the mirr |
| > | or, turning prettily. She was wearing a slinky form-fitting black dress. It was | ||||
| > | one piece, coming down only to mid-thigh, with an elaborate sleeve and collar ar | ||||
| > | rangement that showed off intriguing glimpses of shoulder. It just vaguely sugge | ||||
| > | sted that her neck was bound. The one-piece little black dress was a new look fo | ||||
| > | r her, and it made her nervous. | ||||
| 4 | |||||
| 5 | "I could never wear this," she pouted. "I'm still too self-conscious about my tu | ||||
| > | mmy." She kept turning sideways and checking to see if she had sprouted an extra | ||||
| > | stomach recently. | ||||
| 6 | |||||
| 7 | "You don't have a tummy. You look wonderful." She did look wonderful. She has a | ||||
| > | hot body that you can break bricks on, and everyone thinks so except her. She st | ||||
| > | ill sees herself forty pounds ago. | ||||
| 8 | |||||
| 9 | "I have a belt that would look great with that, back in a sec," the sales girl s | ||||
| > | aid, dashing off to the accessories rack. She came back with an elegant chrome b | ||||
| > | elt made of large metal rings strung together with short lengths of chain. She c | ||||
| > | ouldn't possibly have known how appropriate that choice was. | ||||
Remarkbox