How to build a PostgreSQL-backed website. Quickly.

Model-View-Controller using Ruby-on-Rails & PostgreSQL

So you want to build a website? Quickly! But able to grow to arbitrary size, if fortune smiles.

I’ve been working on just such a website, one which runs the manufacturing process for a world class optical switch manufacturer. They started in 2005 and are now the 2nd leading producer of optical switches. So zero to hero. They started with Ruby-on-Rails & are still running the original code. With a few hacks of course, many of which I built.

So, time for a talk on how to do this. The 2021 PostgreSQL Conference Webinars in the person of Lindsay Hooper was kind enough to extend an invite & I put something short together. I gave the talk earlier today as a webinar. Very happy with the way it came out; it provides a short introduction to how to get started on this, from the database perspective:

I show how to get started building a PostgreSQL-backed website using Ruby-on-Rails, what is meant by the Model-View-Controller architecture, why we want to use that, what tools you need to get started; how to work with the online tutorials; what kind of workflow to use, and which tasks to let Ruby-on-Rails handle versus which are better done by PostgreSQL.

The conference will be posting the video of the webinar in a few days. Meanwhile, I have exported the slides as a PDF up on slideshare.

And if you are wondering what the illo has to do with the talk, it’s a breakdown of the pieces of the Model-View-Controller architecture as it applies to Ruby-on-Rails/PostgreSQL. If you are going to do this, it is the map which is your world.

Reflections

Harvard asked for a bio/reflections for the next reunion. I had fun writing it, so I share here for any who are interested:

I recall my Harvard years with great pleasure: many excellent conversations & some courses that still stay with me. For a while I was a dual major in Anthropology & Physics but back then the overlap between these two disciplines was not great. I settled on Physics.

This was during the political upheavals of the Vietnam war; I with two friends founded the Party of the Radical Middle: the party of extreme common sense. If we had actually had any common sense we would have realized this party would be going nowhere. Still it was fun while it lasted.

Sophomore year final exams were interrupted by discovering I was coughing up blood. This turned out to be tuberculosis. At the time it seemed like a negative, but it turned out it kept me out of the draft & the Vietnam war until the draft was ended, two years later. Net positive.

I got my Harvard BA in Physics in 1972 (summa cum laude) and then a Masters in Physics from Princeton (1977).

For several years after that I was an assistant editor for Asimov’s SF Magazine, which started a life long involvement with the science fiction community.

After that I was the production manager (really the IT guy) for a startup scientific & medical press called Centrum. Many 100 hour weeks. Our first journals were, appropriately enough, the American Journal of Emergency Medicine & the International Journal of Disaster Medicine. My favorite Disaster article was one explaining how to triage at a disaster site, using a system of red, yellow, & green toe tags. If you find yourself with a red or green toe tag, steal your neighbor’s yellow toe tag: yellow toe tags get you the maximum attention (red toe tags get you morphine, green toe tags no attention at all).

I also learned how to lie to computers. This is an incredibly useful skill & has been the foundation of my subsequent career.

I got my start as an official IT consultant working at Bellcore, the joint development arm of the 7 baby bells. After a year or two, I wound up responsible for an entire computer center, with 30 mini-computers & perhaps 1500 users. Time to go independent.

Since then I have worked as a software and database developer, working in the medical, legal, advertising, financial, scientific, and other areas, with clients ranging from a high-risk perinatal laboratory to a cemetery (my company slogan is cradle to grave programming).

I currently work full time as the database department at a leading optical switch manufacturer (your web pages & email travel over switches I helped build).

I’ve stayed part of the science fiction community. I’ve given talks at NASA, and at Philcon, Balticon, Capclave, and other science fiction conventions on Time Travel, Invisibility, Star Gates, Parallel Universes, and related topics. Recently I co-edited (with Darrell Schweitzer) Tales from the Miskatonic University: what evils lurk in the dark reaches of the Dewey Decimal System?

And I am working on a Ph.D. dissertation in physics, Time Dispersion in Quantum Mechanics. I presented this at the 2018 conference of the IARD (International Association for Relativistic Dynamics). It is now up on the web as part of the IOP Conference Proceedings. I’ve written a followup article (Does the Heisenberg uncertainty principle apply along the time dimension?) also published by the IOP.

My lifetime goal is to build a really practical time machine.

Quantum internet at Capclave 2021

Somewhat surprisingly, even tho the Washington DC Science Fiction community is hosting this year’s Worldcon, they are still doing their regular annual convention as well, Capclave 2021. Kudos for courage! And it is inperson as well (proof of vaccination required).

I’m doing a talk on the Quantum Internet this year at Capclave. I moderated a panel on the quantum internet at the most recent Balticon. Panel went well (video of the panel is up on youtube) thanks to my two fellow panelists Kevin Roche and Anne Gray. This is a great subject, so I figured a dedicated talk on this would be fun & helpful to people. Hence:

The Quantum Internet: Hype or the next step

What do we mean by the quantum internet? Why do we need more than just quantum computing? What are quantum cryptography, quantum key distribution, quantum sensors? How are these concepts entangled? What are the advantages of the quantum internet? key problems? Who will get to use it? And do we have just a bunch of interesting tech that all have quantum in their name or can the whole be more than the sum of its parts?

This will be 4pm Saturday October 2nd, 2021 at Capclave

I’m doing two panels as well:

Horrors found in the Editor’s Slush

I’ve copyrighted this story so you cannot steal it and publish it under your name. “And their names were Adam and Eve.” The manuscript written in crayon. Threats if the editor rejects a story. Considering that writers want their stories to be published, they do seem to do everything possible to discourage editors. What are some of the horrors you found in submissions? What should new writers know to avoid?

This with Walt BoyesNeil ClarkeDina Leacock

At 8pm Friday October 1st, 2021 at Capclave

A Century of Robots

The play RUR (Rossum’s Universal Robots) premiered in January 1921. This play was the first to use the word robot for a scientifically created mechanical worker. Why has the concept of robots been so popular? How have robots evolved in fiction?

This with Jennifer PoveyMichael SwanwickJoy Ward

At 11am Sunday October 3rd, 2021 at Capclave

Can we get certain about uncertainty in time?

Einstein takes some time out for time

There is a decent chance that quantum mechanics applies in time in the same way it does in the three space dimensions. I say decent because Einstein’s relativity says we have to treat time like a space dimension. So if quantum mechanics applies in space — and it does! — then it has to apply in time as well.

And since in quantum mechanics all measurements are uncertain about position of an object in space, they therefore have to be uncertain about its position in time as well. Hey, blame Einstein, not me!

The effects are expected of order attoseconds. Now one attosecond is to a second as a second is to the age of the universe: not very long. But with current tech we can actually see times this short.

So we can now tell if the position of a particle is uncertain in time. It’s “now” might be really a bit fuzzy: with a bit of “future” and a bit of “past” mixed in.

I’ve just had published a paper on the specifics of how we might measure the effects of this “Does the Heisenberg uncertainty principle apply along the time dimension?“. This is in the Conference Proceedings of the International Association for Relativistic Dynamics, which is focused on following up on some ideas first suggested by Feynman & by Stückelberg.

I’m working on getting some experimentalists interested in this & have started the next paper in the series “Time Dispersion in Quantum Electrodynamics” to help them crank out estimates effects for various experimental configurations. Much stoked!

It may be more than a few attoseconds before the first results are in, but at this point it should be just a matter of time! And it might be very practical, with real-world applications in biophysics, attosecond-scale chemistry, and quantum computing.

For the record, the abstract of the paper is:

Does the Heisenberg uncertainty principle (HUP) apply along the time dimension in the same way it applies along the three space dimensions? Relativity says it should; current practice says no. With recent advances in measurement at the attosecond scale it is now possible to decide this question experimentally.

The most direct test is to measure the time-of-arrival of a quantum particle: if the HUP applies in time, then the dispersion in the time-of-arrival will be measurably increased.

We develop an appropriate metric of time-of-arrival in the standard case; extend this to include the case where there is uncertainty in time; then compare. There is – as expected – increased uncertainty in the time-of-arrival if the HUP applies along the time axis. The results are fully constrained by Lorentz covariance, therefore uniquely defined, therefore falsifiable.

So we have an experimental question on our hands. Any definite resolution would have significant implications with respect to the role of time in quantum mechanics and relativity. A positive result would also have significant practical applications in the areas of quantum communication, attosecond physics (e.g. protein folding), and quantum computing.

Artificial intelligence, the quantum internet, and life and/or death

The 2021 Baltimore Science Fiction Convention (Balticon) runs this coming weekend. Virtual but real, if you get my drift. Convention is free; the programming looks very strong. Poke around & check off the interesting ones: I had great trouble keeping my choices down to one per time slot.

And, Balticon has recorded all of the talks: I’ve linked each talk to its video.

For my Balticon talk I’m doing:

Hands as seen by an artificial intelligence.
The Hands of AI

Artificial Intelligence: Past, Present, and Futures: Saturday, 2:30pm

From neural nets and genetic algorithms to facial recognition and deep fakes, artificial intelligence (AI) is everywhere today. What exactly do we mean by AI and how did it get where it is today? What are the benefits and risks of AI and how should we manage it going forwards?

Fast moving & fun topic!

Ethics and Robotics: Friday, 4pm

Isaac Asimov’s Three Laws formed one of the earliest ethics systems for robots and artificially-created beings, but aren’t necessarily accurate or complete. A hundred years after Asimov’s birth, what approaches are being taken in the practical development of robots? What is “real AI” and how far away are we from it?

With Anne Gray aka netmouse (moderator), Aaron M. Roth and Marie Vibbert

The Quantum Internet: Hype or the Next Step? Saturday, 7pm

What do we mean by the quantum internet? What are quantum cryptography, quantum key distribution, quantum sensors, and linked quantum computers? What are the advantages and key problems? Who will get to use it? And do we have just a bunch of interesting tech that all have quantum in their name or can the whole be more than the sum of the parts?

I’m moderating this one with Anne Gray and Kevin Roche (who is the quantum computing evangelist at IBM).

From “Mostly Dead” to Alive and Back Again: Sunday, 10pm

How is it that something like the coronavirus can be completely inert one moment and then spawning millions of copies of itself the next? How did intracellular obligate parasites — organisms that can’t survive without a host — manage to evolve into existence in the first place? What of transposons (jumping genes), viroids (the smallest infectious pathogens known), and the dreaded “giant” viruses? Join us as we dart back and forth across the line that separates life & death in biology!

I’m moderating this one as well, with the panelists: Dr. Jim Prego, Doug Dluzen, Anna Kashina, Pam Garrettson.

Does the Heisenberg uncertainty principle apply along the time dimension?

Does the Heisenberg uncertainty principle (HUP) apply along the time dimension in the same way it applies along the three space dimensions? Relativity says it should; current practice says no. With recent advances in measurement at the attosecond scale it is now possible to decide this question experimentally. The most direct test is to measure the time-of-arrival of a quantum particle: if the HUP applies in time, then the dispersion in the time-of-arrival will be measurably increased. We develop an appropriate metric of time-of-arrival in the standard case; extend this to include the case where there is uncertainty in time; then compare. There is — as expected — increased uncertainty in the time-of-arrival if the HUP applies along the time axis. The results are fully constrained by Lorentz covariance, therefore uniquely defined, therefore falsifiable. And therefore we have an experimental question on our hands. Any definite resolution would have significant implications with respect to the role of time in quantum mechanics and relativity. A positive result would also have significant practical applications in the areas of quantum communication, attosecond physics (e.g. protein folding), and quantum computing.

Presented as a talk at International Association for Relativistic Dynamics 2020 Conference; currently in submission to the associated Journal of Physics: Conference Series: Proceedings of IARD 2020. 31 pages, 5 figures, 87 references

Artificial Intelligence: Past, Present, & Futures

22 Artificial Intelligences (3 Real)

My Philcon artificial intelligence talk is at 1pm tomorrow at Virtual Philcon 2020. You can register for it here.

I’ve uploaded a PDF of the talk to slideshare. The Obama Deep Fake movie was too large to uploaded, so I just used a still for that. The PDF has the references as well as the sources of all the images in the splash page above.

There are 22 images, 3 “real”, the rest from various films & so on.

  • Talos — Jason & the Argonauts
  • The Mechanical Turk — popular chess playing fake (18th century)
  • Tik-Tok — Wizard of Oz
  • Robot Maria — Metropolis
  • Joe (transparent robot) — The Proud Robot
  • Roy Batty (replicant) – Bladerunner
  • R2-D2 & C-3PO — Star Wars
  • Terminator — Terminator
  • Rommie (ship avatar) — Andromeda
  • Android Gunslinger — West World
  • Commander Data — Star Trek Next Generation
  • Mecha — AI
  • Sonny — I, Robot
  • BB-8 — Star Wars
  • Eve & Wall-E — Wall-E
  • Asimo — Honda robot
  • Johnny 5 – Short Circuit
  • Sophia — The First Robot Declared a Citizen by Saudi Arabia (2016)
  • Janet — The Good Place
  • Ava — Ex Machina
  • Samantha — Her
  • Denise Virtual Assistant — NextOS (now Realbotix)

And I have a number of references. These should be useful starting points. One of the striking things about these is that all are from the last five years; and all but two from the two years. The field is moving that fast!

  • Miller 2019 – The Artist in the Machine
  • Mitchell 2019 – Artificial Intelligence
  • O’Neil 2016 – Weapons of Math Destruction
  • Pickover 2019 – Artificial Intelligence
  • Scharre 2018 – Army of None
  • Shane 2019 – You look like a thing and I love you
  • Tamboli 2019 – Keeping Your AI under Control
  • Trask 2019 – Grokking Algorithms

2020 Philadelphia Science Fiction aka Philcon

Philcon runs from about noon this coming Friday (11/20/2020) till early evening Sunday (11/22/2020). It is, inevitably, virtual this year. With that said, they are going to a lot of trouble to make it as live & immediate as possible. And are clearly much helped by the benefit of earlier virtual conferences this year. For instance, the program participants were invited to training sessions to check out their setups & make sure they knew how to present on Zoom & Discord. I found mine helpful. Thanks Syd Weinstein & crew!

I have my schedule as well:

 Joy in SciencePlaza 1Science & TechnologyPanelFri 8:30 PM
What about Science first drew us in to it?

Remembering our sparks of inspiration. Recountings and tall tales of our best discoveries and why they continue to inspire us. With Carl Fink (moderator), John Skylar (the invariably intelligent!), Tom Purdam (always witty & knowledgable), and myself.

Artificial Intelligence: Past, Present, FuturesPlaza 1Science & TechnologyTalk by John AshmeadSat 1:00 PMDuration: 00:50
Artificial Intelligence — Too late to escape it, but too soon to panic.

From Oz’s Tik-Tok to the Mechanical Turk, from Neural Nets & Genetic Algorithms to Chess & StarCraft, from fighting the Coronavirus to flying Killer Drones, from Facial Recognition to Fakes, Deep Fakes, & Anti-Fakes, Artificial Intelligence (AI) is everywhere today. How did it start? What do we mean by AI? What are the basic AI techniques? How is it being used? What are the benefits? 

Drift Compatible: The Science of Neural Interface TechnologyPlaza 1Science & TechnologyPanelSat 4:00 PM
Plug in, tune out, or control the world — your call

What can be done with current technology? Are we going to be piloting mechs with our minds before the decade is out? With the ever charming & erudite Catherine Asaro, Rebecca Robare (one of the filk), and myself (as moderator). For me, a nice follow-on to my Arificial Intelligence talk!

Dust to DirtPlaza 1Science & TechnologyPanelSun 4:00 PM
OK, we’re on Mars. What an Expanse of possiblities? Red, Blue, or Green?

 The practical considerations of building a city on Mars, from the habitat to the technology of living on an inhospitable world. I’m moderating based on my talk of a few years back, Mars or Bust! And have Robert Hranek (who has already scared me with his level of preparation), Premee Mohammed (who has scared me with her Lovecraftian Beneath the Rising and who is basically the advance team for Mars), and Tobias Cabral (who I’ve shared many panels with & who is not at all scary — meaning no offense!) to put questions to!

Artificial Intelligence: Past, Present, & Futures

I will be presenting a talk on Artificial Intelligence: Past, Present, & Futures at the 2020 Capclave (virtual). That’s this coming Sunday from 1:30 to 2:25. Capclave is running Saturday & Sunday.

Virtual, yes, but they have rather a good line up of former guests of honor, kaffleklatsches, talks, panels, and so on. I’m looking forward. As to my talk:

Artificial Intelligence: Past, Present, Futures (Ends at: 2:25 pm)
Participants: John Ashmead (M)
From Oz’s Tik-Tok to the Mechanical Turk, from Neural Nets & Genetic Algorithms to Chess & StarCraft, from fighting the Coronavirus to flying Killer Drones, from Facial Recognition to Fakes, Deep Fakes, & Anti-Fakes, Artificial Intelligence (AI) is everywhere today. How did it start? What do we mean by AI? What are the basic AI techniques? How is it being used? What are the benefits? risks? and how should we manage AI going forwards?

The Elephant Versus the Bug

Debugging with PostgreSQL -- the Elephant takes on the Bug

Depending on the project, debugging can take 50 to 90% of development time. But it usually gets less than 10% of the press. PostgreSQL has great tools for debugging, but they are most effective when deployed as part of an overall strategy.

Ten days from now I’m doing a webinar on how best to do this. That’s 1pm, July 29th, 2020. You can register here.

It’s a fun talk: I focus on the key ideas, give a few good examples, have a quick quiz “There are three bugs on this slide: you have the next two slides to find them!” and then finish with some of my favorite debugging references: selected as particularly readable & practical.

[Update: the talk was given as planned. Thanks to Lindsay Hooper for great support! Video is online. And the audience of invisible Zoomers upped the number of bugs on the quiz slide from three to five!]

Last time I did this talk, my favorite piece of feedback was from Bruce Momjian, a founder of PostgreSQL and a member of the core team: Bruce said there was stuff he knew but hadn’t heard put into words, and stuff he just hadn’t seen yet.

And that’s how I hope this will be for you!

We will look at strategies for debugging PostgreSQL: how to find bugs, how to fix them, and how to keep them from happening in the first place.

We’ll look at root causes, technical tricks, and scientific strategies, and why — even if you can’t always write perfect code — it is usually a good idea to try.

We’ll hear from Bjarne Stroustrup, Sherlock Holmes, Kernighan and Ritchie, Pogo, & the experts of the PostgreSQL community.

Goal: less time debugging, more time building great tools and apps that stay up & get the job done.

If you can’t wait or just can’t make it, I have the latest version here: PDF, KeyNote, and PowerPoint, name your poison.

Update

Talk went off smoothly, about 65 or 70 attendees. The invisible Zoomers found two more bugs on the “quiz” slide! The event organizer, Lindsay Hooper of the PostgreSQL conference, did a great job setting every thing up, watching over a dry run, and giving feedback during. And she recorded and edited the webinar, so if you are interested in see the video “live”, herewith.

WordPress Themes