Saturday, December 15, 2007

OpenAniDB: Reinventing the Wheel

Hey, guys. In a lot of ways, the code I've been writing is fundamentally different than Python, and I keep finding myself writing code to do things that wx can do natively. (Would you believe I reinvented the hash map for strings before learning about wxHashMap?)

So, the state of things. UDP is pretty solid. It currently blocks on I/O. Ideally, we would select() and re-enter the code path once we get a response, but this is pretty good considering we are single-threaded. Also, instead of small nonce functions for each response/error code, I'm now letting each part of the app just switch{} between each code, and then the UDP object cleans up and handles any errors received. I'm sure there will be more tweaking, but I think it's pretty cool to be able to just "have things work" in regards to network errors. For example, if you receive a 555 ("Banned!") at any point during execution, the UDP object will pop up a box letting the user know, without bothering the main code.

The DB is, well, the DB. There's a lot of things unimplemented that the old DB system had; in particular, I have ditched the old per-table functions for a nice, generic Put() and Get(), which handle raw SQL statements. There's also PutRaw() and GetOne(), which wrap those into functions that are much more palatable. There's still a lot of app code which is missing. I haven't rebuilt the morass of code that drives the DB browser. I'm looking forward to it, though. It will be quite cool, I hope.

Hashing works. So does adding to the mylist. Hell, if that's all you really want, then it's done. Finished. The ability to load files into the hasher, hash 'em, and then send the hashes to AniDB is all there. However, renaming/moving hasn't been reimplemented, so if you need that, you're out of luck. Also, the whole thing with DB caching isn't quite working (and there's no way to test it without the DB browser,) so more code must be written.

Good news, though. Hashing is fast. I'm using a builtin MD4 instead of external libs, and frankly, it's ridiculously fast. 10-15 seconds to hash 170 MB. On Linux, at least, I can cache the entire file in memory after hashing, and then just do additional hashes from RAM, which is impressively speedy. On Windows, eh, not so much.

~C.

Traditional - "The Christmas Song"

Happy holidays! ~C.

Saturday, December 8, 2007

Music: Corbin Simpson - "Quick Adventure"

One of my adventures. This recording was a warmup before my jazz audition. (He stopped me halfway through the audition, said he had had enough and I was the guy. I'm the guy. Oh yeah. *dances*) ~ C.

Quirk

Something interesting I found: wxConfigBase::Read() is improperly overloaded. GCC accepts:
bool wxConfigBase::Read(wxString, true);

...but not...
bool wxConfigBase::Read(wxString, false);

Very interesting, isn't it? My current hypothesis is that false is internally represented by 0, which is the null pointer, so it isn't sure if it should be (bool)false or (bool*)NULL.
My solution:

bool f = false;
bool wxConfigBase::Read(wxString, f);

Inelegant, but it works. Defaults for settings work. Next on the list is file renaming.
~ C.

Tuesday, December 4, 2007

Music: Portal - "Still Alive"

The infamous radio song from Portal. Cross-posted on Youtube. More tomorrow. ~C.

OpenAniDB: Settings

Settings work. Yay. I'm actually rather fond of the setup as it stands, because the settings calls wxConfigBase::Write() and wxConfigBase::Read() are overloaded for bools, longs, doubles, floats, and strings. Very cool.

I can now hash a file from within the GUI and add it to the mylist. Now that I'm finished with school for the fall, I will probably be putting in a bit more and hopefully will be ready to commit to Subversion in a few weeks or perhaps sooner. The speed of C++ cannot be underestimated: I am hashing files in less than ten seconds now!

~ C.