Notes from the trenches.

Best Hack

Posted: April 15th, 2009 | Author: admin | Filed under: code | Tags: , , , , , , , | No Comments »

I was just thinking what my best hack has been and I think it’s the fix for the following scenario.

I was refactoring the RSinteract source code to get rid of some duplicated classes that had over the course of a, shall we say, rigourous development schedule got disparate. Some classes were used from one set some from the other. I merged them into the common library and deleted all the old ones. This was fine until we ran an old report that had filters on it. Because the types had been serialized into the custom RDL of the report they had the old namespace stored there. Which threw an error when deserializing with the new hierarchy.

So what to do… I had a brainwave:

   1: using System;
   2: using System.Collections.Generic;
   3: using System.Text; 
   4:  
   5: namespace Ics.Reporting.Data
   6: {
   7:     [Serializable]
   8:     public class Dimension : Ics.Reporting.Common.Data.Dimension
   9:     {
  10:         //Proxy class to fix issues with old reports containing a reference to this class which has
  11:         //been moved to Ics.Reporting.Common.Data.Dimension
  12:     }
  13: } 

The empty proxy class in the old namespace that inherits from the new class. Leave a comment as to why. Et voila! No more broken old reports.

What’s your best hack imaginary readers?


Playing with dynamic styles in IE and the Dev toolbar

Posted: December 19th, 2008 | Author: admin | Filed under: code, web | Tags: , , , , , , , , , , , , , | No Comments »

Ever wanted to isolate just one element and mess with the style after it’s been generated with javascript? It’s always been a bit of a tall order with Internet Explorer due to the lack of Firebug and the unrealistic results when using IE developer toolbar to change styles. However, the latter tool does have a feature which allows you to save the element outside of the page with all styles copied, even if they were generated by javascript! Awesome.

You will need: IE, IE dev toolbar

Here’s how:

  1. Load up your page step1
  2. Open the dev toolbar and select the element using the aptly named element selector or in the DOM tree
  3. You will see all the styles in the developer toolbar.
  4. Right click the element in the DOM tree and selected Element source and style
  5. A new window will open with the HTML for the element, nicely formatted step2
  6. Click File>Save>Original HTML Source
  7. Save the file where you want

Now you have your element with all the CSS that was applied to it in the main page in an external file to play with at your leisure!

step3

[The pictures are from RSinteract, a product I am working on.]

Enjoy!


Pushing for Change

Posted: September 17th, 2008 | Author: admin | Filed under: code, rant | Tags: , , , , , , , , , , | 3 Comments »

In a the constant rush of new techniques in the development world it’s hard for us (and by us I mean working developers) to keep up with everything. That is the point though, you don’t have to. Not everything we learn will be ultimately useful to us. I learned “awk” in university but I’ve never used it. However, this doesn’t mean we can be complacent either! I want to learn about the latest developments or I feel like I’m losing my grip on my skills, personally I think that’s a trait of all (hmm – ed) developers. Granted, I’m sometimes a little behind the crowd (I didn’t touch .NET until 2005) but that’s neither here nor there.

Read the rest of this entry »