Currently Reading

Image of Derivatives Demystified: A Step-by-Step Guide to Forwards, Futures, Swaps and Options (The Wiley Finance Series)

Image of Working Effectively with Legacy Code (Robert C Martin)

Image of Coders at Work: Reflections on the Craft of Programming

Image of Succeeding with Agile: Software Development Using Scrum (Addison-Wesley Signature)

Image of iPhone UK: The Missing Manual

Image of My Shit Life So Far

Recently Read

Image of Beginning iPhone 3 Development: Exploring the iPhone SDK

Image of Cloud Atlas

Image of UML 2 for Dummies

Image of Advanced Actionscript 3 with Design Patterns

Image of Test Driven: TDD and Acceptance TDD for Java Developers

Image of Test Driven Development (The Addison-Wesley Signature Series)

Image of The Secrets of Consulting: A Guide to Giving and Getting Advice Successfully

Image of Clean Code: A Handbook of Agile Software Craftsmanship (Robert C. Martin)

Image of iPhone Advanced Projects (Books for Professionals by Professionals)

Image of Refactoring: Improving the Design of Existing Code (Object Technology Series)


May 15, 2010

1 Million Items to Trash!

Filed under: Flex — Anthony @ 1:11 am

I tried emptying my trash can the other day only to find that i had over One and a half million items in there! after leaving it for the weekend i still had more than a million to delete so i had to resort to the Terminal. And gained myself an extra 10 gig in the process!
1 Million items to trash!

So i thought i would write a quick reminder to myself how to quickly empty the trash can instead of using the Finder tool which takes ages!

>> cd ~/.Trash

>> sudo rm -r *

May 14, 2010

Default Skin for custom FlashBuilder components.

Filed under: Flex — Anthony @ 11:08 pm

In a recent post on Custom FlashBuilder Component Views I showed how to create a swc file with your custom component.
This raised a question by one of the commenters on how to create default custom skins for your components so that when you ship them a user can use your default skins without having to explicitly set them.
Normally you have to do something like this

 
<clock:BinaryClock
   skinClass="co.uk.betadesigns.binaryclock.BinaryClockSkin"
   />
 

Setting up my custom component with my custom skin, however if a user of my component doesn't know that they have to set this style they will get a runtime error something like this

 
Error:
   Skin for
   TestProject.ApplicationSkin2._ApplicationSkin_Group1.
   contentGroup.BinaryClock5
   cannot be found.
 

The way to get around this is to tell the library.swc file that you want to set a default style for your components in case one is not set. This allows you to provide one as well as allowing it to be overridden by anyone that wants to.

All you have to do is create a defaults.css file

 
/* CSS file */
@namespace "co.uk.betadesigns.components.binaryclock.*";
BinaryCounter
{
   skinClass : ClassReference(
   "co.uk.betadesigns.components.binaryclock.BinaryCounterSkin"
   );
}
 
BinaryClock
{
   skinClass : ClassReference(
   "co.uk.betadesigns.components.binaryclock.BinaryClockSkin"
   );
}
 

You need to create this in the top level package of your swc file under ( default package for FlashBuilder or src for Flex3 ).
The First element
@namespace is the namespace to the component you want to reference ( you can include multiple namespaces for multiple components in different packages ).
From this you can see that my BinaryClock is in the package co.uk.betadesigns.components.binaryclock.*
You then setup selectors for all the SkinnableComponents you want to give default skins for.
Next you simply need to include the defaults.css file in the compiler arguments.Properties>Flex Library Build Path>Assets>

Then in the Flex Library Compiler>Additional Compiler Arguments set -defaults-css-url defaults.css This will set the defaults.css file as the default css for all components in the swc

All Done.
Example Project files here. ( Right click save as )

May 6, 2010

Custom FlashBuilder Component Views

Filed under: ActionScript, Components, Flex — Anthony @ 12:34 am

I recently discovered that you can create custom components that can appear under your own company/personal folder inside Flash/Flexbuilder design view. Normally any custom component you create will appear under the Custom folder in the Components View and well thats not very good for branding now is it. In addition you also get an actual size representation of your component in Design view rather than just an empty box outline. For example the first image is the default and the second the custom. (more...)