13 August 2012

Solr date formats in C#

The Solr search engine requires dates to be in the UTC format. Using C# to create a Solr crawler, I came across a challenge as the engine would not accept the default dates. It kept throwing errors: "Error adding field". Some research revealed that Solr expects dates to always end with the "Z" character. This handy page showed the different String.Format() patterns to get just about any date string you need. This one worked for Solr:
var date = String.Format("{0:yyyy-MM-ddTHH:mm:ss.fffffffZ}", 
This produces a date in this format in Solr:
Check out this documentation on the Solr date formats.

11 July 2012

Hide CSS rule from IE7

This is clearly a hack, but a quick and dirty solution that works nicely in hiding a CSS rule from IE7, but show it to modern browser:
html>/**/body .my-css-rule-name {
   /* some CSS */
Thanks to David Hammond's CSS Hacks page.

Datasheet view is grayed out

This is an interesting issue: Some of our users couldn't bring up lists in SharePoint's Datasheet view, which makes the list appear almost like an Excel spreadsheet. The item was grayed out on the Internet Explorer 64-bit on Windows 7 64-bit. Solution? Use IE 32-bit. More on the issue here. It has to do with a 32-bit ActiveX control used to render the Datasheet View.

One other interesting item: Both of the IE shortcuts on the Programs menu of Windows 7 x64 are to the 64-bit version; it's somewhat misleading, because one has "(64-bit)" in parenthesis and the other doesn't, so one assumes the one without that is 32-bit. That's not the case. To run 32-bit IE, go to "C:\Program Files (x86)\Internet Explorer\iexplore.exe" and create a shortcut to it on your desktop.

29 January 2012

IE7 and bulleted lists' margins

For a recent project, we noticed that IE7 was giving us fits with unordered lists: It was "hiding" the actual bullet of the item, but showed the text. Some research revealed that it was flushing everything to the left because we had this in our CSS:
#main-content ul{ margin-left:0 }
The solution? Use the hack to reference only IE7 (the hash tag):
#main-content ul{
  The next two lines are only visible to IE7. This fixes the 
  issue of IE7 not showing the bulleted items; they were 
  flushed left so far that the bullet was mostly hidden. 
  All other browsers ignore the next two lines.
 #margin:0 5px 0 42px !important;