Defeating WebSense

I have two laptops (one personal, one work) and one home desktop PC. It would be nice to have some files synchronized between them all. I already use Mozy to back up my personal laptop, but that doesn’t address synchronization issues.

I wanted a web-based solution (similar to Mozy), so I did a quick Google search to see what my options were. The first item in the list was FolderShare (by Microsoft), so I figured I’d check it out. I went to http://www.foldershare.com Here’s what I saw:

Blocked by WebSense

Damn… Well, not a big deal. Since I’m a sys admin here, I can just configure WebSense to ignore requests from my IP address. Before I did that, I tried changing the URL to https://www.foldershare.com.

And guess what? It worked!

Apparently, WebSense sees an SSL site as different from the non-SSL site. I have no idea if this is an oversight just for FolderShare, or some weird configuration thing here, or something related to the version of WebSense we’re running… but it is interesting to know that such a simple workaround exists.

Anyway, I’ll be testing FolderShare now — and will blog about that in due time.

Dvorak, ye shalt not throw stones

PC Magazine author John C. Dvorak, whose work I enjoy thoroughly, threw the proverbial boomerang stone today in his column AJAX and the Road to Bad Web Sites, where he criticized a web site:

Holy crap! The Web site usctrojans.cstv.com is far worse than the football team. I’m not sure what they are hoping to accomplish with a site like this, but if you want to see the site at its worst, use Firefox and make the text two sizes bigger by hitting Ctrl+ twice. That way you can see the problem with Web sites that use AJAX.

Dvorak is correct in his statement, and his statement came right back to haunt him. Compare the two images below. The first is a screenshot of his column as viewed without any font size changes; the second is a screenshot of his column after hitting Ctrl+ twice to increase font size.

Screenshot of Dvorak's column (normal font size)
Screenshot of Dvorak’s column (normal font size)
Screenshot of Dvorak's column (large font size)
Screenshot of Dvorak’s column (large font size)


I know how important advertising is to PC Magazine, but increasing the font size caused the ad to appear twice, and covered some of the text of the article. Let’s hope their web designers read Dvorak’s article, too.

The ultimate launcher: Launchy

William of Bug this! Technie Journal writes about how he likes Vista’s start menu search feature, which lets you quickly find programs in the start menu (Tools that save you headache on trying to find your program in 100+ items start menu). I also liked the feature, and I agree with him in that the feature is not good enough to warrant a Vista upgrade. However, while he found a solution in Colibri, I prefer Launchy.

What does Launchy let you do? To understand, let’s look at some ways to open Remote Desktop Connection:

  1. Click Start, then All Programs, then Accessories, then Remote Desktop Connection.
  2. Press Windows-R to open a command prompt, then type mstsc, then press enter.
  3. Press ALT-Enter, type rem, then press enter.

Launchy screenshot#3 is Launchy in action. You can mistype commands, and it’ll still find reasonable matches — type reno and you’ll still likely find Remote Desktop Connection. Multiple matches? Choose from a drop-down list that puts the most recently used and best matches at the top. It’s super-productive.

With Launchy, here’s how I open Mozilla: ALT-Enter, moz, enter. Visual Studio? ALT-Enter, vis, enter. Cisco VPN Client: ALT-Enter, vpn, enter. This is very cool.

Thinking of how much I love Launchy reminds me that I’ve totally skipped the month of September in my drive to donate $5 per month to a free software product, so I’m going to donate $10 to Launchy — because it is that cool. My donation history to date far is as follows.

Thanks to Josh Karlin for writing such a great utility!

Make your web site accessibile, else the courts will force you

It was bound to happen eventually…

SAN FRANCISCO–(BUSINESS WIRE)–A federal district court judge issued two landmark decisions today in a nationwide class action against Target Corporation. First, the court certified the case as a class action on behalf of blind Internet users throughout the country under the Americans With Disabilities Act (ADA). Second, the court held that Web sites such as target.com are required by California law to be accessible. (read more)

What makes the site not accessible? Apparently, the lack of ALT tags.

Continue reading

TypeQuick: How fast do you type?

It seems many people are measuring their typing speed using the TYPEQUICK online typing test. Not to be left out, I gave it a run:

YOUR RESULTS ARE:
Number of words typed: 282
Test duration: 3 min
Speed: 94.1 words/min. (470 keystrokes/min.)
Error penalty: 14
Accuracy: 95.0%

Not bad. I’d probably have done better if I didn’t habitually use the backspace key to correct errors — a trait that not only reduces error rate, but also slows me down. About ten years ago I took a typing test that would not let you backspace and would beep every time you typed an error. There were beeps every few seconds. The bad part is, I make lots of mistakes. The good part is, my fingers know about them, even when I’m not looking at the words I’m typing. You’d think my fingers would have gotten better over the years…

Forgot your Windows product key? It is recoverable…

I frequently rebuild my computer once Windows starts to reach its half-life, formatting the ‘ol hard drive and starting from scratch. Unfortunately, this typically involves a hunt for the Windows XP product key, which typically was written down on a piece of paper and subsequently misplaced. This time, however, I decided not to hunt for that sticky note. Surely, Windows XP knows the product key that was used when it was installed… right?

KeyFinder by Magical Jelly Bean SoftwareApparently, it does, and there’s a little piece of free software that can find it for you. KeyFinder by Magical Jelly Bean Software can identify the product key for Windows 95, 98, ME, NT4, 2000, XP, Server 2003, Windows Vista, Office 97, Office XP, and Office 2003 — on the local computer or on a remote computer (provided you have appropriate security permissions). Very impressive.

The NHibernate optimization debate: partial object queries

Aaron (Eleutian) and Oren (Ayende) have a little backandforth going about optimizing NHibernate. I’m no expert on NHibernate, but I do have experience with O/R mappers and even more experience with raw databases and SQL, and on techniques for improving performance on both, so I feel I could chime in at least in one area of their debate…

Partial object queries

Let me bring you up to date:

  • Aaron wants to run an NHibernate query of select u(Username, Email) from User u and get a User object with only those two fileds filled in.
  • Oren says you can do it: select new UserSummaryDetails(u.Username, u.Email) from User u.
  • Aaron disputes that as a solution, since it returns a UserSummaryDetails object and not a User object, which would require him to rewrite methods that work on a User object but only use a subset of fields (he mentions a SendMailTo method which uses only the username and email).

There’s a solution that perhaps can perhaps make both happy. You specify an interface (IEmailInfo) that exposes the Username and Email properties, implement that interface in your User and UserSummaryDetails classes, and use the interface on your SendMailTo method? At least, this seems plausible considering my limited (but growing) NHibernate exposure, and would work in other O/R mappers (like Paul Wilson’s).

Either way, keeping up with the aforementioned blog debate is a good way to understand the inner workings of NHibernate.

A repository that works with multiple O/R mappers — is it possible?

A recent post on the WilsonORWrapper Google group talked about making WORW multi-database aware by removing static classes and singletons. Well, I’ve kind of been thinking of something similar lately…

For some time I have been toying with the idea of rewriting WORW to support a generic repository service that would work with any O/R mapper, much
like the logger and cache services work over different underlying libraries. By removing the static classes and singletons and adding a provider model for the O/R wrapper element, you would be able to instantiate multiple instances of a “Registry” class, a class which provides a set of services (Repository, Cache, Logger, etc.) based on a given configuration criteira.

As a test I wrote up a simple project (with unit tests!) as a proof-of-concept, using WORM and NPersist as underlying O/R mappers. The WORM part worked fine. The NPersist part almost worked — however, I believe the errors are related to using NPersist’s not-too-well-documented XML provider, not errors with the O/R mapper provider itself (NPersist does initializes properly, which indicates at least something is working right).

If you’re interested in seeing this little stub of a project, download the source (27.5kb). I’ve dubbed it NRepository right now, not for any reason except it’s the first thing that came to mind. Let me know what you think, and whether you think it’s worth pursuing such a project.

FileHelpers: the .Net way to import text files

I am working on a project where I have to import data from thousands of text files. These text files vary in formats: they use different delimiters; they use quoted identifiers never, sometimes, or always; they sometimes have missing end-of-row columns. Importing these took a combination of custom scripts (to clean up and reformat) and XML format files for SQL’s BCP (bulk copy) command… until I found FileHelpers.

FileHelpers by Marcos Meli is a .Net library which provides services to import and export text in delimited and fixed-length file formats. It takes a unique approach to the file import problem:

  • You write a class, giving it properties to store the data in the text file.
  • You apply attributes to the class and properties, describing the format of the file and applying import rules.
  • You import the file using a single command, which creates an array of objects populated with the data from the text file.

With support for custom converters, null types, optional fields, before/after import events, extensive parsing rules, and so much more — not to mention a web site with gobs of examples and documentation — FileHelpers has single-handedly driven me away from the script and batch file approach to a much more powerful .Net application to import my files.

The fact that FileHelpers uses regular .Net classes allows you to use the same class to both import data from a file and persist it to a database. For example, consider the following sample text file:

1,Chris,Smith
2,Bob,Jones
3,"Mary Jane",Brown

Clearly we have three fields in this comma-delimited file, so we write the following class to hold the data. Attributes provide instructions to FileHelpers — specifying that it is a comma-delimited file, and that the quotes in the first and last name fields are optional. (Note that you can use fields or properties; I use fields below for brevity.)

[DelimitedRecord(",")]
public class Person
{
	public int PersonID;
	[FieldQuoted('"', QuoteMode.OptionalForRead)]
	public string FirstName;
	[FieldQuoted('"', QuoteMode.OptionalForRead)]
	public string LastName;
}

Importing this file now becomes as easy as writing two lines of code.

FileHelperEngine<Person> engine = new FileHelperEngine<Person>();
Person[] records = engine.ReadFile(@"c:\myfile.csv");

You now have an array of Person objects loaded with data from the text file. Now, let’s say you wanted to persist these objects to a database. You can use the same Person object to persist to your database with an O/R mapper. If you were using Paul Wilson’s O/R Mapper and the WilsonORWrapper, you would decorate your class as follows:

[DelimitedRecord(","), IgnoreInheritedClass]
public class Person : WilsonORWrapper.Entities.EntityBase<Person>
{
	public int PersonID;
	[FieldQuoted('"', QuoteMode.OptionalForRead)]
	public string FirstName;
	[FieldQuoted('"', QuoteMode.OptionalForRead)]
	public string LastName;
}

Note I added the base class and the IgnoreInheritedClass attribute, which tells FileHelpers to ignore any inherited fields and properties (otherwise, the IsReadOnly property from EntityBase would be included).

With that, I can now persist all the records I read using FileHelpers back to my database using the O/R mapper.

FileHelperEngine<Person> engine = new FileHelperEngine<Person>();
Person[] records = engine.ReadFile(@"c:\myfile.csv");
foreach ( Person p in records )
{
	Data<Person>.Track(p);
}
Data<Person>.Save(records);

Incredible! We can even add supporting logic. Let’s say I wanted to only insert new persons into the database. I could do this.

FileHelperEngine<Person> engine = new FileHelperEngine<Person>();
Person[] records = engine.ReadFile(@"c:\myfile.csv");
foreach ( Person p in records )
{
	Person pers = Data<Person>.Retrieve("PersonID = " + p.PersonID.ToString());
	if (pers == null)
	{
		Data<Person>.Track(p);
		Data<Person>.Insert(p);
	}
}

FileHelpers makes this and so much more possible. It’s the backbone of a project I’m writing, and it’s making some heavy data-parsing much easier. To top it all off, FileHelpers is open source — you can download the code from their Subversion repository, and post patches on their support forums. Patches are well-received — I’ve already had two (1, 2) I’ve sent and had applied.

Thanks again to Marcos (and recently-added co-developer, Matt Campbell) for providing this fantastic library. For regular updates, be sure to read the FileHelpers Library Blog.