Sunday Sep 30, 2012

JavaOne 2012 Pictures - Java Leaders Brunch and GlassFish Community Event


Some pictures from the Java Leaders Brunch ...










And some pictures from the GlassFish Community Event (with 110+ attendees) ...








And the evolving album ...



Thursday Oct 20, 2011

Oracle Public Cloud - Java, Database, Social Network, Fusion CRM, Fusion HCM

The Oracle Public Cloud is a suite of Oracle Applications, Middleware and Database offerings delivered in a self-service, subscription-based, elastically scalable, reliable, highly available and secure manner. Oracle provides hosting, management, software updates, and world-class support for these offerings.

The Oracle Public Cloud includes the following services:
Why Oracle Public Cloud is a better offering than others ?
  • It can be used for enterprise business applications because of the complete (applications, database, middleware), open (based on standards), and flexible (cloud and on-premise deployment with the ability to move applications back-and-forth)
  • Applications are fully integrated and ready to use
  • New applications can be built using standards like Java EE and SQL without locking you into a framework
  • Based upon Exalogic and Exadata offering superior reliability, peformance, and elastic capacity
Read more details at Why Oracle ?.

Watch an interesting set of short introductory videos recorded on some of the services. The first one is an introduction on Oracle Public Cloud:



The next one explains the Oracle Java Cloud Service:



Read more about the Java Service at Reza's blog. See a live demo of the Java Service below:



Then the Oracle Database Cloud Service:



And finally the Oracle Social Network Cloud Service:



Read more details about Oracle Social Network Service. How do you get started ?
Here are some more links for you:
The service will be offered from the US-based data centers and then expanding to EMEA and APAC based upon demand.

Tuesday Oct 04, 2011

DEMOGrounds, JBoss Party, GlassFish BoF, and Java Champions/JUG Leaders Dinner @ JavaOne 2011

Here are some tweets seen on #javaone11 today ...

#JAVAONE11 day one was great! Preparing for day two. Very curious about the contents of the strategy keynote, which starts in about an hour!
IBM, Red Hat, and Intel folks now on stage #javaone11 > "we're competitors but Java requires collaboration for comparability"
Head is spinning right now. Java on iOS. Twitter in the JCP. Wow.
Looks like #JavaOne11 is rocking this year. Wish I was there, but am sure my wife is having a great time.
Another great #javaone11 day is coming to an end. See you tomorrow in my 2.5 talks - or a hallway conversation. Enjoy J1!
So sad more than half of the javaone is already over #javaone11
Ready for the last BOF at #Javaone11 Too bad they don't continue tomorrow.
Just heard a #javaone11 attendee say the conference this year is the woodstock for #java developers. wOOt wOOt

Over all much more positive vibes all across.

Enjoy some pictures from earlier today ...

And now some pictures from the Java Champions and JUG Leaders dinner ...

And the evolving album so far ...

Sunday Oct 02, 2011

Java Champions and JUG Leaders Brunch Pics @ JavaOne 2011

And the evolving album for JavaOne 2011 so far:

Friday Jul 29, 2011

OSCONJ 2011 Trip Report



Rockstar speakers, solid content, spacious venue, several opportunities for networking, great wifi, a fancy bag for attendees, good food, warm breakfast for speakers, and several other items together is how I'd remember the inaugural OSCONJ. Its never easy to launch a new conference and be this successful. Yes, there were some gotchas (nothing major) but I'm totally impressed with how O'Reilly's multi-year experience showed up inaugurating this yet another Java conference.

OSCON which started as a Perl conference in 1997 has expanded its scope to include all open-source technologies in the early years and now talk about anything and pretty much everything open source. Perl,  Python, PHP, Java, MySQL, JavaScript, NoSQL, HTML5, Community Management, Open Data/Hardware, and polyglot JVM is a slight taste of the topics presented this time. About 3500 attendees were present for the main and sub-conferences, biggest so far.

OSCONJ was organized as a sub-conference of OSCON in its 13th running year. In 2005, the conference had a separate Ruby track where DHH talked about Extracting Rails from Basecamp and then RailsConf was promoted to be a full conference next year. Lets see how the OSCONJ shapes up in the years to come. I don't know the formal registration/attendee numbers for OSCONJ but personal observation through the keynote attendance and attendees in different Java tracks at different times suggests about 150-200.

I presented a session on "GlassFish Server 3.1: Deploying your Java EE 6 Applications" and the slides are available:

I also delivered a hands-on lab building a complete end-to-end Java EE 6 application using GlassFish and NetBeans. The instructions for the lab are also available at bit.ly/javaee6-oscon11. There were about 40 participants in the lab and most of them were actively engaged and could complete the lab successfully.

Watch some of the Oracle sessions in the following playlist:


I'll keep updating the playlist as more session recordings are made available.

Some other recordings worth watching are Java: The Good, Bad, and Ugly Parts by Joshua Bloch, Twitter: From Ruby on Rails to the JVM by Raffi Krikorian, Working Hard to Keep it Simple by Martin Odersky, The Future of Community by Jono Bacon, and several more at OSCON 2011 @ youtube.

Some of the highlights from "Twitter: From Ruby on Rails to the JVM" are:
  • Huge number of oncurrent connections: 200k/seconds
  • Lots of IO, Very few persistent objects
  • Patched Ruby, build a whole new Ruby GC, but looking for opportunities to join a bigger developer community and go in the direction where world is going on.
  • Biggest reason to move to Java is because of "real concurrency model".
  • Ops team give no grief because eventually we give them a JAR file, similar way to GC, monitor, analyse etc.
  • JVM gives something that Ruby does not: scatter-gather algorithm
  • Big part of the app is still in Ruby and working on migrating that to Java.
  • Will add lot more instrumentation in OpenJDK GC
  • Storage/Retrieval is all Java.
The London Java Community leaders also hosted a panel on "The Java Standards Annoyances". Patrick Curran, Jeff Genender, Dan Allen, David Blevins, Bruno Souza, Bob Lee and others participated in a healthy discussion. The key recommendations from the panel were:
  • Participate in JSR 348
  • For the EG leads, make your pages easy to use, issue tracker, downloads etc
  • Make a lot of noise, speak up and don't be afraid. Explain your usecase.

Here are some pictures from the event:









And the complete album:


Unfortunately, my camera's battery exhausted in on the third day so I could not take more pictures. But I can see myself going to this conference again next year, provided they accept my papers, because of the great efforts and meticulous details by Stephen Chin, Laurel Ruma, and O'Reilly :-)

Wednesday Jul 20, 2011

Nominate your Java Technology for Duke's Choice Awards at JavaOne 2011


For the ninth year in a row, the Duke's Choice Awards, are looking for compelling and innovative usage of Java technology. There are no pre-defined categories and its all about innovation in Java.

It allows small developers shops on equal footing with multinational giants. So if you are working on something that you are excited about and believe is extremely innovative, don't wait.
Submit your nominations today (DOC) to Michelle Kovac!

What do you get ?
  1. Promotion on Oracle website and at JavaOne conference
  2. Prestigious award to display at your office
  3. Java Innovation icon for display on your website
  4. Coolest part is the "bragging rights"
Does your Java technology usage out-compel, out-innovate, and outlast others ? Submit your nominations as this is your chance to be grab the bragging rights!

The deadline for submission is Friday, Jul 29, 2011 at 5pm PT.

Friday Jun 10, 2011

Cloud Expo East and New York City Java Meetup Trip Report

7000+ delegates and 200+ sponsors/exhibitors made the Cloud Expo 2011, New York City yet another successful conference by SYS-CON. I gave a talk on "Running your Java EE applications in the Cloud" and highlighted:

  • How Java EE 6 light-weight nature is ideal for cloud development/deployment
  • Show how to deploy a typical 3-tier Java EE application in Amazon, Rightscale, Joyent, and Azure
  • Why Weblogic is ideally suited for enterprises for cloud deployments
  • How Java EE 7 is evolving to provide a standards-based PaaS deployment platform

The slides are available below:

There were about 30+ attendees in the talk and some of them were GlassFish customers and several Weblogic customers. So they both, and others, found out how the two application servers from Oracle are relevant for the cloud deployment.

Check out some pictures from the expo and around the city:


It was good to catch up with Jeff and Justin and enjoy couple of evenings together!

The next day I presented at New York City Java Meetup and explained the key features of Java EE 6 and GlassFish using live coding sessions with NetBeans. There were about 50+ attendees (in and out) at the highly interactive session.

Here is some feedback captured after the event:

Arun gave a great presentation on the virtues of JEE6 and NetBeans as well what is to come in future Java releases.

This was a good meet up. Very informative and useful information. The location is excellent.


And some more ...

Excellent presentation.

Pretty good meetup! very informative as alot of the areas that he covered are relevant and "hot" today. I recruit for Java Developers and these days I am routinely asking about experience with IOC/ CDI, Dependency Injection and restless web services. So I walked away feeling that Oracle was working the same market.

Interesting topic well presented.



Another good data point is that the average rating seems to be 4.5 (out of 5) after 14 attendees have rated it. Any feedback on how I can close the gap between 4.5 and 5 would be helpful :-)

The code built during the meetup can be downloaded here.

Here is a photograph from the meetup page:

And a few more that I took:


The venue for the meetup was Barnes & Noble store in the uptown and they did an excellent job of hosting the event. There was ample sugar and drinks for everybody (as you can see in the pictures) and each attendee even got a $15 gift card. The company is is making major investments in their eCommerce platform and digital products (i.e. Nook, Cloud Computing, Mobile apps). Java/J2EE is being used heavily throughout their environment. Opportunities exist for Engineers, Architects and Team Leads in their NYC and Palo Alto offices. If you are interested an informational conversation about technical careers and what's going on at BN.com, contact Jason Greenhouse @ jgreenhouse@book.com. I chatted with their CTO and VP of Engineering and hopefully will have some followup meetings to coach them more about the benefits of Java EE 6 :-)

Thank you Dario for providing me with an opportunity to talk about the "ultimate threesome" (Java EE 6 + GlassFish + NetBeans) to your meetup community!

On a personal front, I just could not miss the opportunity to grab couple of shorts runs in the Central Park:

There is no dearth of motivation there, tons of runners and in both directions. It was quite an enjoyable experience and matches well with the sedentary nature of my job ;-) If you are in the New York City during spring/summer time, make sure to plan an early morning run through Central Park and you will not regret it!

And as always, check out the complete photo album at:

Wednesday Apr 20, 2011

Why JAX Conf San Jose 2011 ?

Last week at JAX London Spring 2011, I got an opportunity to talk with Sebastien Meyen and Mark Hazell and they explained on why they are bringing JAX to San Jose and how they expect to work with different community leaders to make it effective.

JAX Conferences are "Java platform centric with a high passion" and provides a "Pragmatic mix with Java focused sessions".

Hear it all from them:


Register by 5/9 and save $200 - register now!

Are you a user group community interested in working with JAX Conf ? Send an email to Mark Hazell at markh@jaxconf.com.

There are several special days, including 7 sessions in the Java EE Day on Wed and Thu. More details on that later.

See ya there!

Technorati: conf jaxconf sanjose java

Tuesday Sep 21, 2010

Oracle Open World / Java One 2010 Pics - Hands-on Lab Session, General Session Technical Keynote, Java Champions and JUG Leader Dinner

Here are some pictures from Oracle Open World and JavaOne 2010 from the Hands-on Lab session, JavaOne General Session Technical Keynote, and Java Champions ad JUG Leaders dinner ...

And the evolving album at:

Technorati: conf sanfrancisco oracle oracleopenworld javaone java champions jug

Wednesday Jun 16, 2010

Uber Conf 2010 - Notes from Scala for Java Programmers Workshop

I spent the first half of Day 3 of Uber Conf 2010 (Day 2 and 1) in Scala for Java Programmers workshop by Venkat, took extensive notes, and noted/tried pretty much all the code samples.

<warning>
This is a code intensive and slightly long entry.
</warning>

A more complete entry covering other events of Day 3 will come later today.

Lets go down the rabbit hole!

  • Why Scala ? - Scala is highly concise, expressive, nice support for XML processing, pattern matching, inherent support for authoring concurrent code - lot of good things to write efficient code.
  • Scala means SCAlable LAnguage - comes from the fact that you can write either a small script or a complete application using Scala.
  • An application developed on single core and deployed on multi-core can easily misbehave, primarily because of the concurrency model in Java. Scala makes it much easier to write concurrent applications (more on this below).
  • Writing correct synchronized code in Java requires divine power. Multi-threaded programming in Java is like working with mother-in-law, basically waiting for you to fail.
  • Scala complies with Java semantics without you worrying about it. "-savedcompile" saves the generated class files as JAR in the local directory.

Here is the first sample code that calculates the factorial of a number:

def fact(number: Int) = {
 var total = 1
 for (i <- 1 to number) {
     total = total \* i
 }
 total
}

println(fact(5))

Key points about this code (differences from Java):

  • Each class is "public" by default
  • No "main" method
  • "return" keyword is not required
  • The index "i" is assigned a type using inference, integer in this case
  • "var" defines a variable

This was done as a user exercise and so I wrote my first Scala code today ... yeee-haw!

  • Recursion is very expressive but expensive because of multiple stacks. Scala makes it run iterative and so less expensive
  • Scala supports tail recursion to a fairly decent extent, only one level of stack and so less expensive.

Here is a re-write of the above function using simple iterative recursion:

def total(number:Int) : Int = {
    if (number == 1)
       return 1
    number \* total (number - 1)
}

println(total(5))

And now this method converted to use tail recursion

def total(number: Int) : Int = {
   def totalWithAccumulator(accumulator: Int, number: Int) : Int = {
       if (number == 1) 
           accumulator
       else
           totalWithAccumulator(accumulator \* number, number - 1)
   }
   totalWithAccumulator(1, number)
}
println(total(5))

Here is a function that calculates the total of elements in a list:

def total(list: List[int]) = {
    var total = 0
    for (e <- list)
       total = total + e
    total
}

val list = List(1,2,4,5,6,3)
println(total(list))

This is using iterative approach - keep modifying the variable over & again and tells the next step. In functional, variables are constant and never changed. And here is a new method using the functional capabilities:


// imperative
def total(list: List[int]) = {
    var total = 0
    for (e <- list)
        total = total + e
    total
}

// functional
def total2(list: List[int]) = {
    list.foldLeft(0) {
       (carryOver, e) => carryOver + e
    }
}

val list = List(1,2,4,5,6,3)
println(total(list))
println(total2(list))

In Scala

a.+(b);

is equivalent to
a + b

".", parentheses, and ";" are optional.

When the method name ends with the colon, Scala will transpose them. The following code snippet shows this and some other features of the language:

val list = List(1,2,4,5,6,3)

// Imperative
var total1 = 0
for (e <- list)
    total1 = total1 + e
println("Total is " + total1)

// Functional
val total2 = list.foldLeft(0) { (carryOver, e) => carryOver + e }
println("Total is " + total2)

// Transposition using colon
// /: is a different name for foldLeft
var total3 = (0 /: list) { (carryOver, e) => carryOver + e }
println("Total is " + total3)

// No name required if the parameters are used only once
var total4 = (0 /: list) { _ + _ }
println("Total is " + total4)

// Pipe the method
def add(op1: Int, op2: Int) = { op1 + op2 }
val total5 = (0 /: list) { add }
println("Total is " + total5)
  • No primitive types in Scala, everything is an object

Code samples of closures in Scala ...

def totalSelectedNumbers(list:List[Int], selector: Int => boolean) = {
    var total = 0
    for (e <- list)
        if (selector(e)) total = total + e
    total
}


val list = List(1,2,4,5,6,3)
println(totalSelectedNumbers(list, { e => true }))
println(totalSelectedNumbers(list, { e => e % 2 == 0 }))
println(totalSelectedNumbers(list, { e => e > 4 }))
println(totalSelectedNumbers(list, { _ > 4 }))

Notice how "println" becomes more concise over subsequent lines. And a further cleaner, and concise, version can be written by allowing multiple lists to be passed to the function as shown below:

// Multiple lists to the function
def totalSelectedNumbers(list:List[Int]) (selector: Int => boolean) = {
    var total = 0
    for (e <- list)
       if (selector(e)) total = total + e
    total
}

val list = List(1,2,4,5,6,3)
println(totalSelectedNumbers(list) { _ > 4 })

Here is another exercise to write a function that doubles the number in the list:

val list = List(1,2,4,5,6,3)
println(list.map { _ \* 2 })

And another exercise to find the maximum number of a list

val list = List(1,2,4,5,6,3,2,7)
val max = (list(0) /: list) { (max, e) =>
             if (e > max) e else max
          }
println (max)


And then a simplified method definition ...

println((list(0) /: list) { Math.max })

  • In Scala: "val" creates a pointer that cannot change, "var" creates a pointer that can change but the objects are immutable.
  • In Scala, everything is public unless you say otherwise.
  • Code within the class runs within the primary constructor. In Scala, there is only one constructor, every other is called as auxiliary constructor and they always go through the primary constructor. Only primary constructor can call super (only path to the base class)

Here is a simple class definition:

class Car(val year: int, var miles: Int) {

    // invokes with primary constructor
    println("hello there")

    // year has a getter, miles has a getter/setter
    def drive(dist: Int) = {
       miles += dist
    }

    // private method only to this instance
    private[this] def tuneup {}
}

val car = new Car(2010, 0)
println(car.year)
println(car.miles)
car drive 10
println(car.miles)
  • Scala is a purely OO language, new methods can be defined easily on any object

Here is a sample code that demonstrates adding a new method:

import java.util._ // static import

class IntUtil(number: Int) {
   def days = this
   def ago = {
      var cal = Calendar.getInstance()
      cal.add(Calendar.DAY_OF_MONTH, -number)
      cal.getTime()
   }
}

val num = 2
val obj = new IntUtil(num)
println(obj.days.ago)
  • Scala has no primitive types, everything is an object.
  • New methods can be easily added using "implicit conversion"

Here is a code sample that shows how to perform "implicit conversion" and add a new method to a "val"

import java.util._ // static import

class IntUtil(number: Int) {
   def days = this
   def ago = {
      var cal = Calendar.getInstance()
      cal.add(Calendar.DAY_OF_MONTH, -number)
      cal.getTime()
   }
}

val num = 2
val obj = new IntUtil(num)
println(obj.days.ago)

// implicit conversion - only one conversion can be applied per object (or class??)
implicit def pleaseConvertInt2WonderfulIntUtil(number: Int) = new IntUtil(number)

println(2.days.ago)
  • To create Singleton, use the word "object" such as:
class Car {
}

object Car {
    // place all the static methods here
}
  • This singleton object is also called the "companion" object and it must exist in the same file as the original object.
  • Companion object is used to create the factory pattern.
  • Adding "private" to the class definition makes the constructor private.
  • "apply" is a special method: "blah.apply(something)" is equivalent to "blah(something)"
  • "apply" has a cousin "update" and takes 2 parameters

Here is a code that demonstrates some of the above mentioned features:

import scala.collection.mutable._

class Pen private (val color: String) {
    println(color + " pen being created")
}

// companion object - singleton
object Pen {
    val pens : Map[String, Pen] = Map()
    def createPen(color: String) = {
        if (!pens.contains(color))
            pens(color) = new Pen(color)
            // == pens.update(color, new Pen(color)
        pens.get(color)
    }
}

val bluePen = Pen.createPen("blue")
val bluePen2 = Pen.createPen("blue")
val redPen = Pen.createPen("red")

Running this code shows that "blue" pen is created only once and cached during second attempt. Notice, how the Pen is created using "createPen" factory method. This code can be changed to use "apply" as:

import scala.collection.mutable._

class Pen private (val color: String) {
    println(color + " pen being created")
}

// companion object - singleton
object Pen {
    val pens : Map[String, Pen] = Map()
    def apply(color: String) = {
        if (!pens.contains(color))
            pens(color) = new Pen(color)
        pens.get(color)
    }
}

val bluePen = Pen("blue")
val bluePen2 = Pen("blue")
val redPen = Pen("red")

Notice how default constructors instead of the factory pattern are now used.

Here is a piece of code that has two classes with similar functionality:

class Human(val name: String) {
 def listen = println("I am " + name + " your friend")
}

class Animal(val name: String)

class Dog(override val name: String) extends Animal(name) {
 def listen = println("I am " + name + " your friend")
}

val peter = new Human("Peter")
peter.listen

val rover = new Dog("Rover")
rover.listen

This violates the DRY principle. Scala Traits allows to encapsulate the code as shown below:

trait Friend {
 val name: String
 def listen = println("I am " + name + " your friend")
}

class Human(val name: String) extends Friend

class Animal(val name: String)

class Dog(override val name: String) extends Animal(name) with Friend

val peter = new Human("Peter")
peter.listen

val rover = new Dog("Rover")
rover.listen


// include trait at an object level
class Cat(override val name: String) extends Animal(name)

val molly = new Cat("Molly") with Friend
molly.listen
  • XML processing is a first class citizen in Scala
val xml = therethere
println(xml)

// XPath query
println(xml \\\\ "@greet")
println(xml \\\\ "where")
val stock = Map("APPL" -> 250, "GOOG" -> 300)

def createStock() = {
 stock.map { entry =>  }
}

// Scala code within XML
val xml = { createStock() }

println(xml)

Here is the last exercise from the workshop: Use Yahoo Weather API to find the temperature of Denver, CO:

import scala.xml._
import scala.io._
import java.net._

val theURL = "http://weather.yahooapis.com/forecastrss?w=2391279&u=f"

val xmlString = Source.fromURL(new URL(theURL)).mkString
//println(xmlString)    // for debugging

val xml = XML.loadString(xmlString)

val city = xml \\\\ "location" \\\\ "@city"
val state = xml \\\\ "location" \\\\ "@region"
val temperature = xml \\\\ "condition" \\\\ "@temp"

println("Temperature in " + city + ", " + state + " is " + temperature)
  • Actors enable concurrency in Scala, "receive" is used to receive the response from each Actor
  • Don't use "receive" outside, use receive within
  • OK to share Java code within Scala only if its mutable
  • Scala has "tuples", are immutables, and really good candidate for concurrency

Here is a sample code refactoring the above code in a method, called 50 times in a loop, printed once using traditional method invocation and once using Actors. The total time taken for the two set of executions is then printed.

import scala.xml._
import scala.io._
import java.net._
import scala.actors._
import Actor._

def getTemperature(woeid: Int) = {

    val theURL = "http://weather.yahooapis.com/forecastrss?w=" + woeid + "&u=f"

    val xmlString = Source.fromURL(new URL(theURL)).mkString
    val xml = XML.loadString(xmlString)

    val city = xml \\\\ "location" \\\\ "@city"
    val state = xml \\\\ "location" \\\\ "@region"
    val temperature = xml \\\\ "condition" \\\\ "@temp"

    (city, state, temperature)      // tuples are immutable
                                    // good candidates for concurrency
}

val start = System.nanoTime
for (woeid <- 2391250 to 2391299) {
    println(getTemperature(woeid))
}
val end = System.nanoTime
println("Time taken (without Actor): " + (end - start)/100000000.0) 

// Now dispatching to multiple actors
val start2 = System.nanoTime
val caller = self               // self is a pointer to my actor
for (woeid <- 2391250 to 2391299) {
    actor { caller ! getTemperature(woeid) }      // Dispatch 50 actors
}

for (woeid <- 2391250 to 2391299) {
    receive {
       case msg => println(msg)
    }
}
val end2 = System.nanoTime

println("Time taken (with Actor): " + (end2 - start2)/100000000.0)

A sample result from running this script showed the results:

Time taken (without Actor): 171.62816
Time taken (with Actor): 29.05179

As you can see the difference is quite evident - approx 6x better performance when using Actors.

Overall, super excited after writing so much Scala code and learned something new.

Thank you Venkat for yet another great workshop!

Technorati: conf uberconf scala java workshop

About

profile image
Arun Gupta is a technology enthusiast, a passionate runner, author, and a community guy who works for Oracle Corp.


Java EE 7 Samples

Stay Connected

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today