Tuesday, 7 September 2010

Long time no see

Yeah, sorry about that. Probably it's only a heartbeat on the blog. Not likely that I write any new article in the near future. Although I'd like to inform you, what I'm up to so far.

So, I kinda started to learn Objective C. My first goal is to write a decent iPhone application. Just for fun, for learning the language and getting some experience. I have certain plans, but I don't want to speak about it yet. I've found the official Apple documentation good. But - how to say. It's just too much to dive in for beginners like me. I've bought a quite good book: http://www.amazon.com/Learn-Objective-ndash-Mac/dp/1430218150/ref=sr_1_1?ie=UTF8&s=books&qid=1283887700&sr=8-1 It describes the fundamentals of the language. For me some part seems really weird, like filters and modifiers. But hey, compiler matters, not the syntax. Unfortunately in the last couple of months I also hung that on, but intent to start working with it again.

I did some major refactoring on my Grpahmind app. It was a good experience for me but still can't feel the good level with design patterns. I have to learn a lot. The trick is that you have to know the future capabilities and the current features. I felt sometimes I did overkill with separation. And misused a lot of patterns. One thing for sure, you have to do it again and again.

I was involved quite a lot of Drupal projects as well. I really like it. I'm getting more experience about the actual site-architect part and also about the Drupal-ways. Thanks to my current company and our lead I can work in Brussel now for a month and a half in a huge company. It's a really good experience just seeing how things are going in a different, enterprise environment. You can feel it, you can see it. It's amazing. It's a completely different workflow.

That's it. I'd like to come back with some beneficial articles later, so see you.

Friday, 26 February 2010

Drupal installer script - version 2

Hi Readers,

Last night I felt the need of a new Drupal installer script. My old one (http://itarato.blogspot.com/2009/06/drupal-sandbox-creator-shell-script.html) had some flaws: it used a static preinstalled tarball with a static database dump. My new one use a fresh Drupal 6.15 package and just help to get to the install screen:
echo "> Install Drupal Site - v 0.1"
# Enter the webroot
# Uncompress the latest Drupal tarball
tar -xzf PATHTOTARBALL/drupal-6.15.tar.gz
# Asks for a site name (folder - database in one step)
read -p "> Site name: " site_name
# Rename the web folder
mv drupal-6.15 $site_name
echo "> Site folder is ready"
# Create config files
cd $site_name/sites/default
mkdir files
cp default.settings.php settings.php
# Setting file ownerships
sudo chown WEBSERVERUSER files
sudo chown WEBSERVERUSER settings.php
echo "> Config is ready"
# Creating database
mysql -u root --password=YOURPASSWORD -e "create database $site_name"
# Under OS-X opens a browser with the site's install screen
open http://localhost/$site_name
echo "> Arigato gozai mashi ta!"

Basically you need a Drupal package under: PATHTOTARBALL/drupal-6.15.tar.gz and that's it. Dont't forget to change all the capital letter words to your environment.


Hungarian Drupal Podcast - Episode 8

Hi Readers,

Are you interested in Drupal project management? How to do specification, development and maintenance? Check this out:

In the next episode we have our first (human) guest: Kristof Van Tomme (http://twitter.com/kvantomme) and we will speak about our new Knowledge Management System: http://pronovix.com/solution/alpha-1-knowledge-management-open-atrium-test-it-now


Sunday, 21 February 2010

Hungarian Drupal Podcast - Episode 7

Hi Readers,

Here you are the seventh podcast:

We are basically in a conceptual crisis. We have to decide what we want to talk about. Drupal, web, code or life. This episode is a mutant episode, but we liked it very much.


Wednesday, 6 January 2010

Peer to peer video and audio streaming with Flex

Hi Readers,

This going to be a quick blogpost about how to build a simple video and audio streaming app in Flex. All the fame is for the Adobe Stratus service, and for Tom Krcha, a very great Adobe tech evangelist: http://www.flashrealtime.com/basics-of-p2p-in-flash/ (this is the original article.) Most of my code is from there! Great thanks for your excellent tutorial.

So, first take a look at the Stratus service: http://labs.adobe.com/technologies/stratus/ It allows to your Flash app to create P2P connection between clients. Cool, isn't it?

Our app will open the default camera and microphone streams and transfer to any other client we share our peerID with. I succeeded to open 3 additional connection. That's already two more than Skype allows. Of course, it's not that good.

Ok ok, maybe it's better to try it out: Multivideo.swf
- Allow your camera and microphone to connect
- Share your peerID with your partners using the app (your peerID is in the first text box)
- Add new streams by adding other contacts' peerIDs: copy their peerID into the 2nd textbox and click on [Add contact]
(On some systems sometimes firewall blocks the stream.)

Let's do it than. We need some UIComponent. A base video display and some textbox and a button:
<mx:HBox id="video_stack" top="10" left="10">
<mx:VideoDisplay id="my_video_display" width="320" height="240"/>
<mx:TextInput width="320" id="farPeerId_text" text="Your Peer ID is loading..."/>
<mx:HBox id="add_contact_container" visible="false">
<mx:TextInput id="contact_peer_id_text" width="200"/>
<mx:Button label="Add contact" click="{addContact();}"/>

HBox allows us just pushing the new stream UI elements into the horizontal queue.
Using Stratus we have to register for a Stratus API key. We will get an ID and the url:
private var rtmfpServer:String = 'rtmfp://stratus.adobe.com/cbd2224f9a56771b3d4d05c3-bd9b549abca2';

Than make some vars:
private var nc:NetConnection;
private var sendNS:NetStream;
private var neerPeerID:String;

private var cam:Camera;
private var mic:Microphone;

When the application successfully loaded, we can init our camera, microphone and the net connection for outgoing streams:
private function init():void {

Taking the cam/mic is quite straightforward:
private function initCamera():void {
if (Camera.names.length > 0) {
cam = Camera.getCamera();

if (Microphone.names.length > 0) {
mic = Microphone.getMicrophone();

I said so. Than the net connection to the stratus server through RTMFP protocol:
private function initNetConnection():void {
nc = new NetConnection();
nc.addEventListener(NetStatusEvent.NET_STATUS, netStatusEvent);

When the net connection is ready, we can establish the sending stream:
private function netStatusEvent(event:NetStatusEvent):void {
trace('NetConnection status event (1): ' + event.info.code);
if (event.info.code == 'NetConnection.Connect.Success') {
neerPeerID = nc.nearID;
farPeerId_text.text = neerPeerID;
add_contact_container.visible = true;

This is the point we've got out peerID we can share. wOOt! On setting the provider stream we can attach out camera to the stream. And we can define a client object accepts the connection (return true;):
private function initSendNetStream():void {
sendNS = new NetStream(nc, NetStream.DIRECT_CONNECTIONS);
sendNS.addEventListener(NetStatusEvent.NET_STATUS, netStatusEvent);

var clientObject:Object = new Object();
clientObject.onPeerConnect = function(ns:NetStream):Boolean {return true;}

sendNS.client = clientObject;

So far we have a working camera, microphone, and the stream is already on. Now prepare for accepting others stream:
private function addContact():void {
var nc2:NetConnection = new NetConnection();
nc2.addEventListener(NetStatusEvent.NET_STATUS, function (event:NetStatusEvent):void {
trace('NetConnection status event (2): ' + event.info.code);
var receiveNS:NetStream = new NetStream(nc2, contact_peer_id_text.text);
receiveNS.addEventListener(NetStatusEvent.NET_STATUS, netStatusEvent);

var video:Video = new Video();

var uic:UIComponent = new UIComponent();
uic.width = 320;
uic.height = 240;

contact_peer_id_text.text = '';

When we get a new stream, we create a new video object and add onto the stage.
I know, it's far far basic, but it's good for starting a tool like this.

Download the source code.