Troubleshooting

VMWare IIS7 Woes

Posted in Troubleshooting on May 8th, 2011 by Jamie – Be the first to comment

I spent the last hour trying to setup an IIS7 website running from a VMware Fusion shared folder. Specs:

  • VMware Fusion 3.1.2
  • MacBook Pro OSX 10.6 Host
  • Win7 Guest
  • IIS 7.0 something

I want to edit the website from OSX, so I added the directory as a shared folder. I tried various things to get IIS to recognize the directory including using symlinks and mapping the drive. I read an article that mentioned using the UNC directly, so I tried that and things seemed to work until I loaded the site and got a 500.19 error, “The requested page cannot be accessed because the related configuration data for the page is invalid.”

I tried some different tactics involving changing permissions and messing with the identities that the app pool and website run under, with no luck.

Frustrated, I finally tried some more targeted searching about my particular scenario and came upon two more articles on the VMware forums. These recent posts seem to suggest that it’s not possible to do what I want in the way I want right now.

It seems I’m left with two options:

  • Edit files in the guest OS
  • Setup some synchronization between the guest and host directories

 

 

SQL Server Stem Words

Posted in Troubleshooting on February 28th, 2011 by Jamie – Be the first to comment

We needed to find related words using the SQL Server FORMSOF function. Although it is used mainly to find related words in bodies of text, we wanted to use it to find related words in a table of just words. Initial approaches focused on finding a SQL Function or table that contained the database of related words. This turned out to be a dead end.

We decided a clever approach would be to iterate through each row of the table, using it to query all the rows. This would create groupings of words that could be used to tie them together, via a common group ID.

Although a better solution may have been to use a indexing engine such as Lucene to generate the correspondences, we were already using SQL Server’s functions.

Regex Challenge

Posted in Troubleshooting on February 25th, 2011 by Jamie – Be the first to comment

A friend asked for a regex that matches a paragraph that contains only upper-case text inside a nested hierarchy of tags. Some examples:

Matches:


<p class="abcdefg"><a href="1.htm"><span>HELLO THERE</span></a></p>
<p class="c8"><span class="c7">BY ERIC D. JAMES, MD</span></p>
<p style="border:1px solid red">HELLO DARLING</p>

Fail:


<p class="c8"><span class="c7">BY Eric James, MD</span></p>
<p style="border:1px solid red">Hello Darling</p>
<p class="abcdefg"><a href="1.htm"><span>HELLO THeRE</span></a></p>

I came up with the following expression:

/<p[^>]*>(<[^>]*>)*[^a-z<]+(<\/[^p][^>]*>)*<\/p[^>]*>/

It doesn’t handle tags interspersed with text or nested paragraph tags.

Here’s a sample on Rubular.

Adding comments to spreadsheets with POI

Posted in Troubleshooting on February 7th, 2011 by Jamie – 1 Comment

I was just recently working on a project using NPOI, the .NET equivalent of POI, which is a great library for writing Microsoft Office documents. I was using HSSF, it’s spreadsheet library (Horrible Spreadsheet Format according to Google), and attempting to add Comments to cells.

At first I thought it wasn’t working at all. Then I noticed there was a single cell that had the little red marker that tells you there is a comment. After a little debugging, I realized that this was the last comment added, and guessed that I was doing something to clear the comments I created with each loop iteration.

The block of code that creates comments is something like:

HSSFCell cell //...
// ...
HSSFPatriarch patr = sheet.CreateDrawingPatriarch(); // should only be called once
HSSFComment hssfComment = (HSSFComment) patr.CreateCellComment(
    new HSSFClientAnchor(0, 0, 0, 0,
    cell.ColumnIndex, cell.RowIndex, // start cell index (for size)
    cell.ColumnIndex+4, cell.RowIndex+6) // end cell index (for size)
    );
hssfComment.String = new HSSFRichTextString("Comment text");
cell.CellComment = hssfComment;

Unfortunately I had been creating the drawing patriarch in each loop. I didn’t realize it should be a top-level container for the comments. So make sure to not re-create the drawing patriarch.

Weird Sammy + jQuery on IE error

Posted in Troubleshooting on January 28th, 2011 by Jamie – Be the first to comment

Here’s a post that might help problems with Sammy routes, callbacks, and event handlers using jQuery, especially the “live” function.

I have an input form with submit buttons like:

<form>
<input type="submit" name="what" value="SomeCommand" />
<input type="submit" name="what" value="DifferentCommand" />
</form>

This didn’t play well with Sammy, as it doesn’t load the value of what into it’s params hash. So, I did a work around like:

  // hack to allow sammy to access the 'what' param
  $('form input[type=submit]').live('click', function(){
    var submit = $(this),
      form = submit.parents('form');
    form.find('input[name=what][type=hidden]').val(submit.val());
  });

I’m not sure why I originally chose to use “live.” It could’ve been that I was building DOM dynamically using jquery-tmpl. In Firefox and Chrome, this worked as expected. In IE, the Sammy route handler would fire before the click handler above! So, I changed the code to use the non-live version.

  $('form input[type=submit]').click(function(){ // changed
    ...
  });

Quicksilver Clipboard History Appearing Act

Posted in Troubleshooting on December 22nd, 2009 by Jamie – Be the first to comment

I’ve been using Quicksilver for its clipboard manager–among other things. If you’re a developer, having a clipboard history that is easy to access adds incredibly productivity. I was having an issue where the clipboard manager would suddenly appear out of nowhere, randomly. I was able to implement a cludgy fix by docking the clipboard manager on the side of my screen. Just leave the window touching a side, and it will slide and dock automatically.

Here’s where I found the information:
http://code.google.com/p/blacktree-quicksilver/issues/detail?id=44.


Switch to our mobile site