Qilania is opened!

Qilania is now opened… Enjoy as much as we did making it real 😉

Qilania.com

Advertisements

Backup remote mysql database to local machine

I told you here a way to backup remote MySQL databases using a mix of AppleScript and shell script (ssh).

But that method won’t work with certain table types, which don’t store the data in files, such as InnoDB. So, here is a one-liner using mysqldump to backup that kind of databases…

mysqldump --opt --compress --host='website.com' --user='USER' --password='PWD' --all-databases | mysql -uUSER -pPWD -h127.0.0.1

Just substitute where needed USER and PWD. This shell script requires MySQL running in both machines and privileges to access the data in both sides.

IMHO, it runs much slower than the other method (making a copy of the remote db files) so, if you can use it, go for it! Otherwise, this method is safe for your data (safe if you don’t lose power or internet connection in the process 😉 ).

See “man mysqldump” for more options (such as extracting only certain databases or tables, as this script will backup everything!).

Modify tiles walkability in OpenSpace (on-the-fly)

This post applies to OpenSpace 1.x, but may apply also to 2.x (I didn’t study it yet!).

One major issue for OS1 owners is controlling avatar’s movements all the time long. Full control over the avatar. All the methods and properties related to avatar movement and re-creation of the tile-map according to new settings are private, closed. You can’t access and modify them unless you purchase a source license.

But here we go with a custom solution, which may be helpful for you in some situations as it was for us. As there is no available method to prevent avatar movement (ie, the user clicks in a tile and the avatar walks there in despite of what you say), the only solution is preventing user clicks!

Simple, not smart, but working solution.

And how in hell you do that? Also simple: place a transparent-clickable movie-clip in the tile, so it catches user clicks and nulls them. Just iterate over OpenSpace.getChildAt(0)’s children (the tiles) and do the job.

And now a few hints, as the situations are very different depending on your needs…

You can’t moveMyAvatar() or teleportMyAvatar() to the current tile –> this way you can’t prevent avatar movements! So, before user clicks, you must evaluate and decide if the avatar can walk (click, if you use the suggested workaround).

If you can’t decide prior to user’s election if he can walk/click, then you must evaluate after he clicks and starts walking. In that situation, take into consideration the previous paragraph. As you can’t moveMyAvatar() or teleportMyAvatar() to the current avatar’s coordinates (as coming from getCurrentTile()), move or teleport the avatar to a different tile.

There is a variety of events you can use to evaluate your conditions (ENTER_TILE, TILE_SELECTED, etc.), so most probably you will find some solution to your headache 😉

EDIT: Appart from the exposed method, still valid, would be nice to take a look to the following approach: dispatch a first moveMyAvatar() to a fake tile, so OpenSpace registers as current-tile the next one in the pathfinding, the issue a new moveMyAvatar() to the current (real) one.

AppleScript, mother tongue of Mac’rs

Before you were a Codewarrior addict, later Carbon libraries consumer, then Cocoa, then Obj-c, then iPhone developer, then what!

If you are a Mac user (not developer, being old or new to the business), AppleScript is your friend. In fact, any OSA-based language or “dialect” if I can call it so (such as appscript by Has or some handmade experiments by Phillip Aker). Apple Events. Application Intercommunication. Sounds like simple, but it’s the marmalade (not to talk about glue) of the daily workflow of hundreds of thousands of Mac users.

Come to mind other “experiments”, like “basic” (being Real or MS) or JavaScript for apps (such as Adobe’s apps or Air), but that is just System/App communication. It’s fine, but not in any way a checkpoint.

Although Qilania lives in a Ubuntu-driven server, many automation tasks are done in various “slave” machines, and many of them are driven by AppleScript, specially mirroring and db integration. For example, you can make tiny changes to a SWF file, and see them live in a few seconds. First, on the local server. Then, in the live server. And also changes are propagated to backup disks and so on. Magic under a double-click. Lots of technology involved: network connections, remote servers via ssh or sftp or scp, various desktop applications, etc. And one scripting language to rule them all: AppleScript.

I can ensure today, Sep 10th 2010, there is not programming language to acomplish most of these tasks we solve in a few seconds in Qilania, not in Mac nor in Win or *nix.

AppleScript, the marmalade and mother tongue of all Mac users.