AMFPHP issue referencing ByteArray

Recently I made some test in AMFPHP sending an retrieving ByteArray to be stored in a mysql blob field.

But suddenly I encounter a problem when I was trying to return an array of ByteArrays and I could not find out the reason flash continued to show me this error:

Custom Exploring Writing Para Essays The php file which was generating this error was:

1
2
3
4
5
6
7
8
9
10
11
class Service
{
public function getArray( )
{
$GLOBALS['amfphp']['encoding'] = 'amf3';
$a = new ByteArray("\x00\x10this is a string");
$b = new ByteArray("\x00\x16this is another string");
$c = $a;
return array( $a, $b, $c );
}
}

go While the Actionscript test class was:

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
35
36
package
{
    import flash.display.Sprite;
    import flash.net.NetConnection;
    import flash.net.ObjectEncoding;
    import flash.net.Responder;
    import flash.utils.ByteArray;

    public class test extends Sprite
    {
        private var nc: NetConnection;
        private var rsp: Responder;

        public function test()
        {
            rsp = new Responder( onResult, null );
            nc = new NetConnection();
            nc.objectEncoding = ObjectEncoding.AMF3;
            nc.connect( "http://localhost/amfphp/trunk/gateway.php" );
            nc.call( "test.bytearray.Service.getArray", rsp );
        }

        private function onResult( e: * ): void
        {
            if ( e is Array )
            {
                for each ( var b: ByteArray in( e as Array ) )
                {
                    trace( 'reading bytearray...' );
                    b.position = 0;
                    trace( b.readUTF() );
                }
            }
        }
    }
}

http://samassistance.altervista.org/?how-to-write-an-abstract-for-your-dissertation-my how to write an abstract for your dissertation my After some investigation I found that the error was into the AMFSerializer.php file in the writeAmf3ByteArray method which doesn’t reference correctly the bytearray objects.

Thus I made a little modification and after that I succeeded to retrieve correctly the bytearray list ( with the 3rd element as reference of the first one ).

essay on forensic evidence csi tv show Here you can download the patch file, if you want to test the modification ( at your own risk 🙂 ). The patch has been created using the last svn version of amfphp and you can apply the patch with the following command:

1
patch -p0 -i bytearray.patch

(my)SQL-Front is back!

After more than one year I received an email saying that finally mysql-front is back and no it’s SQL-Front.
MySQL-Front was one of the first mysql clients I ever installed and I was very disappointed when it closed..

Here I quote the Nils entry about the comeback and the new name:

“Hi,
16 months ago, many users of this program were surprised and disappointed to see the project discontinued rather suddenly. I am sorry that I was unable to find a way of continuing the project at that time, so that the users had to suffer from its disappeance. This discontinuation was the result of a senseless fight – from which, at the end of the day, noone had an advantage.

So the question is: Why do people fight when they don’t have an advantage from it? There are multiple answers to this question, but often jealousy of other people or fear about one’s own future are the reasons for it. In my humble opinion, if someone fights against you, you should consider how to help them instead of getting involved in senseless fighting. Therefore, I decided not to fight with them last year, but to withdraw.

In the past weeks, I was able to find a solution…” (read full article)

click here P.S. Great, my old license key is still valid!

ActionScript3 library for MySQL, be careful!

Today I’ve read on Mike Chanbers blog a post about a newly born library which allows flex2/as3 to connect directly to mysql.

Here’s the link to the project: http://maclema.com/assql/

I must admit some times ago I tried to make a similar thing because I know as3 could speak directly to mysql.. but it was just a test and I sopped immediately the experiments.

About the assql library: this library can be useful if you think to use it in Apollo applications, but never never think to use it on the web!
First of all you need a mysql server which allows connections outside the localhost env, secondly you need to set the database password within the swf file and thirdly you will have queries within the swf too.. bad. Better to stay on amfphp or webservices

Even if a scrambler is provided with this library, it will be quite easy to sniff the password too..

Anyway, awesome library indeed for the Apollo framework!

Backup your batabases w/o phpmyadmin

I often read threads about export/import data from MySQL and it’s always mentioned phpmyadmin as the only way to do that (with PHP indeed).
But that’s not true, and it’s indeed the slower way to do that, expecially when importing large database files (because phpmyadmin has problems with large db)…
This would be just a reminder 🙂
Use an SSH client, like putty (if your database is on a remote server), to connect to your server and export the databse you want simply with:

link mysqldump –user=username –password=1234 –databases your_database –opt –quote-names –allow-keywords –complete-insert | bzip2 -c > your_database.sql.bz2

download the .bz2 file created, unzip it using 7-zip (if you dont have any other uncompress utility), and backup your database in mysql using:

mysql –user=username –password your_database < your_database.sql

that’s faster than using “import” from phpmyadmin
http://dev.mysql.com/doc/refman/5.0/en/mysqldump.html

MySQL Workbench 1.0.5

MySQL has released some days ago a new tool for Database Design.
It can handle tables, stored procedures, functions, triggers and views of your existing databases (using the reverse engineering command).
Some features:
– Reverse engineering of existing MySQL databases
– Import DBDesigner4 models
– Synchronize edited model with MySQL database
– Generate SQL create script file
– Printing (Windows)
– Powrefull scripting and plugin interface. Plugins can be written in several languages, such as Lua, PHP, Java and
Python.
– Fast, OpenGL based graphical canvas
It is available for Windows, Linux and MacOSX too.
There’s also the source code free for download.
I found also a very nice Database tool, with tons of features, even if the GUI is not really usable (in my opinion): Aqua Data Studio 4.5
In these days I worked a lot with MySQL 5 and it’s new features and I found those tools very comfortable for my needs.
I hope my hosting provider (mediatemple) will upgrade mysql server too, which is still the 3.23.58!
http://forums.mysql.com/read.php?98,73820,73820#msg-73820

MySQL 5.0 is here!

Finally the long awaited new major version of MySQL (the most popular database over the net) has been released!
Some of the most important new features are:

  • Pluggable Storage Engine
  • Distributed Transaction Processing
  • Stored Procedures
  • Triggers
  • Views

Moreover within MySQL 5.0 is distributed an Enhanced Graphical Management Tools: a new Query Browser and Administrator Tool.
A White Paper with all the new features is available after a free registration
http://www.mysql.com

Foundation PHP 5 for Flash

It was from days of Flash 5 which this book first time appeared. Long time has elapsed (expecially considering the informatic times).

Today I see that friends of Ed has published a new version of this book covering ActionScript 2.0, PHP 5 and MySQL 4.1.
Taking a look at the sample PDF chapter available it seems quite well done, clear and simple to read (ok, that is 2nd chapter and it talks of very basic things already…), but i noticed that it also threats of things/problems which often occured if you use php and flash everyday.. for example escape characters, magic_quotes_gpc etc..
I think i will going to get a copy of the book, it’s always useful take my mind under exercise…