RubyConf 2018 starts tomorrow, and just like I did with RailsConf, I’m very belatedly going to share some highlights from RubyConf 2017, which was in New Orleans last November. It was my first time attending RubyConf, and what struck me the most was the really strong sense of community. Here’s what one first-time attendee had to say:
…This conference was so incredibly worth it. I learned about sweet gems, cool projects, and job opportunities. But more importantly, I met SO MANY totally epic and amazing individuals that even after only three short days I happily now consider friends. I cannot wait to follow their coding lives and journeys in the years to come. I am confident that so many of them are going to do great and groundbreaking things. Plus, I cannot WAIT for my next RubyConf.
That’s from the post 31 thoughts I had while attending my first #RubyConf as an Opportunity Scholar. RubyConf’s Opportunity Scholar program provides financial support for folks who wouldn’t be able to attend otherwise, and are getting started with Ruby. The Scholars are then each matched with a Guide – experienced people who can help them navigate the conference, and make connections for professional development and job opportunities. I applied to be a Guide for this year’s RubyConf and I was selected – I’m looking forward to it!
RubyConf has three tracks of talks, so it’s not possible to attend them all, but here are the ones that were my favorites, including links to the videos for each of them:
And since the conference was in New Orleans, I now have to show you pictures from some of my time spent outside the conference…
RailsConf 2018 starts in exactly one month, and I’m looking forward to it! This means I should probably get around to saying something about RailsConf 2017. The video above is cued to start at the beginning of a lightning talk I gave. The title was “Why Do Planes Crash? Lessons for Junior and Senior Developers.” Analyses of plane crashes show planes actually crash more often when the senior pilot is in the flying seat, often because junior pilots are reticent to speak up when they see problems, while senior pilots don’t hesitate to do so when the junior pilot is flying. There are some great lessons developers can apply from this for how to do mentoring and pair programming.
The lightning talks were at the end of the 2nd day, and I made a last minute decision that morning to sign up and put a talk together. I’ve given a number of conference talks before, but never to a crowd this big, and never with so little time to prepare. Then when it was time to give the talk, there was a technical issue that prevented me from seeing my notes, so I had to wing it. Under the circumstances I think it still turned out ok. Here are my slides (they’re also embedded below) and some tweets about the talk:
Excited I'm near the top of the list for #railsconf lightning talks! “Why do planes crash? A lesson for developers.” Now I have to prepare 😨 pic.twitter.com/M04Oyp2peL
— Michael Toppa (@mtoppa) April 26, 2017
Great lightning talk by @mtoppa on "Why do Planes Crash" at #RailsConf2017 pic.twitter.com/o0fpRXarxZ
— Braulio Carreno (@bcarreno) April 27, 2017
Something to remember. #railsconf pic.twitter.com/44HfEvHT2r
— Heather Herrington (@EventsDoctor) April 27, 2017
@mtoppa showed us the dangers of mitigated speech at #railsconf. Save lives, don't sugarcoat! And value your junior developer's perspective.
— Adam Bowen (@adamnbowen) April 27, 2017
A thought as I board this plane out of Phoenix. Listen to those less experienced, and if you see something say something #railsconf #lessons pic.twitter.com/hHxqSsAsKY
— Santiago (@San_QG) April 28, 2017
Here are my slides for "Why do planes crash? Lessons for junior and senior developers" Thanks #railsconf! https://t.co/aoeEIZ2Kgy
— Michael Toppa (@mtoppa) April 27, 2017
I work for ActBlue and we provided Opportunity Scholarships for people who normally wouldn’t be able to attend, for financial or other reasons.
We adore our Opportunity Scholars and Guides! Big thanks too to @actblue for funding so many Scholars' travel as well; it's a huge help! 💗💗 pic.twitter.com/xwOuPMYGhb
— RailsConf (@railsconf) April 27, 2017
4 of us from ActBlue attended, and my co-worker Braulio gave an impressive full-length talk explaining how our technical infrastructure supports close to 8,000 active organizations, and handles peak traffic like the 2016 New Hampshire primary night, when our traffic peaked at 300,000 requests per minute and 42 credit card transactions per second.
This is the @ActBlueTech delegation that attended #RailsConf2017 We had a blast! @actblue #railsconf pic.twitter.com/kDHxzui2Dh
— Braulio Carreno (@bcarreno) May 2, 2017
Come to "High Performance Political Revolutions" to see what it looks like to handle complex transactions at scale in Rails #railsconf https://t.co/KzC1bGNKU1
— Michael Toppa (@mtoppa) April 27, 2017
On New Hampshire primary night, @actblue’s Rails app processed 40 credit card transactions/sec for Bernie Sanders #railsconf pic.twitter.com/9OqDtknKPN
— Michael Toppa (@mtoppa) April 27, 2017
"High Performance Political Revolutions" by @bcarreno #railsconf pic.twitter.com/6Z2DMpjWRs
— savannah ❤️🧡💛💚💙💜🖤 (@Savannahdworth) April 27, 2017
Slides for High Performance Political Revolutions (High Volume Track) https://t.co/ZzlwwwBqwZ #RailsConf #RailsConf2017
— Braulio Carreno (@bcarreno) April 27, 2017
Here are some other highlights from the conference…
This is a really impressive, honest talk & unlike any tech conference talk I've ever seen, which is both wonderful and very sad #railsconf https://t.co/fqoq9Ehmcy
— Michael Toppa (@mtoppa) April 27, 2017
Such an amazing keynote by @polotek here at #railsconf. pic.twitter.com/Io9TsqZVoe
— Marlena Compton (@marlenac) April 27, 2017
Video of Marco Roger’s talk mentioned above.
I had such so much fun sharing the story of goldilocks, the rails dev, with you all today, #railsconf! Slides here: https://t.co/0FcnDEycq1
— Vaidehi Joshi (@vaidehijoshi) April 25, 2017
Slides from my #RailsConf talk Learning to Embrace Failure. Now I can focus on enjoying the rest of the conference! https://t.co/p2fxlf9xdp
— Jess Rudder (@JessRudder) April 26, 2017
Here are my slides from my Practical Debugging talk at #railsconf: https://t.co/Cw6GZVEgph. I had a great time sharing it with you all!
— Kevin Deisz (@kddeisz) April 26, 2017
A group of us took in a Diamondback’s game the night the conference ended, and then the next morning a couple of us headed to the Desert Botanical Garden before flying home.
Finishing #railsconf with some baseball! pic.twitter.com/o2NtvxguKj
— Michael Toppa (@mtoppa) April 28, 2017
Staying in Phoenix one more day after #railsconf. The botanical gardens are amazing, and – who would have guessed – full of cactuseses pic.twitter.com/Ejvq4CduBb
— Michael Toppa (@mtoppa) April 28, 2017
Lastly, here are the slides from my lightning talk:
I’m excited to officially start my new job at PromptWorks next week. The slogan on their website says it all: “we are craftsmen.” If you’ve seen my Clean Code talk, you know what software craftsmanship means to me. An important aspect of it is to keep improving your skills. I’ve been working at PromptWorks on a contract basis for the past several weeks, and I can tell already that I will learn a lot from my new co-workers. They place a strong emphasis on Agile practices, quality, and working at a sustainable pace. I’ve seen enough so far to know that this isn’t just talk, and that their focus is on building long-term relationships with their clients and their staff. They’re also very involved in the local tech community. Among other things, one of them oversees the philly.rb Ruby meetup group.
They’re also supportive of me working remotely while Post to Post Links II error: No post found with slug "living-in-fukuoka-japan-this-summer-and-fall", which is very generous of them (especially for a new hire).
I interviewed with several different companies recently, and for me, the most dreadful part of interviewing is being asked to do live coding. This is sometimes done in the form of a pop-quiz, where I’m presented with some out of the ordinary coding problem, and I’m expected to write code on a whiteboard, or hack together a quick script to solve it. Other times it’s a surprise mini-project I’m expected to do on the spot. Even though I’ve been coding for close to 20 years, and I’ve had plenty of experience doing quality work faster than expected, I’m terrible at these coding exercises.
The issue for me is that they are nothing like doing real work. The only times in my life I’ve had to think up code on the spot for a surprise problem and write it on a whiteboard is in interviews. And in a real job I don’t think I’ve ever had a project dropped on me out of the blue and been asked to code up a solution in an hour or two, with severe consequences if I make a mistake or try to talk to anyone about it.
My thinking process is largely driven by understanding context (the context of the code, and the context of the business problem), and these coding exercises are usually devoid of context. I’ve also trained myself over the years to not just hack things together. I was told in one interview that, sorry, you won’t have time to write tests. Telling me to take my best practices and throw them out the window in an interview strikes me as completely backwards.
How to best interview programmers is a hotly debated topic. Some very respected people, like Joel Spolsky, swear by the whiteboard-coding approach. Others say you’re doing it wrong:
A candidate would come in, usually all dressed up in their best suit and tie, we’d sit down and have a talk. That talk was essentially like an oral exam in college. I would ask them to code algorithms for all the usual cute little CS problems and I’d get answers with wildly varying qualities. Some were shooting their pre-canned answers at me with unreasonable speed. They were prepared for exactly this kind of interview. Others would break under the “pressure”, barely able to continue the interview…
But how did the candidates we selected measure up? The truth is, we got very mixed results. Many of them were average, very few were excellent, and some were absolutely awful fits for their positions. So at best, the interview had no actual effect on the quality of people we were selecting, and I’m afraid that at worst, we may have skewed the scale in favor of the bad ones…
So what should a developer job interview look like then? Simple: eliminate the exam part of the interview altogether. Instead, ask a few open-ended questions that invite your candidates to elaborate about their programming work.
– What’s the last project you worked on at your former employer?
– Tell me about some of your favorite projects.
– What projects are you working on in your spare time?
– What online hacker communities do you participate in?
– Tell me about some (programming/technical) issues that you feel passionately about.
When I became Director of the web team at the Penn School of Medicine, I led an overhaul of how we conducted our interviews, and we adopted questions similar to these. We focused on behavior-description questions, which are actually much more revealing than you might think, if you haven’t tried them before. We also asked for interviewees to bring in a sample of their code, and we’d have them talk us through it in the interview, and answer any questions we had about it. This was an excellent and reliable way to get an understanding of their experience level and getting past shyness and nervousness. For anyone who’s done half-way decent work, they always become animated when showing off work they’re proud of.
For my interview with PromptWorks, they gave me a small project to do on my own time, to turn in a few days later, which is also a good approach. Apart from that, they also had me do a pair programming exercise, which I was worried about at first, but the focus was on getting an understanding of my thought process and overall problem-solving approach, as opposed to how fast I could tear through it, or trying to hit me with “gotcha” questions.
And they hired me, so I must have gotten something right 😉
These are my notes from today’s Data IO conference
Lucene 4
Solr (Lucene server – managed by the same team as Lucene)
Uses
Old way of system management: active and backup servers, frantically switch to backup when active fails
Common challenges with big distributed system
A common deficiency: sequential consistency (handling everything in the “right” order, when data is coming from multiple places)
Zookeeper open-source equivalent of Chubby
Beware – Zookeeper can be your single point of failure if you don’t have appropriate monitoring and fallbacks in place
I didn’t take notes during those one (a drop of water from the bottom of my glass got under my Mac trackpad, and my mouse was going crazy for a while)
Example IBM sales force optimization
Siemens – compter aided detection of breast cancer
Display ad auctions – how do we decide who to target?
Advertising fraud
Uses
[I’m leaving it most of the details about performance improvements and the roadmap for upcoming refinements – below are other interesting points]
If you use a mouse, hyperlinks, video conferencing, WYSIWYG word processor, multi-window user interface, shared documents, shared database, documents with images & text, keyword search, instant messaging, synchronous collaboration, asynchronous collaboration — thank Doug Engelbart
That quote is from one of Engelbart’s peers. It’s worth taking a few minutes to read the rest of his post, to learn about Doug Engelbart. Personal computing and the internet would not be what they are if it weren’t for his contributions.
About 14 years ago, when Maria and I worked at Stanford, we had dinner with him and his girlfriend, and another couple. He couldn’t have been more pleasant and down to earth. At the time I knew a bit about his history, but not the full extent of his contributions. And I left that dinner still not knowing – he was a modest man. Dave Crocker is someone who worked with him, and he wrote the following last night, after Engelbart’s daughter shared the news of his passing: “Besides the considerable technical contributions of Doug’s project at SRI, theirs was a group that did much to create the open and collaborative tone of the Internet that we’ve come to consider as automatic and natural, but were unusual in those days.”
The San Jose Mercury today re-published a profile of him from 1999:
But the mild-mannered computer scientist who created the computer mouse, windows-style personal computing, hyperlinking–the clickable links used in the World Wide Web–even e-mail and video conferencing, was ridiculed and shunted aside. For much of his career he was treated as a heretic by the industry titans who ultimately made billions off his inventions…
Engelbart is perhaps the most dramatic example of the valley’s habit of forgetting engineers whose brilliance helped build companies–and entire industries. CEOs fail to mention them in corporate press releases; they never become household names. Yet we use their products, or the fruits of their ideas, every day…
“We were doing this for humanity. It would never occur to us to try and cash in on it. That’s still where Doug’s mind is,” explains Rulifson, director of Sun’s Networking and Security Center…
Engelbart’s unwillingness to bend was in evidence when he met Steve Jobs for the first time in the early 1980s. It was 15 years since Engelbart had invented the computer mouse and other critical components for the personal computer, and Jobs was busy integrating them into his Macintosh.
Apple Computer Inc.’s hot-shot founder touted the Macintosh’s capabilities to Engelbart. But instead of applauding Jobs, who was delivering to the masses Engelbart’s new way to work, the father of personal computing was annoyed. In his opinion, Jobs had missed the most important piece of his vision: networking. Engelbart’s 1968 system introduced the idea of networking personal computer workstations so people could solve problems collaboratively. This was the whole point of the revolution.
“I said, ‘It [the Macintosh] is terribly limited. It has no access to anyone else’s documents, to e-mail, to common repositories of information, “‘ recalls Engelbart. “Steve said, ‘All the computing power you need will be on your desk top.”‘
“I told him, ‘But that’s like having an exotic office without a telephone or door.”‘ Jobs ignored Engelbart. And Engelbart was baffled.
We’d been using electronic mail since 1970 [over the government-backed ARPA network, predecessor to the Internet]. But both Apple and Microsoft Corp. ignored the network. You have to ask ‘Why?”‘ He shrugs his shoulders, a practiced gesture after 30 frustrating years…
Here is a set of highlights from his famous 1968 demo of the systems his team developed, showing early versions of computer software and hardware we now consider commonplace. In the 8th video, he shows their online, collaborative document editing system, which looks like an early version of Google Docs. In the 3rd video, he describes the empirical and evolutionary approach they took to their development process. This was another of his ideas that the industry discarded, only to finally re-discover its value, more than 30 years later, as what’s now called Agile development.
After my WordCamp Nashville presentation, I transitioned from talking about how to write clean code, to talking about how the web is transforming the world of journalism, and what it means for civic engagement. This was the topic of the BarCamp NewsInnovation talk two weeks ago in Philadelphia given by Dave Zega and I (we work together at ElectNext). I also presented a longer, more in-depth version at TransparencyCamp in Washington, DC last week, with our CEO, Keya Dannenbaum.
Both conferences were “unconferences,” which means there’s an emphasis on discussion rather than long presentations, and the schedule is determined by the conference participants themselves, on the morning of the conference. However, both had some pre-scheduled talks, including ours.
The TransparencyCamp talk was titled “Civic engagement, local journalism, and open data.” Here’s the summary:
A fundamental purpose of journalism in the United States is to inform citizens, so that they can effectively engage in democratic self-governance. The ongoing disappearance of local newspapers in the digital era is well known, resulting in the decline of traditional watchdog journalism at the local and state levels. There are discussions of “news deserts” and unchecked malfeasance by elected officials. At the same time, we’re seeing the rise of citizen journalists, the growth of organizations that harvest, enhance, and distribute an ever-expanding range of data on government activities, and the creation of new opportunities to share, discuss, and analyze information vital to civic engagement.
For the goals of achieving government transparency and effective self-governance, what has been lost and what has been gained in all these transformations? Is the net effect positive or negative, and what lies ahead? In this talk we’ll lay out the different arguments in this debate, and we’ll engage the audience in the conversation.
I was really impressed by the quality of the audience questions at both conferences, and their engagement with Twitter. Our talk generated over 40 tweets at Transparency Camp. Here are samples from both talks:
@MobileTrevor Result of losing local news is fewer voters, lower civic participation, increased corruption, etc says @mtoppa #TCamp13
@zpez how can you maintain local engagement after an acute issue is resolved? build stronger networks; tap into the ppl w/ the data #TCamp13
@_anna_shaw The ‘digital political baseball cards’ from @ElectNext are pretty darn cool… Gonna be playing around with these later. #TCamp13
@ianfroude Local papers dying, so ‘ppl have gained access to the world (intl/natl papers) but lost access to their backyard’ #TCamp13
@jmikelyons: Politicians know everything about us, we know little about them. The Big Data Divide. Big civic problem #bcni13
@emmacarew #bcni13 impressive: folks at @electnext are working directly with the mayor’s office to makes data not just available but accessible
Transparency Camp was the larger of the two – over 600 people attended. Some traveled quite a distance to be there. In our talk we had questions from people involved in the media from as far away as Poland and Uganda.
Both conferences had a great sense of community. Many of the conversations I heard around me were similar to conversations we have at ElectNext, about how to bring greater transparency to government activities, and making open government data accessible and useful. I also had an unexpected but very welcome encounter: while passing through a crowd I heard a nearby voice say “hey Mike Toppa,” and turned to see a face I hadn’t seen in over 10 years. It was a former co-worker from my time at HighWire Press. He works at the Sunlight Foundation now. It was great to catch up and compare notes on our work. After the conference, I also got to catch up with my old friends Pat and Emma, from my days at Georgetown.
Here are the videos for both talks. If you only have time for one, I recommend the TransparencyCamp talk (the first one below). Below the videos are my summaries of the sessions I attended at Transparency Camp.
These are my own brief summaries of the talks I attended. Most sessions had note takers, and their notes are at the TransparencyCamp site.
Today, at the Agile Testing and BDD Exchange conference, Bob Martin mentioned an article in the EE Times about how microprocessors have changed the world. I looked it up, and the article uses a truly amazing example to make the point. Suppose it’s the late 1940s, and you want to build a device with the computing power of an iPhone. The most sophisticated computer at the time was ENIAC, which was powered by 17,468 vacuum tubes, had about 5 million hand-soldered joints, weighed 27 tons, and occupied 1800 square feet. A single iPhone contains about 100 billion transistors and weighs just under 4 ounces. Building the equivalent back then would have required:
And now you can put one in your pocket.
Bob went on to point out a fascinating contrast to that exponential advance in computing power: just how little computer programming has changed. Languages have come and gone, but programmers are still writing if statements and while loops. What we think of as modern advances, like object oriented programming, were originally thought up in the 1960s.
Personally, I don’t see this as a problem. Programming languages are languages – they are forms of human expression. The world has changed in many dramatic ways since the time of Shakespeare, but we can read Shakespeare today and still relate to the motives, passions, and failings of the characters. Programming languages exist to communicate a painstaining set of instructions (and therefore aren’t as engaging to read as Shakespeare). But their domain is still that of human expression, for communicating often astonishingly subtle, complex, ever changing, and sometimes seemingly contradictory needs. So, to me, it’s perfectly logical that, while syntax and techniques may be refined over time, the fundamental aspects of programming languages today would be much more familiar to a programmer from the 1950s than the incredibly small and powerful devices in which they now run.
This was my second WordCamp, and my first not as a speaker. When I presented at WordCamp Philly last Fall, I was blown away by the positive energy of everyone there (which is one of the things that led to my current position with WebDevStudios). WordCamp San Diego was just as much fun, and there was plenty to learn too. Coming from Philly means it’s a long way to go for a WordCamp, but WebDevStudios was a sponsor, so several of us from the company went. Since we are a virtual company, I also met a couple of my co-workers in person for the first time – @tweetsfromchris and @TobyBenjamin
WordCamps typically have 2 simultaneous tracks – one for developers and one for users. They also provide an opportunity for these two parts of the WordPress community to come together, so online businesses can find good developers, and for developers to find rewarding projects.
I stayed in the developer track for all but one presentation, and they were all excellent. WebDevStudio’s own @williamsba presented on how to configure and use WordPress multi-site. Even in the more introductory-level sessions, where I thought I’d already know everything, I actually learned a lot. The vibrancy of the WordPress community, and the dedication of the speakers, who appear without compensation, continues to impress me.
The “spring training” theme was really well done, from the matching baseball jerseys for the speakers, to the web site, stickers, and, of course, the cake. @norcross gave his whole talk as Ron Burgundy (yes, in his boxers), which was hilarous enough to justify him being the only speaker out of uniform.
The after party was a blast. It was my first experience where it was socially acceptable to both drink and have endless conversations about code and WordPress. I have found my people 🙂 and it was great to meet @housechick, @jaredatch, @matthewjcnpilon and @i3inary.
The 2nd day of the conference was a developers’ day, held at the very sleek Co-Merge workplace. This was similiar to the developers’ day at WordCamp Philly, with some short presentations, but the focus was more on people making connections and helping each other code.
The one challenge for me was sleep. WebDevStudios rented an apartment since several of us were there. The first night there was a party happening in an adjacent unit, and the thumping bass didn’t stop coming through the floor until about 3AM. The next night someone was shot and killed right outside our apartment, and the last night one of my co-workers had to get up and leave really early for his flight. But I’m not so old (yet) that I can’t handle it (actually, having kids has conditioned me to handle sleep deprivation better than I did years ago).
My next WordCamp is in just a few weeks. I’ll be speaking at WordCamp Nashville, on how to apply dependency injection techniques to WordPress plugin development.
I took pictures throughout the day – here’s the complete album:
If you’re developing a WordPress plugin, any initial, one-time setup work your plugin needs is done through a call to register_activation_hook()
(such as registering settings, or creating a database table). Debugging problems with code you call through this hook is notoriously difficult. I think I’ve pulled my hair out over each one of the many things that can go wrong, so I thought I’d share my hard-earned solutions (these all apply to the current version of WordPress, 3.0.4):
if function_exists()
wrapper around your function (or if class_exists()
around your class). But don’t waste your time – all it really means is that there was an error of some kind. Any kind of logic error within your function (such as an incorrect number of arguments to a function call) will result in this error being displayed. Don’t be fooled.echo
or print
to debug, but never see any output: normal output isn’t shown during plugin activation. If you want to see some debugging output, call trigger_error()
instead. This will force your message to be displayed in the plugin activation status box.register_activation_hook
, and it just fails silently. The first argument must be the path to your main plugin file (i.e. the file with the plugin comments at the top – __FILE__
will do fine), which is where your activation function must be. The existence of this argument is deceptive, as it suggests you could put the function in another file (you could, I suppose, put your call to register_activation_hook
in another file, and then put your callback function in the main file, but I can’t think of a good reason to do that). The second argument is the function name – if you want to get fancy, it’s fine to use callback pseudo-types.Two general guidelines I recommend are:
register_activation_hook
. This is a good way to expose errors that are otherwise hidden behind the “cannot redeclare” error.A couple years ago I wrote a post describing how to limit posts on your WordPress home page to ones in specific categories. A limitation of this approach is that it can only show recent posts that are in The Loop. Others have solved this problem as well, but all the solutions I’ve seen have this same limitation. What if posts in the categories you specify aren’t among your recent posts? Your home page would show no posts!
This was a problem for my new home page design. I’ve divided my site’s content into 3 major topics, and I show hyperlinked titles for the 3 most recent posts in each topic. But it’s possible that a topic may not have any posts among the most recent 10 posts, which is all The Loop knows about (10 is WordPress’ default setting for how many posts to show on your home page). So I want to get the most recent 3 posts for each topic, regardless of whether they happen to be in The Loop.
To do this, I created the following function and put it in my theme’s functions.php file. Note that I’m using a straight SQL query, which means this is not guaranteed to work in future versions of WordPress (the WP coders do a good job of maintaining a consistent programming API across versions, but they do change the database sometimes).
function get_top_category_posts ($term_ids) { global $wpdb; $top_3 = ''; $results = $wpdb->get_results("select ID, post_title, post_date from wp_posts p inner join wp_term_relationships r on p.ID = r.object_id inner join wp_term_taxonomy t on t.term_taxonomy_id = r.term_taxonomy_id where t.term_id in ($term_ids) and p.post_type = 'post' order by post_date desc limit 3", ARRAY_A); foreach ($results as $result) { $top_3 .= "<li>" . date("M d", strtotime($result['post_date'])) . " - " . '<a href="' . get_permalink($result['ID']) . '">' . $result['post_title'] . "</a></li>\n"; } return $top_3; }
I then call it like this from my custom home page (where I’m not using The Loop at all):
<ul> <?php echo get_top_category_posts('6,12,89,90,98,105,106,115'); ?> </ul>
I’m passing the IDs for the categories I want. The easiest way to get a category ID is to go to its edit screen and note the cat_ID in the URL. This works for tag IDs also.
There are 3 database tables involved in the query: wp_posts contains your posts, wp_term_taxonomy contains the term IDs for categories (and tags), and wp_term_relationships connects the posts to their categories. Note that a cat_ID or tag_ID you see in an edit screen URL is actually called a term_id within the database. In this case I’m only retrieving the date and title of each post, but you could retrieve the entire post if you want (see the description of the wp_posts table).
If you want to simplify the query to improve performance, you can eliminate one of the table joins if you manually look up the term_taxonomy_id that corresponds to each category’s term_id, and pass those instead:
select ID, post_title, post_date from wp_posts inner join wp_term_relationships on ID = object_id where term_taxonomy_id in ($taxonomy_ids) and post_type = 'post' order by post_date desc limit 3
The downside of doing this is that every time you add a new category or tag, you’ll have to go into your database and look up its term_taxonomy_id. So I don’t recommend doing it this way unless you’re comfortable poking around in mySQL.
(Note to fellow cranky programmers: I know this is poorly abstracted – the need here is simple enough that, to me, abstraction didn’t seem worth the trouble).