Linux Mint & Flex

0

I recently moved over to Linux Mint. Their catch-phrase is “from freedom came elegance” and it rings so true.

Linux Mint is one of the surprise packages of the past year. Originally launched as a variant of Ubuntu with integrated media codecs, it has now developed into one of the most user-friendly distributions on the market – complete with a custom desktop and menus, several unique configuration tools, a web-based package installation interface, and a number of different editions. Perhaps most importantly, this is one project where the developers and users are in constant interaction, resulting in dramatic, user-driven improvements with every new release.

The truth be told – i’m a bit of a n00b when it comes to Linux, but wow… What an OS. You can download the OS here, then simply write it to disk and restart your PC and boot from the installer disk. Mint can be run from the disk, which is quite a cool feature (available on a few other Linux distros i’m told – such as Ubuntu)

My main line of work – and my passion – is developing Flex applications, and as a consequence, i need to be able to develop Flex apps from Linux. The incredible folks over at Adobe have released the fourth public alpha release of Flex Builder for Linux. Being an alpha version, it does not have all the features we’re accustomed to in the Windows or Mac incarnations, and you’ll need to install Eclipse Europa 3.3.2 for it to work (Flex Builder only comes as a plugin at this point). The main missing features are:

  • Design view
  • States view
  • Refactoring
  • Data Wizards
  • Cold Fusion – Data Services Wizard
  • Web Services introspection
  • Profiler

However, the features that are present are more than enough to develop Flex/AIR applications, and if you can’t build Flex apps without design view, you suck :P .

Please note: The Flex Builder plugin will NOT work with Eclipse Ganymede (3.4.x). The plugin will install just fine, but the MXML editor will not work. There has been much discussion about it on the bugs.adobe.com site, but no solution has been found as of yet.

The installation of Flex Builder for Linux is quite simple. Follow these instructions:

  1. Download Eclipse Europa 3.3.2 to your desktop. Open the terminal and extract the archive to wherever you like.
  2. Download the Flex Builder for Linux plugin to your desktop. Open the terminal, direct the terminal to your desktop and enter the following:

    sudo sh flexbuilder_linux_install_a4_081408.bin

  3. Follow the installer’s instructions and install the plugin. Please be sure that the directory you’re installing the plugin to is the correct Eclipse directory.
  4. The plugin will now be installed to your Eclipse install. Go to your eclipse folder and run the main application. Click on the Window menu and select Open Perspective. Click Other and search for Flex. From here you can open your Flex Development perspective and start developing Flex applications :D !

Great! So now you have installed the Flex Builder for Linux plugin. Unlike the Windows/Mac versions, you will have 311 days or something like that to test the application. If you are a student, you can apply for a free Flex license here. I’ve used my student license on both my Windows and Linux versions and it works fine.

Integrating Flex, AMFPHP and CodeIgniter (also including Value-Objects)

23

Yesterday i recorded a video tutorial on integrating Flex, AMFPHP and CodeIgniter. This tutorial will walk you through each step of the process. If you have any questions, please post them as comments and i’ll answer them as best i can. (more…)

An incredibly funny post

0

http://www.aegisub.net/2008/12/if-programming-languages-were-religions.html

If only he’d included ActionScript… what would you have likened it to religion-wise? I’d say… Secular Spirituality… All of the incredible, universal truths (familiar syntax), with amazing support for media (visual and auditory hallucinations) and no fussy bullshit about gods (the ending semi-colon) :P

Drupal Administration Module

1

I’ve recently started playing around with Drupal, one of the best CMSs in my opinion due to its incredible extensibility, easy-to-use administration interface and its impressively large and helpful community.

If you’ve used Drupal before, you’ll no doubt identify with my ballache: the administration interface is somewhat difficult to navigate. There is a module available to aid you in your site’s administration:

Administration Menu module

Download it, unpack it your modules directory and you should see something like this:

Now, i don’t know about you, but 9px for a font size is just a little too small for my liking (since i can barely see a fucking thing!) If you go into the folder of your module on your server, you’ll find the admin_menu.css file. You’ll see the first line of uncommented code is a CSS ID selector called #admin-menu. I made two adjustments to this selector. Firstly, i changed the position to fixed as opposed to absolute (which will force the menu to stick to the top of the page) and i changed the font size from 9px to 13px.

Once i did this, the administration menu module was to my liking… Hope you find these changes helpful too.

Setting up email on localhost with PHP + PostCast Server

8

I recently had a great ballache with trying to test emails from my local machine. Testing emails is painful enough when it fucking works, nevermind when it doesn’t! I’d been putting off setting my system up for weeks but tonight i finally decided to give it a proper bash… And it worked!

This is how i did it… In 3 easy steps!

Step 1 – Configure your PHP to allow for SMTP connections

Firstly, you need to edit your php.ini file found in the php folder of your local server. I personally use XAMPP because it’s everything i need in a web server. XAMPP now has versions for Windows, Mac and Linux, so nobody has an excuse not to use it now.

In your PHP config file (php.ini), if you do a search for SMTP, you will find the following code:

[mail function]
; For Win32 only.
;SMTP = localhost
;smtp_port = 25

All you need to do is uncomment the last two lines (take out the semi-colons).

Step 2 – Download, install and configure PostCast Mail Server

PostCast Mail Server is a great, simple to use application that will allow you to send email from your local machine. Download and install the application. Once installed, go to Tools->Settings, and set your host name to localhost with a server port of 25. Once you’ve done that, you’re almost ready to go!

Step 3 – Send a mail

Create a file on your server called testmail.php and use the following code:

$headers = “From:me@someaddress.com\r\n”.
“To:me@myaddress.com\r\n”.
“MIME-Version: 1.0\r\n” .
“Content-Type: multipart/mixed;\r\n”;

mail(“me@myaddress”,”PHP mail test”,”www.ria-coder.com/blog”, $headers);
?>

And you’re done!

A few Tree tricks

0

The tree control in Flex is a very complex and somewhat complicated component at first glance, but with further inspection the complexity begins to melt away.

A few ballaches i have had when using Trees are:

  • Automatic horizontal and vertical scrolling
  • Static use of leaf and node icons
  • Dynamic use of leaf and node icons
  • Item event handling

Ballache 1 – Automatic horizontal and vertical scrolling

At first i thought that the Tree control’s lack of horizontal and vertical scrollbars – when content grew to beyond the component’s bounds – was a bug. Then i scolded myself for such heresy. The Flex developers would never leave such a common feature out or release a fucked up version of it. So i did a little research and found this post: http://frishy.blogspot.com/2007/09/autoscrolling-for-flex-tree.html.

Ryan offers a great hack that works almost perfectly, besides for the fact that the labelField gets screwed up and sometimes the text is snipped off a little at the end. At the bottom of the page is a solution:

change maxHorizontalScrollPosition = NaN;

to maxHorizontalScrollPosition = 0;

change maxHorizontalScrollPosition = diffWidth;
to maxHorizontalScrollPosition = diffWidth + 10; …or what ever correction factor you need.

The user-submitted fix in combination with Ryan’s sub-classed AuoSizeTree file will allow you to have the horizontal and vertical scrollbars on “auto” mode.

Ballache 2 – Static use of leaf and node icons

This one is a sinch. All you have to do is use the folderOpenIcon and folderClosedIcon properties of your Tree and embed an image that will act as an icon. Same thing goes for leaves: defaultLeafIcon.

Ballache 3 – Dynamic use of leaf and node icons

This one is a bit more tricky. What you have to do here is define a “class” that will refer to an embedded icon:

[Embed(source='myIcon.png')]

private var myIcons:Class;

You can now use this icon as so (considering that you set the icon property of your Tree component to “@icon”):

treeDataProvider.appendChild(XML(“<testLeaf icon=\”” + getQualifiedClassName(“myIcon”) + \”” label=\”hello\”></testLeaf>));

What this will do is add a child to your Tree’s dataProvider and get the class’ qualified class name and use that as the icon in your leaf.

Ballache 4 – Item event handling

Want to handle click events for your Tree nodes/leaves? No problem! Set the itemClick property of your Tree to execute a function (clickHandler in this instance). When you click an item in a Tree control, it will call a function and pass it an event object of type ListEvent.

private function clickHandler(event:ListEvent):void

{

trace(event.currentTarget.selectedItem);

}

In the example above, the function is finding the selected item in your Tree control and tracing it out. If you’re using XML to define your Tree’s model, it will return an XML object which you can then type as XML. It’s really that simple!

Hope i’ve saved you a ballache or four ;)

Flex 3.2, AIR 1.5, Flash Player 10

0

Yesterday, Flex 3.2 was released, along with AIR 1.5 and numerous bug fixes to Flex Builder IDE and the data visualisation component architecture.

Click here to see Matt Chotin’s article which contains all the links for these goodies :)

Adobe AIR 1.5 Released!

0

The latest incremental release of the Adobe Integrated Runtime has been released! This is very exciting news… There have been numerous bug-fixes, the integration of SquirrelFish for a ridiculously fast WebKit HTML/JS engine. Go here to see the other changes.

A tip on using the Image component in Flex

0

At some time in the future – if you’re using the <mx:Image> component in Flex – you will need to listen for an event that will signal the load completion of an image’s source. The Event.COMPLETE function doesn’t work, so you’ll have to use the FlexEvent.UPDATE_COMPLETE function. This will do exactly the same thing as using the Loader class, and using the following code: loader.contentLoaderInfo.addEventListener(Event.COMPLETE…).

Best Development Fonts

0

I’m a very visual programmer. I like my applications to look decent before i start coding the underlying logic. In that same vein, i also like the font i’m developing with to look good.

While trolling the net today, i found this page: http://www.codeproject.com/KB/work/FontSurvey.aspx. Check it out. There are some very nice fonts there.

My two top fonts for development are:

Consolas and Monaco (the TextMate font – this is available for Windows too).

Go to Top

ria-coder.com is Stephen Fry proof thanks to caching by WP Super Cache