CXF Method Not Found When Further Annotated
When using CXF and the JAXWS annotations to publish web services, like this:
@WebService(targetNamespace = "http://blah")
public class ClientData {
@WebMethod
public String getSomething() {
return something;
}
}
you can experience problems if you annotate the web service methods with something that spring-aop needs to process. Like when using perf4js nice @Profiled aspect, like this:
@WebService(targetNamespace = "http://blah")
@Profiled
public class ClientData {
@WebMethod
public String getSomething() {
return something;
}
}
This is due to the fact, that spring will produce a proxy of the @Profiled bean, a proxy that will not have the annotations of the proxied bean. In turn, this will hide the annotations from CXF, which can come out and complain about missing methods on the server side. Like this:
org.apache.cxf.interceptor.Fault: Message part {http://blah}getSomething was not recognized. (Does it exist in service WSDL?)
Solution?
Add the implementorClass attribute on the JAXWS endpoint definitions in your cxf bean definitions xml. This way you tell CXF which class to look for annotations on, instead of just looking on the class of the proxied instance it is passed at runtime.
December 3, 2009
·
polesen ·
No Comments
Tags: aspect, cxf, spring, spring-aop, ws · Posted in: Programming
Flex Spinning Progress Indicator Component
Sometimes you need to indicate progress to users when the application is doing something, like calling a remote web-service or something. At times, it can be nice to incorporate this as an element in the UI, that operates in an unobtrusive way. For instance showing a small indicator on or besides the button, that initiated the operation in progress.
Here is a small spinning wheel example on how to do this with an old style ASCII spinning wheel animation. Enter the LabelProgressIndicator.mxml component:
<?xml version="1.0" ?>
<mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script><![CDATA[
[Bindable]
private var statusText:String;
[Bindable]
private var progressText:String;
private const SPIN_CHARS:String = "/-\\|/-\\|";
private var workingDotsTimer:Timer;
private var progressCounter:int;
public function startProgress(status:String):void {
if (workingDotsTimer == null) {
statusText = status;
workingDotsTimer = new Timer(200);
progressCounter = 0;
workingDotsTimer.addEventListener(TimerEvent.TIMER, onWorkingDotsTimer);
workingDotsTimer.start();
}
}
public function stopProgress():void {
if (workingDotsTimer != null) {
workingDotsTimer.removeEventListener(TimerEvent.TIMER, onWorkingDotsTimer);
workingDotsTimer.stop();
workingDotsTimer = null;
statusText = null;
progressText = null;
}
}
private function onWorkingDotsTimer(event:TimerEvent):void {
if (progressCounter == SPIN_CHARS.length - 1) {
progressCounter = 0;
} else {
progressCounter++;
}
progressText = SPIN_CHARS.charAt(progressCounter);
}
]]></mx:Script>
<mx:Label id="status" text="{statusText}"/>
<mx:Label id="progress" text="{progressText}" fontFamily="courier" fontWeight="bold"/>
</mx:HBox>
and here is how to use it:
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:ui="*">
<mx:Button click="progress.startProgress('working')" label="Start"/>
<mx:Button click="progress.stopProgress()" label="Stop"/>
<ui:LabelProgressIndicator id="progress" />
</mx:Application>
October 28, 2009
·
polesen ·
6 Comments
Tags: flex · Posted in: Programming, Rich Internet Applications
Flex Data Bindings – Behind The Scenes
Ever wondered how flex data bindings actually work behind the scenes? I have, and sometimes I have had troubles with it, that made me wish I knew some more. This post is a writeup of the knowledge about flex data bindings I uncovered, when looking into the mxmlc generated code for bindings.
Vanilla Example
Here is a dead simple vanilla sample of flex that does a little bit of data binding:
<?xml version="1.0" ?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script><![CDATA[
[Bindable] public var value: String = "blah";
]]></mx:Script>
<mx:TextInput id="textInput" text="{value}"/>
</mx:Application>
where value is bound into textInput.text will generate quite a bit of supporting code, when being mxmlc’ed. Basically, it seems like flex operates with two concepts behind the scenes: Bindings and Watchers.
Bindings
A Binding is a one-way connection, that can read a value from a source and set it on a destination, but only when explicitly executed. There is not listening for changes built into a binding as such, it is just a mechanism that can be executed by someone, to transfer a value between a source and a destination.
So, how does a binding get executed? It does so, when the Watchers it is connected to fires. A binding acts as listener for watcherFired on a Watcher, which is how it gets executed when changes happen.
Here is the binding setup, that flex generates for the above example:
binding = new mx.binding.Binding(this,
function():String {
var result:* = (value);
var stringResult:String = (result == undefined ? null : String(result));
return stringResult;
},
function(_sourceFunctionReturnValue:String):void {
textInput.text = _sourceFunctionReturnValue;
},
"textInput.text");
basically, it instantiates a mx.binding.Binding with the parameters:
- this which is this context – pun intended – means the FlexTest application class
- a function that can read the source value when executed
- a function that can set the target property when executed
- a textual string of the target (docs says it is used for validation)
this sets up a “channel” from source to target.
Watchers
While Bindings only implement the reading of the source and setting into target, the other big part of flex data bindings is actually determining if and when, a binding should execute. This is where Watchers come in.
A Watcher can watch for changes on something, one typical example is a change of a property value. When such a change is detected, the watcher notifies its listeners (which are Binding instances) about the change. It is then up to the listener (the bindings), to actually read out the source and set the target (aka: Execute the binding). It is the Watcher, that determines if a value has actually changed.
Here is the watcher setup, that flex generates for the above example:
watchers[0] = new mx.binding.PropertyWatcher("value",
{ propertyChange: true },
[ bindings[0] ],
propertyGetter);
as you can see, it instantiates a mx.binding.PropertyWatcher instance, as it is a property we are binding from, with the following parameters:
- a map of event names as keys, that are the event to listen for, when watching changes. This is what can be overridden with [Bindable("otherEventNameHere"])
- an array of listeners, that get called on their watcherFired method when the watcher detects a change (the listeners are Binding instances, and in this context bindings[0] is the exact binding that we saw the code for just before
- and lastly propertyGetter is a method, that can return access to properties in the context watched
I am sure you can image how this works then. By hey, … when is the “propertyChange” event being dispatched in our code. I mean, when you look at the initial example code, if I was to assign a new value to the value property, there sure ain’t any code there, which fires any events.
Well, it turns out mxmlc has generated code for that too:
[Bindable(event="propertyChange")]
public function get value():String {
return this._111972721value;
}
public function set value(value:String):void {
var oldValue:Object = this._111972721value;
if (oldValue !== value) {
this._111972721value = value;
this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "value", oldValue, value));
}
}
it simply moves the original value property to a generated name _111972721value and adds a get/set pair on the value name instead. Clever. And hey, look into that setter. It dispatches the propertyChange event, when changed.
October 12, 2009
·
polesen ·
One Comment
Tags: data binding, flex · Posted in: Programming, Rich Internet Applications
AppleScript to Check Image Ratio on a Bunch of Files
Faced with the tedious task of checking a large bunch of image files for the correct ratio before uploading to a print service website, I set out to write a small AppleScript application that could do it for me. It turned out to be quite fun and at the same time I got my feet wet for the first time in AppleScript.
This is what the script does:
- Ask the user for an input folder and an output folder
- Ask the user for which ratio he wants to check against (e.g. 1.5 if you want a 2:3 ratio)
- Run throug all image files in the input folder, check if the ratio is the requested, and if not, moves files to output folder
All I have to do then, is to crop the files moved to the output folder, to my requested ratio. Actually, the “Image Events” library that I use to check dimensions can also crop, but it does so from the center. I want to control what is cropped myself.
And respect to Apple for giving us such an easy to use yet still powerful tool like AppleScript. I used the AppleScript Editor to write the script, and then noticed how I could just save it as an application. Cool!
Here’s the script:
-- ask for input folder containing images
set theInputFolder to (choose folder with prompt "Pick the folder containing the images to check ratio against") as string
-- ask for output folder to move files that does not fulfill ratio
set theOutputFolder to (choose folder with prompt "Move image files not fulfilling ratio where?" without multiple selections allowed and invisibles) as string
-- check folders are not the same
if theInputFolder is equal to theOutputFolder then
error "Input and output folder may not be the same" number 500
end if
-- ask user for the ratio
display dialog "Enter image ratio" default answer "1.5"
set theRatio to text returned of result as real
tell application "System Events"
set theImageFiles to every file of folder theInputFolder whose name does not start with "." and (file type is "TIFF" or file type is "JPEG" or name extension is "tiff" or name extension is "tif" or name extension is "jpeg" or name extension is "jpg")
end tell
repeat with i from 1 to the count of theImageFiles
set theImgFile to (item i of theImageFiles as alias)
tell application "Image Events"
set theImg to open theImgFile
set theDimensions to dimensions of theImg
set theWidth to item 1 of theDimensions
set theHeight to item 2 of theDimensions
set min to theHeight
set max to theWidth
if (theWidth < theHeight) then
set min to theWidth
set max to theHeight
end if
close theImg
end tell
-- a little rounding
set theImgRatio to (((max / min) * 10) as integer) / 10
if (theImgRatio is not equal to theRatio) then
tell application "Finder"
move theImgFile to theOutputFolder
end tell
end if
end repeat
display dialog "Done" buttons {"OK"} default button 1
October 7, 2009
·
polesen ·
No Comments
Tags: applescript, crop, OSX · Posted in: Operating Systems, Photography, Programming, Tools
What Photography Challenges Can Do To You
Recently, I got inspired by a post on DPS about photography projects to spark ones creativity, and I committed myself to do one self portrait every day for 30 days in a row. Now, only 6 days into my challenge, I can speak for some of the great things following such a challenge do to you and your photography.
Sparks Creativity
Well, that one was kind of obvious, as that was one of the main reasons I started doing it. Nevertheless, it is pretty important.
Okay, I could have gone for a 365 days challenge, but that just seemed too much for me. Anyways, faced with the task of doing 30 self portraits in a row, one has to come up with some ideas. For starters, I have some myself, but what I also did (and do) was to go out there on the net, and see what others have done. Searching flickr for self portraits has proven really helpful, and sparked many ideas to new ways of doing portraits.
Force Learning of Techniques
Even though I have had a DSLR for some years now, it is only within the last copuple of months, that I bought myself a decent tripod. And even then, I haven’t taken that many shots using it yet. Going into self portraits, I am using my tripod for many of the shots. And already now, I feel much more confident using the tripod, setting it up, knowing what it can do and what it cannot, etc.
Another learning experience I am into currently, is setting up flashes. Not long ago, I bough some cheap wireless Cactus triggers and an extra cheap-o Hong-Kong flash. These are really fun to play with. More and more, I am starting to think lighting into my pictures. And that does not only go for the portaits, but for all shots. I acknowledge, that I should have done this long ago, but I haven’t.
Opportunity to Gear Up
We all know it. Photography is a gear sport
and I simply had to buy a wireless remote trigger for this project. Still eagerly awaiting it though, … from Hong-Kong again.
So, if you are into photography, I can only recommend taking up a photography challenge of some sort. You can follow the results of my challenge in my flickr set here.
September 6, 2009
·
polesen ·
No Comments
Posted in: Photography
Dead Easy Informal Restrospectives
Recently, I was introduced to restrospectives by a wise colleague of mine. Something I had heard about, but really not gotten around to using in my software development process yet. After participating, I found the retrospective really useful, hence I thought I would share.
A restrospective in an agile process is the simple idea about “stepping back and looking at the process”. What we did, was take out 30-45 minutes, where:
- the development team meet up
- an outsider acts as facilitator
I like agile processes for software development, but aside from that, I do not care much for a lot of process. I like my time spent on development – designing and writing code. This is also why I liked (and was surprised that) an agile restrospective can be so short and lightweight.
In the retrospective I participated in, I acted as the facilitator. As such, I was not a part of the development team. I had some, albeit little, knowledge of what they were developing, but that turned out to matter less. In short, this is what we did:
- on the morning of the retrospective day, we agreed on time to meet later
- at that time, the team and I met up in a meeting room – pretty much blank and unprepared
- I, the facilitator, started asking questions against the process
- the team answered and discussed back and forth
The whole thing took around 30 minutes. The questions asked were stuff like:
- what went well in the last sprint?
- what did not go that well?
- what to take with us and repeat in coming sprints?
- what to do better in coming sprints?
- …
but the really nice thing is, that having a project-external facilitator proved to be really helpful in the way that:
- He (the external facilitator) will ask the questions, that lies as implicit knowledge in team members, and hence wouldn’t be touched upon. Like, when I asked “how do you do your etimates”, which led to a discussion on diffent ways to do estimation.
- The team being retrospected can get new input from the knowledge of the facilitator – and the other way around, making the facilitator take something with him too (a true win-win)
- The facilitator gets insight into how other projects in the organisation is run and what they do. This is knowledge and project-status sharing while retrospecting.
All in all, I had the fealing that this was helpful. As a consequence of this, I repeated it on a project at a client where I was part of the team, and we brought in another party as facilitator – a developer on another project, but from the same organization.
Some important rules I feel compelled to emphasize:
- Keep the retrospective short (less than 60 min), and
- Come largely unprepared and resist documenting the output.
August 22, 2009
·
polesen ·
No Comments
Tags: agile, retrospective · Posted in: Software Process
Codecs Should Be Patent Free
In the times we currently live in, where the music, video and tele industries are in constant battle with the consumers, trying to make them pay, it should be obvious that patented codecs are a bad thing.
Now, do not get me wrong. I think everybody should pay for what they use. I think pirates are a bad thing. But we need an open solution, that everyone are free to provide implementations of, without the need to buy specs or pay roalties for the use or implementation of a certain codec.
This is also why I think Opera and The Mozilla Foundation are doing the right thing when speaking about which video codec to choose for the open web platform. Of course, either H.264 should be patent free or everybody should team up around an open, patent free codec like Ogg Theora.
If not, consumers will pay. Less products/players to choose from. No free players or encoders. Platform locked features. Etc. For instance, currently I have no way to use the SF Anytime VOD service on my Mac, because they have choosen to tie it to the Windows Media format and player. I understand their choice, given the current availability of DRM solutions around.
If everybody would just team up on an open, patent free codec, like Theora, I am sure there would be viable DRM solutions around too. Solutions that would play on all major platforms, and not just in one specific player on one specific platform. Instead of battling patents with eachother, the major players should battle on providing the best implementation and best products with the coolest features. Stuff that would really give the users a better experience.
August 20, 2009
·
polesen ·
5 Comments
Tags: codec, DRM · Posted in: Uncategorized
Color Coding Source Files
This upcoming feature about color coding file scopes in IntelliJ IDEA Maia looks awfully lot like a plugin idea I and a colleague had once. We had the idea, that different “layers” or “modules” of the source of an application could be color coded differently inside IDEA. This way, one would have a direct visual indication, if one for instance were editing core domain source or maybe some web layer source.
Nice to see JetBrains are thinking some of the same thoughts, considering we never followed through on our own idea way back.
August 20, 2009
·
polesen ·
No Comments
Tags: IDEA · Posted in: Tools
IDEAs Deep Flex-Mojos Support
If you are writing Flex applications using IntelliJ IDEA, you should also choose the Flexmojos maven plugin for building (if you build with maven, that is) and not the other alternatives. Why? Well, for once, it seems to be the best plugin around for flex building, but also because IDEA has deep support for it.
Currently, with the IDEA8, there is some support for importing POMs that use flexmojos. With the upcoming Maia release, this integration is further enhanced.
In this blogpost, JetBrains explains how to import for POM, and there are some good pointers, that I need to remember for my next POM import. Most notably, enabling the generation of a compiler config file, to have the same settings used by IDEA as flexmojos do at compilation.
August 20, 2009
·
polesen ·
No Comments
Tags: flex, flex-mojos, IDEA · Posted in: Tools
Multiple iPhoto Libraries
Just discovered a cool feature of iPhoto (’08) that I did not know about. It can handle multiple iPhoto libraries.
Due to serious color-related limitations on the display of my wifes laptop, she currently imports her pictures onto my Mac. In addition, my oldest child is taking more and more pictures with her camera, all of which also goes onto my Mac. To avoid “polluting” my own iPhoto library, I wanted to create and manage separate libraries.
It turns out, that if you hold down the Option-key (Alt-key) while starting iPhoto, it will popup a dialog with the options to either create a new library or choose an existing one.
Nice!
August 15, 2009
·
polesen ·
3 Comments
Tags: iphoto, mac, OSX · Posted in: Photography, Tools

