Search my site

Blog Posts


Finally cured of the 64-bit Windows 7 SVN "file or directory is corrupted or unreadable" problem

Running SVN (or TortoiseSVN) on 64-bit Windows 7 can often cause errors reading "The file or directory is corrupted and unreadable. Please run the Chkdsk utility." This is caused by a known bug in the Windows 7 NTFS file system. A few months ago when I first researched this problem there were supposed reports that disabling indexing on the folder or disabling antivirus would fix this problem. This was not the case and I had to deal with the issue for over a year.

Microsoft plans to fix this in Windows 7 Service Pack 1. But there is a hotfix available.

This is a known regression in Windows 7 in the NTFS file system. It occurs when doing a superseding rename over a file that has an atomic oplock on it (atomic oplocks are a new feature in Windows 7). The indexer uses atomic oplocks which is why it helped when you disabled the indexer. Explorer also uses atomic oplocks which is why you are still seeing the issue. When this occurs STATUS_FILE_CORRUPT is incorrectly returned and the volume is marked "dirty" which is a signal to the system that chkdsk needs to be run. No actual corruption has occurred. - Via (Microsoft TechNet) Via (Subversion Community Beta)

Get the hotfix now!


Convert YAML to JSON i18n internationalization locale files

This is a convenient ruby script that I use to transform Rails i18n YAML locales into JSON for use in javascript UI. I've been developeing a lot thick client ExtJS interfaces

Download the GIST

# Transform a YAML i18n local files into JSON object.
# suitable when using Rails YAML for javascript UI translations.
# This takes files DIR_ROOT/locale and outputs DIR_ROOT/js/locale
# filenames are determined by YAML filename.  
# Mark Young @zarzax Nov 2010
# Transforms YAML en.yml:
# en:
#   home:
#     link_name: 'testing'
# Into compressed JSON en.js:
# Ext.locale = {'home': {'home': {'link_name': 'testing'}}

require 'rubygems'
require 'json'
require 'yaml'

DIR_ROOT = File.expand_path(File.dirname(__FILE__))
YAML_ROOT = File.join(DIR_ROOT, 'locales')
JS_ROOT = File.join(DIR_ROOT, 'js', 'locales')

# locale javascript namespace
JS_NAMESPACE = 'Ext.locale = '

Dir[File.join(YAML_ROOT, '*.yml')].sort.each { |locale| 
  locale_yml = YAML::load(
  puts 'Filename: ' + locale
  puts 'Filename JSON: ' + locale_yml.to_json
    File.join(JS_ROOT, File.basename(locale, '.*') + '.js'), 'w') {
      |f| f.write(JS_NAMESPACE + locale_yml[File.basename(locale, '.*')].to_json)

Find the current_controller? in Rails

Fine Current Creative Commons License photo credit: spacesuitcatalyst

Rails provides a very useful current_page?(link) function but I needed a way to find if I was on the current_controller?(link) for adding a css class to menu links. This was useful for when I'm on a deeplink 'users/1/edit' but want to match a menu link to 'users/'. They share the same controller but not a the whole page link.

Download the GIST

# A rails helper snippet I find helpful for building main navigation
# when you want to highlight main pages (controllers) when browser
# requests a subpage.
# eg. current request '/users/1/edit' but we want to highlight
# the menu link to '/users'. current_page? will be false but
# the current_controller? function will be true

# Find if a link is uses the current controller.
# Used in building main navigation to include
# sublinks.
def current_controller?(link)
  url_for(link).include? @controller.controller_name

# Create list elements for building navigation
def menu_link_li(text, link, classes = "", include_separator = false, new_tab = false)
    if current_controller? link
   classes += " selected"
  rescue Exception => e
    # deal with a potential error of not using the helper with a request first being made.
  if new_tab
    link_text = link_to text, link, :target => "_blank"
    link_text = link_to text, link
  html = %{
  • #{link_text}
  • } if include_separator html += %{
  • } end return html end

    Crack open that MacBook Pro

    What happens when your hardrive fails in your 13-inch MacBook Pro? Crack it open and replace the drive!



    Silky Icon Sprites and SASSy Mixins

    Creative Commons License photo credit: roadsidepictures

    I have been working with CompassCSS/SASS for over a year now. I recently had the need to create an image sprite (or one image that contains many icons) from the silk icon sets for use in a large web interface. I created a SASS mixin to make working with the files very easy. If you use CSS and especially if you are using Compass CSS, SASS, or HAML check out my mixins.