About Me

Training

Nothin But .Net Developer Bootcamp

Navigation

Search

Categories

On this page

VMWare Fusion vs Parallels 4.0
Expanding template files in Ruby (for builds)
Typershark – Improve you typing in just minutes a day
Avoid the trap of perfectionism
Useful VS Key Sequences/Shortcuts
How Wise Are You Being With Your Work Time?

Archive

Blogroll

 Agile Developer Venkat's Blog
 Ayende @ Blog
 B#
 Barry Gervin's Software Architecture Perspectives
 Boy Meets World
 Brad Abrams
 Canadian Developers
 Christopher Steen
 Claritude Software News
 Clemens Vasters: Enterprise Development and Alien Abductions
 Coding Horror
 Coding in an Igloo
 Dare Obasanjo aka Carnage4Life
 Darrell Norton's Blog [MVP]
 David Hayden [MVP C#]
 Don Box's Spoutlet
 Eric Gunnerson's C# Compendium
 EZWeb guy: Jeffrey Palermo [C# MVP]
 Fear and Loathing
 Generalities & Details: Adventures in the High-tech Underbelly
 Greg Young [MVP]
 Greg's Cool [Insert Clever Name] of the Day
 IanG on Tap
 Ingo Rammer's Weblog
 ISerializable - Roy Osherove's Blog
 James Kovacs' Weblog
 Jason Haley
 Jean-Luc David
 Jeremy D. Miller -- The Shade Tree Developer
 JetBrains .NET Tools Blog
 Jimmy Nilsson's weblog
 John Bristowe's Weblog
 John Papa [MVP C#]
 Jon Skeet's Coding Blog
 JonGalloway.ToString()
 Jump the Fence or Walk Around
 Lambda the Ultimate - Programming Languages Weblog
 Larkware News
 Lutz Roeder
 Marquee de Sells: Chris's insight outlet
 Martin Fowler's Bliki
 Mike Nichols - SonOfNun Technology
 MSDN Magazine - .NET Matters
 MSDN Magazine - All Articles
 OdeToCode Blogs
 Onion Blog
 Planet TW
 Raymond Lewallen [MVP]
 Rockford Lhotka
 RodMan's Corner
 Roger Johansson's blog
 Sahil Malik - blah.winsmarts.com
 Sam Gentile's Blog
 Scott Bellware [MVP]
 Scott Hanselman's Computer Zen
 ScottGu's Blog
 secretGeek
 Service Station, by Aaron Skonnard
 Signum sine tinnitu--by Guy Kawasaki
 Stephen Toub
 Steve Eichert's Blog
 Steven Rockarts
 The Blog Ride
 The Coding Hillbilly
 The Daily WTF
 TheServerSide.net: News
 Tim Gifford
 Vance Morrison's Weblog
 you've been HAACKED

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

RSS 2.0 | Atom 1.0 | CDF

Send mail to the author(s) E-mail

Total Posts: 519
This Year: 28
This Month: 0
This Week: 0
Comments: 1593

 Tuesday, September 22, 2009
Tuesday, September 22, 2009 4:03:00 PM (Mountain Standard Time, UTC-07:00) ( Productivity | Tools )

A couple of weeks ago I installed a copy of Parallels Desktop for mac. The main driver at the time was that it would allow me to play typing of the dead!!I have been using it since the first week in August. I think parallels is a great product, but I just recently switched back to VMWare Fusion as it was a clear winner in performance (my perceived performance). Parallels also seems to be somewhat of a resource hog. When I first had it installed I installed Windows 7 on a vm allocated 2GB of memory (my MBP has 4GB). I was also running an Ubuntu VM on vmware fusion that serves as my git repository. After about 30 minutes of running the Windows 7VM the Ubuntu VM would error saying that it could not allocate enough memory to continue operation (keep in mind that this Ubuntu VM was only allocated 256MB of RAM).

After switching back to VMWare fusion I can run both vm's quite happily and I am keeping the Windows 7 parallels vm kicking around so I can fire up typing of the dead every once in a while.

Develop With Passion!!

Comments [2] | | # 
 Wednesday, September 09, 2009
Wednesday, September 09, 2009 2:44:00 AM (Mountain Standard Time, UTC-07:00) ( Productivity )

When doing builds with Ruby and Rake, one of the things I often like to be able to do is expanding a set of template files to a set of corresponding files with the appropriate tokenized settings replaced.

Here is an example of a tokenized app.config file (only the important section of the file has been included for brevity):

<connectionStrings>
  <add name="App"
     connectionString="@config_connectionstring@"
     providerName="System.Data.SqlClient"/>
</connectionStrings>

Notice that the only interesting thing to look at here is the @config_connectionstring@ value. This is a value that should be swapped out during the build process with settings specific to the machine the build is taking place on. The place where these settings are defined is in a build specific file named local_properties.rb. Here is a small section of one these files:

require "project.rb"

class LocalSettings
  attr_reader :settings
def initialize
  @settings = {
      :app_config_template => "app.config.xp.template" ,
    #app_config_template = "app.config.vista.template" ;

      :osql_connectionstring => "-E",
      :path_to_runtime_log4net_config => "artifacts\log4net.config.xml",
      :initial_catalog => "#{Project.name}",
      :database_provider => "System.Data.SqlClient" ,
      :database_path => "C:\\databases"
}
@settings[:config_connectionstring] = "data source=(local);Integrated Security=SSPI;Initial Catalog=#{@settings[:initial_catalog]}"

Notice that the goal of this class is to just define a dictionary. These settings indicate values that will be used specific to each machine that is performing a build (which means each machine potentially gets its own different set of settings. To take a file and have it expand out into a file with all the tokens replaced, I wrote a quick ruby class named TemplateFile that looks like the following:

class TemplateFile
  attr_reader :template_file_name
  attr_reader :output_file_name

  def initialize(template_file_name)
    @template_file_name = template_file_name
    @output_file_name = template_file_name.gsub('.template','')
  end

  def generate(settings_dictionary)
    generate_to(@output_file_name,settings_dictionary)
  end

  def generate_to_directory(output_directory,settings_dictionary)
    generate_to(File.join(output_directory,File.basename(@output_file_name)),settings_dictionary)
  end

  def generate_to_directories(output_directories,settings_dictionary)
    output_directories.each do |directory|
      generate_to_directory(directory,settings_dictionary)
    end
  end

  def generate_to(output_file,settings_dictionary)
     File.delete?(output_file)

     File.open_for_write(output_file) do|generated_file|
       File.open_for_read(@template_file_name) do|template_line|
         settings_dictionary.each_key do|key|
           template_line = template_line.gsub("@#{key}@","#{settings_dictionary[key]}")
         end
         generated_file.puts(template_line)
       end
     end
  end

  def to_s()
    "Template File- Template:#{@template_file_name} : Output:#{@output_file_name}"
  end

end

The goal of this class is to just take a named template file and generate it out to one or more locations while making the variable substitution from a provided dictionary of settings. All of these things come together during the build process as follows:

template_files = TemplateFileList.new('**/*.template')

desc 'expands all of the template files in the project'
task :expand_all_template_files do
  template_files.generate_all_output_files(local_settings.settings)
end

All of the template files in the project are grabbed into an array and the expansion happens during the generate_all_output_files method. For special files you can also create a TemplateFile to specifically point at that file and generate it to multiple locations:

#configuration files
config_files = FileList.new(File.join('product','config','*.template')).select{|fn| ! fn.include?('app.config')}
app_config = TemplateFile.new(File.join('product','config',local_settings[:app_config_template]))

task :from_ide do
  app_config.generate_to(File.join(project_startup_dir,"#{Project.startup_config}"),local_settings.settings)
  app_config.generate_to(File.join(project_test_dir,"#{Project.tests_dir}.dll.config"),local_settings.settings)

  config_files.each do |file|
    TemplateFile.new(file).generate_to_directories([project_startup_dir,project_test_dir],local_settings.settings)
  end
end

This makes it a snap to add new project specific configuration files as long as I follow a convention that all new "config" files go into the product/config folder (a build specific folder) with a .[extension].template extension. This way, the new file will get picked up without issue and can have tokenized values in the file easily replaced with machine specific settings.

Develop With Passion

Comments [2] | | # 
 Wednesday, July 29, 2009
Wednesday, July 29, 2009 2:00:00 PM (Mountain Standard Time, UTC-07:00) ( Productivity | ScreenCasts )

As an excuse to play around with a modified audio/visual setup, I thought I would kill two birds with one stone and do a quick screencast on improving your keyboarding skills over time using the game TyperShark.

This screencast gives a brief overview of the game and a sample playthrough of one level.

The screencast can be found here.

If you enjoy the video/sound quality let me know as I am planning to do a lot more in the forseeable future.

Develop With Passion!!

Comments [4] | | # 
 Thursday, July 09, 2009
Thursday, July 09, 2009 3:00:00 PM (Mountain Standard Time, UTC-07:00) ( Inspiration | Productivity )

I am just in the process of thinking about a VAN presentation that I am going to be delivering. The topic is that of developer productivity. One of the things I read this morning was an excerpt from the book Pragmatic Thinking and Learning (an amazing book). The actual fragment that caught my attention was written by an author named Anne Lamott:

"Perfectionism is the voice of the oppressor, the enemy of the people. It will keep you cramped and insane your whole life, and it is the main obstacle between you and a shitty first draft. I think perfectionism is based on the obsessive belief that if you run carefully enough, hitting each stepping-stone just right, you won't have to de. The truth is that you will die anyway and that a lot of people who aren't even looking at their feet are gong to do a whole lot better than you, and have a lot more fun while they're doing it."

This fragment sums up perfectly a phrase I say "a lot" to people that I have an opportunity to work with: "Perfect is the enemy of the good", I can't remember where I first heard that phrase many years ago, but it has been something that I tell myself all the time. I am not at all trying to say that we should not strive for excellence in the tasks that we undertake, I am just saying that the very act of wanting to come up with the "perfect" answer/solution right off the bat is the very thing that can often stop you from even starting the effort in a timely fashion. Instead of writing a crappy piece of code and taking the time to refactor to a cleaner solution, you can spend countless amounts of time staring at a screen, reading a book on good design, looking at other good designs. None of these activities are fruitless, but if they are the very things that stop you from making your own progress then they actually become a detriment to your individual progress. Worse, if those activities further cause you to think about how "imperfect" your own initial solution might be, you can very well paralyze yourself and put yourself in a situation where you will waste precious time.

Today you may well be facing down a tough problem, one that you have not yet faced before. My recommendation for you is tackle the problem in context, draw from your past skills, learn from your mistakes, and just take the first step. As a diligent coder you are not going to allow code smells to remain in the product that you build, but allow yourself to let the code take its initial shape and then "refactor without mercy". Rinse and repeat this process until you have your solution in hand. Enjoy yourself, remember why you became a coder in the first place.

Develop With Passion!!

Comments [6] | | # 
 Friday, June 26, 2009
Friday, June 26, 2009 6:51:00 PM (Mountain Standard Time, UTC-07:00) ( Mouseless Computing | Productivity )

Whether you are a fan of mouseless computing or not, most people reading this blog are .Net developers and that means that a lot of you spend a considerable amount of time in Visual Studio. There are common key-sequences and shortcuts that you can use inside of studio that allow you to keep the context switching from keyboard to mouse at a minimum. I am going to make a note of showing both the accessor sequence and the appropriate shortcut (if it has one). I am a big fan of accessor key traversal for several reasons:

  • your muscle memory will kick in after a handful of times of performing the traversal
  • accessor traversal is something that you can do easily in any windows application (unless it does not provide accessor keys!!) and this can allow you to use the application proficiently with the keyboard without having to commit a new set of shortcuts to memory.
  • in lots of applications the shortcuts consist of a combination of the CTRL key and/or function keys. I don't love having to reach for the function keys as they move me too far from home row (yes I’m a home row nut). With accessor traversal I can keep my fingers on home row and accomplish the exact same tasks!!

One caveat to note about accessor traversal is that as new menus are added you may have to press the first and or second key more than once if there are other menus with the same accessor key in them. Again, this is something you can adapt to quickly!!

Here is the short list of the ones I use the most day to day ( I am excluding the ReSharper accessors):

 

Action Accessor Traversal Shortcut
  Hit the ALT Key and then follow with the key sequence  
Open a project/solution FOP CTRL+SHIFT+O
Add a new project FDN  
Add a new website FDW  
Add existing project FDE  
Add existing website FDB  
Show all files in project PO  
Add a project reference PR  
Cycle backwards through reference dialog tab (standard windows shortcut)   CTRL+SHIFT+TAB
Cycle forwards through reference dialog tabs (standard windows shortcut)   CTRL+TAB
Add a new folder to project/solution PD  
Close all documents WL  
Auto Hide All windows (except main code window) WU  
Goto Options Dialog TO  
Start Debugging DS F5
Start Without Debugging DH CTRL+F5
Step Into DI F11
Step over DO F10
Attach to process TP CTRL+ALT+P
Set as startup project PA  
Add new item PW CTRL+SHIFT+A
Add existing item PG SHIFT+ALT+A
View output window VO CTRL+ALT+O
View Find Results VN{number of result dialog to display)  
View Error List VL CTRL+\ , CTRL+E
Properties Window ALT+Enter F4
Full Screen VU SHIFT+ALT+ENTER
Refresh VF  
     

You can download a PDF version of the above table from here.

Develop With Passion!!

Comments [6] | | # 
 Thursday, June 25, 2009
Thursday, June 25, 2009 5:27:00 PM (Mountain Standard Time, UTC-07:00) ( Productivity | Tools )

Are you able to take the Timesnapper challenge?

One of the recurring themes that often comes up when I talk with people is how they mention how little time they feel they have to accomplish tasks in their day to day jobs. They also get discouraged when they can't seem to find time to explore new techniques, tools, apis etc. Outside of having a company that supports your ability to do self directed learning and exploration, you are also ultimately responsible for how you spend your time at work.

One of the most difficult aspects of teams that start to adopt pair programming is that now people are held up to a level of accountability that they may not be initially comfortable with. "Turn of your instant messenger", "Don't respond to that email", "twitter can wait". All of these are common phrases that can be uttered if you are in an environment where you spend a large part of your day working directly with another person beside you. Aside from the benefits of accountability, pair programming has many other benefits that can allow it to greatly streamline a teams development efforts. This post, however, is not about pair programming. It is about the sole task of getting people to realize where they actually spend their time at work and more specifically, as developers in front of their computers.

I am going to make the assumption that you don't have someone who can sit beside you and prompt you every time that you are misusing your time at work. I am going to challenge you to embark on an exercise that can allow you to greatly streamline your personal development efforts at work (and by development I mean "coding effort"). Download the tool Timesnapper and make a commitment to run it on your desktop for the next 2 weeks. I am not going to go into a discussion about the tool as the website itself does a great job of that. What I will say is that used properly it can be a way to help you analyze your habits while you are in front of the computer. It is a completely unbiased judge of where you spend your time. If you run the report at the end of the day and are not completely happy with your results you can use it as a calibration tool to make adjustments as you try to figure out a way to maximize that 8 hour day. Small improvements made over time are the things that can reap huge benefits.

Can you take the Timesnapper challenge?

Develop With Passion

Comments [9] | | #