7/24/2008
LifeCycle Solutions - Home ( the software development blog )
 

<July 2008>
SunMonTueWedThuFriSat
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789

Subscribe to this feed:

RSS 2.0 | Atom 1.0 |CDF





Add to Technorati Favorites

Tuesday, February 20, 2007

Simile TimelineA recent post over on Scott Hanselman's blog turned me on to Simile Timeline, a open source Javascript API for adding cool timelines to web pages.  Think Google Maps, but for timelines.  It features a brilliant UI, and very extensible, well written client code.  Following the directions on the site, it's pretty easy to get started using it from ASP.NET- simply add the javascript reference and a bit of code to wire it up and you're all set.  But moving beyond the simple demo, I encountered a few issues and solutions that may be helpful:

Reference the Script from the Page Header. Simile Timeline requires you to reference the script from an include inside the <head> tag of your page.  This is because it uses the script include's url to determine the location of other scripts, images, and CSS files used by the app.  It is also possible to set this prefix in javascript, but your script includes should be in <head> anyway.

When generating XML from a HTTP Handler or web page, set the content type to text/xml.   The example that comes with Simile uses a static XML file for the event data, but in many cases you may want to generate this XML from a database in .NET.  This is easy enough to do by looping through a DataReader and writing out XML.  However, if you do not set Response.ContentType = "text/xml", then in FireFox, it will not parse the result as XML, and the events will not display.  IE is more lenient apparently, but this is still a good idea.

Prevent IE XmlHttp from caching results by adding a timestamp to the URL.  Internet Explorer's built-in XmlHttp class caches data, so that after one request to mysimilexml.aspx, the data is cached until the browser is restarted.  This is a problem if your data changes frequently, and can be aggrivating when testing. There is probably a way to adjust this in IE, but why have your users modify their browser settings?  In the javascript, add a timestamp to the URL to force a new request each time:

var eventsUrl = "ScheduleSimileXML.aspx?preventCache=" + currentDate.getFullYear() + "" + currentDate.getMonth() + "" + currentDate.getDate() + "" + currentDate.getHours() + "" + currentDate.getMinutes() + "" + currentDate.getSeconds()

Eventually, I'd like to see a real ASP.NET control wrapping this, but for now this is a very usable and handy API.

Posted by Daniel Root

One of the most useful tools for .NET development is Lutz Roeder's .NET Reflector, now in version 5.  It uses reflection to peek inside .NET assemblies and disassembles the IL back into C# or VB code for those times that you need an in-depth look into any .NET library.  Ever wonder what the code for System.String looked like? This release adds some really nice features:

  • Formatted code comments- doubles as a documentation browser for XML code-commented members
  • 'Expand members' in disassembler lets you see code for an entire class at once- previously you had to look at each method separately.
  • New analyzer features shows where classes are instantiated and exposed.
  • Search Google or MSDN for a member

In addition to helping you debug code, this is also a great learning tool.  What better way to understand framework development than to peek inside The Framework itself?

 

 

Posted by Daniel Root

Tuesday, February 13, 2007

LifeCycle regularly uses FxCop to check our code for conformance to the Microsoft Patterns & Practices Design Guidelines.  This tool analyzes an assembly against rules governing good naming, security, and performance.  Where a problem is found, FxCop gives you a link to more MSDN guidance on the issue.  Not only a great quality assurance tool, but a good learning tool as well. 

But on the horizon are a crop of new code analysis tools that take the concept to the next level.  CodeIt.Right takes a similar approach- analyzing code and providing a list of violations.  However, CodeIt.Right also bakes in refactoring.  Not only does it tell you your Serializeable type should inherit ISerializable, but with one click, it will make the fix for you. 

NStatic analyzes code and reports on violations in an extremely readable graphical overlay displayed ontop of your code.  As far as I can tell, the violations it targets tend to be more subtle flaws in logic within procedures.

Neither is ready for prime time- CodeIt.Right is in beta and was a little buggy in my testing and NStatic isn't available to the public at all yet.  Still, if your interested in writing quality code, these are two products to keep bookmarked.

Posted by Daniel Root

Thursday, February 01, 2007

So, our Action Pack came this week, and I installed Office 2007.  I'm loving the sleek new ribbon UI goodness, but one thing was bugging me in Outlook 2007's email editor.  When composing a new email, the font size looked way too big.  It was set to Tahoma 10, and when I sent the message, it looked fine.  Not a huge problem, but I want WYSIWYG!  I Googled, but apparently I'm the only one picky enough to care.

It turns out it's zoomed to 200% by default, but the zoom tool isn't there!  To fix:

Outlook -> New -> RT Click top of ribbon -> Customize Quick Access -> Customize -> All Commands -> Zoom -> Add

The zoom button should appear in the top left. Then click inside the message, click the zoom button, and choose 100%.

Seems like this could be a problem if users crank their font down when composing, and send tinsy little hard-to-read emails. 

Posted by Daniel Root

© 2006 LifeCycle Solutions, LLC | All Rights Reserved