• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

creating uuid's or similar based on a string

Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I have written a web crawler that crawls tube sites. Each tube it finds it grabs the thumbnails for to show in search results and these are stored on my server. At the moment for each tube I find I create a folder name based on a random uuid and store the thumbnails in that folder. I then store that uuid with the url of the tube so I know where the images for the tube are.

This is not good because if I ever lost some of my data that associates the url with the random uuid named folder it would be hard to rebuild.

I want to create a uuid or similar based upon the url and then use that as the folder name. This way if I lost the associting data I could rebuild by regenerating the uuid of the url and then finding that folder.

I have looked at the uuid api and I can use the UUID.nameUUIDFromBytes() method by creating a byte[] from the url and converting it into a uuid but I cant convert the uuid back to the url.

Using the url for a folder name results in to long folder names and urls have to many charecters that dont make for good folder names.

I have also thought about converting the url to a byte[] then using the bytes concatenated as the folder name but this results in the folder name being to long.

Any ideas???
Ranch Hand
Posts: 43
Android Hibernate jQuery
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
why don't you look at building a pattern
for example if you download an image from say google.com/images/foo/bar/mypic.jpg then you can store the files in a folder structure like /google-images-foo-bar/mypic-thumb.jpg

this way you'll be able to retrieve the weburl by simply analyzing the folder name.. again there are lots of things to be considered, like '-' in the URL etc.,

this could be a start for you to look at things differently...
    Bookmark Topic Watch Topic
  • New Topic