|
It might. I haven't heard that term in the context of hash tables.
|
|
|
|
|
Thanks Alan,
Your reply is clear. I want to check why do you think before Hashtable is fixed size? If the load factor is large enough (e.g. HashMap in Java is 75%), it will be resized to increase its size -- so not fixed. Could you clarify please?
regards,
George
|
|
|
|
|
If you increase the size of the hash table, you also have to change the hashing function to produce keys for this larger size. When you do this, the elements you've already added to the hash table must go to different slots. So every element must be re-inserted in the new larger table.
This process creates a new hash table and replaces the old one. The old one wasn't resized.
|
|
|
|
|
Thanks Alan,
So, the root cause is hash function is dependent on table size?
regards,
George
|
|
|
|
|
|
Thanks Alan!
You mentioned before -- "When the hashtable has to grow regularly, it can increase the time for insertion to O(n) or higher, depending on how often it happens.". "It" means?
regards,
George
|
|
|
|
|
Growing regularly. Every time the hashtable "grows", all elements that have been inserted must be reinserted into the new hashtable. When a hashtable has n elements, it takes n operations to copy them, as opposed to a single operation to insert one element.
|
|
|
|
|
Thanks Alan!
Question answered. You are so patience.
regards,
George
|
|
|
|
|
hello everybody,
I have just finished my senior project and I want to make the installation file that always called (SETUP.exe). so is there any tools that make it directly or should I produce it manualy by VS new project and use the IO library to copy the files to 'program files' folder??
I am using VS.NET 2005 c#.
thanks alot...
|
|
|
|
|
Genius.Boy,
You can use the "Setup project" in VS. I cant remember off hand, but its something like:
New Project -> Setup and Deployment
This will allow you to create an installer for your exe.
Regards,
Gareth.
(FKA gareth111)
|
|
|
|
|
Thanks alot Mr. Gareth. it is very helpful
iam gonna work with it
thanks again.
.
Genius.Boy
|
|
|
|
|
does anyone know how to do this?
Another guy in the office developed a document management system which uses custom file attributes to get the name, revision, drawer etc of some pdf drawings. It was written in vb6 and we've previously had vba cad macros that export the drawings to pdf with the attributes filled out.
we've moved to new drawing software and I'm making the new version of the exporting to pdf, its in C# now, I've got it all sorted but I am stumped on how to make custom file attributes...
I've got a FileInfo on one of the PDF files, but the Attributes property only allows you to set attributes from the FileAttributes enumeration which has things like Hidden, Archive, ReadOnly etc.
How do you set an attribute that is not a part of that enumeration? if there is no way to do it in .net is there a dll i can import from windows api or something?
There's a GetFileVersionInfo function you can import from version.dll (windows 32 com/sdk?) to find the "version" of files, but we've got custom attributes like "DocRevis" ...
Surely there is a way to do it?
|
|
|
|
|
|
Hello everyone,
I want to get the same time in yesterday, is there any bug in my below code?
My concern is code, _CurrentDate.Now.Day - 1, if current date is 1, 1 minus 1 is zero, not a valid date?
DateTime _CurrentDate = DateTime.Now;
DateTime _LastDate = new DateTime(_CurrentDate.Now.Year, _CurrentDate.Now.Month, _CurrentDate.Now.Day - 1, _CurrentDate.Now.Hour, _CurrentDate.Now.Second);
thanks in advance,
George
|
|
|
|
|
George_George,
You should use:
DateTime.AddDay(-1);
This will take into account if its the 1st day of the month.
Regards,
Gareth.
(FKA gareth111)
|
|
|
|
|
Thanks Gareth,
A harder question for you, how to check if two DateTime type instance is in the same day?
regards,
George
|
|
|
|
|
George_George,
If (DateTime1.Now.Day == DateTime2.Now.Day)
HaveAParty();
Do you mean the above?
Regards,
Gareth.
(FKA gareth111)
|
|
|
|
|
Your code is wrong, Gareth.
Maybe it is my mistake not making myself understood. I want to check whether two DateTime type instance are of the same date, not the same day.
From your code, you can see May 1st and June 1st are the same date.
Any ideas about how to fix it?
DateTime d1 = new DateTime(2008, 5, 1);
DateTime d2 = new DateTime(2008, 6, 1);
if (d1.Day == d2.Day)
{
Console.WriteLine("hit");
}
regards,
George
|
|
|
|
|
George_George,
If you want to check the dates are the same just do:
If (d1.Now == d2.Now)
HaveAParty();
Or am i not understanding you correctly?
Regards,
Gareth.
(FKA gareth111)
|
|
|
|
|
Sorry, Gareth!
I have not made myself understood. I want to check whether two time are belonging to the same date, for example, the time of 8am of current day, has the same date of 9am of current day.
But 8am of May first and 8am of June first, even if they have the same Day property, but belonging to different date.
Any ideas to fix it?
regards,
George
|
|
|
|
|
I would subtract one from the other and see if the number of days in the timespan returned >=1 or <= -1
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Seems not working, here is my test case. Any comments?
DateTime d1 = new DateTime(2008, 5, 1, 23, 59, 0);
DateTime d2 = new DateTime(2008, 5, 2, 0, 0, 1);
if ((d2 - d1) > TimeSpan.FromDays(1))
{
Console.WriteLine("hit");
}
regards,
George
|
|
|
|
|
How about
if (DateTime.Compare(d1.Date, d2.Date) == 0)
{
Console.WriteLine("Same Date");
}
ah just noticed answer was already in thread but off bottom of my browser
|
|
|
|
|
Thanks Alex@UEA,
Your solution works! Cool!
regards,
George
|
|
|
|
|