On Mac OS X if you encounter #2002 error when you install phpMyAdmin
Tips From:
http://harrylove.org/2008/11/03/mysql-error-2002-with-phpmyadmin-on-mac-os-x-105-leopard
Open the terminal
sudo mkdir /var/mysql
sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock
Reload the login page and login
Tuesday, March 03, 2009
phpMyAdmin #2002 mysql.sock
Posted by
SONARHYTHM Logic Pro School
at
9:25 AM
1 comments
Labels: mysql, PHP, programming
Thursday, February 19, 2009
Cocoa Things
Couple of cocoa stuff:
Cocoa Bindings:
way of making object interact with each other. Triggers event when one of the interface object's state changes so other objects can catch that change and update itself. It can update multiple things without creating a button/actions. You can choose how they talk to each other. pretty easy once you learn it.
Framework
System > Library > Frameworks
Posted by
SONARHYTHM Logic Pro School
at
3:13 AM
0
comments
Labels: cocoa, programming
Thursday, January 08, 2009
php installation on leopard PEAR Smarty
I've upgraded to Leopard finally and I've ran into some problems upon running php PEAR and Smarty so i will list them and also their solutions.
1. Apache 2 user web site permission or access issue
This basically was the default configuration issue on leopard & apache 2.
Unlike tiger systems, you have to add username.conf or local.conf to gain access to user account on the web server.
It's is confusing that apple does this. but don't trust those words and ip addresses you see on the web sharing page on SystemPreference app.
and then add those Directory deny etc etc thing you do
after that for php you'll have to edit httpd.conf
just remove sharp from the line on php5 module.
2. PEAR
go-pear.php tutorial you see when you search for leopard pear installation works but bit wrong.
It tells you to include usr/share/pear even though the author is installing on some other directory...
well let PEAR installer handle all those directory (because it asks you if you want to change the include_path)
if you've installed PEAR on whatever directory that's the directory you need as the include path. You'll see capital PEAR folder somewhere and inside you'll see HTML, DB and things like that. that's the directory you need to include.
3 Smarty
download file from the website includes all documents. what you need to "cp" are inside the lib folder inside Smarty folder. don't follow direction as is.
4 PHP include_path
It's sometimes better to keep them as global include and when you want to do this would you install it on PEAR directory? you probably wouldn't want to do that. Then what you can do is to set multiple include_path directory.
private/etc/php.ini is the file you want to edit and look for include_path
when you want multiple include_path on mac system you cannot do : and another directory
instead do :: (two colons) between two directories.
for example,
usr/local/::usr/bin
all these you might need root level access to your system.
that's probably enough to remind myself of what to do next time I install so I won't have to waste couple hours struggling with it. hope this helps.
Posted by
SONARHYTHM Logic Pro School
at
12:20 AM
0
comments
Labels: PHP, programming, Web 2.0, WebDesign
Monday, January 28, 2008
AJAX tutorial 1
I finally started looking at AJAX and it seems pretty easy (well if you know html, javascript, already) it makes your learning curve even less steep if you knew actionscript 2.0 because there are many similar elements.
anyways, keys to understanding is XMLHttpRequest and DOM
DOM is basically way of knowing each elements location/names by browser.
1. window is window
2. document is what's inside the window
3. your a object will be like document.object
so document.getElementById('idOfTheObject') will give you access to that object. if you know css yes it's that same id you use. instead of # before the id name you use document.getElementById to access the object.
XMLHttpRequest is something that browser does with server. browsers are communicating with server and this is just and object that tracks that communication.
and you have methods to access that communication like onreadystatechange
this is used like xhr.onreadystatechange = function () {} or xhr.onreadystatechange = functionName; when xhr is the XMLHttpRequest you've created.
so how do you create XMLHttpRequest object? so that i can get info on what the page is doing with the server..
simple..
xhr = new XMLHttpRequest();
like you would any other object...
Only thing you need to keep track of is if the browser know what XMLHttpRequest object is
since this is relatively new technology you wouldn't be able to find one if somebody is using a computer from 10 years ago without updating.
so you just check
if (window.XMLHttpRequest)
very simple. and then in that if {} you are going to create XHR object.
var xhr = false;
if (window.XMLHttpRequest)
{
xhr = new XMLHttpRequest();
}
that will create the object and you can get ready for the next step.
Posted by
SONARHYTHM Logic Pro School
at
10:59 PM
0
comments
Labels: AJAX, programming, Web 2.0, WebDesign
Tuesday, December 04, 2007
Creating the time rag using Tween.
People put cool intro type effect all the time but one of them that i was dying to do through actionscript was time rag. i mean if you look at http://www.2advanced.com for example you can see stuff at the bottom coming in at different timing.
well i finally found out how to do this with action script. i guess it can be done just by animating manually but usually for these kind of thing it's way faster and more acurate to do it via ActionScript.
var speed:Number = .5 * i+1;
var xTween:Tween = new Tween(pp, "x", Back.easeOut, -300, 30, speed, true);
xTween.start();
if you look carefully into it you see a variable i
well yes this is inside the for loop. and iterates for how ever many movie clips that's inside of an array. i was doing this for my new photo gallery i was building.
Here i'm giving a variable speed 0.5 * i + 1
0.5 * i expresses difference in time.
+ 1 is basically an offset value so that the element 0 or the first one will still show up. (0 * anything is 0 so speed or time it takes will be 0 - in Tween class term it means do nothing)
so putting all elements that you want time rags when showing up in an array and create for loop and tween all of them with a bit different speed.
well if you are going to do this for 100 elements it might not work...
I'm still searching for a way to do real time rag which just keeps pause before triggering animation..
maybe if you use eventListever for MOTION_FINISH and 2 tweens it will.
Posted by
SONARHYTHM Logic Pro School
at
1:56 AM
0
comments
Labels: actionscript, actionscript 3.0, adobe, flash, game, OOP, programming
Monday, December 03, 2007
Tweening the filters classes with actionscript 3.0
I was trying to tween blur or glow filters via ActionScript 3.0 and I came across this issue that it doesn't tween. After some trial and error I have figured out ways of tweening filters using tween class.
This really led me to understand tween and filter classes. Basically the object assigned to filters property is an object by itself and it's not a property of the MovieCLip. so the MovieClip cannot be updated unless of course some how reapply the object.
well enough about objects and my rambling so I'll post a code here to make it work.
for example if you are trying to create roll over filter effect.
function rolledOver(e:MouseEvent):void
{
filterTween = new Tween(e.target.bfOver, "blurX", Back.easeInOut, 0, 100, 2, true);
filterTween.addEventListener(TweenEvent.MOTION_CHANGE, updateGraphics);
filterTween.start();
}
function rolledOut(e:MouseEvent):void
{
filterTween = new Tween(e.target.bfOver, "blurX", Back.easeInOut, 100, 0, 2, true);
filterTween.addEventListener(TweenEvent.MOTION_CHANGE, updateGraphics);
filterTween.start();
}
function updateGraphics(e:TweenEvent):void
{
this.filters = [bfOver];
}
This is out of my DynamicButton class so you'll have to tweak a little or create your own but at least I hope you see what I'm doing here. If it successfully compiles then you'll see blur tween over 2 seconds with some easing.
Motion Tween or tween sends out MOTION_CHANGE event when they update properties. you basically catch this event to update the desired MovieClip's appearance.
Actually it was easy.
Now.. please don't ask me about CPU etc... I don't know.
I wish you could control stages or times it calls the function or steps for tween. then you can make it a little easy for CPU or older computers.
anyways, try it out.
Posted by
SONARHYTHM Logic Pro School
at
7:31 PM
4
comments
Labels: actionscript, actionscript 3.0, adobe, game, OOP, programming
Saturday, December 01, 2007
Dynamic Text Embed Font ActionScript 3.0 tips
this is another ActionScript 3.0 or Flash CS 3 tips.
What really stopped me from creating contents today was the dynamic text.. it is an amazing thing but this thing drove me crazy.
i basically had one button that is associated with a class and on rollover, rollout, click, etc tween starts so that it will animate according to an MouseEvent.
Problem I had was i was trying to tween alpha and it didn't kick in. trace shows that it's changing alpha.. i checked my tween also by trying the same tween with other properties like x and it totally works...
i had another regular button that doesn't associate with this button class and that one also was working fine.
only the one i have created through class... didn't do alpha tweens.. (just that didn't show result on screen...)
I really tried bunch of things like loading them into another MovieClip and applying tween to that MovieClip etc...
Then i went to check the differences between the buttons that does alpha tweens and don't.. i noticed one slight difference..
The one that worked had static text for labels and the one that didn't work had dynamic text.
so i went to research "dynamic text alpha" well Bingo.
in order to apply alpha tween to an dynamic text you need to Embed and font.
well first didn't make sense at all but i looked into property inspector for the text and on the right hand side i saw "Embed.." button. and ah huh! i clicked on the button and set it up.
Command + Enter to test movie and it works!!! now i can tween dynamic texts.
if you choose both all upper case and all lower case letters, you should be able to change label dynamically. and now i have a button that plays fancy animation. not like and HTML/CSS simple roll over but a button that does something and that's totally customizable. great.
took me too long to figure out this simple things but i'm sure you won't need to.
Posted by
SONARHYTHM Logic Pro School
at
10:39 PM
7
comments
Labels: actionscript, actionscript 3.0, adobe, flash, programming
Thursday, November 29, 2007
Controlling sound in Flash CS 3 or ActionScript 3.0
I was trying to make an audio player for a web site in flash cs 3 or actionscript 3.0 today and it was more than confusing..
i was reading the references and took me a while before i realized that you had to have bunch of other objects to perform tasks like stopping,..
yes.. stopping sound seems easy but not really in actionscript 3.0..but once you get it you won't forget it.
to make an audio or mp3 player in as3 you need three objects.
Sound() - for loading sounds
SoundChannel() - to control playback, stopping
SoundTransform() - to control volume and panning(Left, right stereo stuff)
SoundChannel has .soundTransfor where you can assign SoundTransform() object
var sound:Sound = new Sound();
var sControl:SoundChannel = new SoundChannel();
var vControl:SoundTransform = new SoundTransform();
so now you have 3 objects. let take a look at how they interrelate
sound.load(new URLRequest("yourSong.mp3"); // get the sound clip
sound.addEventListener(Event.COMPLETE, soundLoaded); // triggers a function soundLoaded on load complete
btnStop.addEventListener(MouseEvent.CLICK, stopSound); // create button with inst name of btnStop on stage for it to work
btnVolumeUp.addEventListener(MouseEvent.CLICK, changeVolume);
function soundLoaded(e:Event):void
{
sControl = sound.play(); // this is the hard part...
}
function stopSound(e:MouseEvent):void
{
sControl.stop(); // sound.stop() won't work for some reason.. or for a good reason..
}
function changeVolume(e:MouseEvent):void
{
vControl.volume += .1; // since volume property's range is 0 to 1
sControl.soundTransform = vControl; // assign that info to control
}
well this should blow up your speaker since it only goes up. try it at your own risk and i didn't tell you to do it. so you can't sue me. you should spend your time in other things like try implementing decreasing volume or much more flexible way of controling volume, etc.
Posted by
SONARHYTHM Logic Pro School
at
9:36 PM
9
comments
Labels: actionscript, actionscript 3.0, flash, OOP, programming
Friday, August 31, 2007
Document Class - Flash ActionScript 3.0 feature
Now you can assign class to a document...
you just define a class, and inside the property window for the document, you should see a text field saying "Document Class"
type in ULR or name for your document class (anything..) and you are good to go.
you can actionscriptically load graphics, etc pretty easily. amazing feature
Posted by
SONARHYTHM Logic Pro School
at
4:39 AM
0
comments
Labels: actionscript, actionscript 3.0, adobe, flash, OOP, programming
Friday, June 29, 2007
PHP: Sessions
Sessions are not hard to understand either..
session is created per user/per site that use sessions.
Sessions:
- create session id and save it as a cookie PHPSESSID
- needs to be called at the very very top of the file by calling session_start();
session_start() will look for existing sessions and create new if there was none.
- sessions values can be added by storing into $_SESSION['key'] associative array.
and you can use it however you want it.
Posted by
SONARHYTHM Logic Pro School
at
10:56 AM
0
comments
Labels: PHP, programming
PHP: Include? or Require
it's always confusing which one is which but there is an interesting way to memorize this.
require file is something that requires and very strict.
include is a little less strict.
require will generate error when you can't open file but
include won't generate error. include only generate error when you call function inside that file doesn't exist for example.
makes logical sense to:
require when you have a function / library php file and you want to use that file.
include can be used for html or something that's only partially crucial.
require_once should be used for functions, etc to avoid multiple declaration.
Posted by
SONARHYTHM Logic Pro School
at
10:49 AM
0
comments
Labels: PHP, programming
PHP: Cookies
settting cookies were just so easy.. and i dont' even know why i couldn't use it.
maybe i was just refraining from it because they are not really secure...
setcookie($name, $value, $expire);
that's it....
expiration can be set by
time()+(60*60*24*7*30)
for a month
time() will print current time stamp, and you are adding number of seconds in a month.
deleting is done the same way except you set expiration to negative value or past..then the cookies will be deleted.
setcookie('test', 0, time() - 6); or whatever it indicates the past.
not sure on how long in the past so keep expiration value reasonable.
----------------
reading the cookie is like reading post values.
$_COOKIE['name'];
$value = $_COOKIE['name'];
echo $value;
just like that....too easy...
i was again got amazed but what a stubborn mind can do for us..so be open.
one more thing you can't for get is always check if the cookie isset();
Posted by
SONARHYTHM Logic Pro School
at
9:54 AM
0
comments
Labels: cookie, PHP, programming
Tuesday, June 26, 2007
ActionScript 3 Timer class
interesting thing i've descovered..
you are adding listener to the timer
Now i think that's a logical choice but for a while i was thinking that i had to tell object to listen to the timer...
well so here is my preloader test code with timer class.
import flash.display.Loader;
import flash.display.LoaderInfo;
import flash.net.URLRequest;
import flash.events.Event;
import flash.events.ProgressEvent;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.utils.Timer;
var velocity:Number = 1;
var loadProgress_txt:TextField = new TextField();
var siteLoader:Loader = new Loader();
var myFog1:URLRequest = new URLRequest("Source/images/Fog2.png");
var myTrigger:Timer = new Timer(2000, 20);
// initialize
siteLoader.load(myFog1);
siteLoader.alpha = 0.5;
siteLoader.x = 0;
siteLoader.y = 0;
loadProgress_txt.x = 200;
loadProgress_txt.y = 200;
loadProgress_txt.autoSize = TextFieldAutoSize.LEFT;
// add listeners
siteLoader.contentLoaderInfo.addEventListener(Event.OPEN, showPreloader);
siteLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, showProgress);
siteLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, showLoadResult);
function showPreloader(evt:Event):void {
addChild(loadProgress_txt);
}
function showProgress(evt:ProgressEvent):void {
loadProgress_txt.text = "loaded:"+evt.bytesLoaded+" from "+evt.bytesTotal;
}
function showLoadResult(evt:Event):void {
removeChild(loadProgress_txt);
addChild(siteLoader);
myTrigger.start();
myTrigger.addEventListener(TimerEvent.TIMER, loadAnother);
}
function loadAnother(evt:TimerEvent) {
siteLoader.x -= velocity * 10;
}
not really a pretty one yet but i can build on this to make a pretty one. using timer was easy too.
Posted by
SONARHYTHM Logic Pro School
at
9:45 PM
0
comments
Labels: actionscript, actionscript 3.0, flash, programming
Sunday, December 10, 2006
flash game tutorial from strille.net - modulo %
i was just reading this tutorial from strille.net on flash and this is really interesting...
i've been trying to hone my skill on multimedia programming so i'm just looking into game codes.
structure wise they all share similar routes. but what's in there or the codes people use to achieve certain results are interesting.
like.. % modulo
for a beginner like myself. when you learn about modulo it's like what? how do you even try to use that? but for this kind of application this works really well and i was amazed how much if else you can avoid just with these simple steps.
How to make Snake Game with Flash Tutorial
Posted by
SONARHYTHM Logic Pro School
at
2:07 PM
0
comments
Labels: flash, game, programming
