Feeds:
Posts
Comments

Archive for the ‘code’ Category

Protected: Test

This content is password protected. To view it please enter your password below:

Read Full Post »

2010 in review

The stats helper monkeys at WordPress.com mulled over how this blog did in 2010, and here’s a high level summary of its overall blog health:

Healthy blog!

The Blog-Health-o-Meter™ reads Wow.

Crunchy numbers

Featured image

A helper monkey made this abstract painting, inspired by your stats.

A Boeing 747-400 passenger jet can hold 416 passengers. This blog was viewed about 12,000 times in 2010. That’s about 29 full 747s.

 

In 2010, there were 22 new posts, not bad for the first year! There were 14 pictures uploaded, taking up a total of 2mb. That’s about a picture per month.

The busiest day of the year was November 14th with 944 views. The most popular post that day was Making your webapp react to emails with Lamson, pt 1.

Where did they come from?

The top referring sites in 2010 were reddit.com, totallysynthetic.com, chemistry-blog.com, coronene.com, and friendfeed.com.

Some visitors came searching, mostly for python imap, python gmail imap, nitrogen triiodide, python imap gmail, and gmail imap python.

Attractions in 2010

These are the posts and pages that got the most views in 2010.

1

Making your webapp react to emails with Lamson, pt 1 November 2010
1 comment

2

Python Gmail IMAP : part 4 January 2010
11 comments

3

Python Gmail IMAP : part 1 January 2010
5 comments

4

Python Gmail IMAP : part 3 January 2010

5

A Chemistry Fraud Roundup February 2010
17 comments

Read Full Post »

This is part 2 in a series, here is part 1.

In the last section, you should have got Zed Shaw’s LamsonProject running successfully through its unit tests.

Now I’ll show you how to make what maybe the *simplest* application with Lamson that you’ll ever see. All our application is going to do is:

  1. Receive emails with Lamson.
  2. Pull the content from the body and subject lines using python.
  3. Send the data to Google Calendar to be turned into a calendar entry using the quickAdd call, again using python.

Because Lamson is built to interact easily with Python code, this is snap. (more…)

Read Full Post »

(quick install instructions)

If you’re a web programmer … and if you’re not, why are you reading this? … at some point you’ve wished you could integrate email into your webapp.  Now, by integrate, I don’t mean sending emails … that’s trivial.  Any language you can think of, there’s a library that will let you fire off all the html gibberish that fills your little hearts with joy.

The challenge comes when the little light goes off in your head and you think, “How hard could it be to have my app react to incoming email?”  Maybe you’d like people to make forum posts by email, or create mailing lists ( listserv ) dynamically.

The answer used to be hard … very hard.  A nightmarish mishmash of postfix, dovecot, procmail, pipes, and the odd custom script would get you something that might, maybe, let you fire off a script when a new email came in.  Actually passing email data to your app? Forget it.  And after all that, most people would rightly wash their hands of it and say ‘let’s just poll the mail server periodically’ … ick.

Why can’t I just convert emails to HTTP POST’s sent to an endpoint on my webapp?  Oh … wait, I can, thanks to Zed Shaw’s LamsonProject.

But first, before going to the trouble of setting LamsonProject up, please be aware that there exist several semi-respectable SAAS companies trying to do this for you:

  • SendGrid Parse API : Email to POST.  I’ve never heard anything bad about SendGrid ( a fair amount of good stuff ) but the it is a sideline to their main business of outsourcing your SMTP server for you.
  • Email Yak : Email to XML, Email to JSON, Email to POST.  In private beta.  Don’t confuse with yak mail or yak messenger.
  • Cloudmailin : Email to POST … “just like a webhook”.  In beta.

Honestly, if I had two nickels to rub together I’d probably use SendGrid, but I don’t … so here we are.  On with the show!

(more…)

Read Full Post »

This post builds on a previous post, if you’re interested, please read it first.  If not … leave.

Previously I showed how to modify the JChemPaint status bar to display the angle of rotation as we drag our molecule through its paces.

Now to do something a tiny bit more useful.  We’re going to add an option to the JChemPaint toolbar that will allow us to specify an exact rotation of our selection.  That was incoherent … fine … how about some pictures instead?

You can also get a combined diff of both of these posts against r15286 of JChemPaint here.
(more…)

Read Full Post »

In my last post, I provided instructions on how to compile an up to date version of JChemPaint.  While exciting … yeah, right … what you as the dabbling chemist / programmer really want to do is extend the functionality of JChemPaint.

As the boringest [sic] example I could come up with … let’s add a rotation tracker to the ‘2d rotate’ ability of JChemPaint, meaning when we rotate a molecule 90°, let’s add a display to the status bar so we know we’ve hit 90° exactly.

this is what we’ve got:

this is what we want:

but how the hell do we get there?

(more…)

Read Full Post »

JChemPaint is a reasonably rich free open-source java chemical structure editor (think ChemDraw). It will take a few seconds to download, so why not start that while you read on? I’m not going to give you list of the many features that JChemPaint already has, as their wiki already does a great job of that except to say it’s written by Christoph Steinbeck and Egon Willighagen of Chemistry Development Kit fame. For all my chemist friends out there, and you know who you are, keep it in mind if you ever need an easy to use front-end for a project, or hell just some quick graphics. It exports to the common chem. formats, common image formats, and SVG. Basically, if you’re looking for a plug-in editor for a pet chemistry project, you could probably do worse.

JChemPaint app shot[1]
( image taken from JChemPaint wiki )

(more…)

Read Full Post »

This is part 4 of my explanation of my gmail_imap (python) example library, please refer to parts 1, 2, 3.

The worst point of the module currently is the method to get a full message … gird your loins, then take a look:

        #gmail_messages.py
        def getMessage(self, server, mailbox, uid):
            if(not server.loggedIn):
                server.login()
            server.imap_server.select(mailbox)

            status, data = server.imap_server.uid('fetch',uid, 'RFC822')

(more…)

Read Full Post »

This is part 3 of my explanation of my gmail_imap (python) example library, please refer to parts 1, 2, 4.

Next we want to load brief forms of our messages so that we could, say, display a list of messages in our inbox.

    gmail.messages.process("INBOX")
    print gmail.messages

Unfortunately, the code is a bit too long post, so instead, pull the code for this file up here, and I’ll post the important snippets as we go along.

Reading through the code, the first weird bit is:

            self.metadataExtracter = re.compile(r'(?P\d*) \(UID (?P\d*) FLAGS \((?P.*)\)\s')

What huh…?

(more…)

Read Full Post »

This is part 2 of my explanation of my gmail_imap (python) example library, please refer to parts 1, 3, 4.

On to how to get our mailboxes from Gmail.  We want to be able to say something like this:

    gmail.mailboxes.load()
    print gmail.mailboxes

so that gmail.mailboxes will behave as a simple list of mailboxes names.

(more…)

Read Full Post »

Older Posts »