I’ve got a new address

Maybe you already noticed, but my blog has a new address:

 

http://AkbarAhmed.com

 

The old links still work, but will redirect to http://AkbarAhmed.com.

Advertisements

Replacing Outlook with Google Apps Email (aka Gmail)

Replacing Outlook with Google Email (aka Gmail for Business) requires proper setup.

In my experience, the most common scenario is for a business to move its email servers to Google, but then completely drop the ball when it comes to setting up the web email client.

Sure, you can simply open a browser, login and there’s Gmail. However, this substantially reduces the probability that users will accept the web-based Gmail client, even though it has substantial advantages.

How to view your email settings

  1. In the top-right corner of Gmail, click the gear icon gear, then click Mail settings.

settings

Notes

  • You will have to view your email settings repeatedly. Gmail automatically closes your settings each time you make a change and click Save. It’s an annoyance, but one that’s easy overcome.

General Settings

  1. Follow the steps above to view your email settings.
  2. Click the General tab.
  3. Set the following options:
Option Value Why you want this setting
Maximum page size Set each options drop-down list to the value shown below.

  • Show 50 conversations per page
  • Show 250 contacts per page
I like to see the maximum number of emails per page. This reduces the next to click next page.
Keyboard shortcuts Select Keyboard shortcuts on. Shortcuts are a key strength of Gmail. Once you get used to them, you’ll find Outlook mouse-intensive.
Browser Connection Select Always use https. If your admin has not set this up by default (which he/she should have), then you’ll want this setting to help secure your business email.
Conversation view Select Conversation view off. This is a matter of personal preference, but if you’re coming from Outlook then you want this setting to ensure that each email is displayed as a separate email. Trust me, conversation view is high on the list of reasons why users reject Gmail.
Desktop Notifications
  • Select Chat notifications on.
  • Select New mail notifications on.
Users have become accustomed to the little popup when a new message arrives. This setting helps preserve this functionality for users.
Signature Create a signature. Personally, I find it annoying to receive emails without a signature. It’s business. Customers, vendors and co-workers may want to contact you.
Attachments Select Advanced attachment features. This makes attaching multiple files easier…but your users need Flash.
  1. Click Save Changes.

Remove Web Clips

  1. Follow the steps above to view your email settings.
  2. Click the Web Clips tab.
  3. Uncheck Show my web clips above the Inbox.

Web Clips are a distraction and really should not be in email.

Enable Labs features

  1. Follow the steps above to view your email settings.
  2. Click the Labs tab.
  3. Set the following options:
Option Value Why you want this setting
Canned Responses Enable Improves email efficiency by using templates for repeat messages.
Default Text Styling Enable Allows users to set fonts.
Google Calendar gadget Enable See upcoming events in the email client. This reduces the need to switch to Calendar
Inserting images Enable Everyone needs to insert images in email. I can’t figure out why Google doesn’t include this as a default feature in the email editor.
Right-side chat Enable Makes initiating chats more efficient as you can quickly see who’s online on the right-side of your email.
Send & Archive Enable You must archive email if you’re going to use Gmail correctly. This button automatically archives each email message that you send.
Signature tweaks Enable This should be a default. However, you’ll want this setting as it’ll put your signature above previous messages in a thread.
Title Tweaks Enable This makes the web browser display the Label (aka Folder) and the number of unread messages in the left of the title. In other words, this features makes it easy for users to see how many unread messages are in their inbox or other Labels.

 

  1. Click Save Changes.

How to setup Labels and Filters (i.e. Folder and Rules in Outlook terminology)

Organizing email is one of Outlooks strongest features. Fortunately, similar functionality is available in Gmail.

Labels (aka Folders)

  1. Follow the steps above to view your email settings.
  2. Click the Labels tab.
  3. Scroll down past System Labels and Circles. You should see a Create new label button.
  4. Click Create new label.
  5. Enter a name for the new label, such as Customer Inc.
  6. Click Create.

Repeat the steps above for each Label that you want to create.

However, you’ll noticed that Labels by themselves are somewhat useless. The real power in Labels comes from Filters.

Filters (aka Rules)

  1. Follow the steps above to view your email settings.
  2. Click the Labels tab.
  3. Scroll down to the bottom of your Filters list.
  4. Click Create a new filter.
  5. Enter your filter rules. For example, you may want to filter all email from @customerinc.com into the Customer Inc Label. To achieve this, enter @customerinc.com in the From textbox.
  6. Click Create a filter with this search.
  7. Check Apply the label, then select a label in the drop-down list. To continue our example, you’d select Customer Inc.
  8. Click Create filter.
  9. Hint: I recommend that you check Also apply filter to ___ matching conversations. This will ensure that all old messages are also displayed in the new Label.

Output XML using Pyramid and Mako

I recently had to connect a .NET desktop application to a web service that was built using Pyramid. My first thought was to use JSONP. However, JSONP is only useful for small amounts of data…and I had a lot of data to send/receive. Obviously, communication via an XmlHttpRequest with JSON was not an option due to limitations imposed by the Same Origin Policy (ref: http://en.wikipedia.org/wiki/Same_origin_policy).

In the end, we chose to use our existing Mako template infrastructure to render XML that the .NET clients could consume. If you’re a .NET developer, then you know that XML parsing in .NET is superb, which is why we went with XML rather than JSON over HTTP.

On the Pyramid side, there were really only 2 steps:

  1. Create Mako templates that would render XML
  2. Set the content type to text/xml

Render XML with Mako

This step was easy, we just created templates that use XML instead of XML.

<?xml version=”1.0″ encoding=”utf-8″?>
<companies>
% if companies:
% for row in companies:
<company>
<id>${row[‘id’]}</id>
<name>${row[‘name’]}</name>
</company>
% endfor
% else:
${result}
% endif
</companies>

Set the Response Content Type

This was also a very easy step. We just set the content_type immediately before the call to return. Importantly, the code below causes Pyramid to return the XML template with a content type of text/xml rather than the default text/html.

request.response.content_type = “text/xml”
return {‘companies’: companies}

Summary

Rendering XML with Pyramid and Mako was exceptionally simple. You can reuse the same view and url, and simply change the the template based on how the view was called.

One last note. You’ll notice that one negative side effect we have not corrected for is the use of \n\r in the rendered XML. This of course bloats network traffic, uses more memory on the client-side (if you’re using a DOM parser), and is all around crappy for all but the smallest of files. Next step will be to create some type of processor to eliminate the newline character.

Naming standards and consistency

I’m a big proponent of keeping a consistent naming standard, even when crossing languages.

True, capitalization and syntax may change, but the standard should remain. Importantly, I have found that naming should play to the strengths of the operating system.

File Names

For example, on every operating system you can sort files by name (i.e. in Windows Explorer on Windows, Finder on Mac, and so on for Linux, etc.). With this in mind, naming should be used for a few key benefits:

  1. Group similar files
  2. Sort files by age/date

Grouping similar files is an important part of naming. For example, say we have a Users feature. We have a basic add, edit, update, delete and list all capability. In this situation, we want to preface our file names with user so that they are all sorted as a group. A good naming standard would be:

File Name Use
users List all Users
user_add Add a User
user_edit Edit a User
user_delete Delete a User
user_update Update a User

Notice how I did not specify a file name as this standard works well for HTML, CSS, JavaScript and Python files. To support other languages, we can simply tweak our standards to support the other language’s syntax, such as Users.vb, UserAdd.vb, UserEdit.vb and so on for Visual Basic.NET.

The above standard is superior to one where we put the action first, such as edit_user or add_user. If we put the action first, then all ‘edit’ files will be grouped together: edit_user, edit_company, edit_project.

The grouped approach is superior as we usually are working on the Users feature, or the Companies module, etc. By using the grouped approach all of our files are naturally and automatically sorted by the operating system.

HTML, CSS, JavaScript and Python

Similar to file names, functions, classes, styles, etc. should be consistently named throughout an application. For example, if we are creating a basic JSON enabled RESTful Web Service with JQuery and a JS library up front, then it’s a huge help to keep names consistent throughout the application (at all layers).

Building on our file names example above, the python def for adding a User should be:

def user_add(request):

Then in JavaScript our class definition would be for User with a User.add() method to save data to the server via basic CRUD Create operation.

User.add({

    name: ‘Bob’,

    age: ’23’,

})

Next, in HTML, we would have a form with a CSS class name that also fits our pattern:

<form class="user_add">

Summary

Consistent naming allows us to leverage built in operating systems for sorting files and reduces developer overhead. It makes it easier for software engineers at all layers to know what is above and below them in the software stack.

A consistent pattern for CSS element positioning

I spend a lot of time switching between different languages and each has a slightly different pattern for element positioning. This often creates the need to pointlessly look up the rotation pattern for each language, which is no doubt a waste of time. To overcome this, I find that using the default pattern for a language consistently is key.

For example, CSS has a different pattern then XAML. However, by reusing CSS’ default pattern it makes our code easier to quickly scan and eliminates needless Google searches (sorry Google).

In CSS, the generic pattern is:

  1. top
  2. right
  3. bottom
  4. left

For example, if I set the padding on an element, then I can control the padding for each of the 4 items above as:

padding: 1px 2px 3px 4px;

That is:

  1. top = 1px
  2. right = 2px
  3. bottom = 3px
  4. left = 4px

So, when define the margin edge offset for positioned boxes, it is beneficial to follow this same pattern.

For example, if we have a positioned box such as <div class=”my_class”>, then we’ll follow CSS’ default pattern as follows:

<div class=”my_class>

Then in CSS:

.my_class {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    bottom: 0;
}

As can be seen above, we specified the 4 margin edge offsets in the same order that CSS uses by default.

The end goal is to improve readability and to maintain consistency in how and where we specify our CSS. In a large web application, this consistency makes it easy to maintain our CSS by ensuring that we can quickly find a property without having to read every line in detail.