Author Archives: Lessan Vaezi

Using wrap_parameters to allow a non-ActiveRecord parameter

Rails 4 introduced strong parameters: With strong parameters, Action Controller parameters are forbidden to be used in Active Model mass assignments until they have been whitelisted. This means that you’ll have to make a conscious decision about which attributes to allow for mass update. This is a better security practice to help prevent accidentally allowing […]

Posted in Technology | Leave a comment

Using a period in YAML tokens

While working on an internationalized Rails application, I came across a case where the names of countries were being translated through the YAML locale configuration files. While a valid short-term measure, I would prefer using a gem like Globalize and storing the translations in a Country model, for example. But in the meanwhile, I was […]

Posted in Technology | Leave a comment

How to clear the Clipboard when exiting Microsoft Word

This week a colleague approached me to consult about a problem he had encountered, where it was necessary to ensure that the Clipboard was empty when Microsoft Word exits. It was part of a legacy Word automation solution that he wasn’t in a position to change just yet, and it would crash if there was […]

Posted in Technology | Tagged , , , | 1 Response

Get email Headers from an Outlook MailItem

While working on a VSTO add-in for Microsoft Outlook, I came across the need to access the headers of an email, to parse out X-CustomProperty tags that were put in by an application that sent the emails. However, I couldn’t find a Headers property in the Outlook object model, so below is an attempt to […]

Posted in Technology | Tagged , , , , , , | 4 Responses

How to filter select list options

Here’s a jQuery extension method to filter the elements of a select list (option tags). It binds to a textbox, and as you type in the textbox the select list gets filtered to match what you are typing. Parameters: textbox This could be a jQuery selector, a jQuery object, or a DOM object. selectSingleMatch This […]

Posted in Technology | Tagged | 55 Responses

Using Open XML SDK to get Custom Properties from a Word document

I stumbled across a library that I didn’t realize was out there, for working with Microsoft Office documents. It only works with the newer Office 2007 and 2010 files (and 2003 with a compatibility pack), i.e. those using the Open XML standard. Download and install the Open XML SDK 2.0 for Microsoft Office: I […]

Posted in Technology | Tagged , , | Leave a comment

How to hide the dotted border outline on focused elements in HTML, using CSS

While working on a web application for data entry, I had to scour the net for a way to hide the dotted border that appears when an element is focused on a web page. Here are my findings. First, the obligatory disclaimer – I do understand that the dotted border is for accessibility purposes and […]

Posted in Technology | Tagged , , , | 4 Responses

Context is Hindi when printing line numbers in Word 2007

[This post accompanies a question posted here:] I’m trying to print a Word 2007 document with Line Numbering turned on, and in Word the document looks fine but when I print the document, the line numbers appear in Hindi script. On screen: Printed: I tried deleting my Normal template and allowing Word to create […]

Posted in Technology | Tagged , , | 2 Responses

Registry settings to add Uninstall as a shell option for VSTO manifest files

I have been working on some VSTO add-ins and on deploying them, and have something to share that I didn’t find anywhere else. First of all, let me just say that despite certain hurdles, deploying using ClickOnce has been a very pleasant experience. After following some tutorials on making an MSI, we eventually ended up […]

Posted in Technology | Tagged , , , , | 6 Responses

Recursive Active Directory group membership using System.DirectoryServices in .NET 3.5

When coding for an organization that uses Active Directory, you will eventually come across the business case for using groups within groups, i.e. a ¬†user is part of say, the HR-Administration group, and that group is itself a member of the HR-Department group. You may then need to secure your application to only allow members […]

Posted in Technology | Comments closed