Two Guys Arguing

Pro Tips: Get Your Windows MSI Installer Logs

Posted in .net, notes_to_self by benjaminplee on 07.25.11

Want more information about what an .msi is doing on your system or what caused a generic and completely useless error message to pop up?  Run the following command substituting the path to your .msi from the command line and the output file will contain verbose logs.

msiexec /i filename.msi /l*v log.txt
Tagged with: , , , , ,

Note to self: C# throw; NOT throw ex;

Posted in .net, java, notes_to_self by benjaminplee on 09.02.10

If you need to catch and re-throw the original exception in C# (and possibly other .Net CLR languages) PLEASE, GOD PLEASE, use:

catch(FooException ex) {
// do what you came here to do
throw;
}

NOT:

catch(BarException ex) {
// do what you came here to do
throw ex;
}

While I love being a polyglot developer equally confident developing on the .Net CLR as the JVM, when I am working in a mainstream OO language I still think in Java.  Thus my confusion today when I found a several times re-thrown exception’s stack trace only going back as far as the last re-throw.  Turns out that explicitly throwing an exception (new or old) sets the originating stack trace location as the point of the throw command, not where the Exception object was created or originally thrown.  This is not the same in Java.  I like the syntactic sugar implicitly throwing the caught exception, but shouldn’t the behaviors be the same!?  Sadly the offending throw anti-pattern is strewn throughout the code I was working with….

** Also, put the damn curly braces on the same line ;-)

*** Several more knowledgeable .Net devs on the team knew this fact, but weren’t 100% sure why; but I found this link which helped.

MonoRail with URL Rewriter working on IIS 7

Posted in .net, notes_to_self by benjaminplee on 02.25.10

I have spent the last few days setting up an existing client application in a new data center (IIS 7 +, Windows Server 2008, x64 bit).  Sounded easy, but it turns out that IIS 7 has some differences from IIS 6 and this app and its libraries (Castle project’s MonoRail & ActiveRecord, and URL Rewriter) were written for IIS 6.  Below are a few tips and tricks that helped us finally get the app up and running this afternoon.  Some of these may be obvious to your average .Net developer, but I come from a Java background and IIS configuration is a enigma wrapped in a mystery to me.  In hind site the few articles I found on Google were helpful and contained good information, but weren’t framed in a way that I immediately could get value from.

  • Setup the application pool with “Classic” managed pipeline mode.  From what I found, this has IIS run the app in IIS6 compatible mode.
  • Setup a new website using the above pool (not some other one, this is important)
  • Add handler mappings for MonoRail and the UrlRewriter (web.config XML snip-it can be found on my GitHub Gist 315115)
  • Most of the MonoRail and URL Rewriter install instructions focus on changing “Application Extension Mappings” in IIS 6.  These are found under “Handler Mappings” in IIS 7.  Note: these changes now modify your site’s web.config directly (instead of just being a IIS setting).  The changes are under the <handlers> element.  If you do an automated build (e.g. with NAnt or MSBuild) and push your files out these changes need to be committed into source control otherwise your normal file will override them the next time you deploy.
  • We ended up including both the 32 and 64 bit Framework isapi filter .dll’s as our handlers but it looks like Windows Server 2008 only cares about the 64 bit libraries.  We are still testing this with our builds because currently all of our workstations are 32 bit XP machines.
  • We also removed all of the original mappings since our application didn’t use them, static content is hosted elsewhere, and they were conflicting with the MonoRail mappings

	
Tagged with: , ,

Notes to self: Basic CVS Command Line

Posted in notes_to_self by benjaminplee on 01.19.10

Self,

Please remember next time…


To create a new module in a given repo:

export CVSROOT=:pserver:USERNAME@CVSSERVER:/PATH/TO/REPOSITORY

mkdir PROJECT

cp FILES PROJECT/

cvs import PROJECT INITIAL start

rm -rf PROJECT

cvs checkout PROJECT

And to add files recursively from a folder:

find . -type d -print | grep -v CVS | xargs cvs add

find . -type f -print | grep -v CVS | xargs cvs add

cvs commit -m “MESSAGE”

Thank you,

Self

Tagged with:
Follow

Get every new post delivered to your Inbox.