Not going to let myself make a habit of staying up until 4am working. Especially since last night, I stayed up until about 3am working.
Up working so late because I really wanted to work on improving the way metadata (EXIF data) is stored in Community Server :: Gallery. One user on communityserver.org had suggested that we add an option to order pictures based on the EXIF picture date value. This was definitely a great idea, since even though I haven't used CS on a live site, I certainly have noticed the issue with sorting by upload date and upload a bunch of your digital photos.
I want everything ordered by dates, since I have my misc folders that randomly get new stuff, and I want the most recent ones up on top. But for my digital photos, I want those in the order I took them. To do that, I basically have to upload them in reverse of the order that I took them. Not very logical.
I don't want to override the post date with the picture date, since I want to use the "top 5 most recent pictures" module and if I did that, if I uploaded a pic that was taken a year ago of my cousin Bob, then it wouldn't show up, even though I just uploaded it. And I need to be able to query the EXIF date in the database to handle the paging right, but it is stored in a serialized string with all the other EXIF data.
Solution? Branch the metadata off into a separate table just for metadata. But I wanted to take it further than that. I want to be able to format fields like date/times to the user's selected format... but I don't want to have to parse it from a string to a DateTime. If I put a DateTime into the DB, I want a DateTime back. Same for string, int, float, double, whatever. Also, looking out to expanding CS even further, there might be a use sometime for this kind of thing.
At first, I was thinking about converting everything to a byte array and store it that way. However, we can't use a BinaryFormatter since it won't work under medium trust (one of our goals is to work in medium trust). Then was trying to convert them using uglier methods, which didn't work. Finally I woke up and released I could use a string and store the original type as well. Convert everything to a string (DateTimes go to 2004-12-31 04:12:31), store the type (System.DateTime), and then use Convert.ChangeType() to get the original object back. Yay. Also serialize everything into an XML string so all the types are sent to the DB at once.
Next... work on reading the EXIF tags raw. Using System.Drawing can to get the properties can be a huge drain, especially with some of the bulk upload tools we're working on (this thing will knock everyone's socks off... its cool... like, why didn't I think of that before cool).
Anyone know of any way to test the image type and get the width/height without using the System.Drawing namespace? I'm working on a small app that processes a lot of pictures at once and could get multiple users using it at the same time. When I use it without doing its image calculations, it only takes max 10% of the CPU. However, when I have it get the width/height (which I need for it to work properly) using a bitmap, it gets up to around 80% CPU usage. Big jump!
I'd found this java class that tests an image's type and gets the width/height by looking at its data raw, but alas, it is in Java, and converting it to .NET is too much of a pain (was trying it for a while... down to 29 errors that I know of). When screwing around with some of the raw data, I can find the width/height in the file, but the offset it sometimes different, since it seems to depend on the size of a header that is before it.
Somebody somewhere in .NET Land must of thought of doing something like this before?
Nearly a month and a half ago, I'd posted about writing up a Repeater control that allows for a <NoneTemplate> that would be used when its datasource is empty. I had a couple of people ask me for the source, and I'd meant to release it, but kept forgetting as things kept coming up (work, holidays, DevConnections). So finally today I sat down, did a quick build, wrote a short sample, and zipped it up.
I've coined it RepeaterPlusNone. We've put it to use quite well in Community Server and it works great. So... check it out.
I recently bought a new Dell PowerEdge 1750 and yesterday I finally dropped it off at a data center for colocation. Now, after having it hosted there for not even 24 hours, I have been unable to connect to the machine for 4 hours now. I lost connectivity with it as I was on it, and I was just configuring which folders it should filter my spam to. So is my confidence in this data center very high at this point? I think not.
Beta2 of Community Server was released today over at communityserver.org. Be sure to check out the announcement.
This release mostly features a massive number of bug fixes. We've gotten quite far on cranking on the various components to get them tweaked out. It does have some new features, such as a new tabbed UI. The tabs are not wired up yet, they mainly serve as a visual for the look and feel we are working towards. Also, we've added a new post UI that is quite interesting.
As with any beta, there are still some issues, but with beta2, we are going to start doing more periodic releases to help ensure that fixes to bugs don't end up creating other bugs. :)