473,503 Members | 1,641 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to generate a unique working folder

hi,

i have a web service that has file operations on Windows OS, and there may
be a file concurrency issue if only one working directory e.g. c:\working

therefore, i want to have a unique sub directory for each request so as to
get rid of any file concurrency issue, e.g

c:\working\unique-identifier1 for Request #1
c:\working\unique-identifier1 for Request #2

of course, house-keep is then required.

any suggestions to do so?

thanks!
Nov 16 '05 #1
6 3048
Hi,

Consider using a GUID for each working sub-directory:

eg.
System.Guid guid = System.Guid.NewGuid();
string strSubFolder = @"c:\working\" + guid.ToString();

Then you can use a collection (CollectionBase or your own CollectionBase
inherited class) with key = Request No. / ID and value = strSubFolder for
house-keeping.

HTH

"Mullin Yu" <mu*******@ctil.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
hi,

i have a web service that has file operations on Windows OS, and there may
be a file concurrency issue if only one working directory e.g. c:\working

therefore, i want to have a unique sub directory for each request so as to
get rid of any file concurrency issue, e.g

c:\working\unique-identifier1 for Request #1
c:\working\unique-identifier1 for Request #2

of course, house-keep is then required.

any suggestions to do so?

thanks!

Nov 16 '05 #2
1. any size limitation of GUID? how many GUID could be generated?
2. will it be overflow? or will it reuse the old GUID if all the values are
used?

thanks!

"mooni" <to*****@hotmail.com> wrote in message
news:41******@dnews.tpgi.com.au...
Hi,

Consider using a GUID for each working sub-directory:

eg.
System.Guid guid = System.Guid.NewGuid();
string strSubFolder = @"c:\working\" + guid.ToString();

Then you can use a collection (CollectionBase or your own CollectionBase
inherited class) with key = Request No. / ID and value = strSubFolder for
house-keeping.

HTH

"Mullin Yu" <mu*******@ctil.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
hi,

i have a web service that has file operations on Windows OS, and there may be a file concurrency issue if only one working directory e.g. c:\working
therefore, i want to have a unique sub directory for each request so as to get rid of any file concurrency issue, e.g

c:\working\unique-identifier1 for Request #1
c:\working\unique-identifier1 for Request #2

of course, house-keep is then required.

any suggestions to do so?

thanks!


Nov 16 '05 #3
> 1. any size limitation of GUID? how many GUID could > be generated?
2. will it be overflow? or will it reuse the old GUID if all the values
are used?
I'll quote directly from the .NET documentation:

"A GUID is a 128-bit integer (16 bytes) that can be used across all
computers and networks wherever a unique identifier is required. Such an
identifier has a very low probability of being duplicated."

The maximum number of possible unique GUID's is 2^128 or
3.4028236692093846346337460743177e+38. A new unique GUID is generated every
time you call the System.Guid.NewGuid() method.

HTH

"Mullin Yu" <mu*******@ctil.com> wrote in message
news:eX**************@TK2MSFTNGP14.phx.gbl... 1. any size limitation of GUID? how many GUID could be generated?
2. will it be overflow? or will it reuse the old GUID if all the values
are
used?

thanks!

"mooni" <to*****@hotmail.com> wrote in message
news:41******@dnews.tpgi.com.au...
Hi,

Consider using a GUID for each working sub-directory:

eg.
System.Guid guid = System.Guid.NewGuid();
string strSubFolder = @"c:\working\" + guid.ToString();

Then you can use a collection (CollectionBase or your own CollectionBase
inherited class) with key = Request No. / ID and value = strSubFolder for
house-keeping.

HTH

"Mullin Yu" <mu*******@ctil.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
> hi,
>
> i have a web service that has file operations on Windows OS, and there may > be a file concurrency issue if only one working directory e.g. c:\working >
> therefore, i want to have a unique sub directory for each request so as to > get rid of any file concurrency issue, e.g
>
> c:\working\unique-identifier1 for Request #1
> c:\working\unique-identifier1 for Request #2
>
> of course, house-keep is then required.
>
> any suggestions to do so?
>
> thanks!
>
>



Nov 16 '05 #4
You can always check if the directory exist, if exists then generate
another guid.
On Wed, 19 Jan 2005 12:32:03 +0800, "Mullin Yu" <mu*******@ctil.com>
wrote:
1. any size limitation of GUID? how many GUID could be generated?
2. will it be overflow? or will it reuse the old GUID if all the values are
used?

thanks!

"mooni" <to*****@hotmail.com> wrote in message
news:41******@dnews.tpgi.com.au...
Hi,

Consider using a GUID for each working sub-directory:

eg.
System.Guid guid = System.Guid.NewGuid();
string strSubFolder = @"c:\working\" + guid.ToString();

Then you can use a collection (CollectionBase or your own CollectionBase
inherited class) with key = Request No. / ID and value = strSubFolder for
house-keeping.

HTH

"Mullin Yu" <mu*******@ctil.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
> hi,
>
> i have a web service that has file operations on Windows OS, and theremay > be a file concurrency issue if only one working directory e.g.c:\working >
> therefore, i want to have a unique sub directory for each request so asto > get rid of any file concurrency issue, e.g
>
> c:\working\unique-identifier1 for Request #1
> c:\working\unique-identifier1 for Request #2
>
> of course, house-keep is then required.
>
> any suggestions to do so?
>
> thanks!
>
>



Nov 16 '05 #5
You can always check to see if the directory exist, if not then use
the new guid otherwise generate another one.

On Wed, 19 Jan 2005 12:32:03 +0800, "Mullin Yu" <mu*******@ctil.com>
wrote:
1. any size limitation of GUID? how many GUID could be generated?
2. will it be overflow? or will it reuse the old GUID if all the values are
used?

thanks!

"mooni" <to*****@hotmail.com> wrote in message
news:41******@dnews.tpgi.com.au...
Hi,

Consider using a GUID for each working sub-directory:

eg.
System.Guid guid = System.Guid.NewGuid();
string strSubFolder = @"c:\working\" + guid.ToString();

Then you can use a collection (CollectionBase or your own CollectionBase
inherited class) with key = Request No. / ID and value = strSubFolder for
house-keeping.

HTH

"Mullin Yu" <mu*******@ctil.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
> hi,
>
> i have a web service that has file operations on Windows OS, and theremay > be a file concurrency issue if only one working directory e.g.c:\working >
> therefore, i want to have a unique sub directory for each request so asto > get rid of any file concurrency issue, e.g
>
> c:\working\unique-identifier1 for Request #1
> c:\working\unique-identifier1 for Request #2
>
> of course, house-keep is then required.
>
> any suggestions to do so?
>
> thanks!
>
>



Nov 16 '05 #6
"qwerty" <no@email.net> wrote in message
news:lk********************************@4ax.com...
You can always check if the directory exist, if exists then generate
another guid.


Probably not worth it in final analysis. AFAIK GUID's are pretty much
guaranteed to be unique in time and space. Considering that GUIDs would be
sufficient to have a million for each cubic lightyear in the entire
universe, you can see that the solution space is quite large (to say the
least). Then, the GUID generation algorithm is designed to avoid collisions.
In fact, IIRC, you could only get a GUID collision on current hardware
before the heat death of the universe if the two machines shared the same
MAC address. As for the on the same machine, I'm pretty sure you'll watch
the Gnab Big before you got a collision.

Putting in checking code for such an infinitesimally small chance is
probably just a waste of processor cycles. If it makes you happier to put
the check in though, go ahead, since I doubt the performance impact will
have any realistic impact on your code.

As you can see, I'm a bit conflicted as to how I'd approach this ;D
Nov 16 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
18547
by: Mamuninfo | last post by:
Hello, Have any function in the DB2 database that can generate unique id for each string like oracle, mysql,sybase,sqlserver database. In mysql:- select md5(concat_ws("Row name")) from...
1
11209
by: hikums | last post by:
I am posting this here, just in case anyone may need this. Step 1: CREATE SEQUENCE ID_SEQ START WITH 1050000 INCREMENT BY 1 MAXVALUE 9999999 NO CYCLE NO CACHE ORDER
29
3709
by: Lauren Wilson | last post by:
Does anyone know how the following info is extracted from the user's computer by a Front Page form? HTTP User Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107...
2
4512
by: Chris Dunaway | last post by:
I have a web service which is accessed by a windows forms application. When the application submits a unit of work (a "job"), I want to return a job receipt or tracking number back to the...
8
13363
by: mortb | last post by:
Hi, How do I write a GenerateHashcode function that will generate guaranteed unique hashcodes for my classes? cheers, mortb
11
4468
by: Alan Mailer | last post by:
A project I'm working on is going to use VB6 as a front end. The back end is going to be pre-existing MS Access 2002 database tables which already have records in them *but do not have any...
1
3636
by: Daniel Hilgarth | last post by:
Hello, I am currently trying to use XSLT for the creation of multiple HTML-files from a single XML-File. This HTML-files need to have links to each other. The following information might be...
9
18073
by: Robert Mago | last post by:
Is there a way to create a 10 characthers or less, alph-numeric string which is unique. I can't use the guid since its longer then 10 characthers. Also i cannot use a random number, since being...
13
40393
by: gamernaveen | last post by:
I am coding a script , where basically the user has to enter his name , choose file , file comments if required and upload. The file comments , name , filename will be stored in the database with...
0
7194
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7267
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7316
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5566
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3160
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
729
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
372
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.