Archive for the ‘Uncategorized’ Category

Animation & data

Tuesday, July 20th, 2010

현재 내가 크게 인식하는 형태는 이런듯.

시각 개체를 이루는 각각의 단계에서 데이터가 직접적으로 관여하고 있는점도 모든걸 어지럽게 만들지만, 이들간의 이벤트를 교환하는 부분도 상당히 버겁다. 가장 큰 이유는 양이 많기때문.

재사용과 클래스의 독립성을 위해 Factory 패턴으로 부분 부분 시도해 보고 있는데, interface 와 creater 를 상황에 맞게 적절하게 적용하기가 힘들다. 추상적인 부분에서는 합의를 볼 수 있겠지만 실제적으로 사용하는데는 무리가 따르는데다 양적으로 지나치달지. 실력이 부족한 탓이겠지만, 지금쯤이면 어느정도 내가 찾는 해법의 가능성은 보여줘야 할 맛이 나는게 아닐까. 결국은 하나 하나 노가다로 해결을 봐야하는 건가.

다만 계속 드는 생각은 구성요소의 기본적인 속성들을 체계적으로 잘 정리해 두고 개념을 잘 정립해 둘 필요가 있는 것 같다.

General Practical Process of Sangpil’s Product

Wednesday, June 23rd, 2010

계획(Planning) -> 작업(Work) -> 검증(Verifing)

보통 작업 시작 전에 확실했으면 하는 것들은 다음과 같다.

  1. 이것의 목적이 뭐냐 : S
  2. 어떤 방법을 쓸거냐 : P1
  3. 이에 들어가는 구성요소 뭐냐 : P2
  4. 구체적으로 어떻게 할거냐 : p3

작업 진행 중 항상 듣는 질문은 다음과 같다.

  1. 언제까지 할 수 있나 : Total Play Time
  2. 어디까지 했나 : Current Time Marker
  3. 지금 뭐하나 : P

작업이 끝난 뒤 검토하는 것들은 보통 다음과 같다.

  1. 잘 작동하나 : V1
  2. 잘 연동 되는가 : V2
  3. 쓸만하나 : V3

이를 간단히 도식화 해보니 아래와 같다.

추상적인 과정들은 파란색으로, 실질적인 작업은 녹색으로 해 두었는데, P 부분은 Total Play Time 안에 있는 요소라고 봐야할 듯 하다. 다시 그려야 할듯. 어쨌거나, 논리적인 계획 및 검증 과정이 진행됨에 따라 실제 작업 시간이 영향을 받는다. 그리고 Process(P)단계는 이 전체구조를 하위 구조에 복제하여 끝없이 반복될 수 있다. 사실 전체 시간이란 시계에서 표시되는 것 과 같이 절대적인 시간으로서 프로잭트에 들어가는 시간 외에 다른 요소들, 밥먹는 것이나, 수면시간 등등을 모두 포함한 완전한 시간의 개념이다. 즉 주제에 의해 엮이는 시간이 아니다. (이같은 관점 : 일년은 365일, 하루는 24시간, 1분은 60초.) 따라서 실생활에서 쓰이는 시간에 따라 한 프로잭트에 들어가는 계획 과정에 영향을 준다라고 막연하게 잡아본다. 엉성한 스케치지만 계속 관찰해 봐야지.

Flowchart

Wednesday, May 19th, 2010

FlowChart

Type of flowchart.

  • Document flowchart.
  • Data flowchart
  • System flowchart
  • Program flowchart

The Universal Turing Machine.

Friday, May 7th, 2010

Its diagram looks suspiciously like a film projector. Is this a coincidence? <...> If we believe the word cinematograph, which means “writing movement,” the essence of cinema is recording and storing visible data in a material form. A film camera records data on film; a film projector reads it off. This cinematic apparatus is similar to a computer in one key respect: a computer’s program and data also have to be stored in some medium. This is why the Universal Turing Machine looks like a film projector. – Manovich, The Language of New Media. p47

Class (computer science)

Sunday, March 14th, 2010

From Wikipedia, the free encyclopedia http://en.wikipedia.org/wiki/Class_(computer_science)

In object-oriented programming, a class is a construct that is used as a blueprint (or template) to create objects of that class. This blueprint describes the state and behavior that the objects of the class all share. An object of a given class is called an instance of the class. The class that contains (and was used to create) that instance can be considered as the type of that object, e.g. an object instance of the “Fruit” class would be of the type “Fruit”.
A class usually represents a noun, such as a person, place or (possibly quite abstract) thing – it is a model of a concept within a computer program. Fundamentally, it encapsulates the state and behavior of the concept it represents. It encapsulates state through data placeholders called attributes (or member variables or instance variables); it encapsulates behavior through reusable sections of code called methods.
More technically, a class is a cohesive package that consists of a particular kind of metadata. A class has both an interface and a structure. The interface describes how to interact with the class and its instances with methods, while the structure describes how the data is partitioned into attributes within an instance. A class may also have a representation (metaobject) at run time, which provides run time support for manipulating the class-related metadata. In object-oriented design, a class is the most specific type of an object in relation to a specific layer.

In object-oriented programming, a class is a construct that is used as a blueprint (or template) to create objects of that class. This blueprint describes the state and behavior that the objects of the class all share. An object of a given class is called an instance of the class. The class that contains (and was used to create) that instance can be considered as the type of that object, e.g. an object instance of the “Fruit” class would be of the type “Fruit”.A class usually represents a noun, such as a person, place or (possibly quite abstract) thing – it is a model of a concept within a computer program. Fundamentally, it encapsulates the state and behavior of the concept it represents. It encapsulates state through data placeholders called attributes (or member variables or instance variables); it encapsulates behavior through reusable sections of code called methods.More technically, a class is a cohesive package that consists of a particular kind of metadata. A class has both an interface and a structure. The interface describes how to interact with the class and its instances with methods, while the structure describes how the data is partitioned into attributes within an instance. A class may also have a representation (metaobject) at run time, which provides run time support for manipulating the class-related metadata. In object-oriented design, a class is the most specific type of an object in relation to a specific layer.

Preparation for Super Map Service – in progress

Sunday, March 14th, 2010

- static class : communication with PHP, MySql > checked
- event : temporary events > checked
- class : post classes : read, write, edit, delete, reply. > checked
- class : communication with html/javascript > checked
- class : Image Loader
- class : file uploader
- class : loader
- class : layout
- class : stamp

actors

- static class : Master infoStick  > checked
- static class : SubItem infoStick : > checked
- static class : service type > checked

Using …args as parameter for function to send data to amfPHP.

Friday, March 12th, 2010

오늘 amfPHP에 NetConnection의 call 메서드로 변수를 보낼 때, 이를 좀더 편리하게 쓰기 위해 별도의 클래스를 만들기로 했었다. 이 클래스에서는 파라미터를 …args로 받아들여와 그대로 amfPHP로 보내고 싶었는데 이게 계속 애러가 났다. 반나절을 헤매다가 좀더 알아보니 NetConnection.call 메서드로 보내는 args(arguments)를 Actionscript에서는 하나의 파라미터로 인식해서 보내기 때문에 애러가 난다는 것이였다.

해결법으로 찾은 것은 Function 변수를 하나 만들어서 NetConnection의 call function 을 대입시켜준 뒤, 아래 코드와 같이 서비스클래스의 이름, Respond class 변수, arrgs에서 넘어온 녀석들을 차례대로 Array에 넣어준 다음 이를 Function.apply 메서드를 써서 변형시켜 적용하는 것으로 우선 결론을 내렸다. 이런식으로 문제를 해결하는 방법이 있음에 신기하달지… 참고로 처음에 시도했던 형태가 현재 마지막 부분에 주석처리 되어있는 _nc.call부분이다. 이렇게 데이터를 보내면 애러가 난다.

public function insertSqlData(serviceName:String, ...args:*):void
		{
			trace("------------------service name : ", serviceName);
			_serviceName = serviceName;
 
			_nc.connect(_gatewayPath);
 
			var reargs:Array = new Array;
			reargs.push(_serviceName);
			reargs.push(_res);
 
			  for(var i:uint = 0; i < args.length; i++)
			{
 
				//args[i] = String(args[i] as Object);
				 if(args[i] is Number)
				{
					trace(i, " is Number = ", args[i]);
					args[i] = String(args[i]);
				}else if(args[i] is String)
				{
					trace(i, " is String = ", args[i]);
				}
				reargs.push(args[i]); 
			} 
			var callFunction:Function = _nc.call;
			callFunction.apply(_nc, reargs);
			//_nc.call(_serviceName, _res, args);
		}

Related Links.
Daniel Eneström’s blog
ActionScript 3.0 References : flash_10, flash_9

AMFPHP(Flash Remoting for PHP)

Monday, March 8th, 2010
  • AMF allows for binary serialization of Action Script (AS2, AS3) native types and objects to be sent to server side services.
  • The fastest way to send and receive data between a Flash movie and a web server.
  • Much faster than using XML when largeamounts of data are involved.
  • Used by a Flash player for things like Shared Object, ByteArray, and LocalConnection.

gotoAndLearn() Introduction to AMFPHP: Part 1
gotoAndLearn() Introduction to AMFPHP: Part 2

1. Usually, custom php files have to be located in /amfphp/services.
2. You can access amfphp browser on amfphp/browser and simply test what you have added in the services folder.

Example 1. Send an Email.

Email.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php
class Email
{
	/**
	* This service sends an email
	* @returns true or false
	*/
	function send($to, $subject, $message)
	{
		return mail($to, $subject, $message);
	}
} // END class 
 
?>

ActionScript Code : SuperW_Map_Service.as

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package {
	import flash.display.Sprite;
	import flash.net.*;
 
	public class SuperW_Map_Service extends Sprite
	{
		private var _gw:NetConnection;
		private var _res:Responder;
		public function SuperW_Map_Service()
		{
			trace('test');
			_gw = new NetConnection();
			_gw.connect("http://sangpil.net/amfphp/gateway.php");
 
			_res = new Responder(onResult, onFault);
 
			_gw.call("Email.send", _res, "testmail@test.com", "Hi, this is a test mail", "this is contents");
		}
 
		private function onResult(responds:Object):void
		{
			trace(responds);
		}
 
		private function onFault(responds:Object):void
		{
 
			for(var i:String in responds)
			{
				trace(responds[i]);
			}
		}
	}
}

Example 2. Query MySql DB

SuperW_Map.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?
 
class SuperW_Map
{
	public function __construct()
	{
		mysql_connect("server","username", "password");
		mysql_select_db("database");
	}
 
	/**
	* Retrives Map data
	* @returns id, time, latitudes, longitudes, posttype, content, name, pass, emotion, iconurl, imgurl 
	*/
 
	function getWishes_onMap()
	{
		return mysql_query("SELECT id, latitudes, longitudes, emotion FROM Wishes");
	}
}
 
?>

>Notice.

When you want to use getWishes_onMap() in php class from SuperW_Map_Service.as, simply change _gw.call on line 17 to _gw.call(“SuperW_Map.getWishes_onMap”, _res);

If you want to figure out what data in responds, change to debug mode and add debug dot on the left of trace(responds) code in flex.

Zend Debugger using MAMP Pro

Thursday, February 18th, 2010

1. Open MAMP Pro and go to File > Edit Template > PHP5 php.ini
2. add below : Make sure path is correct

[xdebug]
zend_extension=”/Application/Zend/Zend Studio for Eclipse – 6.1.1/
plugins/org.zend.php.debug.debugger.macosx_5.2.15.v20080907/
resources/php5/ZendDebugger.so”

3. Open Zend Studio and go to Preferences > PHP > PHP Executables

4. Add Executable path ex : /Applications/MAMP/bin/php5/bin/php

Original Document

PHP Study 02

Sunday, February 7th, 2010

Variable Scope

Local Variables

$x = 4;
function assignx () {
        $x = 0;
        printf("\$x inside function is %d <br />", $x);
}
assignx();
printf("\$x outside of function is %d <br />", $x);

Result

$x inside function is 0
$x outside of function is 4

Function Parameters

// multiply a value by 10 and return it to the caller
function x10 ($value) {
        $value = $value * 10;
        return $value;
}

Global Variables

$somevar = 15;
function addit() {
        GLOBAL $somevar;
        $somevar++;
        echo "Somevar is $somevar";
}
addit();