May 142012
 

It is always interesting when you find new features of a tool you use every day that you just never explored or knew existed before. Especially when they make your code navigation and work-flow better.

My favorite find this week is the go-to-file function which searches your entire project path for file names matching your input while also accepting wild card strings. *.install for instance. (Drupal anyone?) The default key binding is ctrl-shift-o to get the dialog, simply type your search string and hit enter to open your file. I like to avoid excessive back and forth from the keyboard to the mouse so anything that keeps me on the keys is a good deal.

Netbeans Go To File feature

Netbeans Go To File feature

In a similar aspect, I’ve recently worked more in vim than days past and started actually enjoying some of its features. Skipping the editor flame war, if you don’t like vim then don’t install the jvi plugin. If it turns out it IS your thing, then definitely check out jvi. It has some kinks and features being worked on but I haven’t had it affect anything yet. I enjoy it for the vim style home-key navigations alone as well as the regex search and all your standard vim goodness.


May 142012
 

Drush is an essential command line tool for Drupal development. Drush favorites include quick and easy cache-clear via drush cc all and checking up on barking watchdog messages via drush watchdog-list.

A lesser-known, yet incredibly useful Drush command is drush eval. This command provides the ability to call Drupal functions that live inside modules from the command line.

As a practical example, consider a module function that implements hook_cron. This function is called whenever cron is scheduled to run, along with all other functions that implement hook_cron. What if you just wanted to call one particular module instance of hook_cron outright, outside of the normal cron schedule, and without triggering all other scheduled cron functions? Drush eval can help.

 /* implements hook_cron */ module_name_cron(){ $arg = 'foo'; module_name_scheduled_task($arg); } function module_name_scheduled_task($arg){ echo $arg; } 

From the command line, call module_name_cron via drush eval. Note the single quotes around the code portion of drush eval.

 drush eval 'module_name_cron();' 

 

Or, alternatively, call module_name_scheduled_task() directly with an argument. Note the single quote and double quote distinction.

 drush eval 'module_name_scheduled_task("hello world"); 

This statement prints “hello world” on the command line.

Drush eval can run command line php with multiple statements, too.

 drush eval '$condition = true; if($condition)echo "true\n"; else echo "false\n";' 

This statement prints “true” on the command line.


Apr 132012
 

Email marketing is a great way to target prospects and provide your current clients information of value and special offers. The associated costs with sending out an email campaign dwarfs in comparison to direct mail initiatives and offers a much greater ROI. While there are many facets to a successful email campaign, the list below attempts to provide a broad overview of items to take into consideration while coordinating your email marketing campaign.

 

  1. Build Your Own Email List– Integrate a Newsletter Subscription form into your website that is visible in a consistent location on each page of your site. Provide the visitor an incentive to subscribe to your email list by informing them they will receive news updates and special offers available only to newsletter subscribers. Build trust from your subscribers with a transparent opt-in process, not one that is pre-checked during a process (like making a purchase) that a visitor must complete while on your website.It may be tempting to purchase a list of email addresses from a third-party, but in most cases this can result a large number of unqualified addresses or the recipient may feel that they are being spammed. There are certainly instances when renting a list from a third-party to send out an email blast is well warranted. For example, if your target recipients are financial advisors, consider reaching out to a publisher that specializes on that topic. However, make sure you understand the difference between List Rental and List Buying. There is a clear difference when purchasing a list of emails from a clearing house in which you are provided an actual list for you to retain, than a service which send the email for you and you never see the list. For more on the topic of List Buying and List Rental, check out this article from Email Marketing Reports.
  2. Designing Your Email – There are many considerations to take into account when designing your email; your company’s brand attributes, pixel dimensions, preview panes and last but certainly not least, a well constructed relevant message. Just like a business card, brochure or website, an email is an extension of your brand. Brand recognition takes time to build and sending an email that does not include your brand’s attributes will cause an immediate disconnect.
    • As a general rule of thumb, the width of your email should be no wider than 600px
    • Build your email using tables. Yes, I said it… tables. Using tables will give you much greater control over your display as most email clients do not support a CSS layout.
    • Use nested tables to help with padding and margins as they can be rendered a bit quirky by email clients
    • Make it easy for readers to skim your message by formatting Headlines and Sub-Headlines
    • Prioritize what content is most important and make sure it is displayed
    • Use inline CSS instead of using and external stylesheet to add style to your message (a great reference guide to CSS support in email can be found at Campaign Monitor)
    • Keep in mind that not all CSS declarations will work in an HTML email. For example, background images will not display in some email clients.
    • Use a limited number of images to help reduce load time
    • Be sure to have your organization’s name and logo visible in the valuable real estate of the preview pane to help readers make an immediate association
    • Be sure to provide an alternative way for readers to view your email by adding a link to a web page version of the message
    • Make sure to provide an opt-out button with your company contact information at the bottom of the email
    • Send a plain text version of your email for subscribers who block HTML formatted emails
    • If you are new to designing HTML emails, try starting with a free template.
  1. Design for the Preview Pane– When designing your HTML email, take the preview pane into consideration. Many people who receive their emails in a program like Outlook, Eudora, Thunderbird, Entourage or Mail view the message in a preview pane. The content that appears in this limited viewing area should be your most important to help draw the readers attention.The preview pane can be vertical or horizontal, and in most cases will not show images unless the user decides they want to view them. This means that if your text is contained in an image, the recipient won’t ever see it unless they decide to download the images. If your text must be embedded in an image to get that fancy special effect, use an ALT Tag with relevant text. Then, when the message is previewed, the recipient can read what the message may contain instead of viewing only an image placeholder. For more information about designing emails for the preview pane, check out this article.
  2. Include a Call to Action – If the goal of your email is to make a reader to take action, make sure your message contains a clear call-to-action. Offer the reader a reason to click and take the next step by providing an incentive like a discount on a product or a downloadable relevant case study via a landing page.
  3. Content – When considering what type of message you want to send to your subscribers, make sure it’s something that provides them value. Avoid self-serving emails that only promote your business or product. When you offer your readers information that they perceive as something of value, they are more likely to be continued subscribers. Offer insight on topics that your readers find interesting. This will help establish your organization as a quality source for reliable information and helps position you as a knowledgeable leader on the topics discussed. Also, be sure to keep your message short and to the point, nobody wants to read a longwinded email.
  4. Email Message Formatting – Competing for attention in an email inbox is tricky business due to the sheer volume of emails that many receive on a daily basis. Here are a few suggestions to help your message be read.
    • Make sure your subject line is related to the content in your message
    • Instead of using a generic “from” email address like info@foo.com, use a person’s name from your company like jane.doe@foo.com.
    • Avoid using language like “Win a Free iPad” or, “Take this Short Survey”
    • Do not use excessive punctuation and special characters
  1. Landing Pages– Now that the user has read your email, what steps do you want them to take next? If you included a compelling call-to-action to engage your readers as suggested above, direct them to a landing page that offers more information on the topic discussed in your email.Let’s say you offered your readers a free case study available for download through a landing page on your website. In most cases, you may not have much information about the subscribers on your email list. A landing page provides the ability to collect more information that your company or organization can leverage for future marketing. Take this opportunity to gather data about your prospect by asking questions that can be used to target your lead types with content they are most interested in.
  2. Test Before Sending – Create email addresses with multiple providers like Gmail, Yahoo, Hotmail and AOL, and send them each a test to see how your email renders. Since there are numbers of email clients and it can be quite difficult to test them all. This process can become quite cumbersome and can take countless hours. Fortunately there are a few tools that will test the email for you, like litmus. Litmus automates the testing process and allows you to preview your email campaign across 30+ email clients and devices in minutes.
  3. Check Your Spam Score – If you are using one of the many third-party email blast service like MailChimp, Campaign Monitor or Constant Contact, chances are there is a built-in spam checker. Make sure that your email passes the spam score test, otherwise the chances of your message getting caught in a filter will be increased.
  4. Sending Your Blast– The best time to send an email blast depends on your target audience. If your audience is more of the business type, a good time to schedule your email blast is Tuesday morning at 10am. Reason being, most people spend their Monday morning catching up on emails from over the weekend and it can be easy to get lost in the shuffle. Also, sending your message around 10am allows time for people to have settled in to work, get their coffee and start their day. If Monday happens to be a holiday, try sending your email on Wednesday morning.You can also try segmenting your list and sending out tests at different times of the day to compare your open and click-through rates. Going further, if your email list also contains information about where the recipient is located you can segment your list to send at specific times for different locations.

 

In conclusion, there are many factors that must be addressed in order to conduct a successful HTML email campaign. Remember, keep it simple and make sure your message is clear and concise. Provide your subscribers value, include a call-to-action and test diligently. Once the campaign is complete, evaluate the campaign’s analytics and make adjustments where necessary for your next campaign.


Mar 222012
 

We recently installed a plugin for our blog that will allow authors to easily publish teasers from articles to FB and Twitter. Now I just need to get the crew to start writing some meaningful blog entries!

Wordbooker: http://wordpress.org/extend/plugins/wordbooker/

Larry


Aug 102011
 

The MappedEmail class does not take kindly to blank submissions in it’s default form, however with a simple override you can retain all the goodness of the validations built into MappedEmail, while ignoring these requirements if there is no value submitted:

object emailAddress extends MappedEmail(this, 100) {
override def validate = if (this.is == "") Nil else super.validate
}


Jun 302011
 

Open up your preferences, and go to your SBT settings. You want to add this to your VM Parameters: “-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005″

Now to debug, you need to create a new debugging profile of type “Remote”

And make sure that it is running with your sbt debug line ” -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005″, and verify that the settings are set to transport:socket, debugger mode: Attach, and host:localhost on port 5005.

Set breakpoints and enjoy.


Jun 202011
 

Lift provides built in snippets to allow easy pagination of data. Here is a brief reference for the SortedMapperPaginatorSnippet (SMPS henceforth). As you can tell from the name, it specifically allows sorted pagination of mapper data.

The Lift documentation provides more general information on PaginatorSnippets here.

Let’s say you have a snippet called listProducts. You’d like listProducts to display a sorted pagination of all your products, which are stored in your database. Of course, you’ve already created Mapper classes to relate to the data. The very first thing to do is add a couple of imports to your snippet:

import net.liftweb.mapper.{By, OrderBy, MaxRows, Like,Cmp,NotNullRef,NullRef, QueryParam, StartAt, Ascending, Descending}
import net.liftweb.mapper.view.{MapperPaginatorSnippet, SortedMapperPaginatorSnippet}

Now let’s create the paginator.

val paginator = new SortedMapperPaginatorSnippet(Product, Product.createdAt, “createdAt” -> Product.createdAt, “price” -> Product.price) {

}

The first argument sets the mapper class we are querying. The next one specifies the column we want to sort by initially. Finally we have the two columns we will allow the user to sort by. These are actually both part of the third argument, but thanks to scala’s repeated parameters, we can have as many choices as we’d like. The third argument(s) should be pair(s) of column labels [String] and MappedFields.

Now let’s say we want to add some custom query criteria. For example, let’s only return products who have their inStock field set to true. To do this, we must set the constantParams var that is built into SMPS. This variable takes the format of a Seq[QueryParam]. So inside our paginator, add the following code:

var params: List[net.liftweb.mapper.QueryParam[Product]] = Nil
params = By(Product.inStock, true) :: Nil
constantParams = params

The first line sets up the Seq[QueryParam] format of the variable. Then, we set the list to have 2 elements: first is a By QueryParam and second is a Nil. If we had set the variable to just the QueryParam, then Scala would have changed the variable type to QueryParam. By prepending a Nil to the end, it maintains its status as a sequence of elements. The By param takes two arguments. First is the Mapper field to check and second is the value it must be. So in this case, we are checking the inStock is true. Finally set constantParams equal to params. This adds our custom query to the SMPS’s logic.

This is all you need to do to set up an SMPS in a snippet. To add it to a template, you need to bind each page to something in the xhtml. An example of how to do this would be to add this code to the snippet (outside of the paginator!):

def all(xhtml: NodeSeq) : NodeSeq = paginator.page.flatMap(a => bind(“p”,xhtml,”createdAt” -> a.createdAt, “price” -> a.price, “inStock” -> a.inStock))

Paginator creates a “page” that is essentially a list of Products that is sorted and offset based on which page the user has selected. The code above simply binds each product in the paginator.page to some xhtml code. We could use this on a Lift template like this:

<lift:listProducts.paginator.paginate>
<tr><th><sort:createdAt /></th><th><sort:price /></th></tr>
</lift:listProducts.paginator.paginate>

<lift:listProducts.all>
<tr><td><p:createdAt /></td><td><p:price /></td><td><p:inStock /></td></tr>
</lift:listProducts.all>
<lift:listProducts.paginator.paginate>            <nav:first/>            |            <nav:prev/>            |           <nav:allpages/>          |            <nav:next/>            |            <nav:last/>            |            <nav:records/>
</lift:listProducts.paginator.paginate>

Note that all of the tags inside both the <lift:listProducts.paginator.paginate> areas are built into SMPS, which the code inside <lift:listProducts.all> is populated by the custom all function we defined above. Also note that all this can (and should) be customized for your own needs.

A final point about SMPS is that the current sort field, offset, and sort order can all be set by url query strings:

paginatorpage?sort=0 would cause our SMPS above to sort by the createdAt field. sort=1 would cause it to sort by price.

paginatorpage?offset=100 would cause our SMPS’s current page to start at record 100.

paginatorpage?asc=false would cause our SMPS to sort in descending order.

Of course these can be combined such as: paginatorpage?sort=1&asc=true

 

 

 


May 092011
 

Before you start this tutorial, make sure you have the following handy:

  • An email address hosted by Morroni Technologies
    (For this tutorial, we will use info@morroni.com as an example)
  • A username
    (For this tutorial, we will use mor0127 as an example)
  • A password

Once you are ready, go to your iPhone home screen and tap the Settings icon.

In settings, scroll to and tap Mail, Contacts, Calendars

Tap Add Account

Tap Other

Tap Add Mail Account

At this next screen, you will need to enter the name you want associated with your email account. The sample image below uses “Morroni Technologies” but you can enter anything you want.

For the Address and Password please enter the email address and password you were provided with.

Tap Next when finished.

The next step is to set up the Incoming/Outgoing mail servers. First, set up the Incoming Mail Server (IMAP).

  • Host Name: mailserver.morroni.com
  • User Name: Enter the User Name (not the email address!) you were sent by Morroni Technologies. In the sample image below, mor0127 is the user name.
  • Password: Enter the password you were sent.

Now, scroll down to set up the Outgoing Mail Server (SMTP).

  • Host Name: smtpserver.morroni.com
  • User Name: Enter the User Name (not the email address!) you were sent by Morroni Technologies. In the sample image below, mor0127 is the user name.
  • Password: Enter the password you were sent.

Tap Next when finished.
Note: If you get a message saying Cannot Verify Server Identity tap Continue as shown below.

When the Verifying… is finished, you will be greeted with the following screen. Tap Save.
At this point, your iPhone can send and receive messages using your Morroni account.
However, we need to instruct it to use your Morroni Trash, Drafts, and Sent folders instead of sharing with your other email accounts. To do so, first return to your home screen and open the Mail app.

Scroll down to Accounts (not inboxes!).

Note: On the New Account screen from before, there was a Description field. If you made any changes to that field, the description you entered will be the name of the account you want to tap. Otherwise, tap the account that is labelled with your new email address. For the tutorial images, we did not make a change to the Description field, so the Account to select is simply the info@morroni.com email address.
Select your newly created account.
Ensure that under Inbox is a list of email folders as is show below. If the only item listed is Inbox, you may need to tap the refresh icon in the lower left corner of the screen.

 

 

 

 

 

Scroll down and tap Mail, Contacts, Calendars. Tap your newly created account in the list as shown below. Again, it will be labelled with either your email address or, your description if you entered one.


You will arrive at the account settings screen pictured below. Tap the account under IMAP.

Scroll to the bottom of this screen and tap Advanced.

Tap Drafts Mailbox

Scroll to the On The Server list and select Drafts.

Tap the Advanced button in the upper left corner of the screen.
Tap
Sent Mailbox.

Scroll to the On The Server list and select Sent.

Tap the Advanced button in the upper left corner of the screen.
Tap
Deleted Mailbox.

Scroll to the On The Server list and select Trash.


At this point, you are ready to use the iPhone Mail app with your Morroni Email account. Simply press the home button and tap the Mail app to begin!


Mar 112011
 

I’ve been searching for the ideal startup process when building a lift project and I might have just found it!

I am using simple-build-tool(sbt) and two sbt processors.  The processors are:

lifty:  http://lifty.github.com/Lifty/
sbt-idea:  https://github.com/mpeltonen/sbt-idea

Here are the steps:

amore:wheels lmorroni$ sbt
Project does not exist, create new project? (y/N/s) y
Name: appName
Organization: com.morroni
Version [1.0]:
Scala version [2.7.7]: 2.8.1
sbt version [0.7.4]:
...
>*lifty is org.lifty lifty 1.6
>*sbtIdeaRepo at http://mpeltonen.github.com/maven/
>*idea is com.github.mpeltonen sbt-idea-processor 0.3.0
>lifty create project-blank with user
>reload
>update
>idea
>~jetty-run

References:

http://lifty.github.com/Lifty/

https://github.com/mpeltonen/sbt-idea