contact

Posts Tagged ‘data’

mozconcept – file management in online applications

Monday, August 11th, 2008

More and more web 2.0 applications reach a level of sophistication usually only found in native desktop apps. One of the biggest topics right now is cloud computing and cloud storage. So I got my docs in google docs and I got my pictures in flickr and so on. Many apps by now already offer the possibility to import files from your local computer and some even are capable of taking stuff from other 2.0 web apps. The problem with this development is that each web app offers an API to make use of the data stored with the service. Now that would mean that every web app that wants to allow the user to user data from other web apps would have to implement all the APIs of each of those web apps. It is obvious that this will lead to chaos, poor connectivity and poor performance.

each line represents a API connection between a web service

each line represents a API connection between a web service

A possible solution:

The next generation browser becomes a hub for all this data APIs. The APIs are implemented within the browser and the browser can then provide the data to web apps as if they were either stored locally or via a unified API. Lets take the simple example of pictures. I have a picasaweb account with google and a flickr account. boot use the same type of data – Image Data – but they are not compatible. both flickr und picasa offer the ability to upload local files. If the browser knows this as well he could then take the picture from my picasa account using the given API and then present it to the flickr account as if it was a local file. This is the most simple implementation of this idea.

The dream would be that all Web apps offer an API that fulfills predefined standards for different types of data. If I then have a webapp like google docs or this wordpress blog and I am asked to upload a picture I do not only get to browse my local pictures but also all the pictures from all of my webservices like google and flickr.

each webservice my use their own API for sending data but will recieve data from the browser if it were local

each webservice may use their own API for sending data but will receive data from the browser if it were local

advantages of this concept:

  • so all the APIs only need to be implemented once in the browser and not by every webserice
  • future APIs can be built directly to this framework which will increase connectivity even more
  • the cloud becomes real as it really does not matter any more where the data is stored

Google Analytics data update interval

Friday, January 25th, 2008

I keep track of my blog usage by using google analytics . A very good tool that gives a huge amount of data and very good reporting, but what bothers me is that you always have to wait about a day till the data gets updated. A very simple trick gives instant data updates – simply click on the field where you set the time interval, go to the timeline mode and drag the slider all the way to the right. Your done. the stats should now be up to date.

Screen shot 2009-12-03 at 6.53.22 PM

Using Mysql Data in Flash via php

Sunday, January 20th, 2008

In this post I want to describe a very simple technique I use in order to read Mysql data into flash via a php-dynamically created xml file. So what do you need to get this work:

  • a Mysql Database filled with Data of your choice
  • a php capable webserver, if you dont want to upload everytime for testing try installing xampp as a localhost.
  • Adobe Flash
  • a text editor for writing the php file

Alright lets get started with the php by connection to the database. create a php file called config.php and fill it up with this content


define('MYSQL_HOST',     'localhost');
define('MYSQL_USER',     'user');
define('MYSQL_PASS',     'pass');
define('MYSQL_DATABASE', 'db');

    if(!@mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASS)) {
        die("Connection could not be established");
    }
    if(!mysql_select_db(MYSQL_DATABASE)) {
        die("Error ".mysql_error());
    }
    $sql="SET NAMES 'utf8'";
	$result= mysql_query($sql) or die(mysql_error())</pre>
save the file. now create a file called data.php. There we want to have a function that gets a list of all the columns in our Mysql table and then reads and prints them line by line into a nice xml format which can then be read by flash.
<pre lang="php">include "../config.php";

global $table ;
$table ="your table"; // the name of the table you want to read
table_to_xml(view($table)); // this calls the functions

function get_fields($table){ // this function gives us an Array with all the collumns in the database
	$sql ="SHOW COLUMNS FROM ".$table;
	$result= mysql_query($sql) or die(mysql_error());
	$fields=array();
	while($row=mysql_fetch_assoc($result)){
		array_push($fields,$row);
	}
	return $fields;
}

function view($table){ // this is the actual sql call where we fetch the data from the database
	$sql="SELECT * FROM $table WHERE del != 'true'";
	$result= mysql_query($sql) or die(mysql_error());
	return $result;
}

function table_to_xml($result){ // this function will then print the data in simple xml format using properties with the fieldnames to store the values
	$fields=get_fields($table)
	echo ''; 	while($row=mysql_fetch_assoc($result)){ 			$f=0; 			echo '';	 	} 	echo '';
}

now we are almost done. create a new fla file and enter this code in the first frame.


data_xml:XML=new XML()
data_xml.ignorewhite=true
data_xml.onLoad=function(){ if(success){	 trace(this)} else{ 	trace("an error occured")} }
data_xml.load("http://localhost/yourfolder/data.php") // it is important to include the http://localhost because otherwise the php will not be

and now you are done. If you test the project you should get all your data traced. let me know if this was helpful, or if I have errors in my code.