Flex to Java Notes (1)
















The red-circled parts, aka, Java Remoting Service are what I am going to talk about.

  • BlazeDS server is contained in a J2EE web application. That's why we need web server to host it.
  • A Flex client makes a request over a channel and the request is routed to an endpoint on the BlazeDS server. From the endpoint, the request is routed through a chain of Java objects that includes the MessageBroker object, a service object, a destination object, and finally an adapter object. The adapter fulfills the request either locally, or by contacting a backend system or a remote server such as Java Message Service (JMS) server.
  • Channels are client-side objects that encapsulate the connection behavior between Flex components and the BlazeDS server. Channels communicate with corresponding endpoints on the BlazeDS server. You configure the properties of a channel and its corresponding endpoint in the services-config.xml file. 
  • <channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">
  •     <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/>
  • </channel-definition>
  • How exactly Flex components know how to connect to BlazeDS, using which channel?
  • Answer: you can use automatic way or manual way.
  • Automatic way: compile Flex component using -service option, check your "Flex Compiler", you should find something like -services "C:/flex_workspace/EZQ5Browser/WebContent/WEB-INF/flex/services-config.xml" -locale en_US
  • Manual way: 
  • <RemoteObject id="ro" destination="Dest">
  •     <mx:channelSet>
  •         <mx:ChannelSet>
  •             <mx:channels>
  •                 <mx:AMFChannel id="myAmf"
  •                     uri="http://myserver:2000/myapp/messagebroker/amf"/>
  •             </mx:channels>
  •         </mx:ChannelSet>
  •     </mx:channelSet>
  • </RemoteObject>
  • Destination to channels


Mercurial Notes (2)

This is from my colleague Esteban:

When you are working with Mercurial, it may help you understand that the work you are doing in your local repository is being done on your own personal branch (an unnamed branch).

In the meantime, other people continue making changes to the original branch on the master repository.

When you try to synchronize your repository with the master you discover that your branch has diverged from the main branch (as it happens if somebody pushes changes before you).

The best strategy to get back in sync with the master repository is to move all your work in your personal branch, to the top of the history (the top of the current history in the master repository).

Mercurial and the Eclipse plugin let you do this with a command called "rebase".

Steps to synchronize your committed changes with the master repository:
  1. pull and update to the latest version
  2. rebase
  • select the first change you committed in your personal branch
  • select the current tip of the branch you are working with
  • resolve any conflicts
  • commit
     3. push your changes to the server

Why do you get two heads after pulling from the master repository?






















Rebasing:



Mercurial Notes

This is an Email from my colleague Gareth:


Ian explained this a little last night.  Since this is going to come up a lot, I wanted to explain what the dialog options are.

You'll get this dialog if you've made changes to a repository at the same time as someone else.  (You committed changes to your local repository, then went to push them.  Someone else had sneaked in and pushed changes ahead of you that you don't have.)  You'll get this dialog.

If you imagine your repository, this is what it looked like after you committed your changes "L1" and "L2":

But some other developer (probably with a few extra cups of coffee in them because boy they did it awfully fast) made changes "R1" and "R2" at the same time and pushed them to the main repository ahead of you.  The dialog is saying you've got a situation like this:


There are three ways to handle it.  One is to force your changes anyway and split into two heads.  NEVER DO THIS.  It's not what we want.

The easiest thing to do is "Rebase", and it's always the first thing you should try. What "Rebase" does is looks at the files involved.  If you've both worked on completely different files, it will just update your repository to take the "R1" and "R2" changes, then stick your changes on top:

Now you can push your changes with no problem.   In the graph of the branch, this simply adds your changes as a new node after  that "coffee'd up" developer.  Since most of the time we'll all be working on different files, this is the most common scenario, and how we should try to handle it.

OK, but what if Mr/Mrs coffee worked on the SAME files as you did.  What a jerk!  Rebase doesn't work.  You get an error that a merge is required.  OK, no biggie.  Now you have to do a merge.  I'm not sure how the dialogs work and will update this when I find out, but you want to get to that second option "Merge two heads".

If you've changed different parts of the same file, the merge can be done automatically.  If not, you've got to handle the conflicts in the UI just like we did all the time in IDEA and CVS.  Once we're done and happy with the merge, we commit the updated files and push our changes.  The graph now looks like this, with "M1" being the combined streams of work.

Hope that helps.  Please let me know if there's problems with the explanation, or your experience differ with what I've described above.  Happy "Rebasing".

Thanks,

Gareth

Read a file in Classpath

new BufferedReader(new InputStreamReader(Q5Service.class.getResourceAsStream("/Extents.csv")));

Make a link folder in windows


C:\spring-flex-testdrive-1.0.3-v1\projects\java\spring-flex-testdrive-java>mklink /D builds.out C:\spring-flex-testdrive-1.0.3-v1\tomcat
ps\spring-flex-testdrive\WEB-INF\classes
symbolic link created for builds.out <<===>> C:\spring-flex-testdrive-1.0.3-v1\tomcat\webapps\spring-flex-testdrive\WEB-INF\classes

Another example:
do it in cmd line with administrator privilege.
The following is to create a link folder "Banking Documents" under current directory.
C:\Users\hliu\Documents>mklink /D "Banking Documents" "E:\backup\Banking Documents"