Other javascript获取url参数gup

var gup = function( name ) {
    var results = (new RegExp("[\\?&]"+name+"=([^&#]*)")).exec(window.location.href);
    if ( results == null ) {return ""}
    else {return results[1]}
};

Other toQueryString

var toQueryString = function(queryObj) {
    var params=[];
    for (var property in queryObj){
        params.push(property+'='+queryObj[property]);
    };
    return params.join('&');
};

Other jsonHandler

var jsonHandler = makeClass({
    initialize: function(o) {
        // window.funcArray=[];
        this.funcI=0;
        this.o = extendObj({
            callbackKey:'_callback',
            funcPrefix:'jsonHandle'
        },o||{});
    },
    json : function(url,callbackFunc) {
        this.funcI++;
        var name = this.o.funcPrefix+this.funcI;
        window[name]=callbackFunc;
        appendScript(url+'&'+this.o.callbackKey+'='+name);
    }
});

Other makeClass

var makeClass = function(prototypeObj,superClass) {
    var madeClass = function(o) {
        if (o!=false) this.initialize(o);
    };
    if (typeof superClass == 'function') {
        var superClassObj = new superClass(false);
        for(var method in superClassObj)
            prototypeObj[(prototypeObj[method])?'super_'+method:method] = superClassObj[method];
    };
    madeClass.prototype=prototypeObj;
    return madeClass;
};

Other objEval

var objEval = function(template,params,subFunc) {
    var subFunc = subFunc || function() {return ''};
    var match;var compiled = [];
    while (template.length > 0) {
        if (match = template.match(/(^|.|\r|\n)(#\{(.*?)\})/)) {
            compiled.push(template.slice(0, match.index));
            compiled.push(match[1] || '');
            var list = match[3].split(/\.|\[|\]\[|\]\.|\]/);
            if (!list[list.length-1]) list.pop();
            if (typeof params[list]=='function') {
                compiled.push(params[list](list[0]));
            }
            else if (!params[list]) {
                compiled.push(subFunc(list));
            }else if(typeof params[list]!='object'){
                compiled.push(params[list]);
            }
            template = template.slice(match.index + match[0].length);
        } else {
            compiled.push(template), template = '';
        }
    }
    return compiled.join("");
};
var html2el = function(html) {
    var div = document.createElement('div');
    div.innerHTML=html;
    return div.firstChild;
};
var obj2el = function(template,obj,subFunc) {
    return html2el(objEval(template,obj,subFunc))
};

PHP PHP Flex文件下载

<?php
/** ****************************************************************
 * Working File Download XML Server Script for Flex
 *
 * MySnippets
 * Free for use
 *
 * @author  Jonnie Spratley
 * @contact jonniespratley@gmail.com
 ******************************************************************* */
/* Set the content type for the browser */
header("Content-type: text/xml");

/* Establish a connection to database */
$link = mysql_connect('localhost', 'spratley_guest', 'guest') or die('Could not connect: ' . mysql_error());

/* Select the database */
mysql_select_db( 'spratley_tutorials', $link ) or die ( mysql_error() );

/* Build the query for the table */
$query = "SELECT * FROM flex_uploads ORDER BY file_date DESC";

/* Execute the query on the table */
$resultID = mysql_query( $query, $link ) or die( "Data not found." );

/* Set the header xml version */
$xml_output = "<?xml version="1.0"?>n";

/* Set the root node for the xml */
$xml_output .= "<files>n";

/* Loop through all records in the query and output */
for( $x = 0 ; $x < mysql_num_rows( $resultID ) ; $x++ )
{
	/* Result rows */
    $row = mysql_fetch_assoc( $resultID );
    
	/* Set the child node */
    $xml_output .= "t<file>n";
    
	/* Set every node inside the child file node (id) */
    $xml_output .= "tt<id>" . $row['file_id'] . "</id>n";
    
    /* file_name table column */
    $xml_output .= "tt<name>" . $row['file_name'] . "</name>n";
    
    /* file_size table column */
	$xml_output .= "tt<size>" . $row['file_size'] . "</size>n";
	
	/* file_type table column */
	$xml_output .= "tt<type>" . $row['file_type'] . "</type>n";
	
	/* file_url table column */
	$xml_output .= "tt<url>" . $row['file_url'] . "</url>n";
	
	/* file_date table column */
	$xml_output .= "tt<date>" . $row['file_date'] . "</date>n";
    
    /* Close the child file now and print the child file node out */
    $xml_output .= "t</file>n";
    
}/* Ends the loop */

/* Close the parent files node */
$xml_output .= "</files>";

/* Output all of the xml */
echo $xml_output; 

?>

PHP PHP将Recordset映射到VO

	private function mapContact( $recordset )
	{
		require_once( "vo/ContactVO.php" );

		$list = array();

		while( $data = mysql_fetch_array( $recordset ) )
		{
			$contactVO = new ContactVO( $data );

			array_push( $list, $contactVO );
		}
		return $contactVO;
	}

Other Cairngorm代表

/** *******************************************************************
 * MySnippets
 * Free for use
 *
 * @author  Jonnie Spratley
 * @contact jonniespratley@gmail.com
 ******************************************************************* */
package
{
	import com.adobe.cairngorm.business.ServiceLocator;
	
	import flash.utils.ByteArray;
	
	import mx.rpc.AsyncToken;
	import mx.rpc.IResponder;

	/**
	 * The Business Delegate delegates all the responsibility for the
	 * business logic that must locate a service, and then invokes
	 * a method on the service.
	 *
	 */
	public class Delegate
	{
		private var responder:IResponder;
		private var service:Object;

		public function SnipprDelegate( responder:IResponder )
		{
			this.service = ServiceLocator.getInstance().getRemoteObject( "MyService" );
			this.responder = responder;
		}

		/************** ServiceCalls ********************/
		public function getData():void
		{
			var token:AsyncToken = service.getData();
				token.addResponder( responder );
		}		
	}
}

ActionScript 3 Cairngorm价值对象

/** *******************************************************************
 * MySnippets
 * Free for use
 *
 * @author  Jonnie Spratley
 * @contact jonniespratley@gmail.com
 ******************************************************************* */
 package com.jonniespratley.snippr.vo
{	
	[RemoteClass(alias="vo.SnippetVO")]
	
	/**
 	* VOs are used to create a layer of business objects that can be 
 	* transferred between tiers, instead of using records, results sets, and datasets.
 	*/
	[Bindable]
	public class SnippetVO
	{
		public var snippet_id:int;
		public var snippet_title:String;
		public var snippet_code:String;
		public var snippet_type:String;
		public var snippet_created:String;
		public var snippet_user:String;		
		
		/**
		 * Helper function for building the data. 
		 * @param source
		 * 
		 */		
		public function SnippetVO( snip:Object = null )
		{
			
		}
	}
}

Ruby Rails:强制迁移

class CreateCandy < ActiveRecord::Migration
  def self.up
    create_table :candies, :force => true do |t|
      t.string :name
      t.string :type

      t.timestamps
    end
  end

  def self.down
    drop_table :candies
  end
end