Notifo kicks ass.

Saw Notifo on Hackernews and fell in love. It solves all my irritating headaches when making web apps (mainly that I need access to notifications and can’t do it without a simple free app installed).

I made a quick PHP class for using with Notifo. Give it a whirl if you want to.

Notifo PHP Class (Version 1.01, thanks to Ethan and Michael!)

Be sure to include it; then try this:

$a = new Notifo();
try {
$a->subscribe_user(‘username’);
$a->send_notification(‘username’, ‘message’, ‘title’, ‘URL’);
}
catch(Exception $e){
echo “You had an error; {$e->getMessage()}”;
}
Be sure to catch exceptions, there are bound to be quite a few when you get up and running.

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

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.

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.

N00b problems with Appengine

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

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: :o uch: :grr: