Niklas Bivald: August 2008 Archives

Head over to shiftosx.com and tell them what you need from their database handler!
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
Recently I've been using mojoPortal for a project that needed to run on ASP/MS SQL. Suddenly, two weeks later, it's started misbehaving. I got an error whenever I tried to upload or download a file from the shared files module.

If you experience the same problem, first step is always to turn on detailed error descriptions in your config file. I got:

read past EOF

And after some digging I found this post on their forum (which is great btw, cudos to them). I needed to empty the index (~/Data/Sites/<yoursiteid>/index

So I removed all the files in the index, the site rebuilt them, and everything worked great.

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...

From the ALA article:

"All but the sweetest of us have said something in a web discussion that was--intentionally or not--demeaning, sarcastic, flippant, or discourse-crushing. I admit it: guilty as charged. Some of us have ugly motivations, posing as experts by acting superior to others, stirring up controversy to get attention, or perhaps being mean-spirited because our mothers decided we'd be bottle-fed. More often, our contributions are inspired by a higher goal: a heartfelt drive for a better web. Even then, however, our passionate responses to others too often sound like whines, jabs, sour grapes, and one-upmanship. We, too, become responsible for the pervasive sense that the web standards world is one long, soul-draining argument.

How can we move beyond this? How can we transform discussion sections on major sites and online magazines from shooting ranges into arenas of collaboration?"

Continue to the article
Name: WebAppers
Domain: http://www.webappers.com/
RSS Feed: http://feeds.feedburner.com/Webappers
RSS Feed Readers: 8856

WebAppers is a site you might want to follow, I would highly recommend it. Their tagline is "Hunting the Best Open Source Resources for Web Developers". They write about new upcoming ("web 2.0") websites, tutorials but also about human relations (their last post was "14 Ways to Learn From Creative Programmers").

Continue WebAppers
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.
I've previously written about AMFPHP 1.9 being in beta 2. For those of you who don't know AMFPHP enables simple communication between (among others...) Flash Media Server and PHP. It is the key to my webcam report system.

If you intend to program in flash (either client side or Flash Media Server) it is good to have atleast a basic understanding of what it means and how you can use it.

GotoAndLearn() has just released two tutorials covering the basics of AMFPHP:

  1. Introduction 1 - "Learn how to install AMFPHP and create a simple service that sends email."
  2. Introduction 2 - shows you "[...] how to directly return database records to Flash using AMFPHP."

All tutorials on gotoAndLearn() are video tutorials. You will find more about AMFPHP on their website.

ALA Survey - a must take

| | Comments (0)

From alistapart.com:

"Last year nearly 33,000 of you took the survey, enabling us to begin figuring out what kinds of job titles, salaries, and work situations are common in our field.

The responses to last year's survey began teaching the world about the previously invisible profession powering its information economy. The responses also taught us what we did wrong in constructing the survey.

This year's survey corrects many of last year's mistakes, with more detailed and numerous questions for freelance contractors and owners of (or partners in) small web businesses. There are also better international categories, and many other improvements recommended by those who took the survey last year.

As we did last year, we will analyze this year's data and publish the results for all to see in an upcoming issue of A List Apart. We will also, as we did last year, provide an "anonymized" version of the raw data, so that the highly motivated among you can do your own number crunching.

Enough talk! Please take the survey and encourage your friends and colleagues who make websites to do likewise. The world is watching."

About this Archive

This page is a archive of recent entries written by Niklas Bivald in August 2008.

Niklas Bivald: June 2008 is the previous archive.

Niklas Bivald: 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.1