Snippet in Visual Studio to create static method After using Textmate for a couple of weeks I’ve come to realise how incredibly powerful and beautiful it is! Creating text snippets is a breeze – and improves productivity no end! To achieve the same affect in Visual Studio though is a right pain in the butt-ocks. All I wanted
Quick and dirty deny_select I’ve just been learning how incredibly powerful Test First Development is in Rails – being able to test for elements on the dom using assert_select is fantastico! However I note that there’s no opposite – a deny_select if you will. Something that will test to see if a
Javascript conditionals in RJS Something you can’t seem to do in RJS is to do conditional checking with the client side DOM. For example, I want to be able to investigate an element to see if it has the CSS display tag set to none. The solution is to blend javascript and RJS
Enumerating through .Net enums So, I was working on something that required a loop through enumerated types (in this case, go through the different repayment methods of a mortgage calculator) public enum RepaymentMethod { RepaymentOnly , InterestOnly, MixOfBoth, } To loop through this, use Enum.GetValues() to grab an array of the enumerations, and walk through it
Free dotnet profiler So yesterday I was working on an application that was going ridiculously slow and I couldn’t figure out why. That’s when I used the open source program nprof to profile my application to see where the bottlenecks are! (Download it here [http://sourceforge.net/project/showfiles.php?group_
The Elements of Ruby Style The Elements of Style [http://www.amazon.com/Elements-Style-Fourth-William-Strunk/dp/020530902X] is a fantastic little book detailing best practices for writing. It's written as a series of rules about the best way of writing clear, concise elegant writing. Subsequently, there's a series of programming language books that do a similar
Display your KML on a Google Map KML – the Google Earth/Maps markup language – is a handy and convenient way of displaying geographical information on a google map. To use it though you need to store your KML on a website somewhere where Google can get at it – which makes for quick and dirty KML experimentations a
Capture session expiration in Ruby on Rails Dave Naffis blogged about this neat plugin that handles all kinds of session manipulation stuff, including the ability to call a method when you expire a session. This was just what the doctor ordered for me – I had some cleanup code to call on session expiration, and darned if I
calendar_helper now highlights todays date I contributed my first ever open source patch this weekend, to Geoffrey Grosenbachs [http://nubyonrails.com] awesomely simple calendar_helper Rails plugin. You can install this into your current rails app with:script/plugin install http://topfunky.net/svn/plugins/calendar_helper My humble patch added the ability to display
Beautifully format your .net source code in seconds! Ok, so you're creating a beautiful .aspx page - and then you flip to design mode to use an auto tag or something. You flip back to the source and WHAMMO your beautiful layout has been messed up by the stinking asp.net design mode! So, you spend the next
Open files without leaving the keyboard in Visual Studio At the Developer Developer Developer day on Saturday I saw a great presentation done by Zi Makki [http://www.zimakki.com] on how to create Visual Studio plugins. After the conference, I immediately ran home and started work on a plugin to fix a current pain of mine: the ability
Format time_select to nearest 15th minute time_select is a nice little rails helper that generates dropdown lists for populating time fields, like this: However, it can get a bit messy for users when they come to use the thing, displaying every minute from 1-60 like this: You can dress it up nice though by using
Better structured Selenium Tests Selenium [http://www.openqa.org/selenium/] is a fantastic tool developed by ThoughtWorks [http://www.thoughtworks.com/] for automated web acceptance tests. If you're a web developer and you've never used this tool, go check it out immediately! How I've been generally Selenium is by using the Selenium IDE Firefox
Zlib:BufError So, I started installing Capistrano yesterday using: gems install capistrano Annoyingly, the net-ssh dependency failed with the hideous error message: ERROR: While executing gem … (Zlib::BufError) buffer error This seems to only happen on windows - and there doesn't seem to be any documentation on how to fix this. Thankfully,
Automatically load the Asp.net Web Server When I'm debugging my Asp.net applications, I find myself just wanting a quick and easy way of starting the asp.net web server. You can do this from the command line like this: "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\WebDev.WebServer.exe" /path:[PATH OF YOUR WEB
Batch Insert of Records in .Net So, I've got a DataTable behind the scenes practically packed with data (1000s of rows) - and I want to insert this into a table on sql server using a stored procedure. The wrong way: //The dsSourceDataSet is a populated dataset with //a table that has tonnes of rows foreach