Articles and seminars: August 2008 Archives

Some of us does not have a approved SMTP server on our development server, or are working outside the office. So how do you then send email when using Django as your python framework?

The answer is simple: Gmail

You will need:
  • A gmail account
  • Django (of course...)
Open up your settings.py and enter the following information:

EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = '<user>@gmail.com'
EMAIL_HOST_PASSWORD = '<password>
EMAIL_PORT = 587
EMAIL_USE_TLS = True

That's it. Given, you can't use it in your production environment. But it works like a charm during development. And if you need help sending html mail with alternative content (html+txt), check out Ross Poultons article Easy Multi-Part E-Mails with Django
This article  from Smashing Magazine discusses the top 10 usability highs of Mac OS X. It displays a few of the reasons of why I love OS X.

Continue to the article
Tradedoubler is one of Swedens largest ad networks. However, all ads are served over a none secure connection (https). This is fine for regular users, but if you are building a member only site with secure login (https) you are out of luck:

Serving both secure (https, all your content) and none secure (the ads) brings up a IE message asking the user if they want to "show unsecure objects" on the site. Every time the users loads a page. (In swedish: "Denna sida innehåller både säkra och osäkra objekt. Vill du visa osäkra objekt?")

So how do we solve this problem?

Usual Tradedoubler Ad code is something like this:

<script type="text/javascript">
var uri = 'http://impse.tradedoubler.com/imp?type(js)g(<id>)a(<id>)' + new String (Math.random()).substring (2, 11);
document.write('<sc'+'ript type="text/javascript" src="'+uri+'" charset="ISO-8859-1"></sc'+'ript>');
</script>

As you can see, the url is http://impse. None secure. But a little known fact is that tradedoubler ads can also be served over https://tracker.tradedoubler.com. As far as I know there is no difference.

So we do what many organisations do (such as google analytics). We let javascript check if the maste page was served over http and https. Such as this:

<script type="text/javascript">
var tdHost = (  ("https:" == document.location.protocol)   ?   "https://tracker."  :   "http://imp."  );
var uri = tdHost + 'tradedoubler.com/imp?type(js)pool(<id>)a(<id> + new String (Math.random()).substring (2, 11);
document.write('<sc'+'ript type="text/javascript" src="'+uri+'" charset="ISO-8859-1"></sc'+'ript>');
</script>

Simple as that. If it's https it will use https://tracker.tradedoubler.com, if it's http it will use the regular http://imp.tradedoubler.com

The script is hardly perfect, but it works for most purposes. Tradedoubler has been notified of the problem, and hopefully they will implement a solution.

Good luck with your ad serving...
For a while ago I had problem with my OS X. It simply halted when only the spotlight icon is visible. Some searching reveled that this was related to a corrupt font cache.

Gerrit DeWitt describes the problem on Apple Support Discussions:

"The problem is due to a font cache file becoming damaged or being saved incorrectly. I think the situation may be the latter because if you force restart after the hang and restart in single user mode, perform a filesystem check (fsck -fy), then mount the startup disk's filesystem (/sbin/mount -uw /), you'll almost always see a message about orphaned files being cleaned up (deleted). These orphans usually reside in /Library/Caches/com.apple.ATS - the ATSUI typography cache folder. The number of orphans removed should exactly match the number of files listed with an invalid name during the filesystem check. Thus, it may be simply that ATS or Suitcase is writing cache files with invalid filesystem names."

So the quick solution is (for me atleast):
  1. Boot up in single user mode (see this article)
  2. Run a filesystem check (fsck -fy)
  3. Mount the startup disk's filesystem: /sbin/mount -uw /)
  4. Delete the folder /Library/Caches/com.apple.ATS
    by typing: sudo rm -rf /Library/Caches/com.apple.ATS
  5. Restart your computer by typing:
    sudo shutdown -r now
Everything should be solved.

About this Archive

This page is a archive of entries in the Articles and seminars category from August 2008.

Articles and seminars: June 2008 is the previous archive.

Articles and seminars: September 2008 is the next archive.

Find recent content on the main index or look in the archives to find all content.

Powered by Movable Type 4.21-en