Randomness Daryl Ducharme Randomness Daryl Ducharme

Adding a ControlBar via Actionscript

For a project I am working on I was using a panel component that had a controlBar. Throughout the project I used something similar several times I decided to make a component that I could extend. Being a glutton for punishment( in this situation at least ), I decided to do it in actionscript instead of MXML. All of the sudden it became very difficult to figure out how to add a ControlBar component to the bottom of a panel. ...

Once the difficulty became apparent and I could not find any other successes online I had 2 choices to make it work quickly. My first choice would be to revert to using MXML for the basis of the component and embed the necessary actionscript in a script tag. My other choice was to not use a ControlBar at all. I chose the third option, be stubborn and figure it out.

The thought kept running through my head that it must be possible, it is ultimately done through actionscript. I tried several things, starting with adding -keep to my compile options and viewing the generated actionscript. In the end the generated actionscript helped me because a comment in the Panel.createComponentsFromDescriptors function didn't jive with it.

The Panel.createComponentsFromDescriptors comment was:

Restore the original document. Otherwise, when we re-add the child when the Panel is a custom component, the child will use the custom component as the document instead of using the document in which the child was declared.

However, the generated actionscript had this line:

mx_internal::_document = this;

So maybe, the CustomPanel.controlBar.document property should be the CustomPanel object itself. So I added that to my control bar initalization function and it worked.

private function initControlBar( ):void
{
var cBar:ControlBar = new ControlBar();
cBar.enabled = true;
cBar.document = this;

// Add stuff to the ControlBar
...

this.addChild( cBar );
}

Just make sure this is the last child in your custom panel when it gets initialized. The Panel code checks the last child to see if it is a ControlBar during initialization.
----
Daryl "Deacon" Ducharme is currently Director of Application Development for the Interactive Agency Provis Media Group, LLC which helps organizations enhance identity, connect with customers and increase productivity.

Read More
Randomness Daryl Ducharme Randomness Daryl Ducharme

A little friday humor with Flight of the Conchords

I have posted in the past about how I am drawn to things that are french. I've also made several posts about language. That is why I find this Flight of the Conchords bit to be hilarious. It makes fun of trying to learn french, or at least the way in which many people are taught it.
...

For those of you who would like a little more, there is plenty to find if you do a google video search. However, here is one I found today that just makes me laugh again and again the more I watch it.

Self edited rap. I especially like the "hydraulics" on the bikes.

I edited the top part of the post so that it would show the video. I used to use the official version from the HBO site, but it has expired. So here is the nice way they show it:)

Read More
Randomness Daryl Ducharme Randomness Daryl Ducharme

Silverlight license

Working for a company that creates content playable in the flash player, I've been interested in seeing what comes of Microsoft's competing Silverlight. As of yet I haven't found any reason to install it. Nothing I have looked at requires silverlight. However today, lifehacker.com had a posting about Tafiti. Tafiti is a new search engine from Microsoft based on Silverlight. Once I went to the website it said

By clicking Get Microsoft Silverlight you accept the Silverlight license agreement.

Since the license was so prominent I decided to click on it. ...

The first thing I noticed as I read was this statement:

INSTALLATION AND USE RIGHTS. You may install and use any number of copies of the software only with the browser and operating system software named above.

If you look, Opera is not one of the software named above. Neither is Safari, yet safari is listed in the Mac license agreement which also doesn't have Opera listed.

The next thing I saw that was pretty humorous, even though it is probably standard, was:

You may not work around any technical limitations in the software;

So when it has limitations ( which all software does ) we should just sit tight and wait for Microsoft to improve it. Somehow I don't think people will follow this, they don't seem to do it anywhere else.

Then in the license came their difference on updating their player.

This software contains an Automatic Update feature that is on by default. Microsoft may change or cancel it at any time. For more information about this feature, see http://go.microsoft.com/fwlink/?LinkId=87026. You may turn off this feature while the software is running (“opt-out”).

Classic Microsoft automatic update type of mechanism. Probably a good thing for many lay people out there who don't want to interact any way with there computer but I find it annoying. I prefer the Flash express update method better, as I can choose to install the update as needed if necessary ( of course I always have the latest player because of work ).

Even though this software is as-is and really doesn't have any sort of guarantee or warranty they let you know that you do have some recourse

You can recover from Microsoft and its suppliers only direct damages up to U.S. $5.00. You cannot recover any other damages, including consequential, lost profits, special, indirect or incidental damages.

That's right, you can get $5.00 in direct damages. That's awesome. You can buy your lawyer a value meal, but you can't super size it.

Anyway, this is the first license agreement I have actually read through in its entirety ( it is pretty short ), and I thought other people might find these things interesting. I'm just wondering if I should live on the edge and attempt to install silverlight in Opera or on a linux system. That's about all the sticking it to the man I think I can come up with ( other than not installing it at all ).

Silverlight Windows license agreement
Silverlight Mac License agreement
Since silverlight does not run on linux there is no linux license.

Read More
Randomness Daryl Ducharme Randomness Daryl Ducharme

htaccess ForceType

I ran into a problem today that I did not think about. For an application I built, the user could upload pictures that would then get uploaded to a certain folder. For a couple of reasons, the filename used was not the original and it no longer contained the filename extension ( in this case jpg ). As I was testing the front end I ran into the problem doing things this way. When you pointed to the file on the server, it was treated like a text document and no image was seen. ...


There are usually many ways to deal with a problem and this one had a couple:

  • I could rewrite the backend so that it put the extension on the end of the filename. But then I would have to change all the currently uploaded files.
  • I could write a PHP script to parse the data and output the proper image type.
  • I could check and see if there was something to be done with htaccess.

The last idea on the list seemed the best. All the images ended up in their very own folder so I could set the rules for anything pulled from that folder. Also, it would require the least amount of changes to my previous code.

In fact it only took one line:
ForceType image/jpeg

And now all the files are processed as jpegs. I have tried this on Opera, Firefox and IE7 on windows and it works. I'll do some more checking tonight on linux but it seems to work quite well.

Read More
Randomness Daryl Ducharme Randomness Daryl Ducharme

Bowling Shoes and Babies

Last month our oldest son went to a birthday party at a bowling alley. Well, actually we all went and our youngest got a kick out of wearing the bowling shoes. Because of the width of his feet we needed them to be a couple sizes larger than the smallest pair available, which were already a bit big. Video of him enjoying his big bowling shoes below. ...

Read More
Randomness Daryl Ducharme Randomness Daryl Ducharme

Flex Builder in Linux

No, Adobe didn't finally port Flex Builder to the Linux platform. However, I did find a post on how to get Flex Builder working in linux. I followed the post and guess what. It worked! Well, it mostly worked. ...

As stated in the post, MXML design view does not work. But the code completion in MXML and Actionscript work great. As the article says, load it into Eclipse 3.2.2, not the current 3.3 ( Europa ). I first tried it with Europa and it would crash, whenever I would try to make a Flex Project. You also need to make sure you are using the Sun JDK. Since Fedora doesn't use it natively I had to download it and set up the eclipse.ini file with the proper path to the Sun JDK. I also had to use the Sun JRE for getting the charting components installed.

Right now it seems to work well enough. It likes to crash when I compile Flex project MXML files but does okay with a basic actionscript project file. I'll have to try it with a larger actionscript project and see if it chokes, or maybe it is just choking on converting the MXML to actionscript.

Hopefully, Adobe will make a linux version of Flex Builder but until then you have to make it work in ways such as this. Now that they have open sourced Flex 3 ( not builder ), perhaps that will make it easier to have a linux native flex builder or a similar open source project. I know that ASDT is planning on having AS3 support and using the Flex 3 SDK, maybe someone can take what they are doing a bit further and make it work with the MXML and a design view.

Link: A follow up post about Flex Buildr on Linux

Just for fun, I changed the Eclipse splash screen as well :)

Read More
Randomness Daryl Ducharme Randomness Daryl Ducharme

Improving Your Vision

No, this post isn't about laser eye surgery. Instead it is about improving your ability to see possibility. In order to do this I'm going to take you along my own recent journeys into training for parkour. Since the philosophies of the art of movement relate so well to the rest of life, let's learn a little bit that we may have just forgotten. ...

When I first came across parkour I looked at moving from point A to point B a little differently. All of the sudden I started to wonder, "How else could I get there". From my initial introduction, I learned to at least look for other ways.

I started to take a look at how to start training for parkour. AmericanParkour.com has a page called "How Do I Get Started" and a section with tutorials on practical movements( members only, but its free ). After reading these I started wondering, how was I going to be able to practice? When would I have time? Where can I go? I was blocked by my current level of vision. I could not see any possibilites, and I was stopped.

I kept going back to the pages and kept re-reading how to get started and the tutorials. I was also reading some good articles. One great that inspired me was "The Beginner's Mind". Watching my children learn everything they know from nothing has always been a pleasure. As we grow up, we stop learning from nothing and start to avoid knowledge we don't already posess. I got inspired to approach this from a child's mind and start from knowing nothing. There is only one place to go from there. All of the sudden things became clear. I shouldn't be able to do anything, I've never trained parkour before. Maybe I should learn to land first ( the same instructions from the "How Do I Get Started" article ). There are lots of places to jump down from.

So one day at work, I used my lunch break to go outside and practice landing. It went well. I was having fun. I got excited, tried a Kong Vault and landed on my hand. Having worked to gain weight as a wrestler, I was just over 230 pounds and most of that weight came down on my hand hard. I don't think I broke it, but it hurt for a couple weeks before I could use it normally again. All of the sudden I was asking my wife to open jars for me :).

That didn't stop me though. I could still practice the basic landing, without using my hand too much. So I did. Eventually, I got bored of landing and stopped practicing. I didn't know how to move on from that point. Once again, I was stopped by my current level of vision. Where was I going to train? When was I going to train?

In the featured articles section of AmericanParkour.com, there are a line of articles called Demon's Drills. These are some great ways of how to improve your physical and mental training towards parkour. They were all inspiring, but The one that got me moving was Muscle Ups and a related follow up Theme Training. Muscle ups were something I thought I could find somewhere to perform, at least a modified version. I started doing a few while playing with my kids at the park, which I am doing more now that I am training. However, I didn't feel I could train it enough to make that much difference. I wished there were some way I could do it at my gym. Well, the universe provided me that wish. I came in one Monday and they had moved some of the equipment around. This forced me to look at workouts just differently enough that I saw an opportunity to do modified muscle ups on the smith machine. This was great because I could start at a lower height that I felt comfortable with and then move the bar as high as it would go. It was a great plyometric workout and my vision improved.

Soon after starting this exercise, I started looking around where I live and work. One day I walked from the gym to work ( which I do from time to time ) and started to see more training possibilities than I had ever seen before. Ledges to do muscle ups and possibly kong vaults ( I still was a bit leary of that ). That day, I took my lunch break outside for some training. As I was moving around doing different muscle ups on the ledges, I ran up to a shorter ledge and popped myself up to the top without even thinking about it! It was almost a Kong Vault, and I believe it was higher than the place I hurt myself before. I was stoked, but my lunch hour was over so I would have to wait.

The next day, my wife needed the car so I would need to walk from the gym to work again. Insead of having her just drop me off at work, I asked her to let me drop my bags off at the office first. Then when I walked to work from the gym I had nothing keeping me from trying out some kongs, wall runs and tic-tacs. My lunch break consisted of this too. This is where I currently am and now I am consciously trying to improve my vision. Now I'm looking for the next obstacle for me to overcome. I've seen new places around work that I didn't even know existed. I'm still a novice and I most likely move slower and do less than many traceurs and traceusses out there, but that doesn't matter. Parkour is more an approach than certain movements, a philosophy to life that is practiced through the art of movement.

Below, I've linked a video put together by Demon of Demon's Drills called Vaults 102. Its a bit more than the basics ( it is a 102 class after all ) and it approaches vaults in an interesting way for improving your ability to overcome obstacles ( vision or ability to see possibility ).
[youtube http://www.youtube.com/watch?v=opUoIXgEdAk]
The good part is at the end, putting it together into a flow. Even more so, the good part is the text at the end of the credits, which you don't see in this version but here is a link to the full .wmv file at AmericanParkour.com.

Read More