About Me: Jawaad Mahmood: 30, Muslim, Canadian, freelance, doing consulting in Tokyo, Japan.

LOL: Implementing “Margins” on an old Docomo phone.

March 11, 2010

Docomo phones don’t recognize margins and are irritating as hell to program for.

The odd thing is that they do recognize table widths.  As a result, you can make the following horrible code (that “DOEZ THE JOB”)

<BODY>
<table>
<tr>
<td width=”(left margin)”></td>
<td>(whatever)</td>
<td width=”(right margin)”></td>
</tr>
</table>
</BODY>
Hey don’t look at me; I haven’t used Tables since y2k.
Comments (0)

Email Validation in Google App Engine

My current project is building a mobile website for Japanese cellphones that can stand about 10-20k hits within an hour without getting completely trashed.  Admittedly, this isn’t exactly the easiest thing in the world to do, but Google App engine makes it a lot easier.  In the process, I had to brush up on my Python, and in particular, email validation.

The obvious way to deal with email validation is to use google’s “mail.is_email_valid” function.  Unfortunately, this seems to return true as long as you have a string, as it mentions on Aral Balkan’s helpful post on the subject.  I had to dig a little more to find out how to use mail_re; here’s the code for anyone curious.

from django.core.validators import email_re
print (email_re.match(‘test_email@fakedomain.com’) != None)
print (email_re.match(‘bademail’) != None)
Seems to work properly.
Comments (0)

N00b problems with Appengine

March 9, 2010

This problem was stupid, but I’m sure I’m not the only one who is going to run into it :ouch:

Status: 200 OK
Content-Type: text/html; charset=utf-8
Cache-Control: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Content-Length: 3

If you are getting the above message after the output you intended, it is because you are using “print” instead of “self.response.out.write”.   :sick: :ouch: :grr:

Comments (0)

Archives 
March 2010 February 2010 January 2010 December 2009 November 2009 October 2009 August 2009 July 2009 June 2009 May 2009 April 2009 March 2009 February 2009 January 2009 December 2008 November 2008 August 2008 July 2008 June 2008 May 2008 April 2008 March 2008 February 2008 January 2008 December 2007 November 2007 October 2007 July 2007 June 2007 May 2007 April 2007 March 2007 February 2007 January 2007 December 2006 November 2006 October 2006 September 2006 August 2006 July 2006 June 2006 May 2006 April 2006 March 2006 February 2006 January 2006 December 2005 November 2005 February 2005 December 2004 November 2004 October 2004 September 2004

Creative Commons License
All text and images under 1024 x 768 pixels on this site are licensed under a Creative Commons Attribution 3.0 Unported License.
I require a link back to the original page of the article/image. If the image/article
is not public (IE: It is not present in an article on the blog), you may not reproduce it without permission.