July 23rd, 2002

  • brad


Tons of rad stuff got done today/tonight.

You can now create/edit/delete galleries. (well, you could create before, but it was kinda lame.) /manage/galcreate is gone... the same page does all 3 functions.

To delete a gallery, it has to be empty. To test the deletion, I went to /manage/gals, sorted by Pics, and clicked [edit] on one with zero. I then clicked delete, and it redirected me back to the galleries page. But... my sort order was lost!

So, that led me to finish implementing session variables (the db schema was there, but not the implementation).

Now, /manage/gals remembers your sort order from last time you used it (for that session).

If you want to see some incredibly awesome code, check out lib/fotobilder.pl and look at session_var_{get|set}. Fun stuff. I love Perl & BML.

In the process of all that, I unified a ton of code, replacing old db stuff done by hand with the API equivalents.

One of those unifications was the session deleting stuff. Whitaker's "logout" just killed the cookie, but didn't kill the sessions/sessions_data rows. (well, the code he started from did that too. :P) But now both the manually logout and session expiration paths delete the same way.

BTW, if any of you want a part to work on, I have dozens of ideas now. Let me know. Indicate also your general interest area and skills.

If you're lacking time/skills, just go test the latest code at picpix.com and submit good bug reports.
  • brad

Obscure bug fixed

For the last couple days it's been bugging me that everything was working on my own machine, but not on picpix.com, where most people were testing stuff.

I attributed it to inconsistent state in the database, due to old buggy code, so I wrote those two integrity checking pages.

But, that didn't do it... I still found cases where things worked here but not on the public site.

I traced it to a difference in behavior between the DBI and/or MySQL version I have at home versus there. In all fairness, the behavior change was on a weird corner case (essentially a FB bug: I wasn't trying to rely on the weird results), so it doesn't really matter.... I fixed the bug, and now picpix.com works like it should.

Test away! (but clean your data first with the tools linked off the management page)
amused, happy
  • mart

CVS Warning

Danga.com's CVS is telling me:

cvs server: warning: cannot write to history file /home/cvspub/CVSROOT/history: Permission denied

This isn't the most ideal place to report it, but I guess it'll have to do.

concerned, frustrated
  • mart

make_dirs on Windows

I tracked down the source of the uploading problems csogilvie was having. The problem is that make_dirs assumes that all paths begin with slashes, which isn't true on Windows.

The function therefore tries to (with my configuration at least) create the directory /d:, which maps to C:\D:. Since colons are not allowed in file and directory names for Windows filesystems, the mkdir() call fails.

I'm not sure what to suggest, however. Since /d:/fotobilder is a perfectly valid path (even if it is a little silly) on a UNIX system, it can't just check to see if the first bit looks vaugely like a Windows drive letter. I can take the drive letter out of my $PIC_ROOT, but then it'll create on C: which is where my Apache install lives, and while I have my D: drive mapped to a directory on my C: drive, that's not true for many people and so shouldn't be relied on.

I have no solution to offer: I merely present the problem.

Update: If you set FBHOME (or just $PIC_ROOT) to a path which does not begin with a driver letter but instead is relative to the root of drive Apache runs from, it can work with one minor modification which should not break UNIX. In make_dirs, just after the start of the foreach loop, add the statment next unless $_;. If you don't add this, the code will try to create a directory called /fotobilder (or whatever it's called) in the root directory — that is, a directory name with a slash in it, whose path is //fotobilder — and fail because a directory name cannot contain a slash. This new conditional at the start of the loop makes the code skip out 'empty' directory names, which aren't valid on UNIX either but the mkdir function there cheats and ignores them.

  • brad

New snapshot

Just made a new shapshot:

Lot of usability/navigation improvements.

Coolest: from the picture management page, you can select a range of pictures by clicking one, then shift-clicking another.

Also, you can add/move pictures directly from that page to a new named gallery.

Everything works in IE and Mozilla, except for some remaining IE quirks:

-- can't get the span with "Gallery Name" & input text's style.display to go to "none" when [New Gallery] isn't seleceted... trivial in Mozilla.

-- some javascript errors happen every so often when selecting ranges, but I can't figure out a pattern yet.
  • evan

more win98 testing

- Don't murder system icons. (*grumbles something about how the OS should protect itself from misbehaving programs*) [link]
- Support commandline-based list of files to enqueue. (*grumbes something about how the OS should parse command-line arguments instead of just giving you the entire string*)
- More information on error message when sending files.

This latter change means you can enqueue files via the "Send To" menu. Make a shortcut to the executable in your SendTo directory ("C:\Documents and Settings\[username]\SendTo" on NT, "C:\WINDOWS\SendTo" on 9x (I think?)). It doesn't enqueue into an already-running process (that may be v. hard to implement), nor does it recurse directories, but it works in a hacky sort of way now.

A / B. (Only get B if A crashes; more Win9x compat testing. Please report problems, successes, etc.)

Sorry, that's not much. I'm taking a break today... my wrists hurt.
  • brad


If you updated from CVS in the past couple hours, run the following SQL:

mysql> DROP TABLE galleryrel;

And then run bin/upgrading/update-db.pl -r again.

You won't lose any data. (that table hasn't been used yet)

I have been writing alter rules for changes I've needed so far, but this one would've been a pain.
  • mart

Windows Uploading Problems Fixed. More Problems Arise.

I've made a patch which fixes the uploading on Windows servers. Firstly I replaced most of make_dirs with a call to File::Path::mkpath, which should hopefully be able to deal with all kinds of filesystems when making directories (caveat: I've no idea what it does on UNIX systems, which are the priority). Secondly, I set binmode on the uploading filehandle for the same reason that it was set in fotoup.pl.

I managed to successfully upload a picture after these changes. However, when I attempted to load the image (which of course also needs to be binmodeed, but I figured I'd just see if it was in the database first), my Apache process started having spasms and causing protection faults every few seconds, so I've stopped playing with this for a while. I'd be interested to see if anyone else has success.

I'm using Apache 1.3.22 Win32 on my test server with mod_perl/1.26_01-dev dynamically linked. I also have an Apache2 installation with mod_perl 2 on this box which I intend to try out later if I get round to it.

If you don't have patch on your Windows box (I'm guessing this applies to most people) you can just merge the diff by hand as it's not a very complex patch. UNIX users with a death wish might also like to try it to see if mkpath works for them.

I was going to add binmode to the output too, but that uses an Apache-wrapped filehandle which I'm not familiar with the semantics of and am not sure what I need to put in binary mode. My Apache crashing constantly means that I cannot easily experiment, but if you want to try the relevant code is right at the bottom of Apache::FotoBilder::Pic::handler.

  • brad

Gallery Nesting!

This is frickin' cool ....

Go edit your galleries and setup parent/child relationships. Do some tricky stuff... like making a bunch of galleries with multiple parents.

Then look at /manage/gals and flip between the different sort modes.

Very fun.

Next I move that threading code out of /manage/gals and into fotobilder.pl so it can be used by all drop-down select boxes that let you pick galleries.
  • brad

Oft-reported bug fixed

The weird 404s associated with small images are gone.

Two lines were flipped... it was denying requests where it thought the thumbnail was getting larger, but it should've been looking at the resultant scale size, not the requested scale size.