Monday, September 8, 2008

GAE-1

I have been working on two different projects recently and have no time to create my own GAE project. Well, one of the project i am working on is on GAE, but its not mine. :) I really wish i could have a break or holiday to take my plan step future and deploy it.

Monday, usually not very busy but since i am working on two tasks, so i didn't enjoy the cold sunny day that much. Heard a decision that the project has been "definitely" postponed. Whatever. Just as i thought before, they can't do it anyway. However, the bad or good news for us is we may still have to stay as "consultants" here for a while. But., i will go home after Xmas and the reason is twofold, i will release them later. :)

Since i have spend some quality time on GAE both personally and for my commercial project, i would like to start a series entries to demonstrate what i have done, and if possible, help people who want to join as well.

GAE wend public at May. When i was at Google Developerday in Sydney at June, it was still tested internally. At the end of June (i guess), GAE wend public testing phase and people who basically have a mobile phone, can register a GAE account. By the time of this writing, every GAE account (one mobile number can only register one account) can have 10 applications.

What an application means in GAE? It means you can have a stand-alone domain name (buy one as you want for $10/year or use Google's), "big table" which represents 100M back-end database storage and a simple Google-made python web framework to ease your pain as a web developer. Moreover, you get complete analysis of your traffic, bandwidth and usage. Sounds awesome isn't? Also, whatever in the web page is up to you. Its not like Google Apps, which you can't add/modify HTML header materials. In GAE, you have fully control of your page(s). You can include whatever meta tags you want and complete CSS+JavaScript support. It also supports several different Python Web frameworks. For me, i choose Django (its verison 1.0 now) because: one, its easy and famous; two, this is my first time to write python app, i dont have enough time to learn them all. Anyway, GAE did an excellent job on integrating Django into its freamwork. Except Django's database APIs (because it has "big table"), you can alsmot utilize all your Django gears.

Cool, you can search Google now in terms of where to register a GAE account and where to start. They have very good online documents. I wish i can write some source code here next time.

Saturday, August 30, 2008

A simple taste in GAE

GAE == Google App Engine

Like my personal web site is hosted at Google Apps, i am planing to create a new one at Google App Engine.

Some useful links before starting:
  • Their official blog: http://googleappengine.blogspot.com/2008/04/introducing-google-app-engine-our-new.html
  • Google App Engine optimizations: http://www.niallkennedy.com/blog/2008/07/app-engine-optimization.html
  • Google App Engine utilities project: http://gaeutilities.appspot.com/
  • GAE cookbook: http://appengine-cookbook.appspot.com/
I believe they are worth to have a look. BTW, heard a "rumor" that they are planing to support Perl as the next citizen in GAE, not Java, Ruby, Groovy or C++. Anyway, i dont care, got my new Python book already.

Sunday, August 24, 2008

Collaboration!?

Somebodies say: we are using Agile.
Someone says: good programmers are "LAZY".
But nobody talk about collaboration. Oh yeh, they all super-duper, they are "agile".

Of course ideally everybody will happy if all aspects of a project are described as in the textbook. However as IMHO, they are not, at least i haven't seen any. But interestingly, i do meet some "text-book" practitioners and the pain is, sometime i have to work with them.

I hate to have meaningless arguments again and again, especially with one specific person, but in reality, lets face it. Text-book man does sounds like textbook. He/she/they perform according to textbook, they talk like textbook and the worst, if you don't follow them, they "convince" you, everlastingly.

Argument of text-book man always starts with "Do you know...?". Yeh, did you see the question mark in the end of the sentence? Good, if you say Yes, they will say: "then why don't you do it?". On the other hand, if you say No, they will say: "ok, let me explain to you." What happens next -- be prepare to hear a speech or presentation in terms of how people record "the same situation" in "ideal world" and how they "did" it. Importantly, you must show your patience, otherwise they will keep going and going until they sense you are "convinced". Annoyingly they always presume everybody in the project has read the same book or has the same experience. If you don't, they will force you to do everything in their way (its in the textbook, see? Of course its the best!). Basically, they always right.

How to deal with text-book man? I don't know. I tried to ignore them, but trust me, it doesn't work and that's why i keep emphasizing "be patient". I guess the only way to do is try to get yourself be more "text-book" than they are. When they finally shut up, you can come back into reality and continue the work.

Yes i know time has been wasted in these meaningless arguments, but lets face the reality. I am glad that so far no textbook has described any "solution" for this "rubush time", otherwise there will be a infinite loop -- a really really terrible loop.

Thursday, July 31, 2008

Messy

Typically an SOA project: big, messy, massive products and locations, paper waste, single Enterprise prod vendor and etc. However, worst of worst, two departments belong to two consulting companies, and, they don't know each other! Moreover, one of them is product definition team, another is the product implementation team. What a wonderful project!

We, are in the middle, scary isn't it. We read prod definitions everyday, we use prod system everyday, and we confused everyday. We just surprised that why not those people never thought to sit together face-to-face to fight each other? Email? You kidding me. Do you know how many emails have been printed in the printing room and just left in there? Intentionally? I don't know, they probably have too many emails that yelling at each other to read, but they do remember to print them out as a physical evidence (prepare for the system crash in day two).

I don't know whether SOA defines Collaboration. It does have governance. However, does it covers collaborations as well? We heard testers complained about the crappy system again and again. And the explanation from "top" people is: we are using Agile. Fuck agile. Its a methodology, not an excise for this crappy, selfish, buggy system.

Back to our painful days: PD people release new PDs day after days to prove their productivity. Dev team creates version after versions of this buggy system. So what we have? We have defects of defects; we have new-version and old-version products running in the same system, simultaneously!! Our so-called manager(s) are still sitting in the meeting room, 8 hours a day, 5 days a week, to talk about how successful their project is.

Does SOA has anything to do with this mess? If not, then stop using this term. If its technical, then it is technical. If it is business, then it is business. If it is both, then screw you. Oh, sorry, forget to mention a funny thing: they said, they just brought a new ESB. WTF. You know what, i am gonna call day-off for the next 2 weeks to construct my first workflow. Hold on there buddy, i gonna build the world-first wooden workflow which is totally SOA applicable.

Wednesday, July 23, 2008

Cloud+SaaS+RIA = ?

All hot buzz words, huh! But think them together, if we get cloud and SaaS/PaaS and RIA together and put them all over to the Web to build a super online application, then what is it? Web 2.0? Web 3.0?

I payed lots of attentions recently on Google's "new" App Engine. I even picked up Python and start to read it. Well, to be honest, i started with Javascript first coz its more related to my current work (Action Script). Gotta lucky to say that my first project involves with Amazon EC2, so at that time i was told it was all about Cloud. But seriously, what is it? No idea.

Until recently when i saw Google App Engine, i remembered the old story about EC2 and start to do my own research on this topic. IMHO, i think cloud is more hardware-focused rather then SaaS or PaaS which are more application or software-oriented. To start my argument, first i would like to quote a famous word from Thomas J. Watson. You may not know him, but do you know IBM? Yes, he is his father:
"I think there is a world market for about five computers"
Furthermore, Professor Douglas Hartree has the same words:
"I went to see Professor Douglas Hartree, who had built the first differential analyzers in England and had more experience in using these very specialized computers than anyone else. He told me that, in his opinion, all the calculations that would ever be needed in this country could be done on the three digital computers which were then being built — one in Cambridge, one in Teddington, and one in Manchester. No one else, he said, would ever need machines of their own, or would be able to afford to buy them."
You can find them in here. From this point i start to think about Grid and distributed computing, even the Sci-Fi story: SKYNET. In theory, do skynet (exclude AI) and cloud have any difference ("physically")?

Cloud, deterministically emerged as it would be, comes to our life "all in a sudden" and changed all hardwares and infrastructures as what they used to be. On the other hand, I believe when you talk about SaaS or PaaS in general terms, it is naturally to think about software or platform, and as a matter of fact, they do represent s/w and s/w platform*. And that's the reason why we come up with the further idea of SaaWS (Software as a Web service), which is lodged in SOA world. Consequently, think about this: in the ideal world, when all software are exposed as SaaS, then where they should be (hosted) and how we can access/utilize them?

Easy, at "server side", Cloud. At "client side", RIA (i wouldn't bother to say Web browser). Why? Because Cloud promises us universal accessibility and RIA gives us native application-like look and feel.

Well as my story continues, i gotta mention RIA, which is short for Rich Internet Application, might be another misleading name as what Web service does in the past 5 or 10 years. Firstly, its not necessary to be internet as most RIAs' aim is to implement MVC at client-side and provide end users with "offline" functionalities. Secondly, why you call it Application? Why not technology, or platform? An application is more like an ERP or Websphere but our RIAs today, e.g. Ajax, Flex or Sliverlight, are more like technologies or "platforms". But anyway, as we all clear about what it actually means, as we do for Web service, its totally ok here.

OK, so, are they real? I gotta say i dont know. I do believe the story of skynet. In the future, there will be some super computers that have been connected together and people only need a "rich" client to access their data no matter where they are and what they want. You will not worry about upgrade your hardware anymore, no data lost, no synchronization. However, is there any side-effect? I think the answer is yes, Matrix.

Some "earlier" Cloud applications you might interest:
* Google App Engine
* Amazon EC2
* Apple mobileMe
* Salesforce.com
* Microsoft Live Mesh
And a lot more, go nuts...

*: Search and join the debate between Cloud Computing/SaaS/PaaS.

Sunday, July 20, 2008

When does Final Fantasy XIII available on Xb?

Get a little bit of boring of playing my GTA 4 now. However, to summarize what happened in this week: E3, oh yeah! Saw the new fantastic Resident Evil 5 trailers, so awesome. But the bad news is, probably all of you have noticed in Gamespot.com, that the release date of RE 5 has been changed from TBA 2008 to TBA 2009, damn! We gonna have to wait for at least one more half year to get this challenging game on shelf.

Most importantly, the breaking news is (oh actually was), ES changed their decision finally and planed to release FF13 on Xbox 360; and the "damn point" (probably will piss off all PS3 players) is: cross-platform copies will be released on same date. Wtf, have pity on those PS3 processors, you all screwed (no offense honestly, at least i don't have to spend another f**kin $500 bucks. So missing MG4).

All old gamers probably still remember what happened almost 10 years ago, that Final Fantasy 7 was planed to be released on SEGA's machine but finally changed to Sony's Play Station 1 (only and no ported version). It was really a drama at that time and it might be unbelievable that this game can be considered as the main reason for SEGA's later Video Game Industry failure. Well, actually SEGA doomed himself when the first DS machine released, but anyway that's another story.

Back to 1997, PS1 got all dreams: Final Fantasy, Bio Hazard, Parasite Eve, Winner Eleven, Dragon, even Ace Combat, oh and my favourite, Rodge Racer. Now what his descendant has? Compared with Xbox 360, PS3 only has Metal Gear 4. So i am really happy that less-and-less game will be released on PS3 only, and my bias here is, i hope more-and-more Xbox-only games to be released soon (come on Gears of War2, where r ya?).

Anyway, back to the topic. No official details have been released so far, so i don't know how long we have to wait to watch the wonderful FF13 opening. I always saying Xbox needs an excellent RPG. Dead Raising did a good job, but not enough tho.

Ciao, shooters.

Tuesday, July 15, 2008

Google Flash Map

Well, my flash map toy works pretty well recently till i found a tiny problem when writing my own map control.

Basically my control does a simple thing: display lat and lng values when you navigate the map. This is done simply by registering a event listener to Map Move Event, more specifically MapMoveEvent.MOVE_STEP.

For example,

public class ControlLatLng extends ControlBase {
...
public override function initControlWithMap(map:IMap):void {
var latLabel:TextField = new TextField();
...
latLabel.addEventListener(MapMoveEvent.MOVE_STEP,
function(event:MapMoveEvent):void {
latLabel.text = _map.getCenter().lat().toString();
...
}
);
...
}
...
}

Well, gotta say this is what i thought at first that my label listens to Map Event directly. Then once there is a move, label text will be updated correspondingly. However if you add and run this code, you will find it is totally wrong: the listener does not work at all.

Back and forth, forth and back, i was jumping everywhere to find the answer: why doesn't it work? I even analyzed Flex event's 3 different stages but in the end i found answer from the discussion group that i gotta use _map to register this listener instead of my "local" label. But why!?

Back to Google Flash Map official tutorial, i found this:

"The Google Maps API for Flash adds to this event model by defining custom events for objects within the API. It is important to note that the Maps API for Flash events are separate and distinct from the standard Flash events. Note that MapEvent events may bubble up from target objects to container objects, though events in the Google Maps API for Flash are generally designed with specific targets in mind."


Clearly by this, a tiny little piece of my mind reminds me: Flex events, for example, mouse events can not be utilized directly; instead, we have to use Map Events, Map Move Events etc. One thing after another, i remember in Google Developer Day, the map presenter did state that Flash Map is actually loading "an extra" swf into your client app. Meanwhile, i found Ted's blog:

"The Google Maps Flash API is the first major component to work distributed as the core logic remains on google servers and the API you program with is just a simple proxy loading the remote SWF and that SWF talks back to Google to get data and tiles as a service."

And from Francesco Rapanà that

2) Pay attention to the events: you can't use the standard Flex events but you need that ones provided by the Google SDK, such as MapMouseEvent.CLICK.


So from here, the answer might be clear: events that Google Map has are different and can not be utilized directly in our "local" flex app -- obviously they are two separated applications and utilizes "the internal API" to glue them together.

So what the architecture of Google Flash Map? Hmmm gotta say i couldn't find any answer from Google (of course, damn). But look at this from Google IO:









This might not clear enough, but this one maybe better:















1.1swf is embedded in client HTML.

OK gonna stop here but i wish they will open-source this project soon.

Monday, July 14, 2008

ESB in silo-silo apps?

Tom Baeyens posted a great blog entry in terms of data services, most specifically Business Process, in an SOA. As he said:

"The main point I have tried to make is that the implementation of Business Processes should not be tied to integration technologies (read: the ESB). They can be just as well located within the application silos."


So from here i want to extend it into a silo applications scenario. For example, suppose we have 3 Java applications that working as their own. Obviously there is no need to implement any kind of ESB+BPEL "interface" to connect them together -- we can easily take advantage of jPDL or JPD or any other "tight coupled" Java Business Process solution(s) in this specific envionrnment. For the future's perspective, its definitely better to connect these apps by ESB(s) via messaging technologies. However, I get confused about BPEL that whether this language is a "tightly-coupled" language for ESB only?

Where does BPEL belong to? In ESB only?

Wednesday, July 9, 2008

Generate PDF from Flex Application by AlivePDF

Another story about Flex. Now this one is about using AlivePDF to generate PDF file from Flex Application. Its actually very funny that Flex and PDF are both Adobe's products but integrating them together is not that easy (at least there is no existing easy+free solution).

Lets look at what AlivePDF offers. This excellent open-source project is also available at Google Code. Note, generating PDF from AIR application is a little bit different (actually easier). Consult AlivePDF for more details.

In order to generate PDF rather than simply print it to a paper, firstly create a PDF function in MXML script block:
... ...
private function doPrintPDF():void {
var myPDF:PDF = new PDF(Orientation.PORTRAIT,
Unit.MM, Size.A4 );
myPDF.setDisplayMode(Display.FULL_PAGE,
Layout.SINGLE_PAGE );
myPDF.addPage();
myPDF.addImage(this.Template_box, 5, 5, 0, 0,
ImageFormat.JPG, 100, 1, ResizeMode.FIT_TO_PAGE,
"Normal", true);

myPDF.save(Method.REMOTE, "http://localhost/create.php",
Download.ATTACHMENT, "my_flash.pdf");
}
  1. at first create a PDF class which will initialize the required resources for generating a PDF. For example, page size here is A4, and page is portrait.
  2. next you define the page layout settings, very straightforward
  3. after all of these, you can call addPage() to add a page into your myPDF. Remember, you must "add a page" before adding any contents
  4. ok now i have a page already, but its empty. Next, call addImage() to add content into my page. The beauty of addImage() is you can add Flex Display Object into your page. For example, here i "print" my VBox and all its children. Be careful of the numbers: 5, 5, 0, 0. First 5 and 5 mean your "image" will be added 5 pixies after the top-left corner of paper (A4 here). Next 0 and 0 are very tricky. They means "shirk" my image if its too big (bigger than A4 here) or keep it normal when the size is equal or less that the paper (A4 again). Also you can define customized size of your image, for example, 5, 5, 200, 100 means print my image at 5 pixies and image size is 200, 100, regardless of its original size.
  5. save it. Remember you must provide the correct location of your create.php file (simply copy paste it to your_root/Sites if you are using Mac). As for the current time being that Flash player requires server script support for downloading files, you must provide this file when user want to save it to their local machine. On the other hand, use Method.Local for AIR application as it supports local file streams naturally.
Already, all we need is done. Next in your application, add a button as:

< label="Print PDF" click="doPrintPDF()">

That's it. Oh BTW, gonna say sorry to AlivePDF's author Thibault Imbert that i have created a bug report in Google Code but that i didn't realize that providing 0 and 0 in addImage() will "shirk" the image automatically. Well actually i found this from the source code, but anyway, its great that i dont have to write my own ratio calculation function. :)

Monday, July 7, 2008

A simple Flex print button

Recently i am working on a Flex project that i have created a simple print button in order to simply print my flash movie into one single A4 paper. It sounds interesting at first coz no one would think about to print a "moving" picture. However as the project requests, i have to make this possible and make it as simple as possible.

Straight to the code. Firstly i create a simple "PrintButton" that extends the existing UI button and also with a printing function.


package jiang.example {
import flash.events.MouseEvent;
import mx.controls.Button;
import mx.core.UIComponent;
import mx.printing.FlexPrintJob;
import mx.printing.FlexPrintJobScaleType;

public class PrintButton extends Button {
//component attributes
public var component:UIComponent;
public var paper:String;

public function PrintButton():void {
super();
addEventListener(MouseEvent.CLICK, printJobInvocation);
}

// Define private click event handler.
private function printJobInvocation(event:MouseEvent):void {
var printJob:FlexPrintJob = new FlexPrintJob();

//Start the print job
if (printJob.start() != true) return;

if(paper == "OnePage") {
printJob.addObject(component,
FlexPrintJobScaleType.SHOW_ALL);
}
else if(paper == "FillPage") {
printJob.addObject(component,
FlexPrintJobScaleType.FILL_PAGE);
}
else if(paper == "MatchHeight") {
printJob.addObject(component,
FlexPrintJobScaleType.MATCH_HEIGHT);
}
else if(paper == "MatchWidth") {
printJob.addObject(component,
FlexPrintJobScaleType.MATCH_WIDTH);
}
else if(paper == "None") {
printJob.addObject(component,
FlexPrintJobScaleType.NONE);
}
//default print paper setting
else {
printJob.addObject(component,
FlexPrintJobScaleType.SHOW_ALL);
}

//output to hardware
printJob.send();
}
}
}


This simple class can be compiled in both Flex 2 and 3. Put it into the right folder. Next in my simple MXML application,


<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
xmlns:="jiang.example.*"
backgroundGradientColors="[#ffffff, #ffffff]"
backgroundColor="#FFFFFF">
<mx:VBox>
<mx:VBox id="Template_box" verticalGap="0" ...>
... ... ...
</mx:VBox>
<mx:Spacer height="15"/>
<PrintButton component="{this.Template_box}"
label="Print" borderColor="#000000" fillAlphas="[1.0, 1.0]"
fillColors="[#FFFFFF, #FFFFFF, #FFFFFF, #D6F5D1]"/>
</mx:VBox>
</mx:Application>

Remember one thing before you try this little application. Click Flex's "Project" in the menu bar, and then "Properties", and then click "Flex Compiler" in the left-hand menu, add -default-background-color #FFFFFF (look out the space) to the compiler arguments. This argument will set the application's default color from haloblue to white. Also notice that i have used backgroundColor="#FFFFFF" in my Application tag, this one also helps me to change the default color to white.

Turn back to my PrintButton tag, it takes two cousmized attributes:
  1. component: takes any UIComponent that you want to print, e.g. VBox, button, textarea etc.
  2. paper: tell printer how you want to print it, in one page, multiple page?
My upper example print the "Template_box" component and all its children and it print all of them in one paper (shirk it if its too large). This button can also works with dynamic contents: it will print whatever Template_box has in the screen when you click it. So if your mxml has some runtime WYSIWYG functions, it also works.

However, i found a very annoy problem: the damn halo blue color. I have to set up all parent Boxes to have backgroudcolor = #FFFFFF, otherwise it will print halo blue as the default background color for Box component. I hope i can find an easy and possible solution for this soon.

Thursday, July 3, 2008

Google gets serious about Open social

Just looked at Google code and found this new project called "Google Friend Connect". Lets see what it can do.

Unfortunately i have been to Google DeveloperDay at Sydney this year but unable to attend the open-social speech. I am not sure how serious Google is on this topic since we have so many successful stories already, e.g. MySpace and Facebook. As a result, i didn't see any point that Google shows endeavor in this area.

However, read a tech story today states that Google plans to propose its iGoogle as a future "HUB" for global users (i bet its functionality is more or less similar to MySpace or Facebook, or even MSN space). As it says, currently gmail "traps" more attentions than any other google products. Therefore as an improvement, Google plans this "Canvas" API for its open-social platform to try to attract as many developers as they can to enrich its current Web content and experience.

I have no interest in terms of this "social function" provided by Google since i use Facebook everyday. It may be soon "fully occupied" by developers, who knows.

Tuesday, July 1, 2008

iPhone3 == 3xiPhone

Finally as we saw, Telstra joined the mess. According to the unreleased plan,
$279 for an 8GB iPhone 3G or $399 for the 16GB version.
Good news isn't it? Hold on, check out the next line:
while subscribers can obtain the 8GB phone for free with an $80 monthly plan and the 16GB handset for free with a $100 plan.
What the hell! I dare to ask who the hell wants to pay $1920 for just a single bloody mobile phone!? Have a look on the street, those old-timers are still holding a 10-years-old Nokia for just simple telephone and SMS. This price is unbelievable; i can almost buy a MBP by this price.

In fact, i use MBP for my job and daily life; i listen to my nano wherever i been but i gonna say i am not a (huge) Apple fan, neither a windows fan :). The only reason i use Mac OS is because windows sucks and Linux has fairly limited supported software (espacially in enterprise environment). To be honest, i believe Apple products are over-priced. Yes, they do provide high quality, but that's not mean we are fool. Check out the new iPhone 3G plan all over the world:
  • In Canada, FIDO & ROGERS, the lowest price is $60/month and the highest is $115/month. Most importantly, the $115 package can only use 2G for data transfer, and the funny thing is, they explain that 2G equals to 1 million text messages or 16,000 web pages. F**k you fool, it has the bloody Wi-Fi builted in, what the point of having 1M text msgs? I can just pay $39 from Vodafone for 5G mobile internet.
  • 3G at HongKong, 8G version costs $120 with the $42/month plan, and 16G version costs $223 with $34/month plan. Cheaper isn't? If i really want to buy one, it will definitely be HK.
  • America, oh i love it. You just need to pay $30/month for single customer or $40/month or enterprise.
Now Jobs' $199 joke is over. As the concurrency is almost the same between Aus $ and US $, i dont see the point that why Australian have to pay almost $1000 extra dollars for it. It doesn't have Flash support; it doesnt have video call and it does have Wi-Fi builted-in but most companies are selling their Wi-Fi servers rather than telling you that this small brillent device can connect to your wireless router at your home or office.

I am pretty angre with the price, meanwhile i am downloading the damn 1.2G iPhone SDK. Holy shit, can you just make it smaller Jobs? I gonna pay my bill next month, not you!!

Monday, June 30, 2008

A sample Google Flash Map App

Well what a boring Monday afternoon. Luckily i remembered my unfinished Google map toy and created a sample fun application, deployed at my website. Here is the sample screen shot:

Friday, June 27, 2008

Pilot

Keep google products with my gmail account.