Posts Tagged ‘example’

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!


Read Full Post »

Inspired by a conflux of events: a post about demos in Mitch’s chemistry community, followed by a dangerous chemistry demo listed in About.com (below the jump), and ‘Things I won’t work with: FOOF’. I thought I’d mention a series of books near to my heart, full of exciting demos for any precocious high school student with an indulgent teacher or any teachers in the audience.

Bassam Shakhashiri’s Chemical Demonstrations : A Handbook for Teachers of Chemistry, along with vols. 2,3,4 are the absolute best demo books out there. Check them out on Google book’s preview, then buy, borrow, or steal them if you do demos.

However, there are provisos I would offer to a high school student.  For example, when using cent pieces for their copper content … don’t.  The newer (1981+) American cent coins have a zinc core.  Just grab some copper wire from a hardware store … it’s quite cheap.

All of this brings us to my point … Bassam includes in the book (never intending it for unsupervised student use) the recipe for nitrogen triiodide.

… stop …

Look down at your hands.  Pick your two least favorite fingers … now imagine them reduced to a chunky mist about 6 inches to the right of your body.  If you make nitrogen triiodide without knowing what the hell you are doing that image will become reality.  Ask one of its discoverers: Pierre Dulong ( who discovered NCl3, thanks for the kind note Ender!).


Read Full Post »

VMD and NAMD are two closely linked molecular dynamics tools from the UIUC Computational Biophysics Group.  As you can probably guess from the ‘Biophysics’ header, the emphasis for this suite is on large-scale macromolecular clusters such as proteins or even lipid bilayers, meaning CHARMM and force field models are the order of the day.

Despite the emphasis on biochemistry, there is an interesting tutorial on simulating water permeation through carbon nanotubes.  When I stumbled across that tutorial on the same day I saw a post about desalinization using carbon nanotubes, I thought ‘kismet!’.


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.

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?


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:

        def getMessage(self, server, mailbox, uid):
            if(not server.loggedIn):

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


Read Full Post »

Older Posts »