January 8th, 2010 — 6:18pm
I came across this nifty bit of code the other day when looking for a way to do this and, just for fun, thought I’d convert it to IronPython. So I did. And here it is:
import System
def is_assembly_debug_build(filename):
"""Returns true if filename appears to have been built in debug mode"""
result = False
dll = System.Reflection.Assembly.LoadFile(filename)
customAttribs = dll.GetCustomAttributes(False)
for att in customAttribs:
if att.GetType() == System.Type.GetType("System.Diagnostics.DebuggableAttribute"):
result = att.IsJITTrackingEnabled
return result
I saved this in a file called diagnostics.py. So using it (you’ll need to be in the same directory as diagnostics.py or have added diagnostics.py to your path – more info can be found here: http://docs.python.org/tutorial/modules.html#the-module-search-path) is simply a matter of doing something like this:
from diagnostics import is_assembly_debug_build
is_assembly_debug_build([absolute_path_to_your_dll])
If you’re interested you can grab a copy of diagnostics.py from http://gist.github.com/206177
Have fun
Comment » | devtools
December 18th, 2009 — 3:04pm
Are you fed up with so called SEO experts extolling the importance of meta “keywords” tags on a site’s Google rank? Me too. I therefore created doesgoogleusethekeywordsmetatag.com.
So the next time anyone moans about their site’s lack of a keywords meta tag, you know where to send them
1 comment » | web
November 25th, 2009 — 12:10am
Having recently read about Jekyll I decided to boot up Ubuntu, install all the bits and pieces and give it a try. However, I fell at the first hurdle when greeted by the following error:
Error installing gemcutter:
gemcutter requires RubyGems version >= 1.3.5
The Synaptic Package Manager reported everything as being up-to-date but only to version 1.3.1. As it turns out, there is another way to update rubygems on Ubuntu, which worked a treat! The rest of the installation was a breeze
If you are interested more info on Jekyll can be found on GitHub.
Comment » | web
October 16th, 2009 — 8:57pm
I often use a couple of paragraphs of Lipsum when testing forms containing <textarea> tags and have had this bookmarklet I cobbled together sitting on my Bookmarks Toolbar for a while now.
Anyway, I thought it might be fun to hook it up to a HTML 5 form to let you customise how many paragraphs of Lipsum you want each time you click it. So that’s what I went and did:
Lorem Ipsum Bookmarklet Generator
Hopefully it’ll save you a few mouse clicks next time you’re testing some forms.
(Please note that the form used in the generator uses the <input type="range" /> HTML 5 tag which currently works best in the latest version of Opera. YMMV when using other browsers).
Comment » | devtools
September 25th, 2009 — 10:07am
Quite often, when buying books off Amazon, you can sometimes get them cheaper by going to a marketplace seller’s own website. That’s how I came across The Book Depository, where I have bought a few books recently.
One nice UX feature that I like on this site was the way in which they highlight where to find your credit card CVV/security number depending on which credit card you are using:

Visa card with CVV number highlighted
The image above shows the security number highlighted on the signature strip when you select Visa from the credit card type drop-down list. Compare that with the screenshot below showing the security number highlighted on the front of the card when American Express is selected:

AMEX card with the CVV number highlighted
It’s a simple feature really, but nicely implemented.
Comment » | ux
September 4th, 2009 — 2:09pm
When writing unit tests with SubSonic’s new built-in testing for ActiveRecord don’t forget that each time you call the Setup() method on your ActiveRecord object it adds records to any that have already been created. For example:
[Test]
public void Foo_Bar() {
Foo.Setup(10);
Assert.AreEqual(10, Foo.All().Count());
}
[Test]
public void Bar_Foo() {
Foo.Setup(10);
// This will fail: Foo.All().Count() will return 20
Assert.AreEqual(10, Foo.All().Count());
}
To reset your test repositories you will need to call the ResetTestRepo() method prior to each test, which can be accomplished easily enough by adding the method call to your test’s [SetUp] method:
[SetUp]
public void SetUp() {
Foo.ResetTestRepo();
}
[Test]
public void Foo_Bar() {
Foo.Setup(10);
Assert.AreEqual(10, Foo.All().Count());
}
[Test]
public void Bar_Foo() {
Foo.Setup(10);
// Now Foo.All().Count() will return 10 and the test will pass
Assert.AreEqual(10, Foo.All().Count());
}
Hopefully this will save you a bit of time, as well as head scratching :p
Comment » | asp.net, c#