Recently, I had a bit of a pain with adding an mp3 player to pages for playing files held in Sitecore. Here’s a bit of background to the issue: the client wanted an mp3 player like a sister site of theirs has on their site. The sister site does have a player, but the mp3s are served by their Wordpress blog. In our client’s case, they will be uploading mp3s to the Sitecore Media Library.
The task was simple. Search for any link with a class of “audio” or where the extension is .mp3. Whack in the player over that. All done in 30 minutes. Testing in Firefox, it worked fine. In IE, Chrome, Opera and Safari it would play the mp3, but the display would say “Connecting…” and stick with this while playing. I used the standalone version of WP Audio Player
I ended up comparing all the headers with a working version and noticed that requesting from Sitecore gave no content-length. Apparently Sitecore (up to 6.4.1 update 1) does not include this essential header.
I wrote to Sitecore who replied with:
To add the “Content-Length” header to the “Response” headers, please perform the following steps:
Compile the “CustomMediaRequestHandler.cs” file (the file is attached) and copy DLL to the “bin” folder.
Change the old handlers in the “configurationsystem.webhandlers” and “configurationsystem.webhttpHandlers” with the new ones:
For example:
I have attached the Sitecore.Customization.dll I created for this which is the compiled CustomMediaMediaRequestHandler.cs (Download Sitecore.Customization.dll here or the zip here). Clear cache and BINGO! All good.
One other thing to this little tale. Make sure, if you are searching through Mime types in Sitecore (in web.config and MimeTypes.config), that mp3 is set to audio/mpeg, not audio/mp3 which they seem to have done.
For home projects I have started using Mercurial. I have a fairly good grasp of Git and DVCS. I have been using Bitbucket for this and it’s pretty damn slick. But one thing they don’t say is how to add a remote repository to your existing code. It just shows how to clone. With Git the way to add a remote repo is:
remote add origin [remote repo url here]
But in Mercurial, there doesn’t seem to be such a thing. I’m sure there is, and please, if you have found one, just leave a comment. In the meantime, the best I have is to add an hgrc file in your .hg folder (created when hg init is run). This should contain the following:
Recently, I have been working with a client who uses Oracle as their database. We have been running Sitecore from this and it works ok, bar a few bugs.
However, one day, without warning, we started getting the following error:
Great. After some searching, we realised it is easily fixable. You need to get into the server and open SQLPlus, Oracle’s command line tool.
Type in the user and password. You will then get an error that your password has expired. It should then start the process to change it. You can use the old password (depending on settings) or type a new one.
I’ve always been a little wary of ORMs. Linq to SQL, Entity Framework, NHibernate. They’re all powerful, great to use and ease up development time quite a bit. The reason I’m not sure about them is the Select n+1 issue, general performance, tweakability and, well, DBAs don’t particularly like them, and if they don’t like them, I wonder how that can be good for the database they control.
Enter the micro ORM. Yes, we are going back to writing SQL, they are just small libraries that take your SQL, and convert them to objects. It makes for much better performance and DBAs should be much happier to write their stored procedures for you to consume with fewer issues.
I’ve recently got well into CruiseControl.net. Having a server building, testing and even packaging for you is, well, brilliant for so may reasons which I will not get into here.
However, at my current work, we constantly use up space with log files, every build builds a log file, and as we have a huge amount of code to compile, it gets messy quickly. Gigs of files which we will only use the last 10 of at the most.
One dev wrote a Powershell script which just scans the logs folders and deletes any logs older than a certain date. Pretty good, but I realised there is a cleaner built in to Cruisecontrol.net already called Artifact Cleanup Publisher (added in version 1.6).
You just add the following in your publishers area for projects in your Cruisecontrol config file: