Category Archives: Experiment

Nearly achieved my ‘new eve 2007 objective’: Ranking Ahmet keyword on top of Search engines

In that time I was a big fan of SEO and thought that it would be cool to place my first name (Ahmet) in top positions of search engines. When I started I couldn’t even find a reference to my website while searching on Google.com (European server) and there are about 44,700,000 results when searching for Ahmet on Google. I’m now positioned in average at the 15 position, which isn’t bad at all :)

Why do I talk about this? Just because I think it will be harder to go above my actual positioning and I don’t have has much fun in old and traditionnal SEO.
So I am officially ending my (useless) experience about positing the Ahmet Keyword :)

Ahmet [Yes I'll keep on singing my post :) ]

A Chat with FMS 3 coded in ActionScript 3.0

Some days ago I started using FMS (Flash Media Server). Obviously I wanted to write my project in AS3 and realized that they weren’t a lot of documentation on the topic, that why I’ll post here every part of code I made working.

My last project was about creating a chat. I downloaded the demo from FMS2 and tried to update it to AS3, not a big deal, but I’m happy that it works now.

FMS Chat Demo

I didn’t design it in OOP (object oriented programming) as it is only a simple demo, but I think it can be a good start for anybody starting using FMS with AS3.

I wrote 2 files, one .fla for the client and one .asc for the server.

The .asc file

//Fired when the application is loaded on FMS
application.onAppStart = function()
{
	trace(" *** FMS Application Started *** ");
	/**/
	// Get the server shared object 'users_so'
	application.users_so = SharedObject.get("users_so", false);

	// Initialize the history of the text share
	application.history = "Welcome to this chat!n";

	// Initialize the unique user ID
	application.nextId = 0;

}

//Fired when a client connect to the server
application.onConnect = function(newClient, name)
{
	// Make this new client's name the user's name
	newClient.name = name;

	// Create a unique ID for this user while incrementing the
	// application.nextID.
	newClient.id = "u" + application.nextId++;

	// Update the 'users_so' shared object with the user's name
	application.users_so.setProperty(newClient.name, name);

	// Accept the client's connection
 	application.acceptConnection(newClient);

	// Call the client function 'setHistory,' and pass 
	// the initial history
 	newClient.call("setHistory", null, application.history);

	// The client will call this function to get the server
	// to accept the message, add the user's name to it, and
	// send it back out to all connected clients.
	newClient.msgFromClient = function(msg) {
		msg = this.name + ": " + msg + "n";
		for(var i=0; i < application.nextId; i++)
		{
			application.clients[i].call("msgFromSrvr",null, msg);
		}
		application.history += msg;
	}
}

//Fired when a clien disconnect from the server
application.onDisconnect = function(client)
{
	trace("disconnect: " + client.name);
	application.users_so.setProperty(client.name, null);
	application.nextId--;
}

Here we got 3 steps,

  1. application.onAppStart: is called when the application is loaded in FMS, it basically inform us that the application is ready to use.
  2. application.onConnect: is called when a client connect to this application in FMS, here is all the server logic to interact with the client(s).
  3. application.onDisconnect: is called when a client disconnect from the application or when the application is unloaded from FMS

The .fla is only the for UI (user Interface) and for the interaction with the server. If you have trouble understanding what is happening look at this code where I explain how to call functions from server side to client and from client to server.

I know it is not the state of the art in terms of chat but again, this is just a small demo on which complex interaction could be built.

you need to download FMS 3 free developer edition to start having fun with FMS.

Download the source of the FMS Chat

Ahmet

Convincing your Boss to Use AIR – Step #1

AIR LogoIn an over charged world of projects management and ideas, it sometimes hard to gather the attention to the ultimate decider (your boss or yourself) to use new technologies.

I started at the beginning of this week to seed (and water it  ) my boss brain with new possibilities with AIR. Some techniques worked greatly and some did not…

I’ll try to gather all the different move I’ve made (and I’ll make) and let you know what to do and what to avoid ;)

My first step was to present to my boss what our existing technologies could be with AIR, all the advantages of desktop applications, supporting internal database, connections aware and finally demanding very few adjustment to our already existing application to be deployed.

Just told him about the few times involvement and the small budget to allocate and you’ll make a positive point in your argumentations.

The second day, very enthusiast I told him about the easy installation process and the lightweight of the plug-in: bad idea! Technical argument won’t, most of the time, speak to entrepreneurs.

If you are, like me, pushing your boss to shift to AIR, be smart and follow this thread ;=)

Any advices are welcome…

Ahmet

PHP – Dynamic Navigation Class – Stop losing time editing navigation!

I often have to deal with client that want to made some ‘small changes’ in the navigation menu. Put element 2 before element 1 and change the name or the link…

So lazy as I’m, I decided to write (my first) a PHP Class, that should handle a two level navigation. Let me share with you how to use it:

< ?php
	include_once("Navigation.php");//the Class
	include_once('navigation_definition.php');// Array of Nav. Element
	$myNav = new Navigation($a); //Construct Nav.
?>

As you see we need to define a navigation file. This file is an associative array giving a list of information:

  • “key”: link name
  • “class”: the css class name
  • “href”: the URL of the link
  • “parent”: the key of the parent element
< ?php
$a = array(
"Top Level 1"=>array("class"=>"level1", "href"=>"test1.php", "parent"=>"no"),
"Top Level 2"=>array("class"=>"level1", "href"=>"test2.php", "parent"=>"no"),
"Level 2 sub 1"=>array("class"=>"level2", "href"=>"../nav/test3.php", "parent"=>"Top Level 2"),
"Level 2 sub 2"=>array("class"=>"level2", "href"=>"../nav/test4.php", "parent"=>"Top Level 2"),
"Level 2 sub 3"=>array("class"=>"level2", "href"=>"../nav/test5.php", "parent"=>"Top Level 2"),
"Top Level 3"=>array("class"=>"level1", "href"=>"test6.php", "parent"=>"no"),
"Level 3 sub 1"=>array("class"=>"level2", "href"=>"../nav/test7.php", "parent"=>"Top Level 3"),
"Level 3 sub 2"=>array("class"=>"level2", "href"=>"../nav/test8.php", "parent"=>"Top Level 3"),
"Level 3 sub 3"=>array("class"=>"level2", "href"=>"../nav/test9.php", "parent"=>"Top Level 3")
);

?>

Now it’s done, you can see a working example here.
If you like it, download the zip containing the Class, a navigation definition and a CSS file.

This will only work on PHP5 by the way…

Ahmet

Adobe Media Player prerelease

News from the Labs:

This is a prerelease version of Adobe® Media Player™ (AMP) software for Windows and Macintosh platforms. It is being made available for consumers to test the user experience, and for content publishers to test the compatibility of their existing Media RSS feeds with Flash-based video content.


AMP Preview Screenshoot


You will also notice a “badge” that auto-install the AMP (a software running on AIR), which is a really good way to distribute your software on the world wide web :)

Download and install AMP
You will need the latest version of AIR to make it work

Ahmet

Dreamweaver Extension – SWFObject Insertions

SWFObject Dreamweaver Extension
As I use more and more the SWFObject, I took some time to create a Dreamweaver extension that insert the SWFObject Script and the Div with most of the options I ever need with it.
I just tested it on DW CS3, and it worked well as long as you are in design or split mode. It’s not always working in code view for a reason I didn’t understand yet. The resources about building extension on Internet are really rare so it’s hard to code it exactly as I wanted. For example how to use appendChild to create different Tag in different places of the document??

Please test SWFObject Dreamweaver Extension and tell me if it works or not and what I’ve forgot to embed.


Update 0.1.1: Have corrected some minors bug. This version seems to work nicely with DW8 win & mac and DWCS3 win & mac.

Ahmet