{"node_id": "f33ab6ea-2f95-11f1-ae4e-e86a64d24d78", "revisions": [{"id": "f33bc3d7-2f95-11f1-a5e5-e86a64d24d78", "node_id": "f33ab6ea-2f95-11f1-ae4e-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "Python script to build an Oracle or mySQL flat file vault\r\n================================================================\r\n\r\nThis module provides a vault class.  This class is useful for creating a flat filesystem that could be used for storing images, pdfs, mp3, autocad drawings etc.\r\n\r\nThe meta data about this file system would have to be stored in a database.\r\n\r\n\r\n\r\n*pyVault.py*\r\n\r\n.. code-block:: python\r\n\r\n from os import makedirs, path\r\n from random import randrange as r\r\n from uuid import uuid4\r\n\r\n class Vault( object ):\r\n     def __init__( self, path='', name='vault', l=65, w=65 ):\r\n         self.path = path \r\n         self.name = name\r\n         self.l = l\r\n         self.w = w\r\n         \r\n         self.initVault()\r\n\r\n     def initVault( self ):\r\n         \"\"\"Build the vault directories if they don't exist\"\"\"\r\n         p = self.path + '/' + self.name\r\n         if path.exists( p ):\r\n             pass\r\n         else:\r\n             for l in range( self.l ):\r\n                 for w in range( self.w ):\r\n                     if self.path == '':\r\n                         makedirs( self.name + '/' + str( l ) + '/' + str( w ) )\r\n                     else:\r\n                         makedirs(  self.path + '/' + self.name + '/' + str( l ) + '/' + str( w ) )\r\n\r\n     def getFilename( self, ext='' ):\r\n         \"\"\"Generate and return a valid unique file path based on vault\"\"\"\r\n         l, w = str( r(self.l) ), str( r(self.w) )\r\n         filename = str( uuid4() )\r\n        \r\n         return self.name + '/' + l + '/' + w + '/' + filename + ext\r\n\r\n\r\n\r\nExample pyvault test\r\n============================== \r\n\r\n*test_pyVault.py*\r\n\r\n.. code-block:: python\r\n\r\n # import pyVault module \r\n from pyVault import Vault\r\n\r\n # create a vault with default settings in the current directory.\r\n v = Vault( ) # create a vault object\r\n\r\n print v.getFilename() # generate a valid path and filename from vault\r\n print v.getFilename( '.jpg' ) # generate a valid path and jpg filename from vault\r\n\r\n # create vault2 in /var/db 2 directories wide and 5 directories deep\r\n v2 = Vault( path=\"/var/db\", name=\"vault2\", l=5, w=2 )\r\n \r\n print v2.getFilename( '.mp3' ) # generate a valid path and mp3 filename from vault\r\n print v2.getFilename() # generate a valid path and filename from vault\r\n\r\n\r\nExample database schema to use with vault\r\n====================================================\r\n\r\nThen we could use uuids for the actual file names to prevent overwriting or the need to lookup or keep track of names.\r\n\r\nBelow shows an example database schema that could use this vault filesystem:\r\n\r\n.. code-block:: python\r\n \r\n vault\r\n    id (int) # auto increment \r\n    name (varchar 64) # human readable lookup name\r\n    location (varchar 128) # thevault/12/59/28c6104f-cb09-4910-8031-efad22e1ebf9\r\n    filetype (varchar 8) # or possibly another table to keep track of file types or possibly add the extension to the uuid filename when saved.\r\n    description (text)\r\n\r\nThen other tables can refer and relate to this data, like a job table could have relations mapped to jpg files and pdf files, and a video of the finished job and an autocad drawing when it was designed.\r\n\r\n\r\n\r\n\r\n\r\n", "source_format": "rst", "revision_number": 12, "created": 1308770103000}, {"id": "f33bbfd1-2f95-11f1-8f9d-e86a64d24d78", "node_id": "f33ab6ea-2f95-11f1-ae4e-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "Python script to build an Oracle or mySQL flat file vault\r\n================================================================\r\n\r\nThis module provides a vault class.  This class is useful for creating a flat filesystem that could be used for storing images, pdfs, mp3, autocad drawings etc.\r\n\r\nThe meta data about this file system would have to be stored in a database.\r\n\r\n\r\n\r\n*pyVault.py*\r\n\r\n.. code-block:: python\r\n\r\n from os import makedirs, path\r\n from random import randrange as r\r\n from uuid import uuid4\r\n\r\n class Vault( object ):\r\n     def __init__( self, path='', name='vault', l=65, w=65 ):\r\n         self.path = path \r\n         self.name = name\r\n         self.l = l\r\n         self.w = w\r\n         \r\n         self.initVault()\r\n\r\n     def initVault( self ):\r\n         \"\"\"Build the vault directories if they don't exist\"\"\"\r\n         p = self.path + '/' + self.name\r\n         if path.exists( p ):\r\n             pass\r\n         else:\r\n             for l in range( self.l ):\r\n                 for w in range( self.w ):\r\n                     if self.path == '':\r\n                         makedirs( self.name + '/' + str( l ) + '/' + str( w ) )\r\n                     else:\r\n                         makedirs(  self.path + '/' + self.name + '/' + str( l ) + '/' + str( w ) )\r\n\r\n     def getFilename( self, ext='' ):\r\n         \"\"\"Generate and return a valid unique file path based on vault\"\"\"\r\n         l, w = str( r(self.l) ), str( r(self.w) )\r\n         filename = str( uuid4() )\r\n        \r\n         return self.name + '/' + l + '/' + w + '/' + filename + ext\r\n\r\n\r\n\r\nExample pyvault test\r\n============================== \r\n\r\n*test_pyVault.py*\r\n\r\n.. code-block:: python\r\n\r\n # import pyVault module \r\n from pyVault import Vault\r\n\r\n # create a vault with default settings in the current directory.\r\n v = Vault( ) # create a vault object\r\n\r\n print v.getFilename() # generate a valid path and filename from vault\r\n print v.getFilename() # generate a valid path and filename from vault\r\n\r\n # create vault2 in /var/db 2 directories wide and 5 directories deep\r\n v2 = Vault( path=\"/var/db\", name=\"vault2\", l=5, w=2 )\r\n \r\n print v2.getFilename() # generate a valid path and filename from vault\r\n print v2.getFilename() # generate a valid path and filename from vault\r\n\r\n\r\nExample database schema to use with vault\r\n====================================================\r\n\r\nThen we could use uuids for the actual file names to prevent overwriting or the need to lookup or keep track of names.\r\n\r\nBelow shows an example database schema that could use this vault filesystem:\r\n\r\n.. code-block:: python\r\n \r\n vault\r\n    id (int) # auto increment \r\n    name (varchar 64) # human readable lookup name\r\n    location (varchar 128) # thevault/12/59/28c6104f-cb09-4910-8031-efad22e1ebf9\r\n    filetype (varchar 8) # or possibly another table to keep track of file types or possibly add the extension to the uuid filename when saved.\r\n    description (text)\r\n\r\nThen other tables can refer and relate to this data, like a job table could have relations mapped to jpg files and pdf files, and a video of the finished job and an autocad drawing when it was designed.\r\n\r\n\r\n\r\n\r\n\r\n", "source_format": "rst", "revision_number": 11, "created": 1308769994000}, {"id": "f33bbbd6-2f95-11f1-a83f-e86a64d24d78", "node_id": "f33ab6ea-2f95-11f1-ae4e-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "Python script to build an Oracle or mySQL flat file vault\r\n================================================================\r\n\r\nThis module provides a vault class.  This class is useful for creating a flat filesystem that could be used for storing images, pdfs, mp3, autocad drawings etc.\r\n\r\nThe meta data about this file system would have to be stored in a database.\r\n\r\n\r\n\r\n*pyVault.py*\r\n\r\n.. code-block:: python\r\n\r\n from os import makedirs, path\r\n from random import randrange as r\r\n from uuid import uuid4\r\n\r\n class Vault( object ):\r\n     def __init__( self, path='', name='vault', l=65, w=65 ):\r\n         self.path = path \r\n         self.name = name\r\n         self.l = l\r\n         self.w = w\r\n         \r\n         self.initVault()\r\n\r\n     def initVault( self ):\r\n         \"\"\"Build the vault directories if they don't exist\"\"\"\r\n         p = self.path + '/' + self.name\r\n         if path.exists( p ):\r\n             pass\r\n         else:\r\n             for l in range( self.l ):\r\n                 for w in range( self.w ):\r\n                     if self.path == '':\r\n                         makedirs( self.name + '/' + str( l ) + '/' + str( w ) )\r\n                     else:\r\n                         makedirs(  self.path + '/' + self.name + '/' + str( l ) + '/' + str( w ) )\r\n\r\n     def getFilename( self, ext='' ):\r\n         \"\"\"Generate and return a valid unique file path based on vault\"\"\"\r\n         l, w = str( r(self.l) ), str( r(self.w) )\r\n         filename = str( uuid4() )\r\n        \r\n         return self.name + '/' + l + '/' + w + '/' + filename + ext\r\n\r\n\r\n\r\nExample pyvault test\r\n============================== \r\n\r\n*test_pyvault.py*\r\n\r\n.. code-block:: python\r\n\r\n from pyvault import Vault\r\n\r\n v = Vault( )\r\n\r\n print v.getFilename()\r\n print v.getFilename()\r\n\r\n v2 = Vault( root=\"myvault\", l=5, w=2 )\r\n\r\n print v2.getFilename()\r\n print v2.getFilename()\r\n\r\n\r\nExample database schema to use with vault\r\n====================================================\r\n\r\nThen we could use uuids for the actual file names to prevent overwriting or the need to lookup or keep track of names.\r\n\r\nBelow shows an example database schema that could use this vault filesystem:\r\n\r\n.. code-block:: python\r\n \r\n vault\r\n    id (int) # auto increment \r\n    name (varchar 64) # human readable lookup name\r\n    location (varchar 128) # thevault/12/59/28c6104f-cb09-4910-8031-efad22e1ebf9\r\n    filetype (varchar 8) # or possibly another table to keep track of file types or possibly add the extension to the uuid filename when saved.\r\n    description (text)\r\n\r\nThen other tables can refer and relate to this data, like a job table could have relations mapped to jpg files and pdf files, and a video of the finished job and an autocad drawing when it was designed.\r\n\r\n\r\n\r\n\r\n\r\n", "source_format": "rst", "revision_number": 10, "created": 1308769431000}, {"id": "f33bb774-2f95-11f1-b167-e86a64d24d78", "node_id": "f33ab6ea-2f95-11f1-ae4e-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "Python script to build an Oracle or mySQL flat file vault\r\n================================================================\r\n\r\nThis script will build a 64 by 64 flat filesystem.  The root directory will be named thevault.  \r\n\r\nThis is useful for storing flatfiles like pictures, pdfs, mp3 or autocad drawings and then use the database to store metadata about the files.\r\n\r\n*pyvault.py*\r\n\r\n.. code-block:: python\r\n\r\n from os import makedirs, path\r\n from random import randrange as r\r\n from uuid import uuid4\r\n\r\n class Vault( object ):\r\n     def __init__( self, path='', name='vault', l=65, w=65 ):\r\n         self.path = path \r\n         self.name = name\r\n         self.l = l\r\n         self.w = w\r\n         \r\n         self.initVault()\r\n\r\n     def initVault( self ):\r\n         \"\"\"Build the vault directories if they don't exist\"\"\"\r\n         p = self.path + '/' + self.name\r\n         if path.exists( p ):\r\n             pass\r\n         else:\r\n             for l in range( self.l ):\r\n                 for w in range( self.w ):\r\n                     if self.path == '':\r\n                         makedirs( self.name + '/' + str( l ) + '/' + str( w ) )\r\n                     else:\r\n                         makedirs(  self.path + '/' + self.name + '/' + str( l ) + '/' + str( w ) )\r\n\r\n     def getFilename( self, ext='' ):\r\n         \"\"\"Generate and return a valid unique file path based on vault\"\"\"\r\n         l, w = str( r(self.l) ), str( r(self.w) )\r\n         filename = str( uuid4() )\r\n        \r\n         return self.name + '/' + l + '/' + w + '/' + filename + ext\r\n\r\n\r\n\r\nExample pyvault test\r\n============================== \r\n\r\n*test_pyvault.py*\r\n\r\n.. code-block:: python\r\n\r\n from pyvault import Vault\r\n\r\n v = Vault( )\r\n\r\n print v.getFilename()\r\n print v.getFilename()\r\n\r\n v2 = Vault( root=\"myvault\", l=5, w=2 )\r\n\r\n print v2.getFilename()\r\n print v2.getFilename()\r\n\r\n\r\nExample database schema to use with vault\r\n====================================================\r\n\r\nThen we could use uuids for the actual file names to prevent overwriting or the need to lookup or keep track of names.\r\n\r\nBelow shows an example database schema that could use this vault filesystem:\r\n\r\n.. code-block:: python\r\n \r\n vault\r\n    id (int) # auto increment \r\n    name (varchar 64) # human readable lookup name\r\n    location (varchar 128) # thevault/12/59/28c6104f-cb09-4910-8031-efad22e1ebf9\r\n    filetype (varchar 8) # or possibly another table to keep track of file types or possibly add the extension to the uuid filename when saved.\r\n    description (text)\r\n\r\nThen other tables can refer and relate to this data, like a job table could have relations mapped to jpg files and pdf files, and a video of the finished job and an autocad drawing when it was designed.\r\n\r\n\r\n\r\n\r\n\r\n", "source_format": "rst", "revision_number": 9, "created": 1308769195000}, {"id": "f33baf1a-2f95-11f1-a922-e86a64d24d78", "node_id": "f33ab6ea-2f95-11f1-ae4e-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "Python script to build an Oracle or mySQL flat file vault\r\n================================================================\r\n\r\nThis script will build a 64 by 64 flat filesystem.  The root directory will be named thevault.  \r\n\r\nThis is useful for storing flatfiles like pictures, pdfs, mp3 or autocad drawings and then use the database to store metadata about the files.\r\n\r\n*pyvault.py*\r\n\r\n.. code-block:: python\r\n\r\n from os import makedirs\r\n from random import randrange as r\r\n from uuid import uuid4\r\n\r\n class Vault( object ):\r\n    def __init__( self, root='thevault', l=65, w=65 ):\r\n        self.root = root\r\n        self.l = l\r\n        self.w = w\r\n\r\n        self.initVault()\r\n\r\n    def initVault( self ):\r\n        \"\"\"Build the vault directories\"\"\"\r\n        for l in range( self.l ):\r\n            for w in range( self.w ):\r\n                makedirs( self.root + '/' + str( l ) + '/' + str( w ) )\r\n\r\n    def getFilename( self ):\r\n        \"\"\"Generate and return a valid unique file path based on vault\"\"\"\r\n        l, w = str( r(self.l) ), str( r(self.w) )\r\n        filename = str( uuid4() )\r\n        return self.root + '/' + l + '/' + w + '/' + filename\r\n\r\n\r\nExample pyvault test\r\n============================== \r\n\r\n*test_pyvault.py*\r\n\r\n.. code-block:: python\r\n\r\n from pyvault import Vault\r\n\r\n v = Vault( )\r\n\r\n print v.getFilename()\r\n print v.getFilename()\r\n\r\n v2 = Vault( root=\"myvault\", l=5, w=2 )\r\n\r\n print v2.getFilename()\r\n print v2.getFilename()\r\n\r\n\r\nExample database schema to use with vault\r\n====================================================\r\n\r\nThen we could use uuids for the actual file names to prevent overwriting or the need to lookup or keep track of names.\r\n\r\nBelow shows an example database schema that could use this vault filesystem:\r\n\r\n.. code-block:: python\r\n \r\n vault\r\n    id (int) # auto increment \r\n    name (varchar 64) # human readable lookup name\r\n    location (varchar 128) # thevault/12/59/28c6104f-cb09-4910-8031-efad22e1ebf9\r\n    filetype (varchar 8) # or possibly another table to keep track of file types or possibly add the extension to the uuid filename when saved.\r\n    description (text)\r\n\r\nThen other tables can refer and relate to this data, like a job table could have relations mapped to jpg files and pdf files, and a video of the finished job and an autocad drawing when it was designed.\r\n\r\n\r\n\r\n\r\n\r\n", "source_format": "rst", "revision_number": 8, "created": 1297537913000}, {"id": "f33ba7dc-2f95-11f1-9387-e86a64d24d78", "node_id": "f33ab6ea-2f95-11f1-ae4e-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "Python script to build an Oracle or mySQL flat file vault\r\n================================================================\r\n\r\nThis script will build a 64 by 64 flat filesystem.  The root directory will be named thevault.  \r\n\r\nThis is useful for storing flatfiles like pictures, pdfs, mp3 or autocad drawings and then use the database to store metadata about the files.\r\n\r\n*pyvault.py*\r\n\r\n.. code-block:: python\r\n\r\n from os import makedirs\r\n from random import randrange as r\r\n from uuid import uuid4\r\n\r\n class Vault( object ):\r\n    def __init__( self, root='thevault', l=65, w=65 ):\r\n        self.root = root\r\n        self.l = l\r\n        self.w = w\r\n\r\n        self.initVault()\r\n\r\n    def initVault( self ):\r\n        \"\"\"Build the vault directories\"\"\"\r\n        for l in range( self.l ):\r\n            for w in range( self.w ):\r\n                makedirs( self.root + '/' + str( l ) + '/' + str( w ) )\r\n\r\n    def getFilename( self ):\r\n        \"\"\"Generate and return a valid unique file path based on vault\"\"\"\r\n        l, w = str( r(self.l) ), str( r(self.w) )\r\n        filename = str( uuid4() )\r\n        return self.root + '/' + l + '/' + w + '/' + filename\r\n\r\n\r\nExample pyvault test\r\n============================== \r\n\r\n*test_pyvault.py*\r\n\r\n.. code-block:: python\r\n\r\nfrom pyvault import Vault\r\n\r\nv = Vault( )\r\n\r\nprint v.getFilename()\r\nprint v.getFilename()\r\n\r\nv2 = Vault( root=\"myvault\", l=5, w=2 )\r\n\r\nprint v2.getFilename()\r\nprint v2.getFilename()\r\n\r\n\r\nExample database schema to use with vault\r\n====================================================\r\n\r\nThen we could use uuids for the actual file names to prevent overwriting or the need to lookup or keep track of names.\r\n\r\nBelow shows an example database schema that could use this vault filesystem:\r\n\r\n.. code-block:: python\r\n \r\n vault\r\n    id (int) # auto increment \r\n    name (varchar 64) # human readable lookup name\r\n    location (varchar 128) # thevault/12/59/28c6104f-cb09-4910-8031-efad22e1ebf9\r\n    filetype (varchar 8) # or possibly another table to keep track of file types or possibly add the extension to the uuid filename when saved.\r\n    description (text)\r\n\r\nThen other tables can refer and relate to this data, like a job table could have relations mapped to jpg files and pdf files, and a video of the finished job and an autocad drawing when it was designed.\r\n\r\n\r\nExample algorithm to create file locations\r\n========================================================\r\n\r\n.. code-block:: python\r\n\r\n from random import randrange as r\r\n from uuid import uuid4\r\n\r\n def makeVaultName():\r\n     \"\"\"Return a unique file path based on the vault\"\"\"\r\n     root = \"thevault\"\r\n     filename = uuid4()\r\n     return root + '/' + str(r(65)) + '/' + str(r(65)) + '/' + str(filename)\r\n\r\n\r\n\r\n\r\n\r\n\r\n", "source_format": "rst", "revision_number": 7, "created": 1297537849000}, {"id": "f33ba05f-2f95-11f1-bad2-e86a64d24d78", "node_id": "f33ab6ea-2f95-11f1-ae4e-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "Python script to build an Oracle or mySQL flat file vault\r\n================================================================\r\n\r\nThis script will build a 64 by 64 flat filesystem.  The root directory will be named thevault.  \r\n\r\nThis is useful for storing flatfiles like pictures, pdfs, mp3 or autocad drawings and then use the database to store metadata about the files.\r\n\r\n*pyvault.py*\r\n\r\n.. code-block:: python\r\n\r\n from os import makedirs\r\n from random import randrange as r\r\n from uuid import uuid4\r\n\r\n class Vault( object ):\r\n    def __init__( self, root='thevault', l=65, w=65 ):\r\n        self.root = root\r\n        self.l = l\r\n        self.w = w\r\n\r\n        self.initVault()\r\n\r\n    def initVault( self ):\r\n        \"\"\"Build the vault directories\"\"\"\r\n        for l in range( self.l ):\r\n            for w in range( self.w ):\r\n                makedirs( self.root + '/' + str( l ) + '/' + str( w ) )\r\n\r\n    def getFilename( self ):\r\n        \"\"\"Generate and return a valid unique file path based on vault\"\"\"\r\n        l, w = str( r(self.l) ), str( r(self.w) )\r\n        filename = str( uuid4() )\r\n        return self.root + '/' + l + '/' + w + '/' + filename\r\n\r\n\r\nExample database schema to use with vault\r\n====================================================\r\n\r\nThen we could use uuids for the actual file names to prevent overwriting or the need to lookup or keep track of names.\r\n\r\nBelow shows an example database schema that could use this vault filesystem:\r\n\r\n.. code-block:: python\r\n \r\n vault\r\n    id (int) # auto increment \r\n    name (varchar 64) # human readable lookup name\r\n    location (varchar 128) # thevault/12/59/28c6104f-cb09-4910-8031-efad22e1ebf9\r\n    filetype (varchar 8) # or possibly another table to keep track of file types or possibly add the extension to the uuid filename when saved.\r\n    description (text)\r\n\r\nThen other tables can refer and relate to this data, like a job table could have relations mapped to jpg files and pdf files, and a video of the finished job and an autocad drawing when it was designed.\r\n\r\n\r\nExample algorithm to create file locations\r\n========================================================\r\n\r\n.. code-block:: python\r\n\r\n from random import randrange as r\r\n from uuid import uuid4\r\n\r\n def makeVaultName():\r\n     \"\"\"Return a unique file path based on the vault\"\"\"\r\n     root = \"thevault\"\r\n     filename = uuid4()\r\n     return root + '/' + str(r(65)) + '/' + str(r(65)) + '/' + str(filename)\r\n\r\n\r\n\r\n\r\n\r\n\r\n", "source_format": "rst", "revision_number": 6, "created": 1297537552000}, {"id": "f33b98ed-2f95-11f1-8393-e86a64d24d78", "node_id": "f33ab6ea-2f95-11f1-ae4e-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "Python script to build an Oracle or mySQL flat file vault\r\n================================================================\r\n\r\nThis script will build a 64 by 64 flat filesystem.  The root directory will be named thevault.  \r\n\r\nThis is useful for storing flatfiles like pictures, pdfs, mp3 or autocad drawings and then use the database to store metadata about the files.\r\n\r\n*pyvault.py*\r\n\r\n.. code-block:: python\r\n\r\n from os import makedirs\r\n\r\n root = \"thevault\"\r\n\r\n for i in range( 1, 65 ):\r\n     for j in range( 1, 65 ):\r\n         makedirs( root + '/' + str( i ) + '/' + str( j ) )\r\n\r\nExample database schema to use with vault\r\n====================================================\r\n\r\nThen we could use uuids for the actual file names to prevent overwriting or the need to lookup or keep track of names.\r\n\r\nBelow shows an example database schema that could use this vault filesystem:\r\n\r\n.. code-block:: python\r\n \r\n vault\r\n    id (int) # auto increment \r\n    name (varchar 64) # human readable lookup name\r\n    location (varchar 128) # thevault/12/59/28c6104f-cb09-4910-8031-efad22e1ebf9\r\n    filetype (varchar 8) # or possibly another table to keep track of file types or possibly add the extension to the uuid filename when saved.\r\n    description (text)\r\n\r\nThen other tables can refer and relate to this data, like a job table could have relations mapped to jpg files and pdf files, and a video of the finished job and an autocad drawing when it was designed.\r\n\r\n\r\nExample algorithm to create file locations\r\n========================================================\r\n\r\n.. code-block:: python\r\n\r\n from random import randrange as r\r\n from uuid import uuid4\r\n\r\n def makeVaultName():\r\n     \"\"\"Return a unique file path based on the vault\"\"\"\r\n     root = \"thevault\"\r\n     filename = uuid4()\r\n     return root + '/' + str(r(65)) + '/' + str(r(65)) + '/' + str(filename)\r\n\r\n\r\n\r\n\r\n\r\n\r\n", "source_format": "rst", "revision_number": 5, "created": 1297536075000}, {"id": "f33b920b-2f95-11f1-941e-e86a64d24d78", "node_id": "f33ab6ea-2f95-11f1-ae4e-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "Python script to build an Oracle or mySQL flat file vault\r\n================================================================\r\n\r\nThis script will build a 64 by 64 flat filesystem.  The root directory will be named thevault.  \r\n\r\nThis is useful for storing flatfiles like pictures, pdfs, mp3 or autocad drawings and then use the database to store metadata about the files.\r\n\r\n*pyvault.py*\r\n\r\n.. code-block:: python\r\n\r\n from os import makedirs\r\n\r\n root = \"thevault\"\r\n\r\n for i in range( 1, 65 ):\r\n     for j in range( 1, 65 ):\r\n         makedirs( root + '/' + str( i ) + '/' + str( j ) )\r\n\r\nExample database schema to use with vault\r\n====================================================\r\n\r\nThen we could use uuids for the actual file names to prevent overwriting or the need to lookup or keep track of names.\r\n\r\nBelow shows an example database schema that could use this vault filesystem:\r\n\r\n.. code-block:: python\r\n \r\n vault\r\n    id (int) # auto increment \r\n    name (varchar 64) # human readable lookup name\r\n    location (varchar 128) # thevault/12/59/28c6104f-cb09-4910-8031-efad22e1ebf9\r\n    filetype (varchar 8) # or possibly another table to keep track of file types or possibly add the extension to the uuid filename when saved.\r\n    description (text)\r\n\r\nThen other tables can refer and relate to this data, like a job table could have relations mapped to jpg files and pdf files, and a video of the finished job and an autocad drawing when it was designed.\r\n\r\n\r\nExample algorithm to create file locations\r\n========================================================\r\n\r\n.. code-block:: python\r\n\r\n from random import randrange as r\r\n from uuid import uuid4\r\n\r\n root = \"thevault\"\r\n\r\n filename = uuid4()\r\n print root + '/' + str(r(65)) + '/' + str(r(65)) + '/' + str(filename)\r\n\r\n\r\n\r\n\r\n\r\n\r\n", "source_format": "rst", "revision_number": 4, "created": 1297535801000}, {"id": "f33b898f-2f95-11f1-a027-e86a64d24d78", "node_id": "f33ab6ea-2f95-11f1-ae4e-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "Python script to build an Oracle or mySQL flat file vault\r\n================================================================\r\n\r\nThis script will build a 64 by 64 flat filesystem.  The root directory will be named thevault.  \r\n\r\nThis is useful for storing flatfiles like pictures, pdfs, mp3 or autocad drawings and then use the database to store metadata about the files.\r\n\r\n*pyvault.py*\r\n\r\n.. code-block:: python\r\n\r\n from os import makedirs\r\n\r\n root = \"thevault\"\r\n\r\n for i in range( 1, 65 ):\r\n     for j in range( 1, 65 ):\r\n         makedirs( root + '/' + str( i ) + '/' + str( j ) )\r\n\r\nExample database schema to use with vault\r\n====================================================\r\n\r\nThen we could use uuids for the actual file names to prevent overwriting or the need to lookup or keep track of names.\r\n\r\nBelow shows an example database schema that could use this vault filesystem:\r\n\r\n.. code-block:: python\r\n \r\n vault\r\n    id (int) # auto increment \r\n    name (varchar 64) # human readable lookup name\r\n    location (varchar 128) # thevault/12/59/28c6104f-cb09-4910-8031-efad22e1ebf9\r\n    filetype (varchar 8) # or possibly another table to keep track of file types or possibly add the extension to the uuid filename when saved.\r\n    description (text)\r\n\r\nThen other tables can refer and relate to this data, like a job table could have relations mapped to jpg files and pdf files, and a video of the finished job and an autocad drawing when it was designed.\r\n\r\n\r\nExample algorithm to create file locations\r\n========================================================\r\n\r\n.. code-block:: python\r\n\r\n from random import randrange as r\r\n from uuid import uuid4\r\n\r\n root = \"thevault\"\r\n\r\n filename = uuid4()\r\n print root + '/' + str(r(65)) + '/' + str(r(65)) + '/' + filename\r\n\r\n\r\n\r\n\r\n\r\n\r\n", "source_format": "rst", "revision_number": 3, "created": 1297535759000}, {"id": "f33b809a-2f95-11f1-a2ed-e86a64d24d78", "node_id": "f33ab6ea-2f95-11f1-ae4e-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "Python script to build an Oracle or mySQL flat file vault\r\n================================================================\r\n\r\nThis script will build a 64 by 64 flat filesystem.  The root directory will be named thevault.  \r\n\r\nThis is useful for storing flatfiles like pictures, pdfs, mp3 or autocad drawings and then use the database to store metadata about the files.\r\n\r\n*pyvault.py*\r\n\r\n.. code-block:: python\r\n\r\n from os import makedirs\r\n\r\n root = \"thevault\"\r\n\r\n for i in range( 1, 65 ):\r\n     for j in range( 1, 65 ):\r\n         makedirs( root + '/' + str( i ) + '/' + str( j ) )\r\n\r\nThen we could use uuids for the actual file names to prevent overwriting or the need to lookup or keep track of names.\r\n\r\nBelow shows an example database schema that could use this vault filesystem:\r\n\r\n.. code-block:: python\r\n \r\n vault\r\n    id (int) # auto increment \r\n    name (varchar 64) # human readable lookup name\r\n    location (varchar 128) # thevault/12/59/28c6104f-cb09-4910-8031-efad22e1ebf9\r\n    filetype (varchar 8) # or possibly another table to keep track of file types or possibly add the extension to the uuid filename when saved.\r\n    description (text)\r\n\r\nThen other tables can refer and relate to this data, like a job table could have relations mapped to jpg files and pdf files, and a video of the finished job and an autocad drawing when it was designed.\r\n\r\n\r\n\r\n\r\n", "source_format": "rst", "revision_number": 2, "created": 1297535392000}, {"id": "f33b7399-2f95-11f1-b294-e86a64d24d78", "node_id": "f33ab6ea-2f95-11f1-ae4e-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "Python script to build an Oracle or mySQL flat file vault\r\n================================================================\r\n\r\nThis script will build a 64 by 64 flat filesystem.  The root directory will be named thevault.  \r\n\r\nThis is useful for storing flatfiles like pictures, pdfs, mp3 or autocad drawings and then use the database to store metadata about the files.\r\n\r\n*pyvault.py*\r\n\r\n.. code-block:: python\r\n\r\n from os import makedirs\r\n\r\n root = \"thevault\"\r\n\r\n for i in range( 1, 65 ):\r\n     for j in range( 1, 65 ):\r\n         makedirs( root + '/' + str( i ) + '/' + str( j ) )\r\n\r\nI then normally use uuids for the acutal file names to prevent overwriting or the need to lookup or keep track of names.\r\n\r\nI then have a database table similar to this:\r\n\r\n.. code-block:: python\r\n \r\n vault\r\n    id (int) # auto increment \r\n    name (varchar 64) # human readable lookup name\r\n    location (varchar 128) # thevault/12/59/28c6104f-cb09-4910-8031-efad22e1ebf9\r\n    filetype (varchar 8) # or possibly another table to keep track of file types or possibly add the extension to the uuid filename when saved.\r\n    description (text)\r\n\r\nThen other tables can refer and relate to this data, like a job table could have relations mapped to jpg files and pdf files, and a video of the finished job and an autocad drawing when it was designed.\r\n\r\n\r\n\r\n\r\n", "source_format": "rst", "revision_number": 1, "created": 1297535291000}], "count": 12}