Matt RaibleMatt Raible is a Web Developer and Java Champion. Connect with him on LinkedIn.

The Angular Mini-Book The Angular Mini-Book is a guide to getting started with Angular. You'll learn how to develop a bare-bones application, test it, and deploy it. Then you'll move on to adding Bootstrap, Angular Material, continuous integration, and authentication.

Spring Boot is a popular framework for building REST APIs. You'll learn how to integrate Angular with Spring Boot and use security best practices like HTTPS and a content security policy.

For book updates, follow @angular_book on Twitter.

The JHipster Mini-Book The JHipster Mini-Book is a guide to getting started with hip technologies today: Angular, Bootstrap, and Spring Boot. All of these frameworks are wrapped up in an easy-to-use project called JHipster.

This book shows you how to build an app with JHipster, and guides you through the plethora of tools, techniques and options you can use. Furthermore, it explains the UI and API building blocks so you understand the underpinnings of your great application.

For book updates, follow @jhipster-book on Twitter.

10+ YEARS


Over 10 years ago, I wrote my first blog post. Since then, I've authored books, had kids, traveled the world, found Trish and blogged about it all.

How I recovered data from my failed Linux box

Yesterday, I decided to quit procrastinating and finish up my 2007 taxes once and for all. When I booted up QuickBooks on my XP box, it said it couldn't connect to drive Q. Drive Q is on my Linux box, which I discovered wasn't on. When I booted it, the screen showed an "Error 18" after the GRUB loading message. The resulted in several hours of grub-install and many other commands to no avail.

Since I hadn't messed with the box in almost a year, I didn't even know if it had Fedora or Suse installed on it. I had both disks lying around, so I tried the good ol' linux rescue with my Fedora disks. I was able to access the data, but had no luck in getting network connectivity or copying files to a USB drive.

Today I hoped for a different route: Live CDs. Yesterday, I discovered I was running Suse 10, so I downloaded a Suse 11 Live CD, burned it and booted. It worked, but I didn't have access to my hard drives and wasn't able to mount anything. Next up, I tried Knoppix, which allowed me to boot and access my hard drives. Unfortunately, I still didn't have any network access and my 2GB thumb drive didn't hold enough data.

Next, I pulled out a 250GB USB drive I had lying around. Knoppix recognized it, but was unable to format it for some reason. I plugged it into my XP box, used fat32format to format the drive as FAT32, and plugged it back into my Linux box. Success! I was able to copy all the data I needed and now I have the USB drive plugged into my Airport Extreme.

Hopefully if someone else runs into similar issues, they can use this post to find their path to success.

Posted in Open Source at Dec 11 2008, 02:02:29 PM MST 6 Comments

Appcelerator with Matt Quinlan

This evening I attended the Denver Open Source User Group meeting where the Basic Concepts talk was on Appcelerator. Matt Quinlan (Twitter, Blog, LinkedIn) was the presenter. I arrived 10 minutes late, so I didn't hear any of the intro stuff. Below are my notes from the event.

The Appcelerator developers liked the "onclick" syntax, but found it was too limited to do everything they wanted. Rather than onclick, they use an on attribute. For example:

<div on="click then l:show.box">
Click me
<div>

"DOM Manipulation is JavaScript cruft."

Appcelerator allows you to implement the Observer pattern in the browser. In addition to allowing DOM elements to subscribe to messages, server-side objects (in any language) can subscribe as well. In Appcelerator syntax "l:" means local and "r:" means remote. The messages that are passed to the server are JSON and have payloads. JSON is more popular than XML because you can eval() it and create JavaScript objects from it. Appcelerator allows you to do Declarative Ajax. On the server-side, you can annotation Java and C# classes with @Service to subscribe to messages. In other languages (i.e. PHP), Javadoc-style comments are used.

Tagline: The seamless fusion of RIA and SOA.

Web Expression Language
Goal is to eliminate 90% of the JavaScript you write. Example syntax:

on="[condition] then [action]"

Conditions include DOM events (click, focus, blur, change, mouse events), key events (up, down, press), other (history, drag/drop, selected, resize, iPhone orient, sortXYZ), subscribe to custom message. Actions include Scriptaculous effects (show/hide, fade, move, drop, grow), set element value (static, dynamic, bind), set CSS class or attribute, execute custom JavaScript, publish custom message.

Now Matt is doing a demo on http://try.appcelerator.org. This site consists of a form that allows you to type in Appcelerator code and run it. 3 attributes can be added to any tag: draggable, droppable and resizeable.

Client-Side
Add simple tags to your HTML to inject RIA widgets. Add single property to existing HTML elements for dynamic behavior. Eclipse Plugin built on Aptana, but is generally targeted towards web developers moreso than business analysts (no drag and drop of widgets).

Server-Side
Server-side development done with your IDE of choices. Based on your server-side tehchnology platform. Easily create services using annotations.

App Command
The app command is similar to Rails' GEM command. Allows you to build scaffolding and deploy to cloud (AppEngine, Amazon S3). It also allows you to pulldown components from the main server and auto-updating.

Examples:

Appcelerator allows you to create prototypes easily by using a JavaScript file with mocks for the server-side objects. In the next version, you can "annotate" the UI and allow end-users to Ctrl+Click on elements and add feedback. For an example of this, see http://dev.appcelerator.com/pearson.

When starting with Appcelerator, you can start by crawling (including appcelerator.js for widgets) then move to walking (decouple server-side and client-side) and finally running (developing working prototypes with mocks for server-side).

"Let's face it, ASP, JSP, PHP and Ruby are just lipstick on CGI."

Posted in Open Source at Oct 07 2008, 07:08:19 PM MDT 5 Comments

Performance Testing Memcached

Earlier this week, co-workers and I did some performance testing with Memcached. We wanted to see how long it'd take to send different sizes of objects over the wire to Memcached on a remote server.

We setup a simple environment with 2 Mac Pros both running 2 x 2.8 Ghz Quad-Core Intel Xeon processors and 12GB of RAM. We used one machine as a Memcached server and one machine running an application with the addition of a new Servlet Filter. The Servlet Fitler read a size parameter and used it to set the size of the object being written and read from the Memcached server. We used JMeter to put load on the box. The following describes the load and the results.

Write Times
Write tests were performed with a single user executing 1000 sequential remove then writes.

Size in Bytes Time (ms.) Min. Time (ms.) Max. Time (ms.) Total
20000 1.31 0 7 1000
50000 1.834 1 8 1000
100000 2.87 2 9 1000
500000 12.641 9 283 1000

Read Times
Read tests were performed using 50 users with 1 sec. ramp times executing 100 reads each.

Size in Bytes Time (ms.) Min. Time (ms.) Max. Time (ms.) Total
20000 4.8414 1 375 5000
50000 18.343 1 354 5000
100000 46.181 2 415 5000
500000 137.7328 6 953 5000

During our tests, Memcached was started using the following settings:

memcached -d -m 2048 -M -p 10171 -vv

If you've done similar performance testing with Memcached, we'd love to see your results.

Posted in Open Source at Sep 19 2008, 11:29:33 AM MDT 6 Comments

Presenting Web Frameworks of the Future Tomorrow in Denver

Tomorrow (Thursday) night, I'll be doing an encore presentation of my Web Frameworks of the Future at DeRailed. If you're in Denver and would like to hear me ramble while drinking a beer, join us at Forestroom 5 at 6:30.

After the last few days, I'm happy to report I should be in good enough condition to pull this off. If you're curious to learn more about my experience at OSCON and this presentation, please see my writeup on the LinkedIn Blog.

Posted in Open Source at Jul 30 2008, 09:56:17 PM MDT 2 Comments

OSCON 2008 Wrapup

This week, I attended OSCON 2008 in Portland, Oregon. I talked to someone who thought the conference had a very small Java presence. I noticed this too, but that's how it's always been. Interestingly enough, they also thought it had a small Ruby showing. I guess Perl, Python and PHP will always dominate OSCON. Of course, there's nothing wrong with that. I've always admired OSCON for the diversity of developers and languages.

Below is a list of my entries for all the sessions I attended.

If you attended OSCON, did you enjoy the show? What was your favorite session? I'd love to hear other's impressions of the conference and how it could be improved.

Posted in Open Source at Jul 25 2008, 10:05:08 AM MDT Add a Comment

[OSCON 2008] The State of Lightning Talks

From this session's detail page:

As a repeat of the last 2 years, 15 open source project leaders will be given five minute lightning talk slots to bring the audience up to date on their projects.

This year’s speakers and projects include: Brian Aker: Memcached, Glynn Foster: OpenSolaris, OSI: Danese Cooper, MySQL: Monty Widenius, PostgreSQL: Bruce Momjian, GNOME: Dave Neary, Gentoo: Donnie Berkholz, OpenOffice.org: Louis Suarez-Potts, Jabber: Peter Saint-Andre, Mozdev: Brian King, OpenID: Scott Kveton, Open Scrum: James Dixon, and Cliff Schmidt for the Talking Book Project. A couple more projects may be added later.

Each speaker has exactly 5 minutes, and we use various “fun” tools to make sure they stick to their time. The session usually ends with a “zinger” presentation worth staying for.

Unlike the description above, apparently there's 17 projects instead of 15. This session is 95 minutes long (spans 2 normal sessions). I figure this will be the most challenging event for me to blog, so here we go!

OSI (Open Source Initiative), Danese Cooper
Danese has been on the board of OSI since 2001 and will be on the board for another 3 years. This year, they've been asking themselves "What are the ways to make OSI more effective?" The best answer they've come up with is that they should run OSI more like an open source project (with lots of transparency). Minutes are posted publicly on website and they have a public blog. They're also transferring their archives to a searchable system. They'll be using Trac to do more objective tracking of all the issues that've been brought to their attention.

They're also going to establish (formal) membership. They're going to use Apache as a model and allow Charter, Individual, Organizational and have an Annual Members Meeting. ASF currently has 300 members and these folks are in charge of making decisions for the foundation. There's a good chance you'll recognize all the Charter Members of OSI. The names will be announced in the next couple months (I believe). There will be opportunities to be individual or organizational members.

There's new board members this year with an international focus: Nnenna (Africa), Harshad Gune ...honk... out of time.

Open Scrum, James Dixon
James is the founder and Chief Geek at Pentaho. Pentaho recently took their products open source and they're releasing Open Scrum as an agile methodology for managing open source projects. Open Source is not a methodology, it is a set of principles.

Some agile principles are used in open source, but some are not. For instance, trusting developers and face-to-face contact can be difficult with open source projects. Simplicity sometimes comes out of open source projects, but usually only for projects with a large developer base. There's a 45% good fit between Agile and Open Source.

Open Scrum is based on Scrum, but geared towards open source projects. It's simple and flexible and template driven. It scales from single-geek, part-time, single-projects to massively multi-geek full-on and multi-layered undertakings.

MySQL, Monty Widenius
Monty is the Chief Fonder of MySQL and he's talking about what's new in MySQL. There's been no new releases for users, but internally they've been doing lots of bug fixes in 5.1. He expects to have a reasonable GA of 5.1 in 3-5 months. 5.0 will include online backup and optimizer changes for faster joins and sub queries. 5.1 has an InnoDB Plugin.

MySQL was acquired by Sun for $1 billion and 6 months later, life is good. MySQL Backup was announced to be crippleware by MySQL management, but later changed to be open source.

Switched to use Bazaar and Launchpad to increase community participation. Started public bug hunt for MySQL 5.1. Started using case competition for new features in 5.1. There's also a new MySQL forge. Please help MySQL get better by filing bugs!

Maria engine 1.0 and 1.5; now crashsafe and multi-versioned. Transactional part to follow soon.

OpenID, Scott Kveton
Scott is on the board of the OpenID Foundation and his son is on stage with him (with a Twitter shirt on). In terms of adoption, they have a hockey stick graph with the big upturn starting in February 2007. OpenID is only 3 years old and there's over 20,000 sites that now support it. There's about ~500 million OpenIDs (including every AOL, Yahoo, MySpace and LiveJournal user).

OpenID 2.0 was released as final 12/7/2007. What's next: usability (currently sucks), security (PAPE), integration with other protocols, more than just providing, and possibly OpenID 3.0. One of the biggest problems with usability is people just can't remember URLs, so they're trying to figure out a URL -> e-mail mapping.

OpenID Foundation has added 5 corporate board seats and has 7 community board seats and elections are in August. You can get code at openidenabled.com and you can get involved at openid.net.

Gentoo, Donnie Berkholz
Donnie is one of 7 people that's on the council that tries to make sure Gentoo is going in a good direction. In the last year, they've been struggling with community and releasing. Gentoo is just getting old enough where people are quitting and new developers are coming on board. In 2005, they had a lot of voters for their council. 2006 and 2007 were bad years from a community participation standpoint. This year, they've fixed "poisonous people" and participating is back up.

Rather than voting for single candidates, they use a "rank all the candidates" voting system. Community is very important and they've recently kicked out 3 people that didn't think community was important. They released 2008.0 a few weeks ago. It was supposed to be released in February. When they released, they made the front page of Digg, which made Donnie very happy. Gentoo news announcements were way down in 2007, but now they're back up.

Recommended books for community building: Good to Great, The No Asshole Rule, Getting to Yes.

PostgreSQL, Bruce Momjian
Bruce is a PostgreSQL core developer and works for EnterpriseDB. The future for PostgreSQL is going to be a lot different than the past. PostgreSQL's path to the future isn't a straight line. Rather, it's a meandering path like a road up a mountain with switchbacks. People would like a catapult to put features into to get things in, but it's not that easy. It's difficult to improve software that's been around for 20 years.

Companies have very clearly defined goals that usually revolve around money. With open source, it's a lot different. Goals are usually for a feature set, for adoption of open source or for the challenge and fun of it.

PostgreSQL 8.0 was released in January 2005 and had a lot of enterprise features: Win32, Savepoints, Point-In-Time Recovery, Tablespaces. The latest release (8.3 in February) was much different and much more exotic features. In the future, they're going to expand on running queries on multiple CPUs and maintaining their leadership in the open source database space.

Bazaar, Mark Shuttleworth
Mark's interest in distributed version control predates his interest in Ubuntu. If we can elevate our process of version control, we can elevate the entire open source community. Bazaar is a distributed version control system that's developed in Python. It focuses relentlessly on a couple of key values:

  • Cross-platform: Linux, Windows, Mac OS X
  • Performance: sub-second status on > 10,000 files
  • Being adaptive to the way that people want to work (can use it like Subversion if you want or you can have distributed branches or have a team checkout)
  • Extensibility and embeddable - has a plugin system
  • Python Hackable - people can easily modify

Projects that use Bazaar: GNU, MySQL, Twisted and Ubuntu.

Memcached, Alan "Dormando"
Memcached is a very simple project with a mailing list with very simple people on it that run very simple websites. They haven't had a release in 6 months. Memcached was written by a guy named Fitz that wrote it and left. They've only recently created a developer community that's all over the globe. Alan didn't bring any slides, but he did release 1.2.6 RC1 as he was standing on stage. They also hope to release 1.3.1 this week, but there's not a lot of documentation.

People fork Memcached a LOT, mostly because they need a new backend. They've added a new storage engine that's pluggable to hopefully fix the forking problem. Also, their new binary protocol should make it a lot faster for high traffic web sites.

The Talking Bridge Project, Cliff Schmidt
While the network at OSCON has been slow, the folks that live in rural areas around the world have an incredibly slow means of getting information. Their network is often roads that people travel on to communicate with each other.

They've created a Talking Book device that is an MP3 player that costs $5-10. They're also creating kiosks that people in rural areas can interact with to download new information (i.e. podcasts and other educational content). It also has a microphone and can be found at literacybridge.org. They're creating open source projects to help build the device and content around it. They'd love to have open source developers join their projects and help them make access to information easier for rural societies.

Open Source Lab at Oregon State University, Lance Albertson
Lance is a Kansas native and grew up on a farm. He's a Gentoo developer and joined OSL a year ago. OSL was created in 2003 to utilize "extra" unused bandwidth. They provide managed and co-located hosting for open source software projects. They also provide on-the-job learning opportunities for students in system administration and development.

In addition to hosting, they have a development and outreach side. They have 12 student employees that are given developers/sys admins are given real world practical opportunities. Their work is seen and used by many people and students are given extraordinary amounts of responsibility. They're working on a couple external OSS projects: Oregon Virtual School District and One Laptop Per Child.

Outreach wise, they have an Open Source Education Lab and they've been doing Drupal training for OSU employees. They've also helping organize GOSCON, which is an open source conference for governments.

They currently offer hosting for over 70 OSS projects. Services include, email relays, databases, web hosting, file mirroring and code repositories. Notable clients: ASF, Drupal, kernel.org (master), OpenOffice, Freenode, Gentoo Linux & Debian, phpBB and many others. Datacenter currently has 50 racks; they'll be moving to 75 in the near future.

OpenOffice
They've had 150 million downloads and believe there's around 1 million users. There's 350 committers and most of them work from Sun. Presently, their biggest focus is Desktop. In the future, they'll focus on the Web. The idea is that people will want to use OpenOffice from their mobile devices. ODF is a format that can be expressed by any application. OO 3.0 is about extensions, not bloat. They're adding linkage to a free PIM (Outlook replacement). They're also adding better interoperatbility with other suites and formats (e.g., Microsoft Office 2007). They're adding productivity tools and adding toolkits to make things easier for developers. In the next year, they expect to go way beyond 150 million downloads. They also expect to expand greatly internationally.

Mozdev, Brian King
Brian has been in the Mozilla Community since 1999. Mozdev.org is a community site that provides free hosting for Mozilla applications and extensions since 2000. Established as a non-profit organization in 2004. It has over 250 active projects today and there's over 500 developers discussing issues on the [email protected] list.

Services provided: source code hosting, bug tracking (Bugzilla), communication tools (lists, newsgroups, blogs, forums), file management tools, project tagging, wiki, statistics, permissions system and public planning.

They've experienced some grown pains in the last few years, but they're mostly solved now. They've added developer resources to help develop their site, but they need more. Up until Firefox, they were the #1 place to go for Mozilla projects. They're still working on letting people know that they're around and have projects that are interested. They're looking for new avenues for funding.

Moving forward: they'll be add more items to roadmap, making it easier for less technical folks to host and create extensions, solving the funding issue, and developing deeper relationship with Mozilla (MoFo and MoCo). Quite simply, they want to continue with their goal of supporting developers in order to proliferate Mozilla technologies.

Glen Foster, OpenSolaris
Hey - I had a beer with this guy last night at Kells! Rather than focusing on the older Solaris users, they want to move to focus on getting kids to learn and use it. A couple of months ago, they released 200805 and reduced 5 CDs down to a single live CD. The packaging system is now network based. They changes the default shell to bash and changed to GNU tools as they default as well.

They introduced a new site - opensolaris.com. Since Sun released the source code 3 years ago, they've had a long evolution of getting the source out the door. They were using Teamware and doing much of the development behind the door. Early next month, they're moving to Mercurial and they'll be moving all the source outside the firewall. They'll be using Bugzilla as their bug tracking system.

Similar to Gentoo, they've had quite a few people in their community that don't like change. They're working on fixing this and have had good progress. Several years ago, they created a governance system before they had a community. This was a mistake and their new community-driven governance system should work much better.

GNOME, Dave Neary
GNOME is a desktop environment and set of utilities. It's the default on Ubuntu and Fedora. It's the face of Linux on the Desktop. It's also a platform for development. They have a vibrant ISV community that includes Adobe, VMWare and IBM. In addition to desktop, GNOME is also a mobile platform. They also act as a big tent that provides an infrastructure for projects that are part of the GNOME ecosystem.

The most important thing to Dave is the shared vision of universal access to anyone and everyone. Very important things to the GNOME project: usability, internationalization and localization, accessibility (Sun and IBM have done a lot of work). Accessibility is something they've really focused on in the last year. They've created an Outreach Project for Accessibility and have gotten funding from Mozilla, Canonical and Google. Mozilla has done a lot to fund them and help provide accessibility for Rich Internet Applications. To see if a website is accessible, try it in lynx.

Subversion, John Mark Walker
John is the Community Manager for openCollabNet and is not a Subversion developer. Subversion 1.4 was released in September 2006. There was much anticipating for 1.5 and was released last month. The people rejoiced.

What's new in 1.5? Merge tracking: easier to merge changes from trunk to branch and vise versa. You can also do sparse checkouts (replaces -N). Interactive conflict resolution so you can do it from the command line client. It also add changelist support. svn:externals is no longer required to be absolute (sweet!) and you can add peg revisions in your URLs. FSFS repos never change a rev after written to disk. Clients many now perform chained copy/move operations locally. It also supports moving multiple sources for copy and move. Client operations are now significantly more responsive to canceling operations. "resolve" subcommand replaces "resolved" (deprecated). Delete (remove) now takes a --keep-local option.

Now it's time for the fun stuff...

Ken Drachnik had to leave for an emergency and is unable to give his talk on GlassFish. An audience member (Carl Fogel) volunteers to do his presentation. It's very funny, especially since he's not a Java Developer and has never heard of GlassFish. The only thing I got out of this presentation (besides lots of laughs) is that v3 will be released in June 2009.

Drizzle, Brian Aker
Stored procedures, triggers, prepared statements and many other things have been discarded. "One CPU to rule them, and in the query cache, bind them." If you have a query cache turned on in our database, turn it off or delete it.

Drizzle is currently ~420K. The Master Plan is to rethink everything and not assume everything was bad. Also, they can reuse many other libraries w/o writing them from scratch. They don't have to ship every library because many are present on operating systems. In with the new: C99, Posix, package-lib. They're moving to a MicroKernal design and moving code to the edge. No new features will be in core. To add interfaces you have to remove code so there's an equal amount of code.

Multi-Core support: no new locks, remove old locks. Think today (burn memory, messages scales). They can leverage Sun because they can build machines with more cores than anyone else.

Field Types: Less primitives - now there's just one "blob". Removed the 3 byte int and add UUID/IPV4(6). They dumped ACL because we authenticate in clouds. KISS.

You can get involved with Drizzle at http://launchpad.net/drizzle (bzr branch lp:drizzle) and http://launchpad.net/drizzle-discuss (mailing list).

Posted in Open Source at Jul 24 2008, 01:34:08 PM MDT 1 Comment

[OSCON 2008] Web Frameworks of the Future: Flex, GWT, Grails and Rails

Below is the presentation I'm delivering at OSCON today. Unfortunately, I had to remove slides on GWT and Flex to fit w/in the 45 minute time limit. I hope to expand this presentation in the future, as well as continue to develop the side project I'm working on using these technologies.

Posted in Open Source at Jul 23 2008, 04:25:23 PM MDT 19 Comments

[OSCON 2008] Caching and Performance: Lessons from Facebook by Lucas Nealan

Facebook is not just a Social Networking Site, they're a "Social Utility". They have the 4th most trafficked site in the world and over 90 million active users. Of those users, the average usage is 50 pages per day. There's currently over 24,000 platform applications. There's thousands of Apache web servers and hundreds of MySQL and Memcached servers.

The biggest problem with scaling for Facebook is the complexity. Connecting to all the databases is impossible. They have a very large codebase - their homepage has 500 library files and 10,000 functions. Scaling affects resources, particularly with regards to memory consumption and socket connection limits. Cache retrieval is ~10% cpu-user of most pages.

Caching Layers: $GLOBALS, APC, Memcached, Database, Browser Cache, Third Party CDN.

The Globals Cache is a PHP function called "cache_get". The Globals Cache works nicely in that it avoids calling APC and Memcached, but it still requires the overhead of a function call. APC (Alternative PHP Cache) is used for opcode caching (hundreds of included libraries, thousands of functions) and variable caching (hundreds of MB's of data). They use the APC for non-user specific data: network/school information, database information, useragent strings, hot application data, site variables and language strings (now the largest consumer of memory). They don't use it for User data because they don't send users back to the same server each time.

Friends page with a normal run takes 4050ms, with APC enabled it takes 135ms. You can also set apc.stat=0 to gain even more speed (128ms). To bust client-caching, they use APC+SVN with the SVN tag on the file and get the latest version from SVN and store it. Of course, this is a "prime the pump" thing that doesn't happen in production at runtime.

The next layer of caching is Memcached. Facebook currently utilizes over 400 instances of Memcached and has made contributions back to the project. They use Memcached for user-specific data: long profile, short profile, friends and applications. They don't use the timeout feature, but rather use cache invalidation on SQL insert and update. It's harder to do when writing your application, but it's easier to maintain in the long run. To make Memcached faster, they created a PHP extension that reduced PHP function calling overhead and allowed UDP support. The Memcached extension runs ~10% faster realtime than in PHP space.

Facebook likes for each page to render in under 250ms on the backend. To see how long a page took to load, you can mouseover the copyright at the bottom of the page, and a tooltip will show you the elapsed time.

This presentation is available online at http://sizzo.org/talks.

Posted in Open Source at Jul 23 2008, 04:18:15 PM MDT 1 Comment

[OSCON 2008] Google XML Pages (GXP) by Harry Heymann and Laurence Gonsalves

GXP is a templating system that Harry and Laurence developed at Google. It was original created by Laurence in late 2001 (Java run-time, compiler written in Python) as part of the AdWords rewrite. I'm attending this session because I heard from a Google employee that they were using WebWork + their proprietary templating framework for the view. My suspicion is that GXP is that framework. The presentation I'm listening to is available at the following URL:

http://docs.google.com/Present?docid=dcbpz3ck_8gphq8bdt

Google XML Pages has the following features:

  • static type checking
  • convenient parameter passing/modularization system
  • partial markup validation
  • automatic escaping of untrusted content
  • encourages functional style, discourages side-effects
  • internationalization support
  • lightweight runtime

GXP is an open source project as of today and is available at http://gxp.googlecode.com. It's used by AdWords, AdSense, Checkout, Blogger, Analytics, Reader and many more.

HelloWorld.gxp:

<gxp:template name='com.google.sample.HelloWorld'
              xmlns:gxp='http://google.com/2001/gxp'>
Hello, World!
</gxp:template>

Output:

Hello, World!

GXP has compile-time markup validation as well as static-type checking. GXP has native data types: for text/html, text/plain, text/css and text/javascript. It supports loops, conditionals, abbreviations, internationalization (i.e. <gxp:msg>Hello, World</gxp:msg>) with placeholders. You can call GXP in the same package using <call:GXPName>. To call something outside a package, you can use <gxp:import> to import packages or classes. You can also use a qualified XML namespace to access another package.

Posted in Open Source at Jul 23 2008, 03:23:44 PM MDT 3 Comments

[OSCON 2008] An Introduction to Ruby Web Frameworks by Ryan Carmelo Briones

Ryan is a Server Monkey / Code Sumari for Edgecase, LLC in Columbus, Ohio. A framework allows you to create re-usable code. Frameworks allow you to use encapsulation. Frameworks tend to be domain specific. For example, Rails works really for CRUD application, but not for others (i.e. Twitter).

Why Ruby?
Ruby has been Object Oriented since day 1. Ruby promotes Beautiful Code that's easy to read and maintain. Yes, MRI has performance issues. Matz has said "I'm a language designer" and has turned over the VM to others for Ruby 1.9. Another thing that might keep folks from using Ruby or its web frameworks is the libraries available. This is understandable, but it's being solved by alternative implementations. This includes YARV (the official 1.9 implementation), JRuby, IronRuby (not ready for production) and MagLev.

Rack
A framework that provides a minimal API for connecting web services and web frameworks. As a web application developer, this framework allows us to know about web services, but not worry about the details of talking to it. Below is a very simple Rack application.

class HelloWorld
  def call(env)
    [200, {"Content-Type" => "text/plain"}, ["Hello World!"]]
  end
end

Rack allows the handlers do the work and not worry about the web server abstraction. Handlers exist for WEBrick, LightSpeed, Mongrel, Fast-CGI and many others. As an application developer, it allows you to choose different architectures (threaded, evented, etc.). Ryan is talking about Rack first because it's used in all the other Ruby web frameworks.

Ruby on Rails
Rails is 4 years old now and was written by DHH when he was a contractor at 37Signals. Rails doesn't define and grand new ideas, everything has been done before (MVC, code generation, etc.). What Rails did is package everything in a unique way that makes it very easy to use. Rails has influenced a lot of what has come from web frameworks in the last few years. One of Rails' nicest feature is code generation. Ryan showed part of DHH's Create a weblog in 15 minutes video to demonstrate code generation. He noted that the minute he showed was picked because David said "Whoops!" and "Look at all the things I'm not doing". Rails popularized Convention over Configuration using naming conventions and load paths. While this is definitely a cool feature, I think most web frameworks have adopted CoC by now. Maybe not JSF, but who wants to use JSF w/o a framework on top of it anyway?

One warning about Rails: "The Golden Path" can get in your way. Rails is very Opinionated Software and that's how Rails works. As long as you follow that, you should be very productivity. If you decide to go off the Rails (i.e. namespaces), it can be difficult.

Rails uses a DSL in its models (i.e. has_many, has_one for relationships) and in the Rails router. It allows you to very simply map a URL to a controller/method. In addition to DSLs, Rails has first-class testing and its generators create stub tests for you.

Bad things about Rails: too much magic, moves to fast (too many releases).

Merb
Merb was originally developed by Ezra Zygmuntowicz to run alongside a Rails app to handle file uploads. It grew from there and became it's own beast. Merb is very much about using only what you need. It has "package repos" that allow you to add additional features. For example, merb-core doesn't contain an ORM framework, just a web framework. Merb also allows you to choose your ORM. It's standardized on Rack, so it can run on just about any web server. It also included "deferred actions" that allow you to send some URLs to evented web servers and others to threaded web servers. Merb eschews the "magic" that Rails has. It tries to stay away from making it's code a "monument to personal cleverness". Simple code scales better and runs faster.

One of the downers to Merb is that it's flexibility allows you to get down to the nitty gritty. However, it can be less productive than Rails because of its flexibility. Another downside is its documentation and examples are sparse. Merb is not recommended if you're just getting into Ruby.

Camping
Camping is a micro framework (< 4K) developed by why the lucky stiff. It's designed to develop small applications. You can do everything in one file and create prototypes very quickly. It uses Markaby to write HTML code in a builder-style fashion.

Since a Camping application is all in one file, it can be difficult to develop large applications. The solution is to write small apps and mount them in the same URL space. The only issue with small apps sharing the same space is they have to use the same database. One downside to Camping is there is no standard test framework. Mosquito was developed as a solution, but doesn't seem to be maintained.

Sinatra
Simple. Fast. Effective. It's designed to allow creating REST applications with minimal dependencies. Similar to Camping, it has one file for the entire application. Unlike Camping, Sinatra doesn't follow MVC conventions, so it may be difficult to port a Sinatra application to another framework.

Posted in Open Source at Jul 23 2008, 12:33:08 PM MDT 1 Comment