An Open Letter to Legislators on the Second Amendment

I NEVER put political statements on my blog. In fact I feel my blog should remain an apolitical zone – I like it staying technology-centric. However in light of recent events, coupled with the fact that my legislators in Washington (such as Senator Patty Murray) have turned a deaf ear to my words, I think it’s time to “nail those words to the church door” so to speak and publicly state my feelings on the matter.


As your constituent, I strongly urge you to oppose any legislation to ban so-called “assault weapons” and “large” ammunition magazines.

A previous ban on these inanimate objects was in effect from 1994-2004 and had no discernible effect on violent crime. In fact, a study of the ban mandated by Congress found: “At best, the assault weapons ban can have only a limited effect on total gun murders, because the banned weapons and magazines were never involved in more than a modest fraction of all gun murders.”

Tens of millions of Americans choose to own semi-automatic firearms with ammunition magazines that hold more than 10 rounds for the same reason as law enforcement officers: they are effective for self-defense. One never knows how many rounds he or she will need for self-defense or defense of others, or how many criminals may attack. Thus having a firearm that allows its lawful user to discharge multiple shots can often be the difference between life and death. In fact, a number of studies have shown that firearms are used for self-defense hundreds of thousands of times to 2.5 million times annually. This amounts to guns being used 3-5 times more often for self-defense than to commit a crime.

Thomas Jefferson once wrote: “No freeman shall ever be debarred the use of arms.”

If he were alive today, to see what our elected officials are attempting to do to the freemen and free-women of this nation, he would drop dead on the spot of a broken heart.

I grew up with a father who is a retired a Naval Officer and a Vietnam veteran. My next door neighbor in Napa California was a gun collector. As a child growing up in the 1970s I used to help my neighbor cast bullets. Never once.. NOT ONCE.. was I ever in any danger or in any harm from any of the myriad of arms he owned. My neighbor was a responsible owner and taught ME that same respect for firearms – as did my father. NONE of us were ever harmed by any of his firearms. And no one I knew ever was either.

Every time some sick or evil person does something heinous the government responds with punishing the good people of this once-great nation and taking away more of their rights. Why do I say “once great”? Because when PRAVDA – the TABLOID paper of the former Soviet Union calls the United States a nation of “socialism and moral decay” you know something has gone horribly wrong in this nation and continues to do so.

Once again our elected officials – the public servants who are put in office by vote – are responding to the actions of a lunatic by legislation in violation of the laws and principles this nation was founded upon.

Maybe that’s the difference between us, I was taught to respect the firearm and what it can do from an early age. I’m guessing most of those on Capitol Hill have never fired a gun let alone owned one – all the while enjoying the safety of armed guards at every turn.

But the Second Amendment, that the Democrats seem to revile,isn’t about hunting or muskets, as so many of you try to claim, it is about freedom and the Right to Keep and Bear Arms. What part of the phrase “the right of the PEOPLE to keep and bear arms shall not be infringed” escapes so many of you??

We’ve walked in the same footsteps as our forefathers who fought for their freedoms, so we don’t take it lightly. However, so much of the political elite seem to forget their heritage, or at least ignore it, which is an even bigger tragedy.

I urge all of you to reconsider enacting any new legislation on “gun control”. DC, Colorado, Connecticut, Illinois and New York already have some of the toughest laws on the books. It has done *nothing* to stem the tide of gun-related violence in those areas. It HAS, however, left the law-abiding residents of those areas at a severe disadvantage in the ability to protect themselves against criminals. As the son of a veteran, as someone who has friends in law enforcement, I have seen what happens when people are unable to defend themselves. I encourage you to make a stand *against* this irrational punishment against law abiding citizens and vote *against* this insane legislation.

Rather than expanding previously failed legislation that won’t curb violence, but will affect law-abiding gun owners, I urge you to support legislation to enhance school security and improve our nation’s ailing mental health system. We don’t have an issue with guns in this country… we have an issue with crime, punishment, and recidivism in this country. Address that issue.

Please use sanity and reason and stop these affronts to the Second Amendment. Thank you for your time in reading this.

Setting up mail support in your Grails application

At some point in your Grails application development you’ll find yourself invariably needing your application to send mail.  With the Grails mail plugin, it’s a snap.  Essentially the mail plugin is a wrapper to configure a Spring MailSender instance.  And the Spring MailSender is a wrapper to the JavaMail API. As long as you know about these libraries and implementation details, using Grails mail is pretty straightforward.  First start by adding following dependency reference to your plugins section of your project’s BuildConfig.groovy file:

 
    plugins {
        //.. other plugs 
        compile ":mail:1.0.1"
    }

You can also use the “standard” approach to install the plugin as well:

grails install-plugin mail

Next you need to configure the mail plugin to know what smtp server to use in Config.groovy:

 

grails {
    mail {
        host = "mail.yourdomain"
        port = 25
        props = ["mail.smtp.from":"david.orrissjr@yourdomain"]
    }
}

The ‘props’ section can be populated with any of the properties defined in the JavaMail API to leverage the various SMTP features.  Take note to be very careful with them and read the RFCs on the SMTP protocol before you attempt to use something you aren’t familiar with.

Finally a simple call in your controller to the sendMail method that you provide a closure for is all that’s needed to send an email.

 
class MailSendController {

    def sendMessage () {
        sendMail {
            to "davido@yourdomain"
            subject "Hello from the sendmail plugin"
            body "Hello from the sendmail plugin.  Here's the email you wanted."
        }

        render "EMail sent."

    }

} 

There are plenty of other ways you can leverage the mail plugin as well.  You can find more details on the grails mail plugin page:

http://grails.org/plugin/mail

And the Mail Plugin documentation page: http://gpc.github.io/grails-mail/

To see what other features you can leverage you should also read about the JavaMail plugin itself and the SMTP properties that can be set in the JavaMail session object.  You can find out more about that subject here:

http://javamail.kenai.com/nonav/javadocs/com/sun/mail/smtp/package-summary.html

Grails and Legacy Data – Composite Keys in your Tables

When developing a Grails app, you don’t always have the luxury of using GORM (the Grails ORM) ‘out of the box’ against new schemas. Sometimes you just have to work with legacy data as you get it with little modification (if any). Today I’m going to show some of the tricks/traps for working with legacy data when creating a new grails application. There are a few pitfalls that aren’t well-documented with the help of this article you should be able to avoid them.

Mapping Metadata to your Domain Class

GORM is really powerful, but it imposes its own “world view” on table and metadata structures. That can be fine when you start from scratch on a new application. But what happens when you have data that doesn’t match that world view? You could consider revising the table structure and impact all of your other applications. Or you can simply structure your Grails domain class to fit the data you’re working with.

Consider the following table. For this example I’m using MySQL but any popular SQL server  would work:

CREATE TABLE `application_config` (
  `CONFIG_NAME` varchar(128) NOT NULL,
  `KEYNAME` varchar(128) NOT NULL,
  `VALUE` varchar(1024) NOT NULL,
  `DESCRIPTION` mediumtext,
  `LAST_UPDATED` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `VERSION` decimal(10,0) NOT NULL DEFAULT '0',
  PRIMARY KEY (`CONFIG_NAME`,`KEYNAME`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8

This looks simple enough, but Grails will puke on it if you try to use it as-is for a couple of reasons:

  • GORM wants an auto-incrementing large integer field called ‘id’ to be the primary and unique key for the table. A primary key is required by GORM and quite frankly you shouldn’t even bother doing work in SQL databases if you’re not going to use them.
  • GORM also wants a version field for managing changes via optimistic locking. This isn’t a requirement, but I’d strongly recommend adding this field to your tables. Even a simple non-null field defaulting to a value of ’1′ would be sufficient and your grails app will be more robust for it.

According to the Grails documentation there is support for Composite Primary Keys.  From their website:

GORM supports the concept of composite identifiers (identifiers composed from 2 or more properties). It is not an approach we recommend, but is available to you if you need it.

They aren’t kidding.  They not only don’t recommend it but they don’t document very well how to do it, either.

First step is to create your domain class.  For this we’ll call it AppConfigInfo:

grails create-domain-class AppConfigInfo

After being greeted with your empty domain class, lets start adding the data members that will be mapped to the database:

class AppConfigInfo implements Serializable {
	String configName
	String propertyName
	String propertyValue
	String description
	Date updated

	static constraints = {
    }
}

I’ve added the reference to implements Serializable because as we add the rest of the mapping information to the class serialization will be required.

The next thing we need to do is configure constraints for the table.  While not required I’d strongly recommend it.  This way you don’t have issues with your primary key having blank entries.

/*
 * basic constraints to specify the field order. needed when
 * views are generated for the controller
 *
 */
 static constraints = {
	configName (blank:false)
	propertyName (blank:false)
	propertyValue (blank:false)
	description (maxSize:80)
	updated()
 }

Now we’ve enforced basic input validation, but we still need to map the data attributes of this class back to the columns in the table. That’s what the mapping block is for:

/*
 * this mapping configures the columns to match up to the legacy
 * database table.
 */
static mapping = {
	table 'APPLICATION_CONFIG'
	// this line will disable the version number support required
	// for GORM optimistic locking.  comment out or remove
	// if you want to support locking (recommended, not required)
	version false
	id composite:['configName','propertyName']
		
	//maps the columns to the properties in the domain
	columns {
		configName column:'CONFIG_NAME'
		propertyName column:'KEY_NAME'
		propertyValue column:'VALUE'
		description column:'DESCRIPTION', type:'text'
		updated column:'LAST_UPDATED'
	}
}

 

Note the columns block above. That’s the final piece for the mapping. With that block, grails knows which fields will be mapped to your legacy table. That leaves us with only a couple other lines tasks left. We need the code to handle the field called updated and the code to return the composite key to your controller. Also if you have two different fields for creation and update timestamps instead of one, you can skip the handling code below and just write the code that returns the primary key:

//if you have separate columns for created and updated timestamps
//you can skip this code and map the above columns accordingly
//most of the time in my experience, schemas have only one column for this
	
def beforeInsert = {
	updated = new Date()
}
	
def beforeUpdate = {
	updated = new Date()
}
	
def getPK() {
	["configName":configName, "propertyName":propertyName]
}

At this point if you got the idea that you could just generate a controller and use the built-in dynamic scaffolding like this to test out the design so far:

class ConfigureController {
    def scaffold=AppConfigInfo
}

It’ll sort of work, but you’ll have some hiccups. For example: you will be able to create new records like this

Grails Create Screen1

But you won’t be able to edit the entry because the scaffold only recognizes the GORM model of using the standard ‘id’ unique key. Note the empty column for ID:

Grails List Screen1

This fix for this requires generating the full set of views and the fully implemented controller. From there we can modify the views and controller to do what we need. Besides, you’d never actually use the dynamic scaffolding for any real work, anyway

grails generate-all AppConfigInfo

There’s a few other things that have to be updated also. We’ll have to replace the code that supports the GORM id field with code that enables the use of our composite key. When you try to start your application, list will work but clicking the ‘Details’ link generate exceptions like this:

Error 500: Executing action [show] of controller [example.AppConfigInfoController] caused
 exception: groovy.lang.MissingMethodException: No signature of method: example.AppConfigInfo.getPK() 
is applicable for argument types: (org.codehaus.groovy.grails.web.servlet.mvc.GrailsParameterMap) 
values: [[propertyName:english.language.error.expired.password, configName:I18N, action:show, 
controller:appConfigInfo]] Possible solutions: getPK(), getId(), get(java.lang.Object), 
getAt(java.lang.String), getAll(), getLog()

On the bright side, create may just work for you immediately so that’s at least one area you’ll be able to leave alone. Fortunately, Grails actually is attempting to give you a hint on how to resolve this as well with the following line:

Possible solutions: getPK(), getId(), get(java.lang.Object), 
getAt(java.lang.String), getAll(), getLog()

The use of get(java.lang.Object) is the hint. Note that your controller for the ‘show’ action has a line like this:

def appConfigInfoInstance = AppConfigInfo.get(params.id)

In order to leverage the composite key we’ll need to modify two files, the controller and the views for the show and list actions. First change your controllers show action to something like this:

def appConfigInfoInstance = AppConfigInfo.get(new AppConfigInfo(params))

This fulfills the contract suggested by grails stacktrace.

Next the view for the list action (list.gsp) has to be modified so that we can click on the “Details” link and correctly load the show action. Modifying the line shown below is the trick:

<g:each in="${appConfigInfoInstanceList}" status="i" var="appConfigInfoInstance">
    <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
    
        <td><g:link action="show" id="${appConfigInfoInstance.getPK()}">Details</g:link></td>
    
…

</g:each>

Changing the id attribute to a params attribute bridges the gap to the controller:

<g:each in="${appConfigInfoInstanceList}" status="i" var="appConfigInfoInstance">
    <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
    
        <td><g:link action="show" params="${appConfigInfoInstance.getPK()}">Details</g:link></td>
    
…

</g:each>

Next, we need to modify the views for Edit and Delete. Let’s tackle Edit first. GORM supports optimistic locking via a numeric “version” field for tables that are set up to support it. For this demo we’ve disabled it. So change edit.gsp from this:

<g:form method="post" >
    <g:hiddenField name="id" value="${appConfigInfoInstance?.id}" />
    <g:hiddenField name="version" value="${appConfigInfoInstance?.version}" />

To this:

<g:form method="post" >
    <g:hiddenField name="id" value="${appConfigInfoInstance.configName}" />
    <g:hiddenField name="value" value="${appConfigInfoInstance.propertyName}" />

To complete the change we also need to the show.gsp view:

<div class="buttons">
    <g:form>
        <g:hiddenField name="id" value="${appConfigInfoInstance?.id}" />
        <span class="button"><g:actionSubmit class="edit" action="edit" value="${message(code: 'default.button.edit.label', default: 'Edit')}" /></span>
        <span class="button"><g:actionSubmit class="delete" action="delete" value="${message(code: 'default.button.delete.label', default: 'Delete')}" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');" /></span>
    </g:form>
</div>

To reflect the composite key as shown:

<div class="buttons">
    <g:form>
        <g:hiddenField name="id" value="${appConfigInfoInstance.configName}" />
        <g:hiddenField name="value" value="${appConfigInfoInstance.propertyName}" />
        <span class="button"><g:actionSubmit class="edit" action="edit" value="${message(code: 'default.button.edit.label', default: 'Edit')}" /></span>
        <span class="button"><g:actionSubmit class="delete" action="delete" value="${message(code: 'default.button.delete.label', default: 'Delete')}" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');" /></span>
    </g:form>
</div> 

For the sake of completeness I’ve also included the sample code from my application here. This application was built in SpringSource Tools Suite – if you use the same toolset you should have no problem importing it and playing with it.

AppConfigTool.zip

Grails is a powerful framework, geared toward maximizing web application productivity in the Java ecosphere. With a few adjustments you can leverage this powerful framework in a variety of situations.

Reversing a String in Java

Today I’m going to go ‘back to basics’ a bit and talk about string manipulation in Java. In particular, let’s talk about reversing a string. Something that is taught in every 100-level computer science class. The premise is simple enough. Take a string as input, return a string with the sequence of letters reversed.

So that means:

FOXTROT

Is turned into:

TORTXOF

Reversing a string is simple enough: Starting from the end of the source string take each character and append it to a new string. When you have reached the beginning of the source string return the result. It’s the approach you take that determines if you really know your Java coding, however.

In Java, the String object is immutable. This means that you cannot change it. And making a ‘change’ to a string actually creates a new string and disposes of the old one. Consider the following:

	String input = "FOXTROT";
	String s = "";

	for (int i= input.length(); i > 0 ; --i ) {
		s = s + input.charAt(i-1);
	}

Or rather what the Java compiler will actually turn the above code into:

	String input = "FOXTROT";
	String s = "";

	for (int i= input.length(); i > 0 ; --i ) {
		s = (new StringBuilder()).append(s).append(input.charAt(i-1)).toString();
	}

(Be thankful you don’t actually ever have to write that out yourself)

New strings are created for each iteration. One that will include all the characters from the previous iterations plus a new string that represents the current letter in your input variable. The previous version of the string and the character that was converted into a string are flagged to be garbage collected until the final result, “TORTXOF”, is created.

So you might think that’s not so bad. Just a few bytes, right? But if you do something like this when you’re parsing files with thousands of lines of text, it can add up fast. And when you build up a lot of objects for flagging for garbage collection you cause the JVM’s garbage collector to invoke more often, affecting your performance of your software and the scalability of the software you’re creating.

A more memory-savvy approach is to leverage the StringBuilder class. You can also use the StringBuffer class, which is synchronized and used if you need to write something that is thread-safe (which is a completely different topic). StringBuilder, since it’s not synchronized, has the benefit of also being faster.

So taking this into account the above code would look something like this:

	StringBuilder sb = new StringBuilder();
	String input = "FOXTROT";
	String s = "";

	for (int i=input.length(); i > 0 ; --i ) {
		sb.append(input.charAt(i-1));
	}
		

	s = sb.toString();

In this example, we’re down to two string objects: One for the input and one result. Far less GC will occur. Less overhead and work for the JVM and better scalability for your application.

The complete class shown for this example is below. Java is definitely a language that’s geared toward programmer productivity. But learning *how* the Java language itself works makes sure that you leverage it for maximum machine productivity as well.

package com.codethought.java101;

/**
 *	Simple string reverse utility class.  If you want to learn more about all the fun
 *  things you can do with String manipulation in Java I've provided the link below.
 *
 *  Note the use of a StringBuffer.  Strings are immutable.
 *  Meaning that if you change one - say by catenation - the previous version gets
 *  sent off to GC (garbage collection).  To minimize impact to GC, StringBuilders 
 *  can be used to create the string you need (since they're mutable).  When you 
 *  are done, you just call toString() on the builder and call it good.  You can find more out
 *  at:
 *  
 *  http://docs.oracle.com/javase/tutorial/java/data/manipstrings.html
 *  http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/StringBuilder.html
 *  
 *  @author David Orriss Jr
 */

class StringReverser  {

    /**
     * Reverses the string given to it.  
     * 
     * @param 	input 	the string to be reversed
     * @return null if null string is sent, the exact input for short strings, or the reversed string
     */
	public String reverse (String input) {
		StringBuilder sb = new StringBuilder();
		
		//defensive coding in the event someone tries to use a null string
		//you could also just let an NPE trigger.  personal choice
		if (input==null) {
			return null;
		}
		
		if (input.length()<2) {
			return input;
		}
		//strings are zero-based (see referenced docs for details).
	    //subtract 1 in the call to charAt, decrement to 'step back' 
		//down thru the string.
		for (int i=input.length(); i > 0 ; --i ) {
			sb.append(input.charAt(i-1));
		}
		
		return sb.toString();
	}
	
}

Ruby 1.9, TextMate and Segmentation fault errors

While tinkering with Ruby 1.9 in TextMate I found that Ruby was segfaulting on the TextMate Ruby Bundle output screen.

/Users/codethought/Applications/TextMate.app/Contents/SharedSupport/Bundles/Ruby.tmbundle/Support/RubyMate/catch_exception.rb:16: [BUG] Segmentation fault
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.0]

Turns out you can fix the error yourself… as I found at rubyflow.com

http://www.rubyflow.com/items/6795-solution-to-ruby-1-9-3-segfaulting-when-using-textmate-ruby-b

To quote here:

Edit the catch_exception.rb file in your Ruby bundle in TextMate. To get into it on my machine I had to do:

mate Applications/TextMate.app/Contents/SharedSupport/Bundles/Ruby.tmbundle/Support/RubyMate/catch_exception.rb

Then, comment out the require “cgi” line. And then remove all references to CGI::escapeHTML.

But a simpler way is to go is to download the change that someone else made from github and install it yourself.

https://gist.github.com/1354592

And put the new version catch_exception.rb in the following directory yourself:

Applications/TextMate.app/Contents/SharedSupport/Bundles/Ruby.tmbundle/Support/RubyMate/

And your problem will be resolved.

Getting Started with Grails

Grails is an open-source, rapid web application development framework that provides a super-productive full-stack programming model based on the Groovy scripting language and built on top of Spring, Hibernate, and other standard Java frameworks.

At least that’s what the marketing hype says.

My take – Grails is an open-source answer to Rails for the Java Enterprise crowd.  It’s got all the flexibility of Ruby on Rails with the added benefit of being able to quickly leverage Java SDK resources from within the underlying language (called Groovy).  I’ve recently been working with Grails and a can say it’s an excellent platform for rapidly developing web front-ends that can work with your existing enterprise infrastructure.  Even better, it can work with almost seamlessly with your current/legacy Java application codebase.  But the trick to all of this is getting started.  The available documentation that you find online could be FAR better (and I’ll talk about that in other posts) but here are some resources and books that I’ve found to be excellent starting points.

Programming Groovy: Dynamic Productivity for the Java Developer

by Venkat Subramaniam

Vslg To become proficient at Grails, you need to understand the Groovy Programming language, it’s constructs, and it’s importance in contrast to the Java ecosphere. Dr. Subramaniam’s book provides an excellent foundation and starting point. I’ve kept the printed edition in my backpack with me and refer to it regularly. I’ve found the information and insights Dr. Subramaniam provides to be invaluable.You can order the printed and PDF book editions at the Pragmatic Programmer’s Website:


http://pragprog.com/book/vslg/programming-groovy

Getting Started with Grails, Second Edition

Scott Davis & Jason Rudolph

LandingPageCoverSo you’ve started reading about Groovy, but you need to find out more about Grails… This book is the next logical step in that progression. Davis’ and Rudolph’s book provides a step-by-step example showing how to create a basic application (called Racetrack) that takes you along the same development lines that the Depot application in the Dave Thomas/David Heinemeier Hansson Rails book does. You’ll learn how to leverage the underlying Hibernate layer via GORM (Grails Object Relational Mapping), connecting to external databases, the basics for developing robust MVC-based applications using GSP and Grails controllers, implementing basic security and user authentication, and working with the vast plugin library available to Grails developers. The best part is you can the book is in a “try before you buy” model. You can download the book for free from the InfoQ website, and if you find you like the book and find it useful, you can support the author’s efforts and buy a print version. I found the book valuable and was able to get a basic version of an application completed for a project in a day after working through the Racetrack example.

http://www.infoq.com/minibooks/grails-getting-started

The Groovy Language Homepage

Before you can do Grails – you need to get Groovy. Go here and get your Groove on.

http://groovy.codehaus.org/

The Grails Quick Start

Get grails direct from the source at Grails.org. If you want to spin up a Grails application and you are familiar with Ruby and Rails – this will get you going fast. Be sure to read the Installation section for getting the Grails environment configured and running before you use the Quick Start or you’ll get nowhere fast.

http://grails.org/Quick+Start

New Hosting Provider…

If you noticed an interruption to the blog or trying to email me it’s because I just changed all of my hosting and domain management to godaddy.com.  Now I’m not getting paid by them and I’m not going to post some ‘affilate link’ to them where I get a bonus if you sign up for service with them.  But what I AM going to say is that they’re probably the best hosting provider I’ve used since my original provider was bought.  Their prices are outstanding, their hosting feature set is excellent (they support WordPress, Ruby/Rails, and pretty much everything except Java/Tomcat/J2EE servers) and their technical support thus far has been second to none.

If you are looking for hosting or if you feel like you might be paying too MUCH for hosting (I certainly was) then I recommend you check out godaddy.com.  It’ll be worth your time.  It certainly was worth mine!

 

 

ADT and the ‘Debug Certificate Expired’ Error

Ran into this just this morning. I started up my Eclipse for Android environment and had all my projects greeting me with the error; “Debug certificate expired on 10/1/2011″. It’s an easy enough fix.

Delete your debug certificate under ~/.android/debug.keystore (on Linux and Mac OS X); the directory is something like %USERHOME%/.androidon Windows.

The Eclipse plugin should then generate a new certificate when you next try to build a debug package. You may need to clean and then build to generate the certificate.

Problem solved.

I’m writing this with tears on my eyes !!!

Does that title sound familiar? My wife and I got an email this morning from my father that read as follows:

Subject: I’m writing this with tears on my eyes !!!

Hello,

I’m sorry for this odd request and I’m writing this with tears on my eyes due to the situation of things right now, I’m stuck in London United Kingdom with my family,we came down here for vacation and we got Mugged at gunpoint, worse of it is cash cell phone and credit cards were stolen , it’s such a crazy and terrifying experience for us, we need help sort out our hotel bill and flying back home, the authorities are not being 100% helping us, but we thanks God we still have our passports, Our return flight leave today,But we still have problem in sorting out the hotel bills.Please help us i promise to refund it back.

Now I’m freaked out.

David.

There were two problems with this email:

  1. My father doesn’t write like he barely understands english. In fact he’s one of the most eloquent writers I have ever known and is a native speaker of the Queen’s English.
  2. My father lives 12 miles away and has no travel plans

Turns out this is happening to a surprising number of people. It’s a growingly common scam. It’s also happened to a friend of mine. Apparently there is a keystroke-logging trojan that’s in the wild. Virus scanners like F-Prot, and current Mal-ware scanners are not detecting it and it’s causing a lot of havoc:

  1. http://articles.cnn.com/2010-03-28/opinion/greene.email.scam_1_e-mail-first-byline-subject-line
  2. http://community.ca.com/blogs/securityadvisor/archive/2010/04/15/beware-of-scam-emails-i-m-writing-this-with-tears-in-my-eyes.aspx
  3. Google Support

If you see an email like this from any of your friends… CALL THEM before you decide to try to send money to them. Also, if you get an email like this from your friends, tell them to UNPLUG THEIR COMPUTER from the internet.. erase it completely and RE-install windows.

You could also tell them that perhaps they should consider buying a Mac… Because in 4 years of owning and using them I have yet to have them compromised by trash like this.