Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ Programming ➜ General ➜ Self-managed hashed strings

Self-managed hashed strings

It is now over 60 days since the last post. This thread is closed.     Refresh page


Pages: 1  2  3 4  

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #30 on Thu 16 Jun 2005 08:42 PM (UTC)
Message
David@dhaley ~/dev/lib/shared-string/dist/tmp
$ ls
LICENSE*  README*  build_unix/  build_win32/  doc/  include/  libtest/  make_docs.sh*  shared-str-0_9b.tgz  src/

David@dhaley ~/dev/lib/shared-string/dist/tmp
$  


I got it extracting under Cygwin. I also extracted it under Windows. What kind of problems are you having? If you downloaded it under Windows, sometimes it screws up the extension by throwing on a tar at the end when you save the file. The file should be shared-str-0_9b.tgz.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #31 on Thu 16 Jun 2005 08:54 PM (UTC)
Message
Ah. My download counter script had a bug in it. Turns out that I had whitespace after the final "?>" in the PHP script, so it was sending that one byte of space with the file. So, the first 31,079 bytes were correct, but there was an extra byte at the end.

I fixed the script and now you should be able to open it without problems.

Sorry for the mishap...

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Raz   (32 posts)  Bio
Date Reply #32 on Thu 16 Jun 2005 09:12 PM (UTC)
Message
Got it downloaded. Looks go so far, but here is what I see:

In sharedstr.hpp:

inline size_t length() const
		{
			return str_->length();
		}


As a stylistic note, it would be best to typedef the std::string::size_type within your class so you can replace this return type of size_t with std::string's own size_type.

SharedString & operator= (const std::string & rhs)
		{
			// clear the old string
			deleteString();
			// set the new string
			assignString( rhs );

			return *this;
		}

		SharedString & operator= (const SharedString & rhs)
		{
			// clear the old string
			deleteString();
			// set the new string
			assignString( rhs.str_const() );

			return *this;
		}

		SharedString & operator= (const char * rhs)
		{
			deleteString();
			assignString( rhs );

			return *this;
		}


You should add a check to see if the passed parameter is the same string as the class is holding. Let us take this example:


SharedString<Manager> str("Hello");
str = str;


Your current code will break at the assignment operator. The assignment operation would first delete the stored string and then try to re-assign the deleted string.

Otherwise, I see nothing else wrong. I'll look over it a bit more in-depth later.

-Raz
C++ Wiki: http://danday.homelinux.org/dan/cppwiki/index.php
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #33 on Thu 16 Jun 2005 09:20 PM (UTC)
Message
You're right, the typedef is better. I'll throw that into my next version.

And thanks for spotting that assignment bug - could have made for nasty problems if somebody tried to do that. :)

I'll package up the changes tonight and upload version 0.9c with the fixes.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #34 on Thu 23 Jun 2005 05:08 AM (UTC)
Message
Version 0.9.c has been released, with the two fixes suggested by Raz.

Home page:
http://david.the-haleys.org/index.php?page=shared-str

Release notes:
http://david.the-haleys.org/dev/shared-string/doc/files/version_history-txt.html

Download link:
http://david.the-haleys.org/downloads/shared-string-0.9.c.tgz


NOTE: There seems to be a slight problem compiling under some distributions of *nix that do not define stricmp. If you have this problem, you can either implement stricmp or just change it to strcmp (but, in that case, insensitive compare will stop working.) If it's a problem for people, I'll figure out a more permanent solution.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #35 on Thu 16 Feb 2006 02:51 AM (UTC)
Message
I've seen that a number of people have downloaded this, but is anybody using it? Just curious. And if there's any feedback, please be welcome to provide it.

And as a note of random interest, if you google for "shared string library" (with quotes), the library comes up sixth. Whee. :-)

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Nick Cash   USA  (626 posts)  Bio
Date Reply #36 on Thu 16 Feb 2006 03:25 AM (UTC)
Message
I too am having troubles extracting. I get one giant file with everything in it, which I don't think is the intention. Granted whenever I downloaded it gives me a .gz file instead of the .tgz. ::shrug::

If I can ever get it to work I plan to use it for my mud.

~Nick Cash
http://www.nick-cash.com
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #37 on Thu 16 Feb 2006 03:28 AM (UTC)
Message
Are you using the link:
http://david.the-haleys.org/downloads/shared-string-0.9.c.tgz

I just tried it, and I had no problems at all.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Nick Cash   USA  (626 posts)  Bio
Date Reply #38 on Thu 16 Feb 2006 03:37 AM (UTC)

Amended on Thu 16 Feb 2006 03:47 AM (UTC) by Nick Cash

Message
Most curious. It seems that downloading with IE produces rather dubious results. I downloaded with no problems using Firefox.

Yet another reason to use Firefox! :P

--
On another note, I compiled both under unix and win32 with absolutely zero problems. That is something of a rarity these days. Good work :)

~Nick Cash
http://www.nick-cash.com
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #39 on Thu 16 Feb 2006 03:58 AM (UTC)
Message
Yeah, I've had funky problems downloading with IE as well. That's why I haven't used IE for anything other than Windows Update for over two years. :-)

I'm glad your compile worked fine. I discovered that I use the function stricmp which seems to be non-standard, and it didn't compile out-of-the-box on one of the systems I installed it on. Fortunately, stricmp is very easy to reimplement.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Enderandrew   USA  (37 posts)  Bio
Date Reply #40 on Fri 17 Feb 2006 01:05 PM (UTC)
Message
For those instances when you need IE to access a page (it requires ActiveX like Windows Update, for instance) you can use a browser called Maxthon.

It offers the IE rendering engine, ActiveX, tabbed browsing, and most of the security features of Firefox. It also allows plugins/extensions/themes like Firefox.

For pages where you don't want ActiveX, you can block it. It some ways, it is actually BETTER than Firefox.

"Nihilism makes me smile."
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #41 on Thu 02 Mar 2006 03:20 PM (UTC)
Message
I've released 0.9d of the library. The only new functionality it adds over 0.9c is a new, smarter hash function for the hash table manager. It also adds some documentation.

http://david.the-haleys.org/index.php?page=shared-str

Download:
http://david.the-haleys.org/downloads/shared-string-0.9.d.tgz

Has anybody tried integrating this into a MUD yet? It worked well for me and I'm curious to hear what other people have found.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #42 on Sat 04 Mar 2006 11:32 AM (UTC)
Message
As I've been integrating this into my MUD, I've found a number of things were missing. As a result I added the += and + operators.

Download version 0.9e:
http://david.the-haleys.org/downloads/shared-string-0.9.e.tgz

I doubt my implementations are the most efficient -- I just needed something to work for me to finish sticking this into my MUD.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #43 on Sat 04 Mar 2006 12:02 PM (UTC)
Message
Oh, I also provide an implementation of stricmp if you don't have one already. Make sure you check the documentation for how to use it.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Samson   USA  (683 posts)  Bio
Date Reply #44 on Sun 05 Mar 2006 01:53 AM (UTC)
Message
Now, just to refresh my memory, this code of yours handles the same kind of string counting as the hashstr.c stuff in Smaug, right? And it's also a substitute for having to use std::string in C++ STL?
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


146,786 views.

This is page 3, subject is 4 pages long:  [Previous page]  1  2  3 4  [Next page]

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.