Thursday November 27, 2008
GlassFish and MySQL Student Contest - Winners announced
GlassFish
and MySQL student contest winners are announced!
Kolli Bharath from Dhirubhai
Ambani Institute of Information and Communication Technology,
India (review,
project)
and Tomas Augusto
Muller, Universidade
de Santa Cruz do Sul, Brazil (review,
project)
won the grand prize of $500 each. There are 7
second prize winners of $250 each.
Congratulations to all the winners!
Meet some of the contest participants here,
here,
here,
and here.
There were lots of great entries and picking one was a tough decision.
But luckily the process was simple and clearly defined for all the
judges. Each submission was assigned numbers between 1-100 in
8 pre-defined criteria and then a winner was picked. Now, don't ask us
about the total marks for each entry or the winning margin ;)
Thanks to all the judges for reviewing the entries!
Here are some guidelines I followed during the review:
Posted by Arun Gupta in General | Comments[9]
|
|
|
|
|
Wednesday November 26, 2008
TOTD #57: Jersey Client API - simple and easy to use
TOTD
#56 explains how to create a RESTful Web service endpoint
using Jersey
and publish the resource using JSON representation. The blog entry
showed how the endpoint can be accessed from a Web browser. This Tip Of The Day explains how to
use Jersey
Client APIs to invoke the published endpoint.
Lets get started!
| package org.glassfish.samples; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; /** * Unit test for simple App. */ public class AppTest extends TestCase { /** * Create the test case * * @param testName name of the test case */ public AppTest( String testName ) { super( testName ); } /** * @return the suite of tests being tested */ public static Test suite() { return new TestSuite( AppTest.class ); } /** * Rigourous Test :-) */ public void testApp() { assertTrue(true); } } |
| private
WebResource createResource() { Client client = Client.create(); WebResource resource = client.resource("http://localhost:8080/helloworld-webapp/webresources/myresource"); return resource; } |
|
Greeting result = createResource().get(Greeting.class); assertTrue(result.greeting.equals("Hi there!")); |
| import com.sun.jersey.api.client.Client; import com.sun.jersey.api.client.WebResource; |
| ~/samples/jersey/helloworld-webapp >mvn test [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Building helloworld-webapp Jersey Webapp [INFO] task-segment: [test] [INFO] ------------------------------------------------------------------------ [INFO] [resources:resources] [INFO] Using default encoding to copy filtered resources. [INFO] [compiler:compile] [INFO] Nothing to compile - all classes are up to date [INFO] [resources:testResources] [INFO] Using default encoding to copy filtered resources. [INFO] [compiler:testCompile] [INFO] Compiling 1 source file to /Users/arungupta/samples/jersey/helloworld-webapp/target/test-classes [INFO] [surefire:test] [INFO] Surefire report directory: /Users/arungupta/samples/jersey/helloworld-webapp/target/surefire-reports ------------------------------------------------------- T E S T S ------------------------------------------------------- Running org.glassfish.samples.AppTest Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.587 sec Results : Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 4 seconds [INFO] Finished at: Mon Nov 24 16:50:17 PST 2008 [INFO] Final Memory: 18M/43M [INFO] ------------------------------------------------------------------------ |
|
Client client = Client.create(); WebResource resource = client.resource("http://localhost:8080/helloworld-webapp/webresources/myresource"); resource.addFilter(new LoggingFilter()); return resource; |
| Running org.glassfish.samples.AppTest 1 * Out-bound request 1 > GET http://localhost:8080/helloworld-webapp/webresources/myresource 1 > 1 < 200 1 < X-Powered-By: Servlet/2.5 1 < Transfer-Encoding: chunked 1 < Content-Type: application/json 1 < Server: GlassFish/v3 1 < Date: Tue, 25 Nov 2008 07:07:51 GMT 1 < {"greeting":"Hi there!"} 1 * In-bound response Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.074 sec |
Posted by Arun Gupta in Finance | Comments[9]
|
|
|
|
|
Tuesday November 25, 2008
TOTD #56: Simple RESTful Web service using Jersey and Embeddable GlassFish - Text and JSON output
![]() |
Jersey is the open source, production quality, JAX-RS (JSR 311) Reference Implementation for building RESTful Web services in the GlassFish community. It also provides an API that allows developers to extend Jersey to suite their requirements. |
| ~/samples/jersey >mvn archetype:generate
-DarchetypeCatalog=http://download.java.net/maven/2 [INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'archetype'. [INFO] ------------------------------------------------------------------------ [INFO] Building Maven Default Project [INFO] task-segment: [archetype:generate] (aggregator-style) [INFO] ------------------------------------------------------------------------ [INFO] Preparing archetype:generate [INFO] No goals needed for project - skipping [INFO] Setting property: classpath.resource.loader.class => 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'. [INFO] Setting property: velocimacro.messages.on => 'false'. [INFO] Setting property: resource.loader => 'classpath'. [INFO] Setting property: resource.manager.logwhenfound => 'false'. [INFO] [archetype:generate] [INFO] Generating project in Interactive mode [INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven.archetypes:maven-archetype-quickstart:1.0) Choose archetype: 1: remote -> jersey-quickstart-grizzly (Archetype for creating a RESTful web application with Jersey and Grizzly) 2: remote -> jersey-quickstart-webapp (Archetype for creating a Jersey based RESTful web application WAR packaging) Choose a number: (1/2): 2 [INFO] snapshot com.sun.jersey.archetypes:jersey-quickstart-webapp:1.0.1-SNAPSHOT: checking for updates from jersey-quickstart-webapp-repo Define value for groupId: : org.glassfish.samples Define value for artifactId: : helloworld-webapp Define value for version: 1.0-SNAPSHOT: : Define value for package: : org.glassfish.samples Confirm properties configuration: groupId: org.glassfish.samples artifactId: helloworld-webapp version: 1.0-SNAPSHOT package: org.glassfish.samples Y: : [INFO] ---------------------------------------------------------------------------- [INFO] Using following parameters for creating OldArchetype: jersey-quickstart-webapp:1.0.1-SNAPSHOT [INFO] ---------------------------------------------------------------------------- [INFO] Parameter: groupId, Value: org.glassfish.samples [INFO] Parameter: packageName, Value: org.glassfish.samples [INFO] Parameter: package, Value: org.glassfish.samples [INFO] Parameter: artifactId, Value: helloworld-webapp [INFO] Parameter: basedir, Value: /Users/arungupta/samples/jersey [INFO] Parameter: version, Value: 1.0-SNAPSHOT [INFO] ********************* End of debug info from resources from generated POM *********************** [INFO] OldArchetype created in dir: /Users/arungupta/samples/jersey/helloworld-webapp [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 21 seconds [INFO] Finished at: Mon Nov 24 14:09:27 PST 2008 [INFO] Final Memory: 12M/30M [INFO] ------------------------------------------------------------------------ |
|
<plugin> <groupId>org.glassfish</groupId> <artifactId>maven-glassfish-plugin</artifactId> </plugin> |
|
<pluginRepositories> <pluginRepository> <id>maven2-repository.dev.java.net</id> <name>Java.net Repository for Maven</name> <url>http://download.java.net/maven/2/</url> <layout>default</layout> </pluginRepository> <pluginRepository> <id>maven-repository.dev.java.net</id> <name>Java.net Maven 1 Repository (legacy)</name> <url>http://download.java.net/maven/1</url> <layout>legacy</layout> </pluginRepository> </pluginRepositories> |
|
<dependency> <groupId>org.glassfish.distributions</groupId> <artifactId>web-all</artifactId> <version>10.0-build-20080430</version> <scope>test</scope> </dependency> <dependency> <groupId>org.glassfish.embedded</groupId> <artifactId>gf-embedded-api</artifactId> <version>1.0-alpha-4</version> <scope>test</scope> </dependency> |
|
<dependency> <groupId>org.glassfish.distributions</groupId> <artifactId>web-all</artifactId> <version>10.0-SNAPSHOT</version> <scope>test</scope> </dependency> <dependency> <groupId>org.glassfish.embedded</groupId> <artifactId>glassfish-embedded-all</artifactId> <version>3.0-Prelude-SNAPSHOT</version> </dependency> |
|
<properties> <jersey-version>1.0</jersey-version> </properties> |
| package org.glassfish.samples; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; // The Java class will be hosted at the URI path "/helloworld" @Path("/myresource") public class MyResource { // The Java method will process HTTP GET requests @GET // The Java method will produce content identified by the MIME Media // type "text/plain" @Produces("text/plain") public String getIt() { return "Hi there!"; } } |
| ~/samples/jersey/helloworld-webapp >mvn glassfish:run [INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'glassfish'. [INFO] ------------------------------------------------------------------------ [INFO] Building helloworld-webapp Jersey Webapp [INFO] task-segment: [glassfish:run] [INFO] ------------------------------------------------------------------------ [INFO] Preparing glassfish:run [INFO] [resources:resources] [INFO] Using default encoding to copy filtered resources. [INFO] [compiler:compile] [INFO] Compiling 1 source file to /Users/arungupta/samples/jersey/helloworld-webapp/target/classes [INFO] [glassfish:run] Nov 24, 2008 2:36:05 PM com.sun.enterprise.v3.server.AppServerStartup run INFO: HK2 initialized in 229 ms Nov 24, 2008 2:36:05 PM com.sun.enterprise.v3.server.AppServerStartup run INFO: com.sun.enterprise.naming.impl.ServicesHookup@2470b02c Init done in 237 ms Nov 24, 2008 2:36:05 PM com.sun.enterprise.v3.server.AppServerStartup run INFO: com.sun.enterprise.v3.server.Globals@13b3d787 Init done in 239 ms Nov 24, 2008 2:36:05 PM com.sun.enterprise.v3.server.AppServerStartup run INFO: com.sun.enterprise.v3.server.SystemTasks@61bedd7d Init done in 244 ms Nov 24, 2008 2:36:05 PM com.sun.enterprise.v3.server.AppServerStartup run INFO: com.sun.enterprise.v3.services.impl.HouseKeeper@2b9f7952 Init done in 245 ms Nov 24, 2008 2:36:05 PM com.sun.enterprise.v3.server.AppServerStartup run INFO: com.sun.enterprise.v3.services.impl.CmdLineParamProcessor@5249d560 Init done in 248 ms JMXMP connector server URL = service:jmx:jmxmp://localhost:8888 Nov 24, 2008 2:36:05 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start INFO: Listening on port 8080 Nov 24, 2008 2:36:06 PM com.sun.enterprise.v3.server.AppServerStartup run INFO: com.sun.enterprise.v3.services.impl.GrizzlyService@1baa56a2 startup done in 551 ms Nov 24, 2008 2:36:06 PM com.sun.enterprise.v3.services.impl.ApplicationLoaderService postConstruct INFO: loader service postConstruct started at 1227566166208 Nov 24, 2008 2:36:06 PM com.sun.enterprise.v3.server.AppServerStartup run INFO: Application Loader startup done in 740 ms Nov 24, 2008 2:36:06 PM com.sun.enterprise.v3.server.AppServerStartup run INFO: Glassfish v3 started in 740 ms Nov 24, 2008 2:36:07 PM com.sun.enterprise.web.WebModuleContextConfig authenticatorConfig SEVERE: webModuleContextConfig.missingRealm Nov 24, 2008 2:36:07 PM com.sun.jersey.api.core.PackagesResourceConfig init INFO: Scanning for root resource and provider classes in the packages: org.glassfish.samples Nov 24, 2008 2:36:07 PM com.sun.jersey.api.core.PackagesResourceConfig init INFO: Root resource classes found: class org.glassfish.samples.MyResource Nov 24, 2008 2:36:07 PM com.sun.jersey.api.core.PackagesResourceConfig init INFO: Provider classes found: Hit ENTER for redeploy |


| package org.glassfish.samples; import javax.xml.bind.annotation.XmlRootElement; /** * @author arungupta */ @XmlRootElement public class Greeting { public String greeting; public Greeting() { } public Greeting(String greeting) { this.greeting = greeting; } } |
| //
@Produces("text/plain") @Produces("application/json") public Greeting getIt() { return new Greeting("Hi there!"); } |

| mvn clean package |
Posted by Arun Gupta in webservices | Comments[16]
|
|
|
|
|
Monday November 24, 2008
![]() |
GlassFish v2 allows you to configure cluster of multiple nodes/instances to meet various availability requirements, from the highly scalable service availability configuration to the business-critical, 99.999% service-and-data availability configuration. A cluster can be deployed using different toplogies with a choice of service/data availability, in-Memory/HADB, co-located/non-colocated and other factors. This new white paper explains reference configurations on that can be used for deploying business services. |
Posted by Arun Gupta in General | Comments[4]
|
|
|
|
|
Friday November 21, 2008
TOTD #55: How to build GlassFish v3 Gem ?
GlassFish
Gem is a light-weight and robust deployment solution for
Ruby-on-Rails
and Merb
applications. The gem can be easily installed as:
| gem install glassfish |
| svn co
https://svn.dev.java.net/svn/glassfish-scripting/trunk/rails/v3/gem gem cd gem mvn -U clean install |
Posted by Arun Gupta in web2.0 | Comments[2]
|
|
|
|
|
Thursday November 20, 2008
TOTD #54: Java Server Faces with Eclipse IDE
Ed
pointed me to this excellent
tutorial that explains how JavaServer Faces applications can
be easily created using Eclipse IDE. The article clearly shows all the
steps to create a Java Server Faces application and demonstrates the
following JSF concepts:








Posted by Arun Gupta in web2.0 | Comments[2]
|
|
|
|
|
Wednesday November 19, 2008
Screencast #28: Simple Web Application using Eclipse and GlassFish v3 Prelude
GlassFish
v3 Prelude is now available!
Some of the cool features are:
Posted by Arun Gupta in web2.0 | Comments[22]
|
|
|
|
|
Tuesday November 18, 2008
TOTD #53: Scaffold in Merb using JRuby/GlassFish
GlassFish
Gem 0.9.0 can be used to run Rails and Merb applications.
Support another Rack-based framework Sinatra is coming up in the near
future. This blog shows how to create a scaffold in Merb and run it
using the
GlassFish gem.

| ~/samples/jruby/merb >~/tools/jruby-1.1.5/bin/jruby -S
merb-gen core --orm activerecord hello Generating with core generator: [ADDED] gems [ADDED] merb.thor [ADDED] .gitignore [ADDED] public/.htaccess [ADDED] doc/rdoc/generators/merb_generator.rb [ADDED] doc/rdoc/generators/template/merb/api_grease.js [ADDED] doc/rdoc/generators/template/merb/index.html.erb [ADDED] doc/rdoc/generators/template/merb/merb.css [ADDED] doc/rdoc/generators/template/merb/merb.rb [ADDED] doc/rdoc/generators/template/merb/merb_doc_styles.css [ADDED] doc/rdoc/generators/template/merb/prototype.js [ADDED] public/favicon.ico [ADDED] public/merb.fcgi [ADDED] public/robots.txt [ADDED] public/images/merb.jpg [ADDED] Rakefile [ADDED] app/controllers/application.rb [ADDED] app/controllers/exceptions.rb [ADDED] app/helpers/global_helpers.rb [ADDED] app/views/exceptions/not_acceptable.html.erb [ADDED] app/views/exceptions/not_found.html.erb [ADDED] autotest/discover.rb [ADDED] autotest/merb.rb [ADDED] autotest/merb_rspec.rb [ADDED] config/init.rb [ADDED] config/rack.rb [ADDED] config/router.rb [ADDED] config/environments/development.rb [ADDED] config/environments/production.rb [ADDED] config/environments/rake.rb [ADDED] config/environments/staging.rb [ADDED] config/environments/test.rb [ADDED] public/javascripts/application.js [ADDED] public/stylesheets/master.css [ADDED] spec [ADDED] app/views/layout/application.html.erb |
| ~/samples/jruby/merb/hello >merb-gen resource Runner
distance:float,minutes:integer Loading init file from /Users/arungupta/samples/jruby/merb/hello/config/init.rb Loading /Users/arungupta/samples/jruby/merb/hello/config/environments/development.rb Generating with resource generator: Loading init file from /Users/arungupta/samples/jruby/merb/hello/config/init.rb Loading /Users/arungupta/samples/jruby/merb/hello/config/environments/development.rb Loading init file from /Users/arungupta/samples/jruby/merb/hello/config/init.rb Loading /Users/arungupta/samples/jruby/merb/hello/config/environments/development.rb Loading init file from /Users/arungupta/samples/jruby/merb/hello/config/init.rb Loading /Users/arungupta/samples/jruby/merb/hello/config/environments/development.rb Loading init file from /Users/arungupta/samples/jruby/merb/hello/config/init.rb Loading /Users/arungupta/samples/jruby/merb/hello/config/environments/development.rb [ADDED] spec/models/runner_spec.rb [ADDED] app/models/runner.rb [ADDED] schema/migrations/001_runner_migration.rb [ADDED] spec/requests/runners_spec.rb [ADDED] app/controllers/runners.rb [ADDED] app/views/runners/index.html.erb [ADDED] app/views/runners/show.html.erb [ADDED] app/views/runners/edit.html.erb [ADDED] app/views/runners/new.html.erb [ADDED] app/helpers/runners_helper.rb resources :runners route added to config/router.rb |
| ~/samples/jruby/merb/hello
>rake db:create (in /Users/arungupta/samples/jruby/merb/hello) JRuby limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL Loading init file from /Users/arungupta/samples/jruby/merb/hello/config/init.rb Loading /Users/arungupta/samples/jruby/merb/hello/config/environments/development.rb Loading init file from /Users/arungupta/samples/jruby/merb/hello/config/init.rb Loading /Users/arungupta/samples/jruby/merb/hello/config/environments/development.rb ~ It took: 0 ~ Loading: Merb::BootLoader::MixinSession ~ It took: 0 ~ Loading: Merb::BootLoader::BeforeAppLoads ~ It took: 0 ~ Loading: Merb::Orms::ActiveRecord::Connect ~ No database.yml file found in /Users/arungupta/samples/jruby/merb/hello/config. ~ A sample file was created called database.yml.sample for you to copy and edit. |
| :development: &defaults :adapter: mysql :database: hello_development :username: root :password: :host: localhost :socket: /tmp/mysql.sock :encoding: utf8 |
| ~/samples/jruby/merb/hello >rake db:create (in /Users/arungupta/samples/jruby/merb/hello) JRuby limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL Loading init file from /Users/arungupta/samples/jruby/merb/hello/config/init.rb Loading /Users/arungupta/samples/jruby/merb/hello/config/environments/development.rb Loading init file from /Users/arungupta/samples/jruby/merb/hello/config/init.rb Loading /Users/arungupta/samples/jruby/merb/hello/config/environments/development.rb ~ It took: 0 ~ Loading: Merb::BootLoader::MixinSession ~ It took: 0 ~ Loading: Merb::BootLoader::BeforeAppLoads ~ It took: 0 ~ Loading: Merb::Orms::ActiveRecord::Connect ~ Connecting to database... ~ It took: 0 ~ Loading: Merb::BootLoader::LoadClasses ~ It took: 0 ~ Loading: Merb::BootLoader::Router ~ Compiling routes... ~ It took: 0 ~ Loading: Merb::BootLoader::Templates ~ It took: 0 ~ Loading: Merb::BootLoader::MimeTypes ~ It took: 0 ~ Loading: Merb::BootLoader::Cookies ~ It took: 0 ~ Loading: Merb::BootLoader::SetupSession ~ It took: 1 ~ Loading: Merb::BootLoader::SetupStubClasses ~ It took: 0 ~ Loading: Merb::BootLoader::AfterAppLoads ~ It took: 0 ~ Loading: Merb::BootLoader::ChooseAdapter ~ It took: 0 ~ Loading: Merb::BootLoader::RackUpApplication ~ It took: 0 ~ Loading: Merb::BootLoader::ReloadClasses ~ It took: 0 DEPRECATION WARNING: You're using the Ruby-based MySQL library that ships with Rails. This library will be REMOVED FROM RAILS 2.2. Please switch to the offical mysql gem: `gem install mysql` See http://www.rubyonrails.org/deprecation for details. (called from mysql_connection at /Users/arungupta/tools/jruby-1.1.5/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/connection_adapters/mysql_adapter.rb:81) ~ SQL (0.000581) SET NAMES 'utf8' ~ SQL (0.000581) SET SQL_AUTO_IS_NULL=0 ~ SQL (0.000894) CREATE DATABASE `hello_development` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_general_ci` MySQL hello_development database successfully created |
| ~/samples/jruby/merb/hello
>rake db:migrate (in /Users/arungupta/samples/jruby/merb/hello) JRuby limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL Loading init file from /Users/arungupta/samples/jruby/merb/hello/config/init.rb Loading /Users/arungupta/samples/jruby/merb/hello/config/environments/development.rb Loading init file from /Users/arungupta/samples/jruby/merb/hello/config/init.rb Loading /Users/arungupta/samples/jruby/merb/hello/config/environments/development.rb ~ It took: 0 ~ Loading: Merb::BootLoader::MixinSession ~ It took: 0 ~ Loading: Merb::BootLoader::BeforeAppLoads ~ It took: 0 ~ Loading: Merb::Orms::ActiveRecord::Connect ~ Connecting to database... ~ It took: 0 ~ Loading: Merb::BootLoader::LoadClasses ~ It took: 1 ~ Loading: Merb::BootLoader::Router ~ Compiling routes... ~ It took: 0 ~ Loading: Merb::BootLoader::Templates ~ It took: 0 ~ Loading: Merb::BootLoader::MimeTypes ~ It took: 0 ~ Loading: Merb::BootLoader::Cookies ~ It took: 0 ~ Loading: Merb::BootLoader::SetupSession ~ It took: 0 ~ Loading: Merb::BootLoader::SetupStubClasses ~ It took: 0 ~ Loading: Merb::BootLoader::AfterAppLoads ~ It took: 0 ~ Loading: Merb::BootLoader::ChooseAdapter ~ It took: 0 ~ Loading: Merb::BootLoader::RackUpApplication ~ It took: 0 ~ Loading: Merb::BootLoader::ReloadClasses ~ It took: 0 DEPRECATION WARNING: You're using the Ruby-based MySQL library that ships with Rails. This library will be REMOVED FROM RAILS 2.2. Please switch to the offical mysql gem: `gem install mysql` See http://www.rubyonrails.org/deprecation for details. (called from mysql_connection at /Users/arungupta/tools/jruby-1.1.5/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/connection_adapters/mysql_adapter.rb:81) ~ SQL (0.000769) SET NAMES 'utf8' ~ SQL (0.000610) SET SQL_AUTO_IS_NULL=0 ~ SQL (0.001609) SHOW TABLES ~ SQL (0.003952) CREATE TABLE `schema_migrations` (`version` varchar(255) NOT NULL) ENGINE=InnoDB ~ SQL (0.054355) CREATE UNIQUE INDEX `unique_schema_migrations` ON `schema_migrations` (`version`) ~ SQL (0.001691) SHOW TABLES ~ SQL (0.001643) SELECT version FROM schema_migrations ~ Migrating to RunnerMigration (1) == 1 RunnerMigration: migrating =============================================== -- create_table(:runners) ~ SQL (0.005301) CREATE TABLE `runners` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `distance` float, `minutes` int(11), `created_at` datetime, `updated_at` datetime) ENGINE=InnoDB -> 0.0107s == 1 RunnerMigration: migrated (0.0114s) ====================================== ~ SQL (0.014063) INSERT INTO schema_migrations (version) VALUES ('1') ~ SQL (0.003585) SHOW TABLES ~ SQL (0.001324) SELECT version FROM schema_migrations ~ SQL (0.001451) SHOW TABLES ~ SQL (0.017054) SHOW FIELDS FROM `runners` ~ SQL (0.018503) describe `runners` ~ SQL (0.009372) SHOW KEYS FROM `runners` |
| require 'config/dependencies.rb' |
| dependency "merb-assets", "1.0" dependency "merb-helpers", "1.0" |
| resources :runners |
| <h1>Runner controller, index
action</h1> <table> <tr> <th>Distance (in miles)</th> <th>Time (in mins)</th> <th colspan="3">Actions</th> </tr> <% @runners.each do |runner| %> <tr> <td><%=h runner.distance %></td> <td><%=h runner.minutes %></td> <td><%= link_to 'Show', resource(runner) %></td> <td><%= link_to 'Edit', resource(runner, :edit) %></td> <td><%= delete_button(runner, "Delete #{runner.distance}") %></td> </tr> <% end %> </table> <%= link_to 'New', resource(:runners, :new) %> |
| <h1>Runners controller, new
action</h1> <%= form_for(@runner, :action => resource(:runners) ) do %> <p> <%= text_field :distance, :label => "Distance (in miles)" %> </p> <p> <%= text_field :minutes, :label => "Time (in mins)" %> </p> <p> <%= submit "Create" %> </p> <% end =%> <%= link_to 'Back', resource(:runners) %> |
| <h1>Runners controller, show
action</h1> <p>Distance (in miles): <%=h @runner.distance %></p> <p>Time (in mins): <%=h @runner.minutes %></p> <%= link_to 'Back', resource(:runners) %> |
| <h1>Runners controller, edit
action</h1> <%= form_for(@runner, :action => resource(@runner)) do %> <p> <%= text_field :distance, :label => "Distance (in miles)" %> </p> <p> <%= text_field :minutes, :label => "Time (in mins)" %> </p> <p> <%= submit "Update" %> </p> <% end =%> <%= link_to 'Show', resource(@runner) %> | <%= link_to 'Back', resource(:runners) %> |





Posted by Arun Gupta in web2.0 | Comments[5]
|
|
|
|
|
Monday November 17, 2008
GlassFish @ JavaMUG - Trip Report
Presented on GlassFish
at Java
MUG last week. The event is hosted at Sun's North Dallas Office.
It was impressive to know that local Sun team is hosting 4 User Groups (MySQL, Solaris, and OpenSolaris
other than the JUG) in a month.
The evening started around 6pm when the attendees started showing up
for socializing over Pizza and Soda. The JUG started with a brief
introduction by Eric Weibust - the JUG leader. The community leaders
from Spring User
Group, Dallas
Rules Group, and SOA
Users Group then gave an update in their user groups.
After the sponsor's
pitch, I explained What/Why/How of GlassFish. The slides are available here.
It was pretty exciting when 100% of attendees have heard about
GlassFish. A few of them are using it for development as well and now
we need to work on getting some production deployments there :)
The demos showed in the talk can be accessed at:
Friday November 14, 2008
TOTD #52: Getting Started with Merb using GlassFish Gem
GlassFish
Gem 0.9.0 was recently
released.
It can run any Rack-compatible
framework such as Rails
and Merb.
Support for another Rack-based framework Sinatra will
be released in the near future. The gem is even extensible and
allows to plug any of your favorite Ruby framework using -apptype
switch (more on this in a future blog). This blog shows how to install
the gem and use it for running a Merb application.

| ~/tools/jruby-1.1.5 >gem install glassfish rack JRuby limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL Successfully installed glassfish-0.9.0-universal-java Successfully installed rack-0.4.0 2 gems installed Installing ri documentation for glassfish-0.9.0-universal-java... Installing ri documentation for rack-0.4.0... Installing RDoc documentation for glassfish-0.9.0-universal-java... Installing RDoc documentation for rack-0.4.0... |
| ~/tools/jruby-1.1.5 >glassfish -h Synopsis -------- glassfish: GlassFish v3 server for rails, merb, sintra applications Usage: ------ glassfish [OPTION] APPLICATION_PATH -h, --help: show help -c, --contextroot PATH: change the context root (default: '/') -p, --port PORT: change server port (default: 3000) -e, --environment ENV: change rails environment (default: development) -n --runtimes NUMBER: Number of JRuby runtimes to crete initially --runtimes-min NUMBER: Minimum JRuby runtimes to crete --runtimes-max NUMBER: Maximum number of JRuby runtimes to crete APPLICATION_PATH (optional): Path to the application to be run (default: current). |
| ~/tools/jruby-1.1.5
>gem install
merb-core merb-more merb_activerecord JRuby limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL Successfully installed extlib-0.9.8 Successfully installed abstract-1.0.0 Successfully installed erubis-2.6.2 Successfully installed json_pure-1.1.3 Successfully installed rack-0.4.0 Successfully installed mime-types-1.15 Successfully installed thor-0.9.8 Successfully installed merb-core-1.0 Successfully installed ZenTest-3.11.0 Successfully installed RubyInline-3.8.1 Successfully installed sexp_processor-3.0.0 Successfully installed ParseTree-3.0.2 Successfully installed ruby2ruby-1.2.1 Successfully installed merb-action-args-1.0 Successfully installed merb-assets-1.0 Successfully installed merb-slices-1.0 Successfully installed merb-auth-core-1.0 Successfully installed merb-auth-more-1.0 Successfully installed merb-auth-slice-password-1.0 Successfully installed merb-auth-1.0 Successfully installed merb-cache-1.0 Successfully installed merb-exceptions-1.0 Successfully installed highline-1.5.0 Successfully installed diff-lcs-1.1.2 Successfully installed templater-0.4.0 Successfully installed merb-gen-1.0 Successfully installed haml-2.0.4 Successfully installed merb-haml-1.0 Successfully installed merb-helpers-1.0 Successfully installed mailfactory-1.4.0 Successfully installed merb-mailer-1.0 Successfully installed merb-param-protection-1.0 Successfully installed addressable-1.0.4 Successfully installed data_objects-0.9.6 Successfully installed dm-core-0.9.6 Successfully installed dm-migrations-0.9.6 Successfully installed merb_datamapper-1.0 Successfully installed merb-more-1.0 Successfully installed merb_activerecord-0.9.13 39 gems installed Installing ri documentation for json_pure-1.1.3... Installing ri documentation for rack-0.4.0... Installing ri documentation for mime-types-1.15... . . . Installing RDoc documentation for dm-migrations-0.9.6... Installing RDoc documentation for merb_datamapper-1.0... Installing RDoc documentation for merb_activerecord-0.9.13... |
| ~/samples/jruby/merb >merb-gen core hello Generating with core generator: [ADDED] gems [ADDED] merb.thor [ADDED] .gitignore [ADDED] public/.htaccess [ADDED] doc/rdoc/generators/merb_generator.rb [ADDED] doc/rdoc/generators/template/merb/api_grease.js [ADDED] doc/rdoc/generators/template/merb/index.html.erb [ADDED] doc/rdoc/generators/template/merb/merb.css [ADDED] doc/rdoc/generators/template/merb/merb.rb [ADDED] doc/rdoc/generators/template/merb/merb_doc_styles.css [ADDED] doc/rdoc/generators/template/merb/prototype.js [ADDED] public/favicon.ico [ADDED] public/merb.fcgi [ADDED] public/robots.txt [ADDED] public/images/merb.jpg [ADDED] Rakefile [ADDED] app/controllers/application.rb [ADDED] app/controllers/exceptions.rb [ADDED] app/helpers/global_helpers.rb [ADDED] app/views/exceptions/not_acceptable.html.erb [ADDED] app/views/exceptions/not_found.html.erb [ADDED] autotest/discover.rb [ADDED] autotest/merb.rb [ADDED] autotest/merb_rspec.rb [ADDED] config/init.rb [ADDED] config/rack.rb [ADDED] config/router.rb [ADDED] config/environments/development.rb [ADDED] config/environments/production.rb [ADDED] config/environments/rake.rb [ADDED] config/environments/staging.rb [ADDED] config/environments/test.rb [ADDED] public/javascripts/application.js [ADDED] public/stylesheets/master.css [ADDED] spec [ADDED] app/views/layout/application.html.erb |
| ~/samples/jruby/merb/hello >merb-gen controller Runners Loading init file from /Users/arungupta/samples/jruby/merb/jruby-1.1.5/samples/merb/hello/config/init.rb Loading /Users/arungupta/samples/jruby/merb/jruby-1.1.5/samples/merb/hello/config/environments/development.rb Generating with controller generator: Loading init file from /Users/arungupta/samples/jruby/merb/jruby-1.1.5/samples/merb/hello/config/init.rb Loading /Users/arungupta/samples/jruby/merb/jruby-1.1.5/samples/merb/hello/config/environments/development.rb [ADDED] app/controllers/runners.rb [ADDED] app/views/runners/index.html.erb [ADDED] spec/requests/runners_spec.rb [ADDED] app/helpers/runners_helper.rb |
|
def index @message = "Miles to go ..." render end |



Posted by Arun Gupta in web2.0 | Comments[7]
|
|
|
|
|
Wednesday November 12, 2008
LOTD #13: Warbling with RMagick on GlassFish

GlassFish
with RMagick explains the Warbler configuration required for
using RMagick
with GlassFish.
Did you know Rails application can be natively deployed on GlassFish v3 Prelude
? And you can even buy
production support!
All previous entries in this series are archived at LOTD.
Technorati: lotd
rubyonrails
rmagick
glassfish
Posted by Arun Gupta in web2.0 | Comments[2]
|
|
|
|
|
Tuesday November 11, 2008
GlassFish @ Java MUG tomorrow (Nov 12, 2008)
![]() |
I'll be presenting on GlassFish
@ Java MUG tomorrow. This is a highly opportune moment since GlassFish v3 Prelude was released last week. I plan to talk about GlassFish community, deliverables (including v2 and v3), NetBeans/Eclipse integration, the surrounding ecosystem, future directions and anything related that you are interested in :) |
Posted by Arun Gupta in General | Comments[0]
|
|
|
|
|
Monday November 10, 2008
GlassFish @ Silicon Valley Code Camp 2008 - Trip Report
| 1400 registrations, 112 sessions, free pizza, a
barbecue on Saturday
night, raffles and lot more - that is Silicon Valley
Code Camp. Jitu, Jiandong, Jacob, and I presented on GlassFish at Silicon Valley Code Camp over the weekend. The event had higher attendance (close to 500) than last year and certainly is a great networking event for the local community. |
Screencast #27: Simple Web Application using NetBeans 6.5 IDE and GlassFish v3 Prelude
GlassFish
v3 Prelude is now available!
It contains a Java EE 5-based Web stack.
A comprehensive tooling by NetBeans
IDE allows to easily develop Web
applications and deploy directly on GlassFish v Prelude. Rapid
deployment feature of GlassFish allows to redeploy applications without
losing session state. Using the deploy-on-save feature of NetBeans the
complete development cycle is reduced to edit-save-refresh. There is no
longer a need to wait for explicit deployment any more, cool isn't it ?
And you can even purchase
enterprise support as well!
This screencast
shows how you can create a simple Web application
using JSP and Servlets in NetBeans IDE, deploy it directly on GlassFish
v3 and then debug
it.
Are you still doing the conventional edit-save-deploy-refresh
conventional development cycle ? Use NetBeans and GlassFish together to
liberate yourself :)
File GlassFish related bugs here
using "web_container" sub-component. File NetBeans related bug here
using "glassfish_v3" sub-component. Ask your GlassFish related
questions on webtier@glassfish.dev.java.net
or NetBeans related questions on nbusers@netbeans.org.
All other GlassFish related screencasts are available here.
Technorati: glassfish
v3 netbeans
jsp servlets
deployonsave
deployment
screencast
Posted by Arun Gupta in General | Comments[29]
|
|
|
|
|
Friday November 07, 2008
Screencast #26: Develop/Run/Debug Rails application using NetBeans IDE and GlassFish v3 Prelude
GlassFish
v3 Prelude is now available.
It allows Rails applications to be deployed natively using
JRuby and
without the need of any WAR packaging or Servlet container. An
integrated NetBeans
tooling provides a comprehensive development and deployment platform
for all your Rails applications. And you can even purchase
enterprise support as well!
This screencast
shows how you can create a simple Rails application
using NetBeans IDE, deploy it directly on GlassFish v3 and then debug
it.
Typo,
Redmine,
Substruct,
and Mephisto
are some of the applications I've tried deploying on GlassFish. Have
you tried deploying your Rails app on GlassFish ?
File Rails/GlassFish related bugs here
using "jruby" sub-component and ask your questions on webtier@glassfish.dev.java.net.
All other GlassFish related screencasts are available here.
Technorati: glassfish
v3 netbeans
rubyonrails
jruby screencast
Posted by Arun Gupta in web2.0 | Comments[45]
|
|
|
|
|
Today's Page Hits: 5263
Total # blog entries: 1002