Cross-origin resource sharing on IBM Bluemix

Update: A newer version of this post has been published to the IBM Bluemix blog.

The IBM Bluemix Platform-as-a-Service (based on Cloud Foundry) naturally supports applications that are composed of many services that are in turn deployed to different hostnames.

For example, if you push an application to Bluemix, the name you provide will be prepended to .mybluemix.net resulting in an address such as:

  • http://my-sample-app.mybluemix.net

If your cloud-native app follows the best practices of a microservices architecture you’ll probably have two or more subcomponents that live on discrete hostnames like this.

But what if you have a JavaScript based front-end that needs to aggregate information from the disparate hosts? By default you won’t have access to data on these other subdomains.

The solution is to take advantage of the HTTP headers that are available to allow you to control cross-origin resource sharing (CORS).

To illustrate the problem and the solution, consider the simple Ajax application here:

If you click the red box, you’ll initiate an asynchronous HTTP call in JavaScript to a servlet on another host at:

The source of this servlet shows that no particular HTTP headers are set, thus the JavaScript call never reaches it.

However, if you click the blue box, you’ll initiate a call to a different servlet on that host:

This time the Ajax call will successfully consume data from the service, because the HTTP headers allow services from a different domain to access the servlet.

response.setHeader(
  "Access-Control-Allow-Origin",
  "http://krook-service-consumer.mybluemix.net"
);

response.setHeader(
  "Access-Control-Allow-Methods",
  "POST, GET, DELETE, PUT"
);

response.setHeader(
  "Access-Control-Allow-Headers",
  "x-requested-with,Content-Type"
);

If you need to allow access to all client hostnames, replace the whitelist with a wildcard:

response.setHeader(
  "Access-Control-Allow-Origin",
  "*"
);

There you have it; a simple way to build dynamic JavaScript applications composed of several microservices on IBM Bluemix (or any other Cloud Foundry PaaS).

I used Java in this example, but the same HTTP headers apply whether you’re using Ruby, Node.js, PHP, Python or any other runtime.

The Washington Americans

19 June 2014 » Football, Politics

This week presented yet another opportunity to suggest a proposal to rename the Washington Redskins to something less controversial. As I see it, the “Washington Americans” makes the most sense.

It removes a racial slur from the name, expands the appeal of the team to represent the capital city (as a kid, I thought the team hailed from Washington state), and it requires little – if any – change to the existing uniform and logo.

I’m not sure if I’m the first one who came up with the idea, but I’ve sent messages via the redskins.com feedback form a couple of times over the past 10 years.

December 2005

Greetings,

Congrats on the win today, and good luck next week at Seattle.

I just wanted to share my thoughts on your team name. I enjoy the history of the team, and the logo and colors. However, every time I hear the word “redskin,” I cringe (and it’s not just because I’m a New York Giants fan :).

My suggestion is to seize the opportunity and rename the team the Washington Americans. You would honor both native-American heritage, and unify that with your home in the nation’s capital.

Just a suggestion. And again, good luck… Unless you face the Giants in the NFC Championship. :)

December 2009

Greetings,

I wrote a similar note about four years ago through redskins.com, and after watching the prime time Sunday night game last night, I thought I’d write again.

I wanted to share my thoughts on your team name. I enjoy the history of the team, and the logo and colors. However, every time I hear the word “redskin,” I cringe (and it’s not just because I’m a New York Giants fan :).

My suggestion is to seize an opportunity and rename the team the Washington *Americans* without a change to logo or team colors. You’d continue to recognize native-American heritage and team history yet also strengthen the team’s association with your home in the nation’s capital.

Furthermore, by using the name “Americans” by itself, without any hyphenated prefix suggesting exclusion or exception such as “Native-,” makes a statement that all US football fans are united as a single nation with a common history.

Of course, this is just my suggestion. But, in what’s looking to be an off season full of change, I think you have a golden opportunity to break with a negative aspect of the past and look to a greater future of the franchise here.

If you could float the idea by Daniel Snyder I’d very much appreciate it.

I’ve also shared the idea a couple of times on Twitter to a positive reception.

Putting aside whoever it was that first came up with the suggestion to rename the team to the Americans, it’s at least a positive starting point to find common ground in this controversy.

It addresses the most offensive part of the name, reduces the cost of change to logo and uniform, and it expands representation of the city and the sport of American Football during this dreadful onslaught of World Cup “football.” :)

Please vote for my OpenStack talk proposals

27 February 2014 » Cloud, Cloud Foundry, OpenStack

I’ve submitted two abstracts for the OpenStack Atlanta conference that happens in May.

The OpenStack project is interesting in that it allows members of the community to weigh in on the topics they’d like to see at the conference.

If you like my presentation topics, please consider voting for them (ideally with 3 stars: “Would Love To See This!”).

To vote, you need to be a member of the OpenStack Foundation. You can join as an individual member for free.

The community review period ends on March 3rd, so please vote today!

IBM forges its new PaaS with Cloud Foundry

29 July 2013 » Cloud, Cloud Foundry, OpenStack

IBM recently announced an open cloud architecture, based on OpenStack at the Infrastructure-as-a-Service (server, storage, and network) level, and on Cloud Foundry at the Platform-as-a-Service (runtime, framework, and database) level.

The partnership follows a fifteen year trend at IBM. This strategy to start with – and contribute back to – open source projects benefits IBM, its customers, and the community itself.

  • By building on top of an existing open source foundation, IBM can focus its efforts on higher level services tailored to specific customers.
  • By generating interest in the technology – and dedicating employees to the open source project – the community and its software is strengthened.

I’m proud to be a part of the work at IBM to build our next generation PaaS on top of Cloud Foundry. We’ve already got 1,000 IBMers running 1,200 apps on it, and we’re growing fast.

As with Apache, Linux, Eclipse, and OpenStack before it, I have have high hopes for Cloud Foundry. It’s good news for IBM customers, and everyone else who can benefit from a free, open source PaaS.

This post is my own and doesn’t necessarily represent IBM’s positions, strategies or opinions.

An alternate history of Super Bowl matchups

16 January 2013 » Football, History, Thoughts

The NFL’s conference championship (semifinal) games always capture my imagination.

In many cases, it’s where the two best teams in the league face off, even if they still move on to face a weak opponent from the other conference in a largely ceremonial Super Bowl. Most of the San Francisco 49ers and Dallas Cowboy match ups from the early 1990s fall into this category. So these conference games represent the de facto league championship game.

In other cases, there are some teams that just can’t catch a break, like the Cleveland Browns or New York Jets, despite numerous, and often successive, championship game appearances. Without at least a Super Bowl appearance, these teams fall by the wayside of NFL history.

The forgotten championship
In all cases, the loser quickly disappears from the public’s memory – unlike the Super Bowl participants who have at least a moment’s glory on the national stage – despite an excellent season up to that point.

Do you remember how dominant the Browns were in the late 1980s? Or the Los Angeles Rams in the late 1970s?

A second chance at three hours
I often contemplate what NFL history could have looked like, had the NFC and AFC championship games gone the other way and the losers instead advanced to the Super Bowl.

See the full results below, starting with the 1970 season, with the winner shown in bold. I assume the conference that won the real Super Bowl also wins the alternate match up, though admittedly this is unlikely in several match ups. My observations follow the results.

Super Bowl        AFC team NFC team
V Oakland Raiders San Francisco 49ers
VI Baltimore Colts San Francisco 49ers
VII Pittsburgh Steelers Dallas Cowboys
VII Oakland Raiders Dallas Cowboys
IX Oakland Raiders Los Angeles Rams
X Oakland Raiders Los Angeles Rams
XI Pittsburgh Steelers Los Angeles Rams
XII Oakland Raiders Minnesota Vikings
XIII Houston Oilers Los Angeles Rams
XIV Houston Oilers Tampa Bay Buccaneers
XV San Diego Chargers Dallas Cowboys
XVI San Diego Chargers Dallas Cowboys
XVII New York Jets Dallas Cowboys
XVIII Seattle Seahawks San Francisco 49ers
XIX Pittsburgh Steelers Chicago Bears
XX Miami Dolphins Los Angeles Rams
XXI Cleveland Browns Washington Redskins
XXII Cleveland Browns Minnesota Vikings
XXIII Buffalo Bills Chicago Bears
XXIV Cleveland Browns Los Angeles Rams
XXV Los Angeles Raiders San Francisco 49ers
XXVI Denver Broncos Detroit Lions
XXVII Miami Dolphins San Francisco 49ers
XXVIII Kansas City Chiefs San Francisco 49ers
XXIX Pittsburgh Steelers Dallas Cowboys
XXX Indianapolis Colts Green Bay Packers
XXXI Jacksonville Jaguars Carolina Panthers
XXXII Pittsburgh Steelers San Francisco 49ers
XXXIII New York Jets Minnesota Vikings
XXXIV Jacksonville Jaguars Tampa Bay Buccaneers
XXXV Oakland Raiders Minnesota Vikings
XXXVI Pittsburgh Steelers Philadelphia Eagles
XXXVII Tennessee Titans Philadelphia Eagles
XXXVIII Indianapolis Colts Philadelphia Eagles
XXXIX Pittsburgh Steelers Atlanta Falcons
XL Denver Broncos Carolina Panthers
XLI New England Patriots New Orleans Saints
XLII San Diego Chargers Green Bay Packers
XLIII Baltimore Ravens Philadelphia Eagles
XLIV New York Jets Minnesota Vikings
XLV New York Jets Chicago Bears
XLVI Baltimore Ravens San Francisco 49ers

Some observations

  • The New York Giants never reach the Super Bowl. The New England Patriots appear only once (and win).
  • The Vikings, Lions, Eagles, Chargers, Oilers, Panthers and Seahawks each win at least one Super Bowl.
  • San Francisco still wins 5 Super Bowls, but also loses 3 times. Oakland wins 5 (including 3 in a row, which has never happened in Super Bowl history) and loses two.
  • The Browns make it to 3 Super Bowls but lose all of them. The Jets make 4 but win only one.
  • There is an expansion team meeting the year after both new teams joined the league, when the Carolina Panthers defeat the Jacksonville Jaguars.
  • The Pittsburgh Steelers and Dallas Cowboys still meet two times.
  • The Bears go 3-0, representing the best overall Super Bowl record.
  • The Buffalo Bills still don’t win a game.
  • There are lots of interesting local rivalries. Los Angeles and Oakland, San Francisco and Los Angeles, Pittsburgh and Philadelphia, Philadelphia and Baltimore, Jacksonville and Tampa Bay.

It would also be interesting to consider alternate MVPs, though I’d limit this to quarterbacks, since defensive or special teams players reflect a strong individual performance rather than the overall team strength. Kenny Stabler and Joe Montana would probably lead the MVP tally.

Best practices of the daily scrum at NYPHP

28 August 2012 » Agile, New York PHP, PHP

Join us tonight at the New York PHP meeting in midtown Manhattan to hear best practices for agile PHP development from Patricia Ju of Hackerbilt.

As a former scrum-half, I’m particularly interested in the actual rugby ball Hackerbilt brings to the daily standup. :)

RSVP now.

Zend on IBM private/public clouds at NYPHP

21 June 2012 » Cloud, DB2, IBM, New York PHP, PHP, Zend

Next Tuesday, June 26th, I’ll be speaking at the New York PHP user group about the project I led to bring the Zend Application Fabric onto IBM’s on-premise private cloud rack, PureSystems, and onto IBM’s public cloud, SmartCloud Enterprise.

I’ll describe the Zend Application Fabric for highly available PHP clusters, and show how its topology is supported by scaling and failover policies built into the IBM platform. I’ll also show how it integrates with the DB2 based Database-as-a-Service.

Zend Application Fabric

At the core of the Zend/IBM system is an IBM virtual application pattern (based on the TOSCA standard) that specifies how virtual machines are layed out, which other VMs they should link (or react) to based on life cycle events, and when they should scale up or down.

You will learn how to activate the Zend pattern, customize the topology, set a scaling policy, monitor the infrastructure, tweak the Zend configuration, view IBM elasticity and fault tolerance in action, and perform repeatable deployments using a template.

RSVP now, or make a note to catch the live stream.

Predictive analytics for football play outcomes

30 April 2012 » Football, IBM, Writing

Inspired by the NFL playoffs in January, I wrote an invention disclosure on how to merge player statistics with current field conditions to yield a visual probability of how a play might turn out.

The end result I envisioned was that you could watch the game on television as a spectator (or in real time as a competing coach) to see what the outcome the system predicted at the start of a field goal or 3rd down pass, for example.

As a sports fan the technology adds value to what broadcasters currently provide with digital first down markers and 3D play analysis.

As a coach, you could confidently plan what your next play would be. If the likelihood of scoring a touchdown was high, you could more quickly decide whether to kick the extra point or go for a two-point conversion ahead of time.

Beyond American football, the technology could be applied to many other situations, such as ice hockey, as well as non athletic events.

  • Example Embodiment #1: Field Goal
    In the NFL, a place kicker lines up to attempt a field goal. Using statistical data about the player (his history of successful field goals from this distance in this stadium) as well as sensor or other real time data about conditions on the field, the system overlays a heat map onto the image on the television screen, showing solid orange where the kick is likely to go (and fading opacity farther away from the center based on the probability). This provides a good indication where the kick will end up, and whether it will be successful. (Figure 1)

    Figure 1: Likely outcome of field goal attempt in this context
    Example Embodiment #1: Field Goal

  • Example Embodiment #2: Pass Play
    In the NFL, a quarterback has his team lined up in a pass formation. Using statistical data about the player (his history of passes from this field position in this stadium) as well as sensor or other real time data about conditions on the field, the system overlays a heat map onto the image on the television screen, showing orange where the ball is likely to go (and fading opacity farther away from the center based on the probability) and yellow highlights the probable receiver. This provides a good indication where the pass will end up, or to which player he will pass. (Figure 2)

    Figure 2: Likely receiver of the pass and field position of the catch in this context
    Example Embodiment #2: Pass Play

  • Example Embodiment #3: Hockey shootout
    In the National Hockey League (NHL), a hockey game has goes into overtime and comes to a shootout to determine the winner. Using statistical data about the player (his history of one on one shots against this goalie in this venue) as well as sensor or other real time data about conditions on the ice, the system overlays a heat map onto the image on the television screen, showing orange where the puck is likely to go (and fading opacity farther away from the center based on the probability). This provides a good indication where the player will shoot.

IBM decided not to pursue a patent, but published the idea to protect the intellectual property. The full article is available behind a paywall at IP.com.

Would be interesting if this serves as prior art for any later invention that gets implemented.

Next page »