Showing posts with label os x. Show all posts
Showing posts with label os x. Show all posts

Saturday, 14 November 2009

FMS in OSX

Hi Readers,

I would like to give you a quick description how to work with FMS (Flash Media Server) under OS-X. Unfortunately FMS server is only available for Windows and Unix. Almost. I tried to fire it up in Ubuntu 9.10, and got a bunch of error messages. I would have killed both of that bastard application. Nevermind. So these were my steps to a working environment:

1 - Install Virtualbox and Windows XP in it
This is an easy step, just make sure you use latest version of VBox.

2 - Run Windows XP, and install FMS
The development version of FMS is free: download Though, you have to have an Adobe account. (1 minutes registration) The installation is straight forward, you can't make a mistake. I suggest you using the built-in Apache if you don't use that guest os for other webserver functions.

3 - Port forward to the guest machine
I'm not a server guy, so maybe it's not the best, but it's working, and that is the point. By default, your guest OS is listening on your localhost (127.0.0.1). But without port forward you can't access to it. We have an Apache (port 80) and the FMS (admin server port: 1111, fms server port: 1935) on our newly installed Windows XP. These 3 ports we have to bind. Open a terminal in OSX, and type these commands:

(change the YOURGUESTMACHINESNAME text to the name of your guest OS - which is the name in the vbox machine list)

VBoxManage setextradata "YOURGUESTMACHINESNAME" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/httpfwd/Protocol" TCP
VBoxManage setextradata "YOURGUESTMACHINESNAME" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/httpfwd/HostPort" 8888
VBoxManage setextradata "YOURGUESTMACHINESNAME" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/httpfwd/GuestPort" 80

VBoxManage setextradata "YOURGUESTMACHINESNAME" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/fmsadmin/Protocol" TCP
VBoxManage setextradata "YOURGUESTMACHINESNAME" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/fmsadmin/HostPort" 8889
VBoxManage setextradata "YOURGUESTMACHINESNAME" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/fmsadmin/GuestPort" 1111

VBoxManage setextradata "YOURGUESTMACHINESNAME" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/fms/Protocol" TCP
VBoxManage setextradata "YOURGUESTMACHINESNAME" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/fms/HostPort" 8890
VBoxManage setextradata "YOURGUESTMACHINESNAME" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/fms/GuestPort" 1935

(more about these settings in the virtualbox's UserManual.pdf)

Now you have to restart your guest OS. Settings above allows you to access to your guest OS, for example for port 80 type http://localhost:8888 into your browser in OS-X. You should see the FMS server start page with a video (train). If you don't see, there is something I missed or is wrong.
And one more step, you have to turn of the firewall in Windows. (Sorry but I haven't found a better way.)

4 - Create a sample Flash / Flex project on the client side (host OS)

It doesn't really matter which one you use. Here you are my working actionscript code:

public var nc:NetConnection = new NetConnection();

public function connect():void {
var r:Responder = new Responder(responderResult, responderStatus);

nc.connect('rtmp://localhost:8890/HelloWorld');
nc.call('serverHelloMsg', r, "John Doe");
}

public function responderResult(result:Object):void {
trace('Result came: ' + result.toString());
}

public function responderStatus(status:Object):void {
trace('Status update');
}

5 - create the server side code (in the guest OS)

The server side parts has to be written in ActionScript 1.0. (Pretty weird.) I just pasted the sample from the tutorial:

application.onConnect = function(client) {

client.serverHelloMsg = function(text) {
return "Welcome: " + text;
}

application.acceptConnection(client);

}

Copy it into: C:\Program Files\Adobe\Flash Media Server 3.5\applications\HelloWorld\HelloWorld.asc.

6 - Start FMS server in the guest OS
In Start Menu you can find an icon that starts the FMS server.

7 - Test you application
And be patient if it won't work at the first try.

Of course, these stuffs are all available in the documentations.
Flash Media Server: get all the official documentations
Great FMS service tool for your host OS: FMS Feature Explorer

Best wishes,
Peter

Monday, 22 June 2009

OS X + PHP Part 2

Hi Readers,

As I promised, this my second explanation about how to build a PHP web development environment in OS X (10.5).
As I mentioned a very basic configuration ships with the distro by default. But for me it was not enough. Going further from my last setup (http://itarato.blogspot.com/2009/06/first-macbook-webdeveloper-enviroment.html) I noticed there isn't APC for PHP. No GD2 support (neither GD1). I depressed till found this miracle: http://www.entropy.ch/software/macosx/php/
Marc Liyanage compiled a very good PHP 5.2.9 with a lot of modules. If you step through his description you can install it quite easily. At the end you get a new php.ini. You need to add your previous xdebug settings to it. For APC see this article: http://discussions.apple.com/thread.jspa?threadID=1578979. As it turned out, the pecl related APC is wrong on OS X, but the original APC compilation will work.
Lately my favorite high end IDE is the stable NetBeans (6.7 RC3 has a StackOverflow for me). For PHP it works out of the box but for any Java related project I had to change the default java classpath: http://statistics.netbeans.org/analytics/detail.do?id=150231

In a nutshell thats all about it. The MySQL and Apache server works as I wrote before. By the way just for play I tried the free MAMP application, but I found it a little bit old for my claims. It has a pretty cool minimalistoc control interface, works fine but doesn't contain some imprtant module. To be honest I was't bother with it so much. (My bad.)

One thing. Last week I began to use NetBeans for debugging PHP projects. The reason I didn't use it for debug I didn't know how I can examine pages other than index.php. But as a matter of fact if it starts and finish it's first debug run you can enter any subpage into the browser (the same has the xdebug session) and the debug cycle will start again. So its really cool. There is a big advantage against ViM+XDebug, I like more NetBeans's variable browser. In ViM you are restricted to the php xdebug config (ex maximum variable nested level) and the limited height of the editor. But sake of NB's tree visualizaton you can traverse arrays and objects quite convenient.
(Other tiny minus sign for osx - the default key bindings messes the F2..F6 key usages in vim.)

Thats it. Any webdev environment related question would be welcomed:)

Bye,
Peter

Saturday, 13 June 2009

First Macbook - webdeveloper enviroment

Hi Readers,

This week I've got my first Macbook. I don't want to say any advertisement for the machine. Apple already has a very ugly campaign, just check www.apple.com and watch some commercial. Anyway. I love it even if it's so hard to setup.
Some quick steps, how you can setup a minimal web developer environment if you've never seen OS X.
  1. OS - by default
  2. Apache (2.2) - Enable it in System preferences / Sharing (Web) [http://www.procata.com/blog/archives/2007/10/28/working-with-php-5-in-mac-os-x-105/]
  3. Apache rewrite - overwrite appropriate line in httpd.conf to: AllowOverride All
  4. PHP - by default
  5. MySQL - download the official 5.06 version package (install both two dmg-s), and link the /tmp/mysql.sock to /var/mysql/mysql.sock
  6. MySQL - if mysql doesn't allow to get in, you have to hack an account [http://www.linuxquestions.org/linux/answers/Security/MySQL_root_password_recovey]
  7. XDebug : download macvim, xdebug plugin for vim and compile the xdebug extension [http://www.chrissearle.org/blog/technical/running_xdebug_204_osx_leopard_apachephp]
Important paths / files:
  • /etc/php.ini
  • /etc/apache2/httpd.conf
  • /etc/apache2/users/youruser.conf
  • /private/etc/... [almost the same as in /etc]
  • apachectl restart/start/stop
  • /usr/local/mysql/bin/mysql
  • /Library/StartupItems/MySQLCOM/MySQLCOM start/stop/restart
It just an overview, it's highly suggested to read some external materials. My intention was giving a small insight what you should expect. For me (as a first-time macer) was kinda hard to setup the basic stuffs. Of course there are easier ways. If you want to find some seamless solution, just check out these projects: MAMP, Fink.

I want to write about my other experiences about the mac, but for now there are tons of works to do, so back to mac.

Night!