var gup = function( name ) {
var results = (new RegExp("[\\?&]"+name+"=([^&#]*)")).exec(window.location.href);
if ( results == null ) {return ""}
else {return results[1]}
};
var toQueryString = function(queryObj) {
var params=[];
for (var property in queryObj){
params.push(property+'='+queryObj[property]);
};
return params.join('&');
};
<?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;
?>
/** *******************************************************************
* 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 );
}
}
}
/** *******************************************************************
* 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 )
{
}
}
}
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