Showing posts with label q2oh. Show all posts
Showing posts with label q2oh. Show all posts

Tuesday, November 25, 2008

Quote of Tomorrow via RSS

The latest release of Q2OH went live last night and now it truly delivers the Quote of Tomorrow. Each night a quote is chosen at random and added to the new RSS feed. It uses the Feeds plugin and the Quartz plugin to make it happen and both are remarkable. Here is what it took to create and schedule a job as part of a Grails app:

class FeedSeedJob {

def quoteService

def cronExpression = "1 0 0 * * ?"
def group = "QotdGroup"

def execute() {
def qotd = quoteService.getQotdQuote()
println "QOTD is ${qotd.content}"
}
}

I honestly don't know how it could be any easier.

Thursday, November 20, 2008

Today's Timestamp is Tomorrow's Date

I have been working on a RSS feed for Q2OH. The Feeds plugin makes it as easy as I can imagine. I have run into a quirk or two with data formats that have nothing at all to do with the plugin. It seems my Dates are Timestamps. Grails does such a good job of things just working that I never noticed before. Trying to format a Timestamp is not exactly the same as formatting a Date. Also, when an API needs a Date, it may choke on a Timestamp. This makes sense and once understood is not too huge a stumbling block. However I noticed one thing that I found interesting and works in my favor. Incrementing a Timestamp seems to turn it into a Date.

Since Q2OH is the Quote of Tomorrow, in the feed entry I add a day to the field that holds the day the quote was added to the feed. In the Domain Class Quote, qotd is a Date. Here is the entire code necessary to create the feed:

class FeedsController {

def rss = {
render(feedType:"rss", feedVersion:"2.0") {
title = "Q2OH >> Quote of Tomorrow"
link = "http://host:port/app/rss/feed"
description = "The Quote of Tomorrow"

Quote.findAllByQotdIsNotNull().each() { quote ->
entry("Quote for ${quote.qotd + 1}") {
link = "http://host:port/app/quote/display/${quote.id}"
author = quote.author
publishedDate = (java.util.Date) quote.qotd
quote.content // return the content
}
}
}
}
}

This results in an entry title of : Quote for Fri Nov 21 10:22:50 EST 2008

Originally the code was:
    entry("Quote for ${quote.qotd}") {

That had an entry title of: Quote for 2008-11-20 10:22:50.0

So if you ask me, tomorrow looks better than today.

Thursday, November 6, 2008

Q2OH is now live!

Thanks to Ed's perseverance, Q2OH is now live and can be found at http://www.q2oh.com. You are all welcome to check it out, amaze your friends with a quote or just use it as a tool to procrastinate on your work.

Friday, October 31, 2008

Close But No Cigar

I have been trying to get the production server ready for a November 1st launch but it doesn't look like I am going to make it. My sysadmin skills are suspect and things that work just right in test seem to be yielding different results in production. Support at Layered Tech has been great. They are very responsive and have taken care of everything I've asked. Tickets get handled in a few hours and it doesn't seem to depend on the time of day. Now I just need to figure out why things aren't working the way I expect them to.

Monday, October 27, 2008

How Soon Can We Launch Q2OH?

I want to launch very soon. Testing has gone well. We still need to configure the production server. It is a race to the finish. Can we make it happen by November 1st? Stay tuned.

Wednesday, October 8, 2008

Quote of Tomorrow

What would you get if you made a Quote of the Day site with Web 2.0 features? How about the Quote of Tomorrow, or Quote 2.0? Better yet, Q2OH. In an effort to get something shipping now we are working on a very simple web application. The goal of Q2OH is to practice. Make sure the hosting is configured, the development process is working, we have the ability to test, and maybe have some fun along the way.