Saturday, June 23, 2007

Evangelist Dialogs – Day 7: Walled Gardens and the Best Cocktail in the World in Bangalore

We did three more talks today. It was mainly journalists but also some local users groups and architects. The talk that explains how to decompose Tim O’Reilly’s Web 2.0 examples into design patterns using the Mackenzie-Nickull Architectural Patterns Meta Model template seems to be very popular. There are a lot of people anxious to read the book when it comes out.

Back at the hotel, Prayank and I stopped for a drink at my hotel (the Leela Palace). I couldn’t decide what I wanted so I asked the bartender to invent a new drink. He came up with a really cool invention. When I asked him what it was, he said he just invented it and asked me my name. I told him and he proudly declared that the new drink is “The Duane”. The inventor, Mr. Ramalingham from the Library Bar at the Leela Palace, also started getting other customers ordering it who were sitting near me. If you go to Bangalore and come to the Leela Palace, ask for "The Duane".



Trust me – this guy is a genius!!! The recipe is as follows:

Grey Goose – 45 ml
Malibu – 30 ml
Pineapple Juice – 120 ml
Orange Syrup – 80 ml
Raspberry Syrup – one dash
Glass – tall glass
Garnish – Pineapple cone with cherry

IMO – this is the best cocktail in the world.

Traffic continued to be bad in Bangalore. Prayank and I just had to laugh it off as we dodged cows, a guy riding a horse, pedestrians and about 45 different types of wheeled vehicles.



Right now it is time to head to the airport to get back to Singapore, then on to Sydney. Further away from home.

Thursday, June 21, 2007

Evangelist Dialogs Day 5 and 6: India

I arrived in India late at night to find what appeared to be complete chaos. After getting my luggage, the private car picked me up in what I can only describe as a non-contact demolition derby. The entire parking lot was jammed packed with cars all beeping horns at each other. The funny thing is that it is like adding bold text to emphasize a phrase. If you bold everything, you have emphasized nothing. The Indians use their car horns in Bangalore very similarly. To beep at everything is to beep at nothing (but it is much noisier).


Now just to clarify, I have been to New York, LA, Paris, Barcelona, London and Berlin. Traffic is bad in so many places but Bangalore takes the cake. The lines in the middle of the road and the traffic lights hanging above the streets are meaningless to those who use the roads. The poor lines lie in the road in an utterly futile attempt to mark lanes, impassioned in their quest and ignored universally. Nevertheless, what a blast!! We got a great driver. He got us everywhere ahead of schedule.

At our visit to Fidelity, I received a great honor. I was asked to light a candle in front of a huge crowd with the other guest speakers to inaugurate their architects convention. There were at least 250 architects present. The talk went very well too and I found the crowd very easy to relate to as architects just get the topic of design patterns, models and reference architecture for Web 2.0. The questions were bang on.

After Fidelity, we grabbed our driver and raced across town, dodging 3-wheeled taxis, cows, pedestrians and potholes that could have swallowed a hippo.

The second talk at Infosys was really well received too. The architects at Infosys were totally amazed to see that Adobe has a really good enterprise story and we have baked SOA into our new LiveCycle ES architecture. I can’t wait to share this with the LiveCycle team back home. Infosys definitely is a first class company.

Today, we meet with some press and bloggers in addition to a few side meetings. Should be fun.

More later.

Wednesday, June 20, 2007

Evangelist Dialogs Day 4 - Goodbye Hong Kong

..and Hello Bangkok/Bangalore India. Traveling all night is fun, really! NOT!!

My suspicions are confirmed; Cathay Pacific is first class royale! Check out my seat/bed/cocoon.



Today was another frantic day of early rise and nonstop presentations and meetings. From the start of the day it was end-to-end presentations with the exception of about 18 minutes where I had a chance to eat some food. Zip2Zap showed off a great demo of a really cool Web 2.0 application for financial services built with Flex. The Hong Kong IT crowd, like the crowds in Korea and Singapore, seems very eager to adopt the latest in Web 2.0 technologies. There is a great infectious air of enthusiasm and a “let’s do it” attitude. No wonder this region is booming economically. Lots of smart developers and lots of open minded IT managers who seem to understand that the core design patterns of SOA and Web 2.0 are essential to the future of their enterprises. This makes it very easy to deliver a compelling message about why LiveCycle ES is a must have for any company serious about being in sync and not losing its edge to the competition.

I have been asked a lot about Microsoft Silverlight and JavaFX from Sun. While I have not used either of these technologies, I wouldn’t compare them directly to AIR (the technology formerly known as Prince… oops. I meant Apollo) . What is clear is that the future of RIA development is going in the same direction. The fact that Adobe, Sun and Microsoft have all started carving out a niche in this area seems to indicate it is the place to be. Of course, Adobe has the advantage being the incumbent player in the Enterprise 2.0 space (Clarification: to me, Enterprise 2.0 is the adoption of the design patterns of Web 2.0 by enterprises). Some analysts might cast it differently so ask for a definition when talking to someone.

On a personal note, I really miss my family now. My son has a new mountain bike needing some assembly which I need to be doing but this trip pays the bills. My wife and two young daughters are hard to be without. Ahh – one more week till I return.

Hong Kong has to be one of the most beautiful cities in the world. Check out this photo from the Adobe office:



No rest for the wicked. As I write this I am on a plane bound for Bangkok then on to Bangalore. My less-than-a-week-old 15” MacBook Pro has some serious display issues too. I went with the newer sharper display. It seems to be a hardware issue and it is making it hard to do presentations. The job of an evangelist requires nerves of steel. When things go terribly wrong with less than 3-5 minutes before starting a presentation, you need to have a backup plan, remain cool, and always do what needs to be done to do the job.

Bangalore will be another day of panic but I am also looking forward to spending more than 18 hours in one country. I get in after midnight and have to be ready to leave the hotel by 8:00 AM. So tired…. Need sleep.

More to follow.

Tuesday, June 19, 2007

Evangelist dialogs - day 3

Arrived in Singapore late last night and got busy preparing for the next day. Schedule is nuts! Check this out:

7:00 am – up for breakfast
8:30 – leave hotel (check out)
9:00 – 10:00am: Room set up. Computer check.
10:00 am -12:00 pm: Partner briefing
10:00 am: Arrival of Partners / Refreshments
10:15 am: Welcome
10:15 – 11:15 am: Livecycle ES presentation
11:15 am -12:00 pm: Q&A
12:00 pm: lunch (working lunch)
1:00 pm: Arrival of Media
1:15 pm: Welcome
1:15 – 2:15 pm: Livecycle ES presentation
2:15 – 3:00 pm: Q&A
3:00 – 4:00pm: Refreshments / Side one-one interviews
4:30 – leave for airport.

It is now 5:15 and I am sitting in an airport lounge. On the way out of the city I saw this amazing statue. It is either going to be the world’s largest Ferris wheel or the world’s largest bicycle wheel truing stand. Either way – well done Singapore! This country is also very cool! Everyone is really energetic and positive. If only there was a way to export this energy to other areas of the world.

Tonight I fly to Hong Kong. After two days of luxury aboard Singapore Airlines (my gawd – has it really only been two???), tonight I see what Cathay has to offer for first class.

Sunday, June 17, 2007

The Evangelist Dialog - Day 2 (Seoul - Singapore)

Seoul is such a beautiful city. When I was here 8 years ago, the smog and traffic were so bad I could barely see three blocks. Today is a beautiful day, filled with sun and clean air. The day was very busy. All day long talk, listen, talk, listen. Here are some interesting things. My fellow blog brethren have informed me that the Korean Flex user group community has over 6500 members! They also asked me to come back and party with them with some cool Korean liquor called Shoju (spelling???). These guys were fun.

I just about missed my plane thanks to a minor fender bender which slowed freeway traffic to a crawl. Managed to make it by about 3 minutes. Once again, Singapore Airlines exceeded every single other airline.

Flying to Singapore, will be there soon.

.. and now I am in Korea!

Anyung ha se yo! Je erumun Duane yim ni da! Ju nun Canada esu whatsem ni da.

I am now in Korea and I love everything about this country. In South Korea, about 70% of the land is covered with mountains and Seoul itself is a world class city with a world class tech community. I am a bit haggered but glad to be here again.


Being an evangelist for Adobe Systems definitely has its benefits. At the airport I got picked up in an Equus Limo (made by Hyundai). The car is amazing - full on Luxury. At the Hotel Intercontinental, there is a pyramid sticking out of the ground reminiscent of the Louvre in Paris where I was 3 weeks ago.




Tomorrow I will be meeting some of the top bloggers and top press in Korea. It will be an honor to meet with luminaries such as Ik-Jong Kim (Electronic Times), Hong-Seok Lee (Digital Times), Kyu-Hee Cho (eWeek Korea), Management & Computer magazine's Sang-il Lee, Computer World's Jeong-eun Kim, Jun-Kee Park or Monthly w.e.b., Electronic Information Times' very own Jeong-Hyun Heo, Computer Times' Jeong-Hyun Kim and several other top notch publications. This country just *loves* technology.

I am really keen to meet my fellow blogosphere devotees too. A special meeting has been arranged where I will get a chance to talk to Jun-Gyun Bae (Flex Adobe Community Champion), Ho-Sung Shin (Flex Adobe Community Champion & one of the brains behind the Dongbu Life insurance Flex project), Man-Young Lee (Flex Adobe Community Champion, BAM, Java and BPM master), Kwang-Nam Hur (Flash Adobe Community Champion), Joo-il Yang (blogger extraordinaire and Flash Designer), Chang-Shin Lee (top flight Java guy), Tae-Wan Kim, Dong-Ho Lee, and Sung-Hoon Choi among others.

Many people who talk to me think the evangelist role is only about talking, promoting etc. It is also about listening. Tomorrow, while I might be giving two presentations, most of the day will be focused on listening to what Koreans want from Adobe and what they think we need to be doing in the next 1,3,5 and 10 years. After all, they are the real users and the ones who are instrumental to our success.

Time to grab some sleep and ready myself for a power day tomorrow. here is the schedule:

7:00 - Up and get breakfast
8:00 - Pack up suitcase, leave hotel room
9:00 - meet local Adobe staff.
10:00 - 10:45 a.m. Pre-meeting with Interpreter (get set up for live concurrent translation into Korean)
10:40 - 11:00 a.m. Reception (I hope they have Tim Horton's)
11:00 - 11:10 a.m. Introduction to Press
11:10 - 11:50 a.m. Presentation (WHOOPS! Maybe I should write one before going to bed)
11:50 - 12:00 a.m. Q & A
12:00 - 13:00 p.m. Lunch
Session 2. Blogger Roundtable
13:00 - 13:10 p.m. Introduction
13:10 - 13:40 p.m. Presentation
13:40 - 14:20 p.m. Open Forum
14:20 - leave for airport (60 minutes via limo)
16:30 - on flight bound for Singapore
21:45 - arrive Singapore
22:00 - clear customs, get bags
22:30 - get to hotel
23:00 - new blog entry and prepare for next day.

This is the reality of Technical Evangelism. If you think you've got what it takes, email us - we have more jobs like this open!

Saturday, June 16, 2007

The Evangelist Dialog - Day 1 (Vancouver - Seoul)

A lot of people tell me I am lucky to be an evangelist for Adobe. Yes - I am but they often don't see the other side of the job. The tireless hours, long trips and endless interviews, press events, speaking engagements, conferences and more.

To illustrate what this job is like, I am going to publish a diary of the next 2 weeks during a trip. Today is Saturday. While most people have the day off, I am sitting at the Vancouver international Airport about to leave for Seoul, Korea. I am excited about riding on Singapore Airlines new 777 Dreamliner in first class. Heard a lot of good things.

I will hopefully arrive tomorrow at suppertime in Korea and get a chance to sleep before going to my first meetings.

TTYL

Tuesday, June 05, 2007

SEO - Search Engine Optimization Tricks

Consider this a gift if you are seeking to lead the search engine rankings with some newer tips and tricks. I used to do this for a living and have tried to stay current over the new technologies as they come out. SEO is generally much easier now that there are fewer search engines to target. Back in the good 'ole days we had to target multiple engines and change the code behind to be specific for each one.

I have a long history of working on search engine projects and feel nothing reveals tricks like building a search engine to see how it works. One project was the Initiative to evaluate XML Retrieval (which I was largely working with Universities on advance ontological and syntax mechanisms) while another one was the GoXML Contextual XML Search Engine launched in 1998, days after the recommendation was done. GoXML is still featured on PatentStorm.

SEO has little to do with indexing the content of a page nowadays. All that does is give you a starting reference point. The indexbot parses your page noting some particulars and provides you a weight with various terms.

The key metrics are:

1. Domain name matches search string (note – since hyphens and periods are removed during the webbots normalization process, things like www.ford.com are equal to www.f-or.d.com). Not many people know this since they do not write code to parse domain names. The hyphens are removed since not many people search on hyphens and the search engine index needs to be as efficient and lean as possible.

2. How many relevant sites that point at the site are very important. I showed some Adobe colleagues how to use this to our advantage to beat out Microsoft and Sun for the term “Enterprise Developer Resources”. All I did was ask that everyone make a signature to their email that said “Adobe Enterprise Developer resources – http://www.adobe.com/devnet/lifecycle” and then go about our normal business of posting to public threads. The index assumed that we must be relevant given the other top sites seemed to have links pointing at Adobes site. In reality, these were only archived email threads with the signature being treated as a link. All the Search Engine saw was “-links to -> Adobe.com. Within 6 weeks we beat out MSDN, BEA, Sun, IBM etc. and are still #1
http://www.google.com/search?source=ig&hl=en&q=enterprise+developer+resources&btnG=Google+Search

3. How people click on the top ten search results in Google. Google uses an adaptive algorithm which is a variation of the GoXML algorithm of which I co-wrote. We had 51 unique patent points in 1998 on this. When you click on one of the top ten results, Google simply tracks the result via a pass through. You can see this in action by doing any search on google, then right clicking the link and copying it. Where you see www.adobe.com/devnet/livecycle/ or get that URL if you copy/cut, when you right click and copy link, that actually translates to http://www.google.com/url?sa=t&ct=res&cd=1&url=http%3A%2F%2Fwww.adobe.com%2Fdevnet%2Flivecycle%2F&ei=JzZkRvzMEZqUgwPkmNmKBw&usg=AFQjCNGx7iKEUn38Kcfk8woBnWtcNueL9g&sig2=ope-x2wZBZhBXtNlk_fj0w

A case study is “Architectural patterns metamodel”. Matt Mackenzie and I wrote a variation of the gang of fours template for architectural patterns using UML 2.0 and linking known uses. It is now ranked #1 since it is the most used template by many software architects. See http://www.google.com/search?hl=en&q=architectural+Patterns+meta+model&btnG=Search

Note that this is referenced by the unique IP address bound form the incoming HTTPRequest header so you cannot spoof it without additional tricks. Since you have to first receive the call back code from google to build the new outgoing request in order for it to register, there is almost no way to spoof it ;-)

4. The meta tags are indexed and useful but only up to a certain point. Many people who have no clue how code works try in vain to do things like META Content=”mountain, bike, mountain bike, mountain bike clothing . Etc. The truth is that the meta keywords are parsed and normalized stripping out both the commas and spaces except for one space or other delimiter to separate the array. All the indexbot see from the above example is “mountain:bike:mountain:bike:mountain:bike:clothing” Any word repeated is generally disallowed completely and interpreted as spamdexing the bot.

5. Any keywords that do not appear in the body in plain text at least once are heavily discounted unless the core content of the page has no visible words, then the indexbot defaults to what it has to work with to establish the baseline weights.

6. Any keywords that appear more than approx. 7% of the total word count for the body are discounted as spam. (Note - this cannot be verified lately but it used to be true in the early part of the decade).

7. Words in large fonts near the top of the page and in the page title weight very heavily. People used to trick the SE’s by making this text the same color as the background. The human would not see anything but the indexbot would. The SE’s caught this trick early on and made a cross reference of colors to nab perpetrators. What many people do not know is that you can beat this by using javascript which the indexbots do not see. A browser’s parser hands this off at a later stage to the rendering engine so they might catch this later. I suspect that Google should catch this trick in the near future.

8. Google overlays the search matrix with an ontology classified by a first order of logic that separates all results into a modal array. The ontological nodes are also ranked at the meta level based on the preceding and mix into the pages dynamically but within the constraints defined by their librarians. That is why a term like “washington” will have results for the president, the state, the university, the actor etc all in the top ten. One way to trick this is to find the least common context then build a site to get #1. Once you have done that, replace the words for the context of your choice and you will usually stay in the top ten since the visibility draws

I have other tricks but have never failed to get any site less than 3rd for the terms including “mountain bike”, aromatherapy, whistler rentals, enterprise developer resources and many others...

Oh yeah - these are the tricks I am willing to share. I am still keeping some others as closely guarded secrets. It's not hard to figure out since it is all based on simple logic. Enjoy and good optimizing. Post your success back here if you find this helped.

Tuesday, May 29, 2007

Gas Prices are not high - stop whining already!

Okay - gas at the pumps is now about $3.50 USD per gallon. Seems steep right. Well, it's not really out of line. Sure in 1980, gas cost only $1.13 per gallon. That was 1980 people!!! You could also buy a house for under $100,000 and a car for under $8,000. In inflation adjusted figures for 2005, the real price was $2.86 (based on US Census figures for inflation adjusted prices). In 1955 gas was only $0.27 per gallon. In a time where a brand new house AND car could be bought for under $10,000, this would be the same multiplying the whole equation by ten. Hence Gas goes from $0.27/gallon to $2.70 per gallon and the car AND house goes from $10,000 to $100,000 USD. If you think gas is to high at $2.70 per gallon, consider your range of options for buying a new house and car in the US for under $100,000. Can't really to it. the US national median house price is actually about $220,000 as of August 2005.
If you raise the price of gas to be in alignment with housing and new automobiles, it should be around 2.2 times the $2.70 in terms of 1955 inflation adjusted dollars or approximately $6.00 US per gallon. Coincidentally, that seems to be what many other countries pay.

On top of that, the US has one of the lower prices for gas at the pumps world wide. See this graph to see how really upset people would be if placed in a country like Norway where gas is over $6.00 USD per gallon. Us Canadians have been paying $1.35 per litre at the pump (approximately $5.00 USD perUS gallon). The Dutch pay $6.48 per US Gallon!

The price of gas has largely remained stable over the last 40 years and in terms of inflation adjusted dollars, has not become a luxury. Yes - in the last few months we have witnessed US prices that appear to almost approach the median price the rest of the world pays but we have not yet even seen the USA get into the expensive half of the chart. In short, the US still has some of the cheapest gas in the free world.

Also - consider that higher prices might have positive effects. Perhaps even less people on the roads in their own cars, more people car pooling or sharing. If higher prices make people think, let's think about how we got into a position where the gas and oil companies have the power to unilaterally raise prices over us and screw us in the pocketbook. We got ourselves into this position by becoming Dependant upon it in the same manner drug addicts feel the financial wrath of their dealer.

What I would really like to see? I would like to see a real Energy policy in the USA. The US an dCanada could lead the world in alternative energy innovation and use if the right people take control. Get rid of the brats who still falsely consider Hydrogen as a viable terrestrial energy storage device and start real research into the net energy capabilities of new systems. My great Uncle Stig runs the world's largest and cleanest bio-mass energy conversion plant in Finland. We shoudl be doig the same here. The California wind energy policy is a good move. Solar works.

And I would like to see more people stop and think before winging on about how costly gas is. it really isn't.

Wednesday, May 23, 2007

SOA : the real goods

This series on Youtube called "Greg the Architect" is brilliant. it left me ROTFL..

Monday, May 21, 2007

Adobe MAX 2007 info

The amount of work going into MAX 2007 is unbelievable. Preparing our annual event for North America, Europe and APAC regions is a monumental task to take on. To date, I have about 500 emails from various parties (each taking a minimum of 5-10 minutes to read and respond to or about 50-100 hours) plus almost a full GB of materials to go over. It takes a serious commitment, not just from the track leaders but from all involved. Rom Portwood and Sarah Eaton are putting their hearts minds and souls into MAX 2007 and we have tons of community involvement planned this year.

Some of the other evangelists on our team have done the same and from what I have seen so far, MAX 2007 will not be something you want to miss. Ted Patrick, Ben Forta and I have asked for a received permission to do a full blown code camp style event. Anyone reading this that would like to be involved int eh code camp, please contact one of us and we'll figure out a way to fit you in.

The MAX 2007 website will be going live soon with registration and the content.

Sunday, May 20, 2007

A must read entry to music lovers

Ajit's entry on Open Garden's really spoke to me. Not just because the idea fits in with the model of Mix2r.fm for the next generation of music. He nails the ideas that the record industry has to understand and how fans are attracted to music for more than just the bits and bytes that make up the files we transfer.

Technoracle (a.k.a. "Duane's World"): Buying a hot water heater? Read this first. Don't buy Rheem

Rippoff Report!!! Buying a hot water heater? Read this first. Don't buy Rheem: "http://www.ripoffreport.com/reports/ripoff17495.htm"

Technoracle (a.k.a. "Duane's World"): Buying a hot water heater? Read this first. Don't buy Rheem

Technoracle (a.k.a. "Duane's World"): Buying a hot water heater? Read this first. Don't buy Rheem

Friday, May 18, 2007

Buying a hot water heater? Read this first. Don't buy Rheem

I want to share a personal experience with anyone considering buying a hot water heater in North America. When my wife and I moved into our house in Vancouver, we soon found we needed a new hot water heater. After much choice, we went with a Rheem brand since it was sold to us as a high quality, North American brand with a 8 year warranty. Were we ever taken for a ride though. The warranty turned out not to be worth the paper it was printed on. While the warranty did state it was "limited", we were lead to believe by Hillcrest Plumbing that if anything happened to our hot water heater, it would be replaced within the warranty period. After all, what does warranty mean? According to Rheem, even today you are protected on parts but don't be fooled. They are unscrupulous and are lying to you.

Our water heater let go and we had to call Hillcrest during off hours. They told us that Rheem and Hillcrest are no longer honoring their written warranties and due to a change in design and rules , would not be able to honor their warranty on parts. WFT??? This is a clear case of a large multi national company imposing a unilateral change on a contract due to their own lack of foresight. We, the people are being ripped off.

My advice:

1. Do not believe anything Rheem promises in terms of warranty. They lied to us and did not honor their own written warranty. This website could just as easily be lying.

2. I will also never do business with Hillcrest Plumbing again. I urge you to consider this when looking for a plumber. Get references from any plumber. By contrast, there are lots of reputable firms like Roto Rooter and others who have never ripped us off.

3. Rheem Canada also seems to handle the Ruud brand. Be wary.

4. If you are a contractor looking for a line of water heaters/holding tanks
to carry and install, consider how your customers will feel about you if this happens to them. It will cost you money if too many people experience lies like this.

If you are one of the 10,000 people who read this blog every month, please pass this on to others in North America.

Friday, May 11, 2007

Stupidity knows no bounds!


I am speechless. I am not even sure where to begin addressing this. Someone at Vancouver International Airport actually convinced others to get a budget for a project to tell people how to bring food on an airplane. They developed a small logo for their project. Do they really think we need signs to help us? Did they envision that people are too clueless to figure the three steps out for themselves (1. buy food; 2. ask for it "to go", 3. bring it on plane)??? WTF??? These signs are everywhere.

This is one project I am glad I was not in any meetings for. I would have strangled someone.

Duane's World 2007 Java One "Coolest in Show" award

Every year I blog after Java One and recognize one company, demo, entry, exhibit that is better than all others. In 2006, this award went to a robotic Lego and Java demonstration. This is never an easy task since there are so many cool things at Java One. This year is no easier. After much internal debate and watching the "wow" factor from peopel seeing things for the first time, I bestow the 2007 Duane's World "Best in Show" award to the Java powered helicopter. Das ist ein sehr gute Hubschrauber!



Runners up were the Sun SPOT (Small Programmable Object Technology) and the Quebec University students Java submarine. the latter failed to make tops given they have not yet included an adaptive algorithm to learn and re-program thrust bursts based on Causality Event Programming models (The thrusters usually over-compensated in attempts to level the device). While it is not "kinderspiele" (Child's play), it could be done with minimal effort. Quebec has a long history of great technology and good hockey goalies so I look forward to seeing what they bring next year.

Disclaimer: I excluded the Flex, Apollo and Java PDF code from Adobe.

Thursday, May 10, 2007

Java One 2007 source code and slides

Java One 2007 is full on! My favorite was the helicopter but I also can't wait to start developing with the SunSpot devices. I think I am going to build a solar tracking device.

Anyways - thanks to all of you who came to my talk. I was overwhelmed with the great reception and applause and felt really humble to be appreciated by such an esteemed and knowledgable peer group. I don't use Java every day so I was happy to see all the code I wrote for you compile the first time. Felt like I dodged a bullet.

Here is the first class (DuanePDFClass2.java). You will need to download the XPAAJ.jar file to make this work. The other class is directly below. You should also know that we are moving towards the XML friendly version of PDF ("Mars") which will allow any developer to work with PDF XML formats using the XML parser in their native language. For the long term, this is a much better solution than us developing libraries for each and every programming language.

import java.io.*;
import java.util.*;
import java.awt.image.DataBuffer;
import com.adobe.pdf.*;

public class DuanePDFClass2 {
public static void main(String[] args)
throws FileNotFoundException, IOException

/* Make sure we have the correct args.length() and call PDFExtract() */

{
String inPdfName;
if(args.length != 1 )
{
System.out.println("\nCommand line format: java classname pdf-file");
return;
}
else
{
inPdfName = new String(args[0]);
PDFExtract(inPdfName);
}
}

public static void PDFExtract(String inPdfName)
throws FileNotFoundException, IOException
{
System.out.println("\nOpening PDF with DuanePDFClass2...");
PDFDocument doc = null;
boolean b = false;
FileInputStream inPdfFile = new FileInputStream(inPdfName);
try {
doc = PDFFactory.openDocument(inPdfFile);
} catch (IOException e) {
System.out.println("Error opening PDF file :" + inPdfName);
System.out.println(e);
}
if(doc == null)
System.out.println("Cannot open PDF file : " + inPdfName);
else
System.out.println( inPdfName + " was successfully opened.");

System.out.println ("Document Version = " + doc.getVersion());

System.out.println ("PDF is " + doc.getNumberOfPages() + " pages long.");

/*Save PDF to file*/
System.out.println ("\nSaving document ... ");
int j = inPdfName.lastIndexOf(".");
String outPdfName = inPdfName.substring(0, j) + "_saved_by_Duane_at_JavaOne2007" + ".pdf";

InputStream inputStream;
inputStream = doc.save();
b = false;
try {
b = saveFile(inputStream, outPdfName);
} catch (Exception e) {
System.out.println("Error saving PDF file.");
System.out.println(e);
}
if(b == true)
System.out.println ("Document was saved to file : " + outPdfName);
else
System.out.println("Document was not saved to file.");

System.out.println("\nExecution of DuanePDFClass1 has finished.");
}
/**
method to save InputStream to a file.
*/
public static boolean saveFile(InputStream is, String filePath)
throws Exception
{
boolean retVal=false;
byte[] buffer = new byte[10240];
FileOutputStream outStream = null;
try
{
outStream = new FileOutputStream(filePath);
int len=0;
while (true)
{
len = is.read(buffer);
if (len == -1)
break;
outStream.write(buffer, 0, len);
}
outStream.close();
retVal = true;
}
catch (IOException io)
{
System.out.println("Writing the array of bytes into the file "
+ filePath + " failed.");
throw new Exception(
"Writing the array of bytes into the file "+ filePath +
" failed in saveFile");
}
return retVal;
}
}


Here is the second class which casts the input stream handed off by the Document factory class into a buffered stream reader and strips out the XMP metadata.

import java.io.*;
import java.util.*;
import java.awt.image.DataBuffer;
import com.adobe.pdf.*;

/* XMPExtractSample
* by Duane Nickull, Adobe Systems Inc. dnickull@adobe.com
* Copyright (c) October 25, 2006 - all rights reserved
*
* Use this at your own risk and don't whine/winge on to me if it doesn't work.
* You will need to have XPAAJ.jar from Adobe labs.
* Written and tested with JDK 1.5 on a mac w/osx 10.4.7

*/

public class XMPExtractSample {
public static void main(String[] args)
throws FileNotFoundException, IOException

/* Make sure we have the correct args.length() and call PDFExtract() */
{
String inPdfName;
if(args.length != 1 )
{
System.out.println("\nCommand line format: java DuanePDFClass1 pdf-file");
return;
}
else
{
inPdfName = new String(args[0]);
PDFExtract(inPdfName);
}
}

public static void PDFExtract(String inPdfName)
throws FileNotFoundException, IOException
{
System.out.println("\nOpening PDF with DuanePDFClass1...");
PDFDocument doc = null;
boolean b = false;
FileInputStream inPdfFile = new FileInputStream(inPdfName);
try {
doc = PDFFactory.openDocument(inPdfFile);
} catch (IOException e) {
System.out.println("Error opening PDF file :" + inPdfName);
System.out.println(e);
}
if(doc == null)
System.out.println("Cannot open PDF file : " + inPdfName);
else
System.out.println( "\n" + inPdfName + " was successfully opened.");

// Export the xmp metadata from the document
try {

//Call the PDFDocument object's exportXMP method.
InputStream myXMPStream = doc.exportXMP();

//Get the byte size of the InputStream object.
int numBytes = myXMPStream.available();
System.out.println("\nNumber of XMP Bytes found is " + numBytes + "\n");

// Read into a Buffered Reader Stream.
BufferedReader d = new BufferedReader(new InputStreamReader(myXMPStream));

// Iterate through the XMP object and print each line
String xmpLine;
while((xmpLine = d.readLine()) != null)
{
System.out.println(xmpLine);
}
// Find the Physical Memory Reference of the object
System.out.println("\nXMP InputStream is in physical memory at -> " + d);

//Create an array of bytes. Allocate numBytes of memory.
byte [] MDBytes = new byte[numBytes];

//Read the XMP metadata by calling the InputStream object’s read method.
myXMPStream.read(MDBytes);
} catch (IOException e){
System.out.println("it went really bad" + e );
}
System.out.println("\nXMP Extraction has finished.");
}
}



Friday, May 04, 2007

Web 2.0 Definition? What is the Web 2.0?

I have been writing a lot lately for an upcoming book on the topic of Web 2.0 with James Governor and Dion Hinchliffe for O'Reilly. During the process, we have done an amazing amount of research in an effort to quantify some of the patterns surrounding the concept. The work was actually quite intense and started with examining a single table put forth by Tim O'Reilly. The table illustrated examples of what was web 1.0 vs. web 2.0. Many people have struggled to define and understand "Web 2.0" At this point, defining it probably won't happen due to the fact that there are so many differences in what people think it is, however, anyone can mine it for knowledge. I personally don't see this as a problem since there seems to be a lot of consensus surrounding what is and is not web 2.0. While definition has possibly slipped away, the ability to share the collective knowledge on the subject has not. The knowledge of web 2.0 can be caught and expressed in architectural patterns and models. This blog post is a teaser of the upcoming book on that exact subject.

So what are "Patterns"? A pattern is a repeatable solution to a frequently occurring problem. The value of patterns is that it captures the solution knowledge independent of the implementation which then allows the pattern to be re-applied to other instances of problems in different contexts. An example of a pattern is to note the collaborative tagging (A.K.A. "Folksonomy") and commenting patterns on Flickr, then realize that the same mechanism can be used for video, audio, scientific research, news articles etc. Entrepreneurs in general should be very interested in this book. New start up ideas will be plenty abound.

We started with this diagram:



From each of these examples, patterns were distilled from the instance. The methodology left us with a huge collection of patterns that are documented and can be used to compare the old way to the new way. From these patterns, we were able to create a model based on further abstracting the main concepts required to fulfill the patterns. The model itself is abstract but from the model we were able to create a reference architecture for developers and architects. The idea is that the reference architecture is abstract of all technologies, implementation detail yet presents a great technology component view that can be used to help guide architects and developers as they build their applications.




The value of this methodology is that anyone can take the reference architecture and build their own specialized architecture from it. The model is simple and reflects abstract concepts that are present in most of the patterns. So what does the model look like and what is different? The model is shown below:



The model is definitely different than the old internet in a number of ways. In order to reflect the capabilities necessary to fulfill the patterns mined form Tim's examples, developers need to extend the basic client server model. Instead of a simple "server", the Services Tier of the model reflect the core tenets of Service Oriented Architecture, itself a a core pattern of Web 2.0. SOA is a pattern that can be used to match needs and capabilities under disparate domains of ownership. In this context, SOA is independent of any specific implementation or technology family such as web services and aligned with the abstract definition in the OASIS Reference Model for SOA. SOA allows "capabilities" to be offered for consumption to potential consumers on a common fabric. The common fabric is defined in terms of "Reachability and Connectivity", often implemented by using common standards and protocols. The concept of web 2.0 as an open platform relies on these open standards and technologies to function. Work such as the Service Component Architecture will rely on this type of infrastructure to exist in order to work.

The services tier offering these services is necessary to fulfill many patterns. To deliver a Rich User Experience (RUE), the capabilities must be leveraged to add more depth to interactions between users. To enable people to build mashups or offer Software as a Service (SaaS), the services tier must beliver the capabilities whilst abstracting the client from how the capabilities are being fulfilled.

The the middle tier of Capabilities and Reachability, we have seen huge changes since the first iteration of the internet. The development of Web Services standards and new data serialization forms such as XML to supplement the simplistic HTTP and HTML model form the first internet are necessary to fulfill the promise of the first iteration of the web. Guys like Bob Sutor, David Orchard, Marc Goodner and Eric Newcomer have all been working on these new standards and protocols for a long time. Why? They are absolutely necessary for Web 2.0. The Web must be open and mashable (new word??) to enable the patterns.

Additional patterns beyond simple "Request-Response" are necessary to fulfill core patterns like the "Synchronized Web". This latter pattern being used a lot for online gaming, collaborative applications and other synchronous architectures of participation. We have seen the rise of AJAX as an asynchronous model and various other mutations to make the patterns reality. Models for interaction include Probe and Match, Request-Response, Subscribe-Push, Synchronized, Asynchronous and more.

On the top side of the model, the old notion of "client" has been widened to become a "Client Applications/Runtimes". The purpose of this is to perform client duties and prepare the ultimate user to connect to the web. We noted that there is a new entity above the client. This entity is the User. The user is now a core part of the model for the internet and vice verse. Users are involved is so many patterns it would be difficult to ever devise an inclusive list. The Collaborative Tagging pattern ("Folksonomy), Collaboration-Participation Pattern, Rich User Experience Pattern, Semantic Web Patterns, Synchronized Web Patterns, Declarative Living and many others all include the notion of the user. Note that 'users' are not limited merely to humans but may include applications or other agents.

Some more about the model? This model can be used as a pattern between any two entities on the web. It is not about simply making one model for a platform of all interconnected devices. The model can be used in Peer to Peer patterns (one peer has a capability that gets consumed by another peer using protocols like BitTorrent via services for the ultimate benefit of a human actor) or other patterns like the Web Services * architecture, reflected in a great book by Chris Kurt.

Note that we do not consider the model to be the one single model that forever defines Web 2.0. It is simply "a" model which people can use, even if they disagree with it. If you disagree, you still have a model to use as a point of reference to describe your disagreements.

The reference architecture was presented during a recent session at Web 2.0 in San Francisco but I am not going to repost it here just yet. It will be the subject of another entry. In true Web 2.0 style, the book will have a sister website that allows anyone to collaborate and contribute to the set of patterns. This will be announced when the book is published.

The list of patterns identified to date is as follows:

Adaptive Software (software that gets better the more it gets used)
Asynchronous Particle Exchange
Collaboration Participation
Collaborative Tagging
Declarative Living
Mashup
Persistent Rights Management
Rich User Experience
Semantic Web
SOA
Software as a Service
Synchronized Web
Tag Gardening
...

Expect this list to grow as the work continues and others start contributing patterns. Note that Rich Internet Applications (RIA's) use a combination of patterns (RUE, Mashup, etc). Patterns themselves may be combined and used together.

Ahh - back to work..TGIF!!!