Latest Entries

How to build a Growl style

If you answered ‘yes’ read on, if not but you like the one I made you can download it (pardon the zipped .dmg, WordPress doesn’t let you upload .dmg‘s)

Building your own Growl style is quite easy, all you need to know is a little HTML and CSS. Growl has some documentation on their website explaining how to make a style so I won’t bother repeating it here.

My style ended up looking similar to the Smoke style included with Growl with a greater focus on the typography. I was aiming for a clean, light, and ‘easy to ready’ feel without taking up too much screen real-estate. I’d appreciate any feedback you have or ideas on how to improve the design.

Apple Mail Signature Inconsistency

I love using Apple Mail as my default email client on my Mac however there has always been one thing that drove me nuts…signatures.

I was hoping that this issue would be fixed in Lion however I have come to realize it is such a small issue that it has probably gone unnoticed down in Cupertino.

The problem is that Mail adds an inline style to a span element that wraps the signature block. When viewed in Mail everything looks fine but elsewhere things get out of whack.

Here’s the email I sent to dev support.

Request to speak to a developer for Apple Mail.

I would like to know if it is possible to change the behaviour of Mail in regards to a CSS attribute that is written inline for email signatures.

I know that I can easily create a custom HTML signature however I feel that the default behaviour of Mail is not performing as expected.

In the interface for creating an email signature you can ask Mail to match your default message font. This works great when you view a message in Mail however when the message is viewed in Gmail’s browser interface an inline style of font-size: medium is applied to a span element wrapping the signature content, as seen here http://db.tt/7PPUFvL. This element overrides the inherited font-size attribute causing the signature to display at the browsers default font size rather than the intended size when drafted in Mail.

As far as I can tell removing this style should have no effect on how the message is viewed in Mail. I feel this change would make the lives of people a lot easier and improve the consistency between Mail and other email providers.

Please let me know if you need any other information.

Alexander Millar

Here’s a view of the code causing the problem.

I also decided to email Steve because he’s pretty picky on usability so perhaps he could get the ball rolling on this faster.

Hi Steve,

I sent an email to Developer Support about this issue already but I figured I’d send it to you in the off chance you have a minute to send a message down to the dev team for Mail.

Here’s the message I sent to support.

(… truncated developer email…)

Essentially its an easy change and its been driving me nuts for a while now. I figured this is something you would appreciate.

Regards,


Alexander Millar

Hopefully I can get a response back soon, in the meantime I’ll settle with my HTML signature. For those of you reading that have also had this problem your solution for now is to follow one the various guides online, no need to reproduce one here.

iTunes Increase/Decrease Volume Script

I’ve recently moved my speakers to a wireless system through an AirPort Express which has been great expect for one thing, adjusting the volume!

In order to solve this problem I decided to write a simple AppleScript to change the volume within the iTunes application.


#Increase iTunes Volume
tell application "iTunes"
  if it is running then
    set curVol to the sound volume
      if curVol < 100 then
         set sound volume to curVol + 10
      end if
    end if
end tell

and…


#Decrease iTunes Volume
tell application "iTunes"
  if it is running then
    set curVol to the sound volume
    if curVol > 10 then
      set sound volume to curVol - 10
    else
      set sound volume to 0
    end if
  end if
end tell

If you want to do this for yourself simple download my iTunes Volume Scripts and save them to…

/Library/Scripts/iTunes Scripts

Then download and install FastScripts.

In order to make it easy and intuitive to use the scripts we’re going to map them to the F11 and F12 keys. (Basically the same keys you press for Volume Up/Down but you need to press Fn as well)

Go into System Preferences and disable the system defaults for Desktop and Dashboard.


Then go to the FastScripts preference pane.

There you will assign the scripts to run via Fn+F11 and Fn+F12 respectively.

Now you can easily change the volume of iTunes independently of the systems sound level.
Update
After rooting through some of the other scripts provided with the your Mac I noticed a volume adjustment Applescript. The script uses a scale of 16 volume levels rather than 100 so as to match the number of levels on the bezel HUD that appears you adjust the system volume.

So I just changed the older scripts to use this 16 level system and voila!


#Increase iTunes Volume

tell application "iTunes"
  if it is running then
    --Get the current output volume (on a scale from 1 to 100) and convert it to a scale from 1 to 16 as seen when using the volume keys
    set currentVolume to the sound volume
    set scaledVolume to round (currentVolume / (100 / 16))

    --Use this code to increase the volume by a certain interval
    set soundInterval to 1
    set scaledVolume to scaledVolume + soundInterval
    if (scaledVolume > 16) then
      set scaledVolume to 16
    end if

    --After using one of the above, the volume needs to be set to the new level (before which we must convert it back to the 1..100 scale)
    set newVolume to round (scaledVolume / 16 * 100)
    set sound volume to newVolume
  end if
end tell

#Decrease iTunes Volume
tell application "iTunes"
  if it is running then

    --Get the current output volume (on a scale from 1 to 100) and convert it to a scale from 1 to 16 as seen when using the volume keys
    set currentVolume to the sound volume
    set scaledVolume to round (currentVolume / (100 / 16))

    set scaledVolume to scaledVolume - 1
    if (scaledVolume < 0) then
      set scaledVolume to 0
    end if

    --After using one of the above, the volume needs to be set to the new level (before which we must convert it back to the 1..100 scale)
    set newVolume to round (scaledVolume / 16 * 100)
    set sound volume to newVolume

  end if
end tell

I also wrote another script to mute iTunes, which I then mapped to F10


# Mute iTunes

-- get the current mute setting
tell application "iTunes"
  set isMuted to mute
  -- invert it
  set newMuted to not isMuted
  -- and set it back
  set mute to newMuted
end tell

I've updated the original .zip above to reflect the changes.

Reversing a Linked List

In preparation for some upcoming interviews I’ve started going over some standard coding questions. There are tons of example questions over the internet most of them having to do with linked-list, string manipulation, and basic algorithms.

Today’s exercise was to implement a function to reverse a linked list along with the corresponding data structure. I’ve decided to implement this recursively as I find it much easier to conceptualize after spending my early university years working in Scheme.

The recursive algorithm goes as follows;

  • Start at the beginning of the list.
  • Link the next item to the first item (ie. reverse the link)
  • Continue doing this until there are no items left.
  • When we get to the last item change the head pointer to point to it
  • Change the first item to point to NULL (so the list isn’t circular)

We achieve the iterative step of reversing the links via recursion. This happens due to the fact that the current item, ‘the pivot’ is maintained on the stack frame while reversing the rest of the list. When we get to the end of the list we make the head point to the last item and then return it. As the stack unwinds the links reverse and bubble up until we get to the first item in the list upon which point we’re done.
Note that we’re leveraging the side-effect that the assignment operator returns the value of the assignment.

#include "iostream"

using namespace std;

struct node
{
    int value;
    node *next;
};

void printList( node *hd )
{
    while( hd != NULL )
    {
        cout << hd->value << "-->";
        hd = hd->next;
    }
    cout << "[]" << endl;

}

void createList(node *&hd, int size)
{
    node *tmp1, *tmp2;
    tmp1 = new node;
    tmp1->value = 0;
    hd = tmp1;

    for( int i = 1; i < size; i++)
    {
        tmp2 = new node;
        tmp2->value = i;
        tmp2->next = NULL;
        tmp1->next = tmp2;
        tmp1 = tmp2;
    }
}

node * revListHelper( node *&hd, node *piv )
{
    if ( piv->next == NULL )
    {
        hd = piv;
        return piv;
    }
    else
    {
        return revListHelper( hd, piv->next )->next = piv;
    }
}

void revList( node *&hd )
{
    revListHelper( hd, hd )->next = NULL;
}

int main()
{
    node *start_ptr;

    createList(start_ptr, 10);

    cout << "Orignal List: ";
    printList( start_ptr );

    revList( start_ptr );

    cout << "Reversed List: ";
    printList( start_ptr );
}

HTML versus PDF resumes

This morning I decided that it was probably time that I converted my PDF resume (exported from Open Office) to an HTML resume for use on jobmine. I decided to do this mainly because the system doesn’t support PDF resumes. I had originally written a simple HTML page that linked to my PDF resume on Dropbox to get around this.

The problem I have with HTML resumes is that the document is not portable and is easily subject to manipulation or loss of information. I know a lot of employers use tools to scrape applicant resumes and automatically check the data against their position requirements. Although I don’t necessarily agree with this its beyond the point.

Last summer during my co-op term at RIM I had the opportunity to conduct interviews for the next round of co-op students. My boss would print off a copy of their resume that was given to him by HR and we’d review their qualifications. Almost every time the resume would be striped of its styling, squashed, or cut off. This made it extremely difficulty to get a sense of what to ask the candidate and furthermore hurt our initial impression of the candidate.

Submitting PDF resumes not only solves this but makes it easier for the average user to develop a well designed document. It eliminates cross-browser compatibility issues and helps ensure the original message the user intended to convey is preserved.

With all the unknowns and issues arising from HTML resumes why not simplify everyones life and use PDF’s?



Copyright © 2004–2009. All rights reserved.

RSS Feed. Powered by Wordpress and uses modified version of Modern Clix, by Rodrigo Galindez.