Friday 3 January 2014

PhoneGap 3 ebook winners

Late last year Packt Publishing offered 3 e-books to help promote Giorgio's revised edition of PhoneGap 3. People who commented or tweeted the blog post received entries to win.

While I prepared some SQL to randomise selection of winners, I didn't get a chance to arrange the job to be executed at midnight on new year's eve.

I still wanted to schedule a job as not to be biased with results, so I picked another abitruary date instead, one that might excite the numerologists out there - Jan 2nd, 2014 at 3:45 - yep, there's a sequence in there.

Here is the code the scheduled the job, which created a table with entries in random order.

  job_name => 'SW_PACKT_WINNERS'
  ,job_type => 'PLSQL_BLOCK'
  ,start_date => to_date('201301020345pm','yyyymmddhhmipm')
  ,enabled => TRUE
  ,job_action => q'{
execute immediate q'[
  create table  packt_contest_winners as
  with data as (select name, case when linked='Y' then 3
        when tweet='Y' and post='Y' then 2
        when tweet='Y' then 1
        when post = 'Y' then 1
        else 0 end entry_qty
        ,null rn2
       from packt_contest)
  select xz.rn entry, entry_qty, ,dbms_random.value() rnd
    ,case xz.rn when 1 then 'Posted comment'
     when 2 then 'Tweeted post'
     when 3 then 'Included backlink' end reason
    ,case when row_number () over (order by dbms_random.value())  <= 3 then 'winner!' end prize
    ,sysdate ts
    (select  rownum rn
    from dual
    connect by level <= 50) xz
    (select rownum rn, name, entry_qty from data) d
    on xz.rn <= d.entry_qty
  order by rnd
]'; end; }');

You can see the results on this page

The first three won - so congratulations to

I have contact information for all three winners, so I'll hunt you down when I have further information from Packt.

I've been busy building an APEX website over the holiday season so I haven't had a chance to try out the examples from the book yet - but I really look forward to it!
My first read showed it was really promising for Oracle Developers to really take advantage of PhoneGap as a tool to make our mobile applications even better.
As I mentioned, I'll write a fuller review once I've had a play - and I'll see how people's comments regarding the chapters of interest come through.

Here's to a productive 2014.


No comments: