Viewing by month: January 2009

The other night I released a few tweaks to the already existing plugin for MangoBlog that does some code formatting and coloring. Being that I was still unhappy with the results I started tweaking. It wasn't long before I ended up with a completly redone color formating plugin. So what started out as tweaks resulted in almost a total rewrite. The changes includes modifications to the plugin parsing logic and the addition of targeted color coding. I'm starting out by targeting HTML, CF, ActionScript and MXML. There is a LOT of room for improvement, but as you can see in my examples below, I think it's very powerful.

In this first release I am supporting ColdFusion and ActionScript and MXML. Average use html and quotes will get styles applied accross the board. In design mode, simply wrap your code output with the followign styles. The nice upgrade with this feature is the ability to add this code directly into the WIZYWIG editor; so in the end I'm also parsing &lt;code&gt;, not just <code>. This results in a MUCH nicer display while editing code. No having to turn off JavaScript to edit your posts. The plugin can be downloaded at the bottom of the page.

  • <code></code>
  • <code class="as3"></code>
  • <code class="coldfusion"></code>
  • <code class="mxml"></code>

ActionSript 3 Example:
[Autowire(bean="EnvironmentVO")]
public var Environment : EnvironmentVO;

public function DownloaderDelagate() {
      Swiz.addEventListener(Swiz.INIT_COMPLETE, onSwizComplete);
}

public function onSwizComplete(event : Event) {
      /*
            Do Stuff With this.Environment Here to Init Class
      */

}

ColdFUsion Example:
<cfset var query = ""/>
<cfset var retVar = structNew() />
<cfquery name="query" datasource="myDsn">
      SELECT *
      FROM dbo.myTable
            LEFT JOIN dbo.table2
                  ON table2.id = myTable.id
      WHERE name = 'joe'
</cfquery>

<cfset retVar.query = query />
<cfreturn retVar />

The Coldfusion parser will actualy parse the <CFQUERY> sql code as well to a small extend giving color definition to [case sensative]: SELECT,FROM,WHERE,ORDER BY,GROUP BY,LEFT JOIN,RIGHT JOIN,INNER JOIN,JOIN,ON,LIKE,BETWEEN,AND,OR.

MXML Code Example:
<mx:Canvas id="wraper" width="100%" height="100%">
      <mx:Image src="«image path>" height="60" width="55"
      <display:CustomComponent id="testing" input="randomStuff" />
</mx:Canvas>


Default Code Example:
<html>
<body style="background-color: white;">
      <div>Hello World</div>
      <p clear="all"><a href="http://www.google.com">This is my example</a></p>
      <form name="form1">
            <input type="text" name="firstName" size="25" />
      </form>
</body>
</htmL>

http://www.mangoblog.org
Download the latest Version of Code Coloring by EmpireGP Services

I love my Blackberry Bold 9000, but I've been very dissapointed with some of the available media players. Media/Streaming players like xPlayer and PocketStreamer have so far done nothing but dissapoint.

Today however I ran accross 2 players I didn't know existed before.

  1. FlyCast delivers music, talk, weather, and traffic to portable devices. Introduced in January 2008, the network has grown very rapidly from 80 channels to well over 1000 in a nine month period, and more channels are added weekly.

    I've listened to about an hours worth of talk radio and I would have to say I'm impressed. I'm often without a radio or the ability to stream audio onto my computer, so this should be a great little app to have while I work. I've tried several other radio streaming apps; all of them were horrible in comparison to my short experience with this product.
  2. Slacker Radio: I can't lie, when I found out that slacker radio had a mobile app that actualy worked on my Blackberry Bold I was almost gitty. The app is clean and easy to use, very professional. I listened to about 3 hours of my Latin & Reggaeton channel with my headphones and I was extremly impressed with the sound quality considering the type of hardware I was listening on.

    There is also a pay to play that will cut out commercials and give you unlimed skips, something I might invest in for the paultry 3.99 a month.

 

I'm on a small Mango Blog kick tonight and decided to make a couple small adjustments to my Site Map Generator.

  1. I've tweaked the settings to only run on page and post creations, removing the onUpdate listeners.
  2. I've also updated the settings page to correctly show the last time the site map was generated from a stored attribute. In an earlier version I was storing this in the site map XML, which was causing a validation issue with the google bot; while I removed the offending code I never addressed the user interface issue.
  3. If you visit the settings page and the site map does not exist, it will be created and then shown to you. It's original behavior was to just tell you that it will be created the next time you make a post.
  4. Lastly I added a generate now link for the controlling personality in all of us.

Download the Latest Version of SiteMap Generator

I've been using Mango Blog for some time [and loving it] but have failed in successfully using the <code> wrappings for displaying my code. While my changes might not suite everyone, I much prefer the new usage and wanted to share.

The biggest change I've made is to the implimentation. While you can still use the true <code> html representative, I was very unhappy with how it effected my editing view. I've added the ability to use &lt;code&gt; wrappings; in other words you can just type the code blocks in the WIZYWIG editor and the colorizor will parse them out. I've also gutted several pieces of functionality that caused the colorizer to format my code in ways I didn't think it should be. Basically write the code as you want it to be displayed!

This did leave one challenge and that was writing this post with all these <code></code> references. So I've also added in the translation of code wrapped in ^^ instead of <> to be converted and not used as display stylings. If you want to gut this little add on, it's one line in the Colorer.cfc (150).

For a code display example, here is my CSS I used to format what you see. The below CSS will keep code from wrapping and display a scroll bar when needed.
#content code {
    display: block;
    width: 568px;
    overflow-x: auto;
    padding: 5px;
    background-color: #dfedfa;
    white-space: nowrap;
    border: 1px solid #666666;
}

Since you most likly have this installed and in use already, to flush the cache, disable and re-enable the plugin once the new code has been uploaded.

Download The Latest Version of Mango Code Color by EGPS Here

I'm working on several new flex apps and using Swiz [by Chris Scott] as my framwork of choice; which BTW I'm absolutly loving. I'm converting one large app that was originally written using Model-Glue-Flex. For those that are not familiar with the framework, Swiz among many things does dependency injection and to me feels very ColdSpring it it's implimentation. Just like ColdSpring You create a file declaring all your beans, and then Autowiring is as simple as:

[Autowire( bean="securityController" )]
public var securityController : SecurityController;

However I ran into some issues last night [motivator for this post] where the Autowiring was not "working". I made the ultra-simplistic mistake of not changing my once private variable, to a public one. While I didn't see it stated anywhere specifically, Autowiring will not work with a private variable [which makes perfect sense after the fact]. The app won't throw any errors, it just won't do anything.

Another mini lesson is that when Swiz is loading the framework the needed autowire parts are not immediatly available. This is because at least to date, injection via constructor arguments (like ColdSpring) is not possible.

Old Code [Model-Glue-Flex]
private var Environment : EnvironmentVO;

public function DownloaderDelagate(Environment : EnvironmentVO) {
      this.Environment = Environment;
      /*
            Do Stuff With this.Environment Here to Init Class
      */

}

New Code [With Swiz]
[Autowire(bean="EnvironmentVO")]
public var Environment : EnvironmentVO;

public function DownloaderDelagate() {
      Swiz.addEventListener(Swiz.INIT_COMPLETE, onSwizComplete);
}

public function onSwizComplete(event : Event) {
      /*
            Do Stuff With this.Environment Here to Init Class
      */

}

Notice my Swiz listener on INIT_COMPLETE; this will fire once Swiz has injected all my object goodness. I can then proceed and init my class as needed.

Brian Kotek has written a couple great posts on using Swiz [1 & 2] and there is also some decent documentation on the Swiz Google Code Site if you want to learn more about Swiz.