Web 2.0 Expo – Day 1 & 2

IBM gave out candy if you tweeted (or didn't) #sweettweet.  My tweet on top middle.

IBM gave out candy if you tweeted (or didn't) #sweettweet. My tweet on top middle.

Today, I attended day two of Web 2.0 Expo. See day. While I didn’t attend the main conference on day 1, there are a couple comments in here about it.  Many of the presentation files are available.

Day 2 Keynotes

They had a live tweet stream of all items tagged #w2e.  Apparently on Tuesday people posted some less than appropriate things.  Edited to add link. Today the tweet stream was curated (are we in a museum?) and only appropriate ones showed on screen.  Or as the speakers said, the stream was censored.

  1. There’s a #hashtag for that. – I had seen the swine flu part of The Onion speaker’s talk at a previous Ignite event.  It was still funny.  He gave many more examples.  Since this is a twitter topic, I’ll let you check out the speaker’s twitter page for more details.
  2. How we get past “free” and learn to exchange value again – Douglas Rushkoff talked about how money was created as a scarce and controllable resource in the Middle Ages.  It continued through the Industrial Age so the rich could stay rich without “doing anything.”  Corporations support this currency system by extracting value.  He also talked about how if something is free, you must leverage what isn’t.  (Write for free; get paid to talk.)  Looking to the future, Douglas speculated about power being won by companies that index content or control the index and that the next big thing is a non-cash electronic payment system.
  3. Making sense of Google Wave – After plugging her free preview PDF book The Complete Guide To Google Wave, Gina Trapani introduced Wave.  With that: she said, Wave:
    • is a protocol
    • is e-mail if e-mail were invented today (e-mail is a messaging paradigm based on postal mail)
    • does not strive to replace e-mail
    • is a collaboration tool
    • is meant for use in small groups of people you work with (public waves are overwhelming)
    • can have multiple clients like Twitter if someone writes them
    • does not support Internet Explorer – Google calls this “forward thinking” what’s forward about not supporting the most widely used browser?
    • targets power users, not “applications for dummies”
    • takes time to learn – like Photoshop
    • is too unstable to use for writing the PDF book not exactly a ringing endorsement
    • is good for threaded conversations
    • can show realtime movements on a map to others in your Wave
    • can easily start a group conference call when you need to go verbal
    • is currently in the invite only Beta.  Web 2.0 Expo attendees get an invite which comes with 10 invites. First 10 people to ask me for one get them.  I know I look forward to playing with it.
  4. Beyond Facebook and Twitter – Anil Dash described a few lessons learned of Web 2.0 that governments are applying: wisdom of crowds, cloudes, every problem is a scaling problem and there are more experts outside than inside.”
  5. Interview with John Barthwick from Betaworks – The classic O’Reilly style sit on the chairs interview.
  6. Confessions of a public speaker -Scott Berken author of a book by the same name said public speaking is the original social medium.  He pointed to three timeless technologies (at least in techie circles) – talking, writing and beer – all of which provided areas for communication.  Before ending by suggesting an exercise (he suggesting asking “what’s the best story about your product” rather than listening to a marketing pitch”, he made three interesting comments:
    • You can tell a good or bad story with any technology.
    • Failures to communicate cannot be resolved by technology.
    • Technology can only get you so far.  “The world is pretending the breakthrough is in technology; the bottleneck is really in art.” – Penn Jillette

Birds of a Feather

I liked the Wednesday Birds of a Feather much more than the Tuesday ones.  I attended two sessions on both days.  Each day, one had a decent number of people and the other was almost empty.  However, the Wednesday ones had more of what I call “prepared discussion” while the Tuesday ones were more presentation driven.  Since the spirit of Birds of a Feather is supposed to be about discussion, I was surprised by the amount of presentation involved.

Web 2.0 Open

Like Birds of a Feather, Web 2.0 Open also focuses on participation over presentation.  I only attended one of their sessions today, but they did a great job.  There were a lot of people in the room, they were engaged and there were references to discussions earlier in the day.

Other things I learned at assorted talks or things I think were especially clever

  • Open source is people getting together and doing something.  Crowdsourcing is a company trying to get people to do something for it.
  • We all write for a living – e-mails, tweets, etc
  • “Sending cat pictures to friends” is becoming a cliche.  I’ve been hearing about it for over a year now.  In case you haven’t heard about it – I can has cheezburger
  • UX stands for user experience
  • Sony Ericson has a phone/camera with facial recognition.
  • “Social Mining” and “Sentiment Monitoring” are terms.  They are what they sound like.
  • People may say bad things about your product whether you are on social networking sites or not.  The difference is you can respond/react properly
  • Social media isn’t free.  It still takes time to market.
  • Page views are an early matrix.  Financial metrics should be used for ROI which come after that.
  • Facebook is starting to become profitable from ads.  Twitter is still leaking money.
  • IBM talked about the “virtuous cycle or reuse” (aka positive feedback loop) – each mashup you create makes creating the next one faster due to more widgets in your catalog.  This seems like it applies to any type of common component.
  • IBM shows how they use social networking on their own internet with live examples.
  • Wolfram Alpha showed many interesting examples using their knowledge engine.
  • If everyone gets a phone, do you wait for someone to mail you a letter?
  • You can waste time with any technology – such as Minesweeper when PCs first had it.
  • On Twitter, your popularity increases your credibility which increases your status.
  • Four online behaviors are lurking (private), staying in touch (people you know), connecting (people you want to know) and brand building (very public)

Check back tomorrow for comments on the final day of Web 2.0 Expo.

why to turn down a paid job

More money is always better, right?  Not really.  Granted if you don’t have enough money to buy food and other necessities, this doesn’t apply to you.  However if you already have a full time job and enough money to live comfortably, is more money better?

Liking your full time job

One time in the Job Discussion forum of JavaRanch, someone asked about which of two completely disparate things paid better.  In a discussion about which he liked better, I asked a hypothetical question.  The gist of it was – if you got paid a lot of money to get poked with a hot/sharp stick 40 hours a week for the next 10-20 years, would you do it?”  While someone obligingly answered that it depends on how much you get paid, it shows the point.  Making you think about enjoying the large percentage of time you spend at work.

Similarly, a few participants in that forum have expressed a statement that they would rather stay technical even if becoming a manager paid more.  I certainly understand this sentiment.  It shows enjoying a job matters.

What about volunteering?

Some technical people do volunteer work on the side because they enjoy it.  This is a marked contrast to “I’m on a computer all day at work – why would I want to touch one at home.”  On the surface, it would seem like if you enjoy something enough to do it voluntarily, getting paid would be icing on the cake.  I’ve turned down a couple offers to do something on the side for money.  My reason is that I have a full time job and if I get paid to do X, it will be stressful.  Whereas while I’m a volunteer I don’t feel bad if I have to stop for a little while – as long as someone else is covering.

Then I read Ilja Preuss’ tweet about the article “How Rewards can Backfire and Reduce Motivation.”  The article points out rewards remind us of obligations and dull/tedious/painful tasks.  Very interesting and it really resonates with me and why I do things as a volunteer.

Assuming you can pay the bills, fun is a factor!

Java + Cron Job = Quartz

Quartz Enterprise Job SchedulerOne of my favorite, often least used, open source tools for Java/J2EE applications is the Cron Job scheduling tool Quartz. Anyone who’s ever administered Linux or a web server is probably familiar with creating and modifying cron jobs to run a process at a specific time of the day/week/month. For example, you may need a nightly clean job for a data directory, or you may need to generate reports automatically at the end of the week. What I like about Quartz is that it’s simple to use, works in both Java and J2EE server-based applications, and is easy to install.

Java with operating-system cron jobs
Despite the availability of Quartz and similar Java-based tools, some developers still choose to use the operating system crontab and set it up to call Java methods directly. Although this can work well in practice, it’s not a very stable solution. For example, if the Java home variable changes, the cron job could break. Also, it’s not portable, since each operating system has a slightly different scheduling tool. Most importantly, though, the application is more vulnerable to attack since it requires input from a process outside the JVM.

What is Quartz?
Quartz is an open source scheduling module written entirely in Java, which lives inside the JVM. It has complete support for creating jobs based on crontab-like syntax, such as using the string “0 4 * * * ?” to run a job every day at 4am. It also supports a more rigorous non-crontab syntax for schedules that can’t be specified in a single string. Anytime a developer needs to write a process that runs in the background, whether its run once a day or every 5 minutes, they should consider Quartz for their scheduling needs.

Creating a Job
Even though you probably only have one job you want to schedule, all Quartz applications start by creating a scheduler that can support any number of jobs using the following code:

SchedulerFactory schedulerFactory = new org.quartz.impl.StdSchedulerFactory();
Scheduler scheduler = schedulerFactory.getScheduler();
scheduler.start();

From there, we can create our 4am job schedule by defining the job, defining the schedule, and then tying the two together by adding them to our scheduler instance, as below:

JobDetail job = new JobDetail("myJob",MyClass.class);
CronTrigger schedule = new CronTrigger("mySchedule",Scheduler.DEFAULT_GROUP,"0 4 * * * ?");
scheduler.scheduleJob(job,schedule);

Finally, you create a job class, in this case MyClass, that implements the Job interface and has a method quite similar to a main method:

public class MyClass implements Job {
   public void execute(JobExecutionContext context) {
    ... // Perform job
   }
}

Keep in mind that this code to create the scheduler and job can be in any class. The only class-level restriction is that the job itself has to implement the Job interface. How and where the job is created is up to you.

J2EE: How to apply?
J2EE servers often run for long periods of time, therefore they are a natural fit for Quartz scheduling. For example, you can use Quartz to create reports out of large sets of data in the middle of the night when usage is low. There are literally dozens of ways to integrate Quartz with J2EE, but the two main ways I prefer to use are:

  • Job calls a session bean method
  • Job creates a message and sends it to a JMS queue

In both cases, the job itself is *never* more than a page of code. It just picks up what it was called for and executes a J2EE call. In this manner, you might have a bean called ReportBean with a method on the bean call generateNightlyReport(). The Quartz job would be a short segment of code that connects to the bean and executes the session bean command.

My favorite method, though, is to have a job create a message and send it to a JMS queue, since the Quartz process can return without waiting for the actual job to finish. Also, the job does not require a transaction or context since it’s going to a queue instead of executing a bean directly. As long as you have a messaging bean watching the queue, the job will get executed soon after the Quartz scheduler has finished processing the request.

Some tips
Hopefully this article has given you a taste for Quartz as a scheduling tool. While I am aware there are other scheduling tools in Java, Quartz has always worked right out of the box for me with very little effort, so to be honest I’ve never had a reason to try another. Here are some tips I recommend to write good Quartz applications:

  • Keep your job class under a page. If you find yourself writing a very large job class, extract the useful code into a separate class and have the job code call that class. In this manner, there’s very little code actually tied to your scheduler and you can reuse the class outside the context of scheduler.
  • If your schedule executes often or your jobs are quite long, there’s the distinct possibility a job could be started while the last job is running. For example, if a job runs every 2 minutes and the first job is taking 3 minutes, Quartz won’t block the second job from starting so you will have multiple instances of the same job running at once. While there are probably ways to prevent this within Quartz, one sanity check I like to enforce is a semaphore lock that prevents two threads from executing the same code at the same time. In the case a second job is started while the first is running, the second should just exit instead of waiting for the first to finish. In Java, you can do this atomically by setting an int to 0 or 1.
  • Quartz is often included in a number of J2EE server packages, so you may have it without the need to import the libraries. Keep in mind, though, that the existing version installed with the J2EE server may be older than the one you want to use. In that case, you may want to import your own Quartz jar into the application.