Flex Builder 2 on Eclipse 3.3

15/8/2007

Filed under: Coding, Flex, Eclipse — Ollie @ 11:08 am

WARNING: FlexBuilder 2 running in Eclipse 3.3 is not supported by Adobe. Your mileage may vary, may break, may not work. If it breaks, it’s not my fault :)

As the warning says, officially FlexBuilder 2 is not supported on (nor, in fact, installable into) Eclipse 3.3. And this is a pity, because 3.3 has a loada lovely features, especially if you do Java development.

But… in theory Eclipse tries to perform as much backwards compatibility as possible so it *should* be possible.

Here are my steps to 3.3 nirvana:

  1. Download latest release of FB installer
  2. Download Eclipse Platform 3.2 and decompress to somewhere - referred to as [3.2 Root]
  3. Download Eclipse 3.3 (whatever type, Platform is the basic one) - referred to as [3.3 Root]
  4. Run the FB installer, ensure you choose plugin version and set the Eclipse target directory as [3.2 Root].
  5. Copy startup.jar from [3.2 Root] to [3.3 Root]
  6. Run the FB installer again, ensure you choose plugin version and set the Eclipse target directory as [3.3 Root]. Installer will fail at some point, simply ignore the error and continue.
  7. Open [3.2 Root] in explorer and open [3.3 Root], too
  8. Copy com.adobe.* from [3.2 Root]\features to [3.3 Root]\features (should be 1 folder)
  9. Copy com.adobe.* from [3.2 Root]\plugins to [3.3 Root]\plugins (quite a few folders and around 5 or 6 .jar files
  10. Remove [3.3 Root]\startup.jar
  11. Start Eclipse from [3.3 Root]
  12. Bask in the 3.3 goodness

Notes:

  • If you have 3.2 with FB2 installed, skip the 3.2 installation stuff
  • For teh quick win, you could try skipping the FB2 installation into 3.3. It might work… not tried it though

More warnings

Ok, confession time - it *appears* to work but there a few bugs:

  1. Current line highlight defaults to black. Solution: Window->Preferences, expand General->Editors, in ‘Appearance color options’ select ‘Current line highlight’ , click the color box to it’s right and choose a more pleasing colour!
  2. On a few Eclipse mailing lists there is mention by a member of the Adobe development team that the debugging may not work in 3.3. At first glance this doesn’t seem to be the case… fingers crossed!

Ctrl+Shift+T - Open Type

10/8/2007

Filed under: Coding, Flex, Eclipse — Ollie @ 8:54 am

Following on from my last post about opening resources, I’ve found another little gem hidden away. Once again, the Eclipse JDT provides Ctrl+Shift+T to open a type. Very useful, very nice. The internals of FB in Eclipse are quite familiar to me now, so I thought “hey, why not make my own”. I start looking to see whether the JDT open type dialog is part of the Eclipse IDE core only to find com.adobe.flexbuilder.ui.OpenTypeDialog.

So, Ollie’s Eclipse Tip For The Day ™ is: Ctrl+Shift+T = Open Type

The FlexBuilder open type dialog

For now, I shall not reinvent the wheel. But I’m not keen on the FB Open Type Dialog to display all the available classes, including the stuff from the Flex core as - currently - you can’t open them. Maybe I’ll implement a class viewer or something so you can at least see an overview of the class details if it’s in an SWC. Additionally, the JDT Open Type dialog is ’smart’ and it maintains a list of the types you’ve opened/searched/whatever recently.


Flex/Eclipse tip: As-you-type resource location.

3/8/2007

Filed under: Flex, Eclipse — Ollie @ 9:55 am

There are so many funky features in Eclipse (and in turn FlexBuilder) that it’s hard to know ‘em all. It helps to drop oneself into a pure Eclipse development environment as your colleagues chip in with highly helpful comments.

Todays is: As-you-type resource location. In Eclipse/FB, hit Ctrl+Shift+R (if that doesn’t work, then click here for help finding the key binding). Up pops a lovely window. Do some typing (in the example, I’ve hit the P key) and Eclipse will present you with a list of matching resources. You can use the usual Eclipse wildcards (? = one character wildcard, * = any string). Note that the window will present you with all the resources, including any generated or hidden (excluding such resources such as SVN/CVS artifacts). Once you’ve found the one you want, hit enter. If you’ve a resource with the same name in more than one location (i.e. a HelloWorld.as class in 2 projects or folders) you’ll need to select the appropriate folder from the “In folders” list. Enjoy!

Open Resource Window Screenshot

Discovering the key binding

Not a standard Eclipse key binding set? No worries, here are the steps to finding your resource-locating nirvana:

  1. In Eclipse, go to the ‘Windows’ menu, and then ‘Preferences…’
  2. Expand the noes ‘General’->’Keys’
  3. Select the ‘View’ tab
  4. You’ll be presented with a grid of key bindings. Click the ‘Command’ column header to order by command name
  5. You’re looking for the Open Resource command. Once you’ve found it, you’ll see the current key binding. If you want to change it, edit ‘Edit’ and modify it

Cairngorm, Flex 2 & where to raise events

3/7/2007

Filed under: Coding, Flex — Ollie @ 11:27 am

When developing in Flex 2.0 using the Cairngorm architecture you have a separate event model. Normal Flash events use the display list to propagate, Cairngorm events come from bindings on CairngormEventDispatcher.

So let’s say we have a view and that view is based upon the model (and quite possibly modifies the model directly). Our model consists of a persons collection, our view displays all the people in a list. When the user double clicks on a person we want to save the data to the server.

The view is bound to the model, though not through any direct reference to my TestApplicationModel singleton. The persons collection is databound when the PersonsView is declared in my main application MXML file. So my application MXML file might look like:

<Application>
<testapplicationmodel id="model"/>
<personsview people="{model.people}"/>
</Application>

The tempting thing to do (and this is what my main Cairngorm project uses) is to dispatch a CairngormEvent from within the view. Hey presto it all works and away we go a-coding.

But hold a minute. If we’re dispatching CairngormEvents from within the view, why don’t we bind to the model directly within the view component?

From my point of view, one shouldn’t do that as it introduces an explicit reference to that instance of the model within the view. I can’t take that view and use it elsewhere.

So if I’m not allowing my view components to directly access the model (they used to, but then I realised the issue and stopped)
then really the view components shouldn’t dispatch CairngormEvents.

The solution? Dispatch normal Flash events from within the views. Handle the events elsewhere (for example, in the main application MXML file).

This thought has been proposed elsewhere, so it’s not as if it’s new… it’s just that it’s come as a revelation for me as I try to create a project to muck about with the UI components of a Cairngorm project.


Arrr!, InputStream ye be a scurvy darg!

6/3/2007

Filed under: Random drivel — Ollie @ 10:20 am

The joys of InputStream. Or rather, XML parsing and the dreaded “content not allowed in prolog” error from a SAX Exception.

You have a lovely well-formed XML document such as
< ?xml version="2.0" encoding="UTF-8"?>

From HSQLDB

You give it to a DocumentBuilder and it takes it and complains. Why, you wonder, would it do that to you? It’s in a String, what’s wrong with it? You cut the XML down to simple and still it complains!

The reason? I dunno. I found it’s something to do with the StringInputStream that HSQLDB has. In the end I found some other code that reads XML from a String. It uses ByteArrayInputStream and it works. Grargh. My Java knowledge isn’t good enough to tell me why, but try not to let it get you either.

Remember: when parsing XML from a String, use ByteArrayInputStream.

For example:

public Document parseXml(String input) {
Document doc = null;
try {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
InputStream str = new ByteArrayInputStream(input.getBytes());
doc = builder.parse(str);
}
catch(ParserConfigurationException e) {
System.err.println("Parser config error!");
}
catch(IOException ioException) {
System.err.println("IO Exception while parsing XML");
}
catch(SAXException saxException) {
System.err.println("SAX Exception while parsing XML");
}
return doc;
}


If you wanna cancel an event, handle on the parent, not the target

10/1/2007

Filed under: Coding, Flex — Ollie @ 7:19 pm

Okay, moment of idiocy here. The Flex 2 event model has three phases: capture, at target & bubble (values are in EventPhase so don’t use the numeric values, yeah?).

So let’s say we have the following heirarchy:

Application
  Canvas
    VBox

When an event is raised, say the MouseEvent.CLICK event, on the VBox (so the user clicks the VBox) the event is sent in the capturing phase down the heirarchy to the VBox. So it goes Application, Canvas and then VBox. But not quite. The VBox will apparently never receive the event in the capture phase, only the at target phase (makes sense, but I didn’t see it). The event will then bubble up (if it bubbles, check the events bubbles property) in the bubbles event phase.

So if you want to catch an event and stop it before it bubbles back up then you must listen on the target’s parent and not the target.

The quick way to do this for UI component’s is to register on the parent property of the object. That should mean that it’ll get caught just before it reaches the actual target. So something like:

private function setupCancelEvent(targetToStop : UIComponent) : void {
  targetToStop.parent.addEventListener(MouseEvent.CLICK, stopEvent);
}
	
private static function stopEvent(event : Event) : void {
  trace(\"Event, you're not getting past me!\");
  event.stopImmediatePropagation();
  event.stopPropagation();
  if(event.cancelable) {
    event.preventDefault();
  }
}

That will do it’s upmost to stop that event getting into the bubbling phase. If you really want to stop things happening, then assume that your target’s parentApplication property implements IEventDispatcher and attach the stopEvent event listener to that. That’ll in theory stop the event before it gets sent down the heirarchy.

I’d reccommend leaving the trace in (obviously altering it to something else, more useful) ‘cos otherwise you may never remember that the event is being cancelled and it’ll disappear into the ether!


Yarrrr!

20/9/2006

Filed under: Random drivel, China — Ollie @ 10:46 am
My pirate name is:
Bloody William Bonney

Every pirate lives for something different. For some, it’s the open sea. For others (the masochists), it’s the food. For you, it’s definitely the fighting. You can be a little bit unpredictable, but a pirate’s life is far from full of certainties, so that fits in pretty well. Arr!

Get your own pirate name from piratequiz.com.
part of the fidius.org network


I’m going surfing!

11/9/2006

Filed under: Random drivel — Ollie @ 7:39 pm

One ticket to Bali
Bali ticket!

Note the departure time from Xi’an to Hong Kong: 1420. It’ll only take a couple of hours to get there… and then I have to wait until 1000 the next morning! So I’ll be spending 18 hours in Hong Kong. On the way home I’ll be spending more than 24 hours there! Wheeeee


I’m a DJ, me :)

8/9/2006

Filed under: Random drivel — Ollie @ 12:01 am

So, last week Owen asks me to make a CD or two of music for the radio show that the school does with a local music station. Off we go and have some fun - quite relaxing really, no phone calls, no interviews, no interruptions. The Chinese host, a young lady called Xaviera (probably spelt it wrong), decided that I have a more English accent than Owen, the other Englishman with a good English accent (we think that Owen’s has been corrupted through spending too much time in an office with Craig, who’s Canadian).

Anyways, she asked me to come back to do the radio show (Owen’s buggered off to another city for a few weeks) and bring some more CDs. So I was up until 2am yesterday morning making 4 mix CDs (following a foot massage & dinner with Craig & others) for the show. Then up at 8am to the studio. This time I took some pictures of it so I can prove it!

Anyway, we did 2 or 3 shows and you’ll be able to listen to them in the UK through the magic of the Internet. The show is at 14:00 Chinese time, so that’s currently 07:00 English time (assuming the clocks haven’t gone back yet).

Here’s the link: mms://61.185.214.171/fm931

I’m going to try and record them myself and put them up somewhere so everyone can listen to me! Yay!


Myself in action

2/9/2006

Filed under: Random drivel, China — Ollie @ 10:47 pm




Craig and Ollie

Originally uploaded by scribeoflight.

I don’t often see photos of myself that I’m not posing for or doing something silly, so it was quite nice to see an action shot!


Bat-tastic + I’m a radio star!

30/8/2006

Filed under: Random drivel, China — Ollie @ 9:56 pm

Cropped batty picture

Wheee, what a fun week it’s been.

First off, fun with bats. As you should be able to see from the photo we had a bat in our belfry! I have no idea where it came from, but whooosh, a bat appears. The next 20 minutes were spent dodging the flying rat, I mean, bat, trying to persuade it to leave through some exit. Eventually it flies into the kitchen whereupon I shut the door.

Now what? Well, in I sneak and open the window and out again I go. Thereupon begins the chant “fly through the window, fly through the window”. Unfortunately another bat hears us and flies in the window. Argh! After many more minutes of their inane flying back and forth we eventually notice that they’ve stopped flying. Our assumption is that they’v left the building… We hope.

In other news, I’m going to be on the radio! Sweeet! (I should really stop saying ’sweet’, I sound like an idiot). The school have a deal with one of the local radio stations to do a weekly English radio show. The host of the show is a young Chinese lady with an excellent British accent and a completely unspellable name. Today we needed to do two pre-recorded shows, pretty much just music tracks sellotaped together with a minute or two of talking.

It was quite fun, I didn’t say a huge amount as I was kinda asleep and not really with it. Got into it as time went by, and am going back next week to do some more taped shows. Amusingly the reason I’m going back is that my accent is apparently more British than Owen’s (I don’t believe this, but hey ho) and I’ve been given the task of jotting down any British words that I use so that I can explain them on the next shows.

After that I won’t do it as the host is heading to the UK to Keale Uni! But we’ll be keeping in touch as it appears she’ll continue doing the show back in Blighty.

If I can, and I like how it sounds I may put the show up on the ‘Net for people to listen to - there are some kick-arse songs on it, including “Dancin’ in the Streets”, “Pretty Woman”, “Fix you” - Coldplay, “Pure Shores” - All Saints, etc.) Some oldies and some newies.


PSB spot check

14/8/2006

Filed under: Random drivel, China — Ollie @ 7:04 pm

Excitement today, enough for me to bother blogging it!

The Chinese Public Security Bereau came to school today. The PSB handles “things such as policing, security and social order, but also issues such as residence registration as well as immigration and travel affairs of foreigners” (taken from Wikipedia).

So the appearance of them at Aston was interesting. I’d just finished interviewing a kid and was about to write what I thought about them when Lorna comes over and asks whether I have my passport. The answer, as usual, was no. We aren’t required to have them on us at all times, though it’s obviously advantagous if you do. I did, however, have a scan of the info page which helped me jot some details down.

The funny thing was that they’d brough a sheaf of papers that had information on every teacher at the school. A guy leafed through them and presented me with one saying “Is this you?”.
“Nope.”
“Oh, this is you.”
“Nope”
“Well you look the same as him”
“Okaaaaay”

In the end they left me alone as I had to do some work, but apparently they interviewed one of our new teachers and another teacher, Jane, has to go to the PSB tonight to be interviewed!

Scary! Ah well, fun fun fun.


我是候明泽 - I am Shining Knowledge Monkey!

3/8/2006

Filed under: Random drivel, China — Ollie @ 12:06 am

Yeeehaawwww! I have a Chinese name! Yay!

In pinyin it’s: Hou Ming Ze, all pronounced with an ascending tone (say “I’m going to kill you, OK?”, it’s the tone we used for OK to be a question).

Hou: Monkey
Ming: Bright, shining
Ze: Knowledge, knowledgeable

To be very picky the first character, 侯, is actually a Chinese family name that has something to do with Monkeys.

Now you may be wondering why this name. Well it started last week when my business cards were delivered. The Chinese name that I was given was just a Chinese version of my English name. I was informed that it didn’t sound good, so what was I to do? Pay for more cards? Thankfully it turned out that the printers had mucked up the cards. For my job title they had put “Aston 1 Tupman”. Yay, time to get a proper Chinese name. Oh, and get my job title correct.

So off I go to the lovely front desk ladies telling them what my English name meant. So, starting with my Chinese given name: 明泽(ming-ze), translated as Shining Knowledge - this is because ‘Oliver’ can mean wise, so apparently 明泽 is a good name. They then had some issues deciding on a family name for me, Lisa suggested my Chinese year of birth - the year of the Monkey. This is a good suggestion as there is a family name that sounds the same as the word for monkey (for those that don’t know, Chinese has a fair few words that sound exactly the same but mean different things). The translation of my family name actually means ‘marquis’, a type of nobleman. So maybe I’m a bright, knowledable nobleman? Who knows? Who cares!?!


First day as part-time LSO today!

1/7/2006

Filed under: Random drivel — Ollie @ 12:51 am

Okay, I say ‘today’ because it’s 0051 and I’m still awake. I spent most of thursday (from midnight until 1700 on thursday) in pain due to a nasty stomach bug. I’m still recovering, the biggest problem currently being persistant dehydration (not helped by our water bottle running out and the replacement hasn’t arrived). I’m also still suffering from some random stomach cramps.

Plus the eleventh episode of Doctor Who hasn’t arrived, which realllllly makes me grumpy.

Oh, the good news that I was going to talk about - I start part-time LSO today. Woohoo! More work! Woohoo! Someone remind why I’m doing this? Oh yeah, ‘cos I’m raving looney. I knew there was a reason.

Righto, time for bed with the ususal mantra of "I do want to teach some insane 8 year olds at 8 o’clock. I do want to teach some insane 8 year olds at 8 o’clock. I do, I do, I do…." Repeat until asleep or 8 o’clock comes around.


Dear god, my father is blogging.

28/6/2006

Filed under: Random drivel — Ollie @ 11:32 pm

Now, many parents are about as IT-literate as a fish. Maybe they use them at work, maybe they ‘use’ one at home. They assume they are compentent in using them. Now imagine that your parents are IT professionals (or at least, one is a working IT professional, the other an early retired - lucky/lazy git - IT professional).

And then one of them gets on the Blog-bangwagon. Oh yes, dear old father dearest has started his own blog. If I remember most children are continually embarrassed about their parents, so it can’t be a good thing when they appear on the Internet?

My revenge: he has a photo of himself on his blog… A verrrrrrry old photo. Check this out:

Daddy Dearest years ago!Daddy Dearest now

Of course what could now follow are some embarrassing photos of me when I was teeny weeny child.

Hey ho.

Powered by Qumana


Great pictures of China (Beijing anyways)

Filed under: Random drivel, China — Ollie @ 11:36 am

The BBC have some great pictures of China showing a loada things that we see every day. To us, they’re now commonplace and it’s easy to forget how strange it all looked during the first few weeks.

Enjoy, like I’m enjoying Ice Age 2… in Spanish. Amusingly the Spanish subtitles don’t match the Spanish soundtrack :( Oh well.


Where have all the cheap flights gone?

22/6/2006

Filed under: Random drivel, China — Ollie @ 5:21 pm

Grargh! Today is a bad day. I was once again looking into the price of flights to Bali and lo and behold, they’ve gone! This does not bode well for my trip in October. The cheapest flights I can find so far cost around 6000RMB, which is over a months pay. Doh!

Classes go well. The new adult semester started 3 weeks ago and both I and the students have settled in nicely. The good thing about this batch is that they’re all quite talkative, so not many stay quiet - a very good thing! Of course, the same can’t be said about some of my kiddie classes but you can’t have it all, can you?

Life will get more hectic as of 3rd July when I start part-time as Language Support Officer at school. Not hugely more busy - just an extra 10 - 15 hours on top of my 25 hour teaching contract. O’course the 25 hours doesn’t include lesson planning. Doh! Talking of lesson planning I must remember to murder Laura as she’s planned her entire semester of adult lessons already. Grrrrr!

And talking of school, hello to all of my adult students who may be checking this out! 你好! But you shouldn’t be reading the Chinese, so: hello! Hah, a few lessons ago I was running over some classic quotes from the list of "You know you’re in China if/when…". One of them is "… all foreigners look the same to you.". I was after what the opposite might be, or why it’s different or notable from a Western country. Apple said, "Well, maybe to you all Chinese girls look the same". Now this was kinda what I was after, but what piqued my interest was the reference just to girls. So, stupid me, I asked "why just Chinese girls?".

Her answer: "Because I think you are only interested in the girls in China".

My answer: Silence as the entire class burst out into laughter. ‘Twas a good point and one I can’t deny! (Thank god Laura doesn’t read this :D )

And my final mention in this, the first post in a while, I’ve just randomely been surfing looking for some ideas for a review lesson and I come across this: 99 ways to say ‘very good’ - For those days when you can’t think of what to say. Some excerpts: "SUPER!", "THAT’S IT", "Good remembering." (????) and finally, "That’s a good boy/girl".

Nice.


Is it delicious?

15/6/2006

Filed under: Random drivel, China — Ollie @ 11:52 pm

I was reading the webpage You might be in China if… when I came across this gem:

You know you are in China if…

- you are constantly asked if you think simple foods and beverages are delicious. "This is the best boiled water ever!" "fantastic seeds!"

Amusingly, this one is very true - the Chinese for good food is haochi 好吃 of which the literal translation is "delicious (food)". So my current bugbear during classes is to yell "no, it’s not bloody delicious, alright? We ask ‘is it nice/tasty?’ or simply ‘Do you like it?’". I think they get the idea. Maybe.

Oh, just found another corker (when I should be heading to bed): You’re afraid of toilets. Well this is kind of true. Let’s just say that I’m glad I’m a bloke in China,… no squating down to get close to that lot.

And the last one for the night: apples are the size of pumpkins. Hell yeah! And good, too!

Nighty, night.


A surfing trip to Bali for only £400… can it be real???

6/6/2006

Filed under: Random drivel, China — Ollie @ 10:44 pm

Okay, so here I am in Xi’an, China. Some of the more intelligent of you may have noticed that this isn’t the ideal location for a surfer. So I’m currently planning to have a surfing holiday sometime between September - November. Now for those that don’t know, Bali is a surfer’s paradise. And, until today, Bali was too expensive to fly to. But a very lovely Chinese-based travel website is offering a flight for around £150. This brings Bali down to something like £400 including flights, accommodation and, most importantly, surfboard hire!

Teeeeeemmmmpting!

Powered by Qumana


Chinese lessons again, woohoo!

25/5/2006

Filed under: Random drivel, China — Ollie @ 3:33 pm

Well, after a prolonged break I’ve re-started my 1-to-1 Chinese lessons with my Chinese teacher, Steven. It went well - I didn’t understand everything he said, but I at least remembered to say in Chinese "I don’t understand blahblahblah" and "What is the meaning of blahblahblah"… We chatted about various odds and sods, such as our trip to Pingyao, our mutual friend’s wedding banquet (in fact, Steven is MC’ing it!), and the differences (if any) between giving presents here and in England. Here they give a magic envelope which is simply an envelope with money inside.

Anyways, following the Chinese lesson I treated my self to a coffee at one of the King Coffees kicking about. But I was a good boy and reviewed the stuff I’d learnt and made up 20 or so sentences using the tenses that I know (simple present, simple past & simple future).

What a good boy I am. Not such a good boy that I could be bothered to hang around for the afternoon’s free Chinese lessons though. I need to fix my e-mail as I currently can’t download them and read ‘em on my laptop. I have to read them via webmail, which is a pain in the arse because I get so many spam mails and Thunderbird was filtering nicely. Hey ho.

Zaijian!

Powered by Qumana


Next Page »