I need to be able to generate unique names for files. I was considering
that hash alogorithms, but if I had two files with the same name, I'd get
the same hash. I am collecting and storing files and I want to store them
all in the same directory and I want the names to be cryptic and unique.
Any thoughts?
Jerry
Nov 20 '05
13 1552
Very cool. Thanks.
Jerry
"Andrew J. Marshall" <An************ *@ObjectVision. netANTISPAMDEVI CE> wrote
in message news:um******** ******@TK2MSFTN GP12.phx.gbl... Custom algorithms and GUIDs are cool, but I prefer to use system provided functionality when it provides exactly what you need.
Check out the System.IO.Path' s GetTempFileName method.
I've used the Win32 API equivalent before with flawless results.
-- Andrew J. Marshall MCP (Visual Basic) Fairfax, VA
"Jerry Camel" <rl*****@msn.co m> wrote in message news:eM******** *****@tk2msftng p13.phx.gbl... I need to be able to generate unique names for files. I was considering that hash alogorithms, but if I had two files with the same name, I'd
get the same hash. I am collecting and storing files and I want to store
them all in the same directory and I want the names to be cryptic and unique. Any thoughts?
Jerry
Actually the filename will probably only be unique to the path 8-(
Jerry never stated his uniqueness scope, so ... ?
--
Andrew J. Marshall
MCP (Visual Basic)
Fairfax, VA
"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:ei******** ******@TK2MSFTN GP12.phx.gbl... * "Andrew J. Marshall" <An************ *@ObjectVision. netANTISPAMDEVI CE>
scripsit: Custom algorithms and GUIDs are cool, but I prefer to use system
provided functionality when it provides exactly what you need.
Check out the System.IO.Path' s GetTempFileName method.
That's what I was looking for when doing some "research" in the documentation. Nevertheless, these filenames won't be really "unique" (only unique on the machine).
-- Herfried K. Wagner [MVP] <http://www.mvps.org/dotnet>
* "Andrew J. Marshall" <An************ *@ObjectVision. netANTISPAMDEVI CE> scripsit: Actually the filename will probably only be unique to the path 8-(
ACK.
Jerry never stated his uniqueness scope, so ... ?
Who knows...
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Actually, Jerry mentioned that all the files would be stored in the same
directory... :o)
All the feedback has been great and this problem is a problem no more...
Thanks!
Jerry
"Andrew J. Marshall" <An************ *@ObjectVision. netANTISPAMDEVI CE> wrote
in message news:uc******** ******@TK2MSFTN GP11.phx.gbl... Actually the filename will probably only be unique to the path 8-(
Jerry never stated his uniqueness scope, so ... ?
-- Andrew J. Marshall MCP (Visual Basic) Fairfax, VA
"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message news:ei******** ******@TK2MSFTN GP12.phx.gbl... * "Andrew J. Marshall" <An************ *@ObjectVision. netANTISPAMDEVI CE> scripsit: Custom algorithms and GUIDs are cool, but I prefer to use system provided functionality when it provides exactly what you need.
Check out the System.IO.Path' s GetTempFileName method.
That's what I was looking for when doing some "research" in the documentation. Nevertheless, these filenames won't be really "unique" (only unique on the machine).
-- Herfried K. Wagner [MVP] <http://www.mvps.org/dotnet>
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Dave Theese |
last post by:
Hello all,
We're presented with the problem of needing to generate a unique file name.
I've had some thoughts, but also wanted to solicit suggestions from the
group.
Any suggestions for schemes, using only *standard* C++, to do this?
Thanks,
Dave
|
by: Agoston Bejo |
last post by:
I want to enforce such a constraint on a column that would ensure that the
values be all unique, but this wouldn't apply to NULL values. (I.e. there
may be more than one NULL value in the column.)
How can I achieve this?
I suppose I would get the most-hated "table/view is changing,
trigger/function may not see it" error if I tried to write a trigger that
checks the uniqueness of non-null values upon insert/update.
|
by: BuddhaBuddy |
last post by:
Platform is DB2/NT 7.2.9
The table was created like this:
CREATE TABLE MYTEST (
MYTESTOID bigint not null primary key,
FK_OTHEROID bigint not null references other,
FK_ANOTHEROID bigint not null references another,
FK_LASTLYOID bigint not null references lastly,
unique (FK_OTHEROID,FK_ANOTHEROID))
|
by: Jerry LeVan |
last post by:
Hi,
I am futzing around with Andrew Stuarts "Catchmail" program
that stores emails into a postgresql database.
I want to avoid inserting the same email more than once...
(pieces of the email actually get emplaced into several
tables).
Is the "Message-ID" header field a globally unique identifer?
|
by: daldridge |
last post by:
I have a unique-elements/sorting question (who doesn't?), but haven't
yet been able to get appropriate template/select/for-each processing
working. I don't fully grok the Muenchian technique yet (still an XSLT
n00b), but I'm not sure that's the way to go anyway...
What I'm trying to accomplish is generation of XML Schema output from a
given XML input, with "xs:import" elements in the output with the
"namespace" and "schemaLocation"...
| |
by: pstachy |
last post by:
Hi again!
I have another issue. I would like the attribute of the tag <invoice>
to be unique. Made the following schema but unfortunately it doesn't
validate. Could someone please indicate what is wrong or give me other
solution. Thanks Very much.
Regards
------------------------------------------------------------------------------------------------------------------
Schema:
|
by: ba.hons |
last post by:
Hello all,
Was wondering if anyone could provide some info on what could be a
possible solution to a problem am having.
I have to generate a Unique Identifier in C# which I will use to
assign to a user, i dont really need the Unique Identifier's to be
sequential so i was considering using system.time.hour +
system.time.minute. + system.time.second, but am worried about
daylight savings and also people altering the time on the host PC.
|
by: cedric.louyot |
last post by:
Hi,
I've written a schema that looks like :
<xs:schema>
<xs:complexType name="myType">
<xs:sequence>
<xs:element name="e1" type="T1" maxOccurs="unbounded"/>
<xs:element name="e2" type="xs:string"/>
</xs:sequence>
|
by: Alvin SIU |
last post by:
Hi all,
I have a table in Db2 v8 like this:
Team Name Role
------ -------- ---------------------
A Superman Leader
A Batman Member
A WonderWoman Member
B Alvin Leader
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |