Monday, May 3, 2010

Issues with Visual Studio 2010

ACTION ALERT: See the end of this post for a request to vote on a Visual Studio bug that is affecting Gallery Server Pro development. I need your help!

UPDATE 2010-5-5: Microsoft has confirmed they can reproduce the issue and is investigating it. Keep voting to keep the pressure on!

Visual Studio 2010 just came out, so I installed it, opened up the Gallery Server Pro solution, and took a peak around. The first thing I noticed is that all my ascx and aspx pages had squiggly marks all over the place:

Visual Studio 2010 error

When I hover over the @Control directive in the first line, I see this message:

"ASP.NET runtime error: Could not load file or assembly 'System.Data.SQLite' or one of its dependencies. An attempt was made to load a program with an incorrect format."

That is a tell-tale sign that Visual Studio is trying to load the 64-bit version of System.Data.SQLite into its own 32-bit process. Kind of makes sense, but this worked fine in VS 2008.

This problem also seems to cause issues with custom user controls and third party server controls. For example, when I hover over the uc1 user control declaration (you can see it in the screen shot), I see this message:

"Unrecognized tag prefix or device filter 'uc1'"

I also lose intellisense on these controls.

Despite these problems in Visual Studio, these errors seem to be more cosmetic than a show-stopper. I can compile the solution and run it in IIS. It is annoying to lose intellisense and the squigglies are making me sea sick, but at least I can continue working.

If you are working with the Gallery Server Pro source code on a 64-bit operating system, you may run into this as well. Not a big deal, but if it drives you nuts, here are the known workarounds:

1. Use Visual Studio 2005 or 2008 instead.

2. Use a 32-bit OS.

3. If using a 64-bit OS and VS 2010, avoid IIS (which is 64-bit) and stick with the built-in Cassini web server (which is 32-bit). Rename the dll in TIS.GSP.Data.SQLite\assemblies\x64 to something else such as System.Data.SQLite_x64.dll (or delete it) and then recompile. This forces Visual Studio to use the 32-bit version of System.Data.SQLite.dll.

None of these workarounds are very attractive to me, so my best hope is for Microsoft to fix this in a service pack. To start this process, today I submitted a bug report with Microsoft. To make this a priority for Microsoft, I need lots of people to validate the issue and vote on it. So I ask for your help. Please go to the bug report and vote for it. Thanks!

Wednesday, April 7, 2010

New version adds features, support for .NET 4.0, and fixes bugs

The latest version of Gallery Server Pro fixes several bugs, adds a few minor features, and includes support for ASP.NET 4.0. Download it here. The Web Platform Installer version will be released in a week or two. There are no changes to the database schema, so upgrading is as simple as saving a copy of your web.config and galleryserverpro.config files, replacing the web files with the new ones (but don’t overwrite your SQLite database file galleryserverpro_data.sqlite), and then navigating to default.aspx?g=upgrade in your web browser. Detailed upgrade and installation instructions are in the Admin Guide.

Besides fixing over a dozen bugs, this version adds the following features. Below I dig into these in more detail.

  • Includes support for running under .NET 4.0
  • Added support for web archive files (.mht)
  • Easier integration into other web applications
  • Backup file now compressed in ZIP archive to enable faster download and uploads
  • Files are guaranteed to be added in alphabetical order during a synchronization
  • Automatically clear deleted users from album owner field
  • Improved date parsing of image metadata

Support for ASP.NET 4.0

Gallery Server Pro can run under .NET 2.0, 3.5, or 4.0. By default it is configured to run under .NET 2.0 with MS Ajax 1.0 Extensions. Since 3.5 and 4.0 include built-in Ajax support, you do not need the MS Ajax extensions when running under those versions. The only change that is required to run under .NET 3.5 or 4.0 is a switch to a different web.config file. GSP includes several variations of web.config, as seen here:

DifferentWebConfigFiles

There are six versions of web.config, but only one is necessary. Pick the one you need, rename it to web.config, and delete the rest. The versions with “sqlserver” in the name can be used in medium trust environments where SQL Server is the only data option. These have been purged of references to SQLite, which requires full trust.

For example, if you are installing to a freshly built server with .NET 4.0, rename the file web_4.0.config to web.config and delete the remaining config files. In this case, you do not need to have .NET 2.0, 3.0, 3.5, or MS Ajax Extensions installed.

Support for web archive files (.mht)

Thanks to a suggestion by a user, I added support for web archive files (.mht). These are files that contain web pages, including images, in a single file. You can create an MHT file by navigating to a web site in Internet Explorer and choosing the Save As… command. It is an efficient way to capture the contents of a web page at a single point in time, in a single file.

For example, I used Internet Explorer to save the home page of www.galleryserverpro.com to a file named gsp.mht and then I uploaded it to my gallery. Here is how it looks when viewed in Internet Explorer:

mht_in_ie

The MHT file is is displayed in an iframe. Notice how, even though it is a single file, it preserves the text, images, and styles of the original web page.

Unfortunately, only Internet Explorer can render MHT files. For other browsers, GSP gracefully degrades to a helpful message about your options for viewing it:

mht_in_chrome

This feature was implemented entirely by adding a few lines of text to galleryserverpro.config. All I did was define the MHT file extension:

<mimeType fileExtension=".mht" browserId="default" type="message/rfc822" allowAddToGallery="false" />

…and then define an HTML template to display this particular MIME type. Notice how I define the default template and then another one for Internet Explorer:

<mediaObject
  mimeType="message/rfc822">
  <browsers>
    <browser id="default"
      htmlOutput="&lt;p class=&quot;gsp_msgfriendly&quot;&gt;This browser cannot display web archive files (.mht). Use Internet Explorer or download it by clicking the download link in the toolbar.&lt;/p&gt;" />
    <browser id="ie"
      htmlOutput="&lt;p&gt;&lt;a href=&quot;{MediaObjectUrl}&quot;&gt;Enlarge to fit browser window&lt;/a&gt;&lt;/p&gt;&lt;iframe src=&quot;{MediaObjectUrl}&quot; frameborder=&quot;0&quot; style=&quot;width:680px;height:600px;border:1px solid #000;&quot;&gt;&lt;/iframe&gt;" />
  </browsers>
</mediaObject>

The ability to create and edit HTML templates to customize the display of media files is a powerful one that really sets GSP apart from the competition. The Admin Guide has more information if you want to explore this feature.

Easier integration into other web applications

Gallery Server Pro no longer requires anonymous identification to be enabled at the application level. Previously, the web.config file enabled anonymous identification so that GSP could store user preferences for anonymous users.

In previous versions, a problem appeared when developers tried to integrate the gallery into an existing web site that was incompatible with anonymous identification. For example, Yet Another Forum throws an error when this feature is enabled. Since GSP throws an error when it is disabled, you were in a no-win situation.

Anonymous identification was only marginally useful to GSP, as I really only used it to keep track of whether the user had requested the image metadata popup window to be visible. Since I could easily handle this with a session variable, I refactored the code to use session to store this info for anonymous users. Logged on users continue to store user preferences in profile properties, just like before.

The most significant aspect of this change is that the web.config file for the web application no longer needs this line:

<anonymousIdentification enabled="true" />

The versions of web.config that ship with GSP already have it removed. If you have integrated GSP into an existing version, you should remove this line. Also, update the profile property ShowMediaObjectMetadata to disable anonymous identification:

<add name="ShowMediaObjectMetadata" defaultValue="false" type="String" allowAnonymous="false"/>

Other enhancements

I will quickly mention the remaining enhancements.

  1. Backup file now compressed in ZIP archive. The Backup/Restore page in the Site Admin area now packages the backup file in a ZIP file before sending it to the user. Since the backup file is XML that is easily compressed, this creates a compressed file that is a fraction of the size of the original. You can restore with the zipped file, too, which is especially useful if you are on a network with a painfully slow upload speed.
  2. Files are guaranteed to be added in alphabetical order during a synchronization. Most users discovered that files added during a synchronization were added in alphabetical order of the file name, but for some people the order seemed random. I added a specific step where I sort the list of files that are given to me by the operating system before adding them to the gallery. This should ensure media files are always added in alphabetical order.
  3. Automatically clear deleted users from album owner field. This affects the small percentage of users who integrate GSP into an existing web site where users may be deleted by a mechanism other than the Manage Users page in the Site Admin area. For example, you might have implemented your own user management page. This change helps ensure data integrity.
  4. Improved date parsing of image metadata. Gallery Server Pro is now a little smarter about handling partial dates in image metadata. I am referring to dates that contain only the year or only the month and year. For example, if you used Adobe Photoshop Elements to specify a picture was taken in 2007 – without specifying the month or day - GSP could not correctly read the date. This has been fixed.

Thursday, January 21, 2010

Minor bug fixed by jQuery 1.4

I am surprised I didn’t notice this before or that no one reported it, but there is a small bug in 2.3.3512 on the Manage Users page in the Site admin area. To reduce information overload when user albums are enabled, only user-created roles are shown by default on the Roles tab of the Edit User dialog window, as seen here:

Edit_User

If you want to see ALL roles – including the ones created by GSP to manage security for user albums, then select the checkbox Show roles that support the album ownership and user album features. When you do, a little jQuery script runs that shows all of these roles. In this screen shot, two additional roles materialize out of thin air when the checkbox is selected:

EditUser_WithAlbumOwnerRole

Or at least it does in browsers other than Internet Explorer 8. When IE8 is in the default Standards Mode, selecting the checkbox does… nothing. Well, almost nothing. If the checkbox is selected and you close the dialog box and then make it reappear by editing the same user, the roles will correctly display. But that is hardly the desired behavior.

The first thing I did was download the new jQuery 1.4 release and try it out. As luck would have it, the problem is solved! Selecting the checkbox correctly toggles the visibility of the roles in all major browsers. Phew!

The next version of GSP will either include the latest version of jQuery or else it will link to the hosted one at Google. My current thinking is that it will default to the hosted version for performance reasons but you can always switch to a local copy if you want.

But you don’t have to wait for this fix. There are two ways to update your current installation of GSP to the latest jQuery library:

1. Download the latest minified version of jQuery and copy it to the gs\script directory in your GSP installation. As of today the file is named jquery-1.4.min.js. Then update the jQueryScriptPath setting in galleryserverpro.config to point to this file.

2. Even easier is to tell GSP to use the hosted version at Google. Open galleryserverpro.config and update the jQueryScriptPath setting to http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js.

jQuery is a powerful library that helps make web pages come alive with rich interactivity. Currently I only use it in a few places in the Site admin area, but I plan to start using it throughout GSP. It will let us do some really cool things that previously I considered far too difficult to even attempt. Stay tuned!

Tuesday, December 8, 2009

GSP to be released as DotNetNuke module

The headline gives away the surprise at the end of this post, but first let me tell you what’s been going on.

I previously blogged about how I am taking a temporarily break from full-time work on GSP to restock the savings account through a programming contract. That started in August and looks like it will continue for a few more months. It has been a real bummer being away from GSP – it is so unsatisfying to have so many things I want to do but not enough time to do them.

Your support continues to amazes me. In the last couple weeks there were three $100 donations. I truly appreciate every gift and am doing my best to get into a position where GSP is self-sustaining. Ultimately I plan to bring developers on staff to speed up the pace of development.

Work on GSP continues, but at a little slower pace than when I was at it full-time. Each evening I have a go, beginning with catching up on forum threads. There are a couple things you can expect in the coming months.

SQLite support in the Web Platform Installer (WPI)

Microsoft included support for SQLite in Web Platform Installer 2.0, released a few weeks ago. I am working with them to create a new package that takes advantage of this. This will allow an even easier installation process for GSP because you can use the file-based, self-contained SQLite database engine rather than SQL Server.

As long as I am modifying the package, I am trying to add support for choosing the type of SQL authentication for SQL Server users. The current version requires that you use a SQL login account – support for Windows authentication is not supported. Sounds easy enough, but the Web Platform Installer does not appear to allow for this. I am waiting to hear back from Microsoft as to whether we can somehow shoehorn this in. If not, we’ll have to settle for SQL-only authentication for a while.

Bug fixes

There are a few bug fixes I’d like to get out, so I’ll probably refresh all the packages when the WPI version is released.

DotNetNuke module

Today I am publicly announcing that Gallery Server Pro will soon be released as a DotNetNuke module. You have probably heard of DotNetNuke – it’s the most popular Content Management System (CMS) for .NET. Below is a screenshot of a default DNN installation with the GSP module running in a page.

dnn_gsp

The module preserves all the features of GSP 2.3 while integrating with core DNN functionality such as user membership and site-wide searching. I am nearly done with the coding – just a handful of items left that I think will take about 40 hours or so to finish up. Finding those 40 hours is a real challenge, so I can’t provide a firm release date. I can tell you it won’t be within the next month, but I can also tell you that I want to get it out the door as soon as possible.

The module will be released as a commercial product, although no price has yet been set. The goal is that the revenue will pay the bills so that I can continue to offer the stand-alone version of GSP as a free open source product. Let me repeat – there are absolutely no plans to begin charging for the regular version of GSP. I adore the donation model and it is one of the things I am most proud of. That will not change.

If you are wondering why someone would pay for a module when they can have the regular app for free, I have thought of that, too. And I’m not worried. Developers who build DNN sites are accustomed to paying for modules that provide the desired functionality. They are typically building sites for customers who are paying good money and they don’t mind shelling out a few bucks to get what they need. Having access to the free regular version doesn’t really help them because it won’t integrate into DNN.

Stay tuned for more information.

Wednesday, October 28, 2009

Installing Gallery Server Pro Just Got A Lot Easier

I am pleased to announce that I teamed up with Microsoft to create a greatly improved installation experience using their Web Platform Installer. Installing GSP is now as simple as clicking a few buttons and filling out a few textboxes. No more manually creating the web application or wrestling with NTFS permissions!

wpiBadgeGreen_3Plus, GSP is also being distributed by Microsoft through their Web Application Gallery. Web traffic doubled the day this went live, and it has only increased since then!

The Web Platform Installer has two requirements:

  • You must have permission to run the program
  • You must use SQL Server to store the data

Those of you who use hosting companies that restrict you from running applications on the server – or who want to use SQLite as your data store – should continue to use the existing installation process. Support for SQLite will be coming soon.

I will step through the installation process to show you how easy it is.

When you click the installation icon (above or on the download page), The Web Platform Installer starts. If you do not have it installed, you’ll be prompted to install it.

wpi1

Gallery Server Pro is pre-selected, so click Install. The installer determines which dependencies are needed. You list could include more than shown here.

wpi2

Note that the installer will want to install SQL Server Express. If you already have SQL Server available on your network, you can skip installing it by clicking the X next to it.

When you click I Accept, the installation begins.

wpi3

After your requirements are installed, the installer asks where it should install Gallery Server Pro.

wpi4

Then it will ask for some SQL connection info. Remember that the installer supports ONLY SQL Server. Support for SQLite will be coming soon.

wpi5

The installation is finished. Woo hoo! Look Ma! No messing with IIS Manager, Network Service accounts, or NTFS!

wpi6

Click the link to launch your new gallery:

wpi7

Pretty sweet, huh? This is a significant step toward making GSP easier to install and use. Microsoft has been very helpful and they deserve our thanks for supporting open source projects like this. And I look forward to spending more time adding features to GSP and less time in the forums explaining how to give the Network Service account modify permission to a directory. Cheers!

Wednesday, September 30, 2009

A temporary diversion

Ever since introducing the product key a little over a year ago, donations have gone from a trickle to a consistent several hundred dollars per month, with a few months hitting $1000. Your support keeps me from having to get a real job so I can focus on GSP full time.

At least, that is the goal. In reality, my expenses are quite a bit more than $1000 a month, and this summer my savings account hit rock bottom. I called up a few consulting companies, and a fine one named Beacon Technologies hooked me up with a contract at CUNA Mutual Group. I am now working for them full time for the next few months.

Fortunately, these lucrative contracts bring in more money than I can spend, so after a few months the savings will be stoked and I can get back to full time work on GSP. I can’t wait to work on all the cool new features that are swimming around in my head. I am passionate about keeping GSP the top .NET web gallery and expect that it will soon become the #1 web gallery. I will be publishing a roadmap of the next major features in the near future.

Your donations have a direct effect on how much time I spend on GSP. Keep them coming so I can get back to GSP development. Thanks!

During this time I will continue to answer your questions on the forums and provide advice and assistance on your installation and customization efforts. Note that I am not available for contract work at this time, but will be when my CUNA contract is over, which is expected to last through summer 2010.

Thursday, August 13, 2009

New Release Adds Support For Flash Video, H.264 and more

Today I posted the latest version of Gallery Server Pro. I added support for a few more media types, included a few new features, and fixed several bugs. Get it here.

Flash video and H.264

I blogged earlier about how to tweak your gallery to add support for Flash video and H.264 audio and video. Now it is included in the default installation. Note that you still have to enable the appropriate file extensions on the Media Object Types page in the Site admin area before you can add these media types. There are examples of videos in these formats in the video gallery.

Hidden directories ignored during synchronization

Starting with this version, any folders within the media objects directory will be ignored if it is marked as hidden. Use Windows Explorer to hide a directory, as seen here:

hiddendirectory

When a directory is hidden, it is ignored by GSP during the synchronization process.

Allow a membership or role provider to be specified by name

Prior to this release, GSP always assumed the default membership provider was the correct one. That is, GSP required the defaultProvider attribute for the membership, roles, and profile definitions in web.config to point to the the entry used by GSP. For example, by default GSP specifies the SQLiteMembershipProvider for membership in web.config:

<membership defaultProvider="SQLiteMembershipProvider">...</membership>

However, if you are integrating GSP into another application, this might create difficulty since your existing application may already have a default provider, and in some cases you want GSP to use a different one. Now you can go ahead and create the second provider definition in web.config.

<membership defaultProvider="YourMembershipProvider"> 
    <providers>
        <clear />
        <add name="YourMembershipProvider" applicationName="Your application" ...additional stuff here... />
        <add name="SQLiteMembershipProvider" applicationName="Gallery Server Pro" ...additional stuff here... />
    </providers>
</membership>

Then, in galleryserverpro.config, you tell GSP the name of the membership provider in the new membershipProviderName attribute:

<galleryServerPro>
  <core ... membershipProviderName="SQLiteMembershipProvider" ... />
  ...
</galleryServerPro>

After this change, GSP will use SQLiteMembershipProvider for membership and your existing application is unaffected. You can do the same thing with roles using the roleProviderName attribute in galleryserverpro.config.

I could not figure out a way to programmatically access a non-default profile instance, so profile behavior is unchanged.

Perhaps the best use for this feature is to keep the roles used by GSP separate from the ones used in your application. You already know that you can create roles in the Site admin area to manage the security access your users have to albums. In addition, the user album and owner features automatically create roles behind the scenes. When you have a large number of users and especially when you have the user albums feature enabled, you can end up with a lot of roles. Normally, this isn't a problem - in fact, that is exactly why roles exist. However, if you are integrating GSP into an existing application, you may not want all the extra roles interfering with your "regular" roles.

The solution is to configure GSP to separate the roles into their own application space. A little primer: The ASP.NET membership system can use a single data store for one or more applications. An application is uniquely defined by the applicationName attribute in the membership, roles, and provider definitions in web.config. In the <membership> example above, there are two applications defined: "your application" and "Gallery Server Pro". If you peek in the aspnet_Applications table in your database, you will see one record for each. If you add a third provider with a new app name, ASP.NET will insert a third record into that table.

OK, hopefully that is enough background. Here is how to configure GSP to use the same membership (that is, list of users) but isolate the roles into its own application space. First, in web.config add a definition for the role provider to be used by GSP:

<roleManager defaultProvider="YafSqlRoleProvider" ...>
<providers>
  <clear />
  <add applicationName="YAF" name="YafSqlRoleProvider" ... />
  <add applicationName="Gallery Server Pro" name="GspSqlRoleProvider" ... />
</providers>
</roleManager>

In this example, GSP is not the default role provider, so we must tell GSP which one to use. We do this in galleryserverpro.config:

<galleryServerPro>
  <core ... roleProviderName="GspSqlRoleProvider" ... />
  ...
</galleryServerPro>

SQLite users: If you use SQLite as your data store, there is one more step. Add the attribute membershipApplicationName to the role provider definition to tell the role provider the name of the membership provider that stores the list of users. So instead of the example above, it will look like this (replace "SQLiteMembershipProvider" with the correct name):

<roleManager defaultProvider="YafSqlRoleProvider" ...> 
<providers>
  <clear />
  <add applicationName="YAF" name="YafSqlRoleProvider" ... />
  <add applicationName="Gallery Server Pro" membershipApplicationName="SQLiteMembershipProvider" name="GspSqlRoleProvider" ... />
</providers>
</roleManager>

That is it. The roles needed by GSP are associated with GSP and the roles needed by the other application (in this case "YAF") are associated with it, and never the twain shall meet, even though they share the same list of users. As I said, I think this will be most useful when you do not want the roles used by GSP to clutter up the rest of your web application. Note that you may need to re-run the install wizard after making this change so that the admin account is correctly associated with the automatically created System Administrator role.

Bug fixes

There were a few bug fixes as well. You can view a detailed report of them on the Release History page.

Install and upgrade info

I have not yet updated the Admin Guide for this version, but the install and upgrade procedure is identical to previous versions, except for one small detail when upgrading. Before you upgrade, open gs\config\galleryserverpro.config and add the .m4a and .mp4 file extensions to the silverlightFileTypes configuration setting. That is, it should be ".mp3,.wma,.wmv,.asf,.asx,.mp4,.m4a". Then upgrade as normal. Later you will rename this file to galleryserverpro_old.config and run the Upgrade Wizard (see the Admin Guide for details). If you didn't make this change, the wizard would import the original value for this setting and you would find that Silverlight may not play your .m4a and mp4 files.