N-way tile based worlds
November 6, 2009
This is an excellent tutorial and introduction to AS3 Flex Tile-based world design and fundamental concepts.
The Author Jeff Fulton summarizes :
In this tutorial we will discuss the theory and practice behind 360 degree n-way blit fine scrolling in AS3. What does that mean? N-way scrolling is a means by which you can scroll the screen in any direction based on the angle the main character of the game is facing. In this example we will talk about simulating an overhead 2-d car driving game, but this technique can be used for any game where the player can rotate to an angle before walking / moving.
Thanks Jeff, this article is great.
Artificial Intelligence in PHP
October 10, 2009
The title of this post sounds exciting, and it’s something I’ve been wanting to try for awhile. I’ll put a link in here to show you the sample code running.
I pretty downloaded and ran the code from Tremani, who have made an advanced artificial neural network in PHP. And it’s pretty easy to use so far. The interface is simple.
Tell it how how big you want the network to be
Feed it your input data
Tell it your expected output for each testset, and hit the go button.
of course this is in PHP but and not literally a button.
but with very little work it could be setup with a button.
So these guys have done an awesome job of making the setup and usage of an ANN this simple.. there is no reason why anyone can’t just start making little AI’s running around the net.
ok so I would like to try that. So now next steps.
- figure out a problem to solve
- figure out how to map that problem into inputs and outputs.
- then run it and figure out a way to test if it’s working
Sounds pretty good… so that is something I am going to try to play with.
Pretty excited about this
now I just need a genetic algorithm class that is this easy to use
Duplicate record removal from MySQL DB table
September 27, 2009
Man I don’t know how many times I’ve had to do this. I get a list , I want to clean dupes before I import, or after.
and I’d like to do this with a query ( it’s gotta be possible right ? )
so I hunt I test, i break stuff… it sucks, I undo.. I redo.. I blah and I blah.. then it’s done..
waste of time.. so here it is.
First make sure I find what I am looking for :
SELECT * FROM email_db, email_db AS vtable WHERE vtable.id > email_db.id AND vtable.email = email_db.email
very simple and elegant right ?
This is the one I actually ended up using.. to remove the dupes
- CREATE TABLE temp_table AS SELECT * FROM foo WHERE 1 GROUP BY bar;
- DROP TABLE foo;
- RENAME TABLE temp_table TO foo;
Adobe Air library
August 17, 2009
I recently came across a very good library called everythingflexairlib.
This library includes :
Components
- NativeAlertWindow
- AlertWindow
- ContextWindow
- SuperWindow
Managers
- ConnectionManager
- UpdateManager
- IconManager
You can download the swc and source code hosted at Google code
CSS centering
August 13, 2009
It seems I like to do alot of centering in my CSS. I always end up searching for ways to do this, and there are a few tricks that work very well in both browsers.
For now here is a link to a W3 article explaining some simple and effective ways to do this
Recently had to install wordpress and Drupal on our shared server.
I wasn’t seeing any errors, just a status 500 Server Error.
So after poking around and trying some things. I had to make a .htaccess file with the following settings :
php_flag display_startup_errors on php_flag display_errors on php_flag register_globals off php_value memory_limit 16M php_value zend.ze1_compatibility_mode Off
This allowed me to see the errors and also to avoid a brutal compatibility bug our provider has setup in their version of PHP5 install. After these were set… no problems
First time for everything
November 5, 2008
I am still getting familiar with the wordpress blogging system. I am testing my first post. My posts should get more interesting as time goes along.
Flash to Facebook bridge
November 19, 2008
I recently got working a Flash to Facebook bridge. I downloaded the as3 classes and example files from Zerofractal.com.
I spent a good couple of hours setting up my code and finding it not working.
So back to square one, I loaded ZF’s example code and it worked. So I knew the issue remained with my setup
I first tested the calls with my barebones swf placed in an FB:iframe.
It worked!
So next I started adding the flashvars I was trying to pass into the swf inside the frame.
It still worked !
next I added back the POST variables I was passing from the main page into the iframe.
BROKEN !!
It turns out I was not url-encoding my POST vars.
Lesson learned : urlencode() my vars !.. and of course the JS code and such did not alert me to any problems, it just didn’t work.
Development marathon
November 26, 2008
So we are on week 6 now of developing our first multi-user Flex based facebook game.
3 of us are working on it, it seems like a 2 steps forward, 1 step back cycle. Sometimes 1 step forward, 2 back.
Either way we are seeing progress. The main application file is at it’s 115th iteration, and I think we are approaching about 10,000 lines of code.
All the major functions work, but still appear buggy. We have successfully integrated into the Facebook platform and speed looks good in our tests.
Over the next fews I hope to iron out the last of the bugs, make some final design decisions, and move towards a beta testing phase with live people.
The Social web of trust
November 29, 2008
Today I found a “friend” connected to me in Facebook amongst the 220 people.
In my account, there is only about 5 people I’ve never met, and “met” through Facebook.
I was looking through this guys profile and he’s got about 300 friends, and about 15 in the last month of so.
Most of his friends look like commercials.
I was thinking, is this a robot account ?
It could be, couldn’t it ?
All my personal details are being splashed into this account’s feed, all the data could be getting dumped and sifted.
Am I being paranoid ?
Flex Facebook app in beta
December 22, 2008
We have finally released our first social gaming Flex application on Facebook. The application is called Presidents & Assholes, it based on the popular card game Asshole. The application is real-time, and requires 4 live players to activate a game table. We have added a betting component, so users have a sense of reward.
The application has a Spectator mode that will allow users to “preview” the game without forcing them to install. This same preview is available to the global internet without logging into Facebook. You can preview the game by clicking http://apps.facebook.com/play_president/.
The game has an easy to use chat window that will broadcast your message to the room. Users can enter and leave any number of game table rooms, and optionally sit down if they have installed the Facebook app.
multi-user flash games
January 6, 2009
I just come across a network that will power a flash game with:
- real-time multi-user capability
- data storage api
- payment api
- acheivements
- high score
the service is called Nonoba
Web flash game monetization
January 8, 2009
I recently came across this ad network that is designed for Flash and Flex game developers to monetize and promote their online games.
The network is called Mochiads and will allow you to embed a couple of lines of code , that will show ads in your game. Optionally you can upload an ad, and depending on how many impressions you send them, they will show your ad. Click to check them out, you can sign up for free.
Format an external USB drive for data back on linux
February 10, 2009
I’ve had to do this task a good many times, soI figured I should note it here for easy access.
Problem: How do I format an external USB drive for access in the linux filesytem.
First plug in the drive and power it up.
To ensure the Linux OS recognizes the new device, you can run the command
dmesg
It should output something like:
I/O error: dev 08:10, sector 0 unable to read partition table I/O error: dev 08:10, sector 0 Device 08:20 not ready. I/O error: dev 08:20, sector 0 SCSI device sda: 625142447 512-byte hdwr sectors (320073 MB) /dev/scsi/host2/bus0/target0/lun0: p1
What you are looking for now is the device the OS has mapped it to.. in this case it’s sda ( it may also be sdb or sdc, depending on what other devices you have connected )
You will now be able to access this device through /dev/sda
Next I ran
cfdisk /dev/sda
This allows me to view the partition table on this device. It should show you the type of filesystem if any ( ntfs,fat or unformatted, etc )
In my case I want to make it a linux partition.
I created a [new partition], and set the type to 83 – Linux
I then chose [write] and [quit], this will create the new partition ( and WARNING!! :permanently erase everything on the device)
I could then format the device. I use ReiserFS, which I find great for devices that get jostled around and may get slight corruption, Reiser is awesome at recovering and fixing itself, even better than Ext3
I ran
mkreiserfs /dev/sda1
The 1 on sda1 now signifies the first partition on the device sda.
This will format the device and let you know the result.
At this point I did a quick check to see the health of the device with the command
fsck.reiserfs –check /dev/sda1
Which output:
Do you want to run this program?[N/Yes] (note need to type Yes if you do):Yes
###########
reiserfsck --check started at Tue Feb 10 09:57:44 2009
###########
Replaying journal..
Reiserfs journal '/dev/sda1' in blocks [18..8211]: 0 transactions replayed
Checking internal tree..finished
Comparing bitmaps..finished
Checking Semantic tree:
finished
No corruptions found
There are on the filesystem:
Leaves 1
Internal nodes 0
Directories 1
Other files 0
Data block pointers 0 (0 of them are zero)
Safe links 0
###########
reiserfsck finished at Tue Feb 10 09:58:06 2009
###########
the key info there is the line : No corruptions found
Which means there are no Bad blocks on the device.
So now I proceed to mount the device and then access it like any other folder on the system
mount -t auto /dev/sda1 /mnt/BACKUP-DRIVE/
in this case I had already made a folder called BACKUP-DRIVE in my /mnt directory.
now If I run:
df
I get
/dev/sda1 312559096 32840 312526256 1% /mnt/BACKUP-DRIVE
That tells me the drive is ready to go, I can cd /mnt//BACKUP-DRIVE and start writing files.
it my case I was to rsync my work files into the backup device I use this command
rsync -vbruz /work /mnt/BACKUP-DRIVE
This will check any only update the files that have changed since the last backup, and go recursively.. in this case, it will copy everything over and may take awhile.
When this is complete.. I run
umount /dev/sda1
and I can safely unplug the device until the next backup.
For the next backup I simply
- Plug device in and turn on
- mount -auto /dev/sda1 /mnt/BACKUP-DRIVE
- rsync -vbruz /work /mnt/BACKUP-DRIVE ( where /work is the source of the files I want to backup )
ReiserFs comes with a whole bunch of great tools, in case the drive does become corrupted.. or it’s starts to age and gets bad blocks.
You can also automate alot of this ( I have yet to do this ) so that when you plugin the device it automatically calls your backup scripts or something.
Show a count of new installs per day
February 11, 2009
Everytime we launch a new application in a social network, after a few weeks it’s important to know if we have upward growth.
The only thing I can think that demonstrates this is more installs per day. In our databases we capture full timestamps of the new installed user.
To turn this into something I can look at and understand, I have to run this query.
SELECT date_format( date_added, ‘%Y-%m-%d’ ) , count( * )
FROM fb_user
GROUP BY date_format( date_added, ‘%Y-%m-%d’ )
ORDER BY date_format( date_added, ‘%Y-%m-%d’ ) ASC
I am going to try to make a graph to view this in flex… first time Flex graphing
I’ll post an update when it works..
Web Virality targeted in Social networks
September 17, 2009
I have just come across this great article at http://framethink.wordpress.com/2008/01/15/the-four-viral-app-objectives-aka-social-network-application-virality-101/
Amazon Web Services EC2
May 1, 2009
So finally got a chance to get on the Amazon EC2 hosting cloud. Got myself a small “instance” a virtual machine equivalent to a 1 gig xeon. Hmm instead blogging about it, I should probablly get my web applications moved over to it.
So I will do that, then update this post with more info. So far the Amazon system is pretty awesome, it’s fast, I was able to shutdown and start about 7 instances in about a 1 hr timeframe trying out different starter images.
I ended up settling on a base Debian 5.0 Lenny , and re-setup all my services from scratch. This takes time but ensures I know what services I have running and forces me to re-look into the configurations I setup. Fortunately I can do cool things like copy the entire /var/lib/mysql folder over and all my databases move no problems
. The bandwidth on the amazon instances is capped about 10 Mbit/s which is pretty decent.. I’ve seen my transfers average 8 Mbit/s easy..
So better get back to it, and move another domain over.
SSH keypair authenticated login automation
April 22, 2009
I have had to do this a few times, and it’s really handy. Making a SSH keypair that will allow me to login on a remote machine without entering a password.
Here are the commands:
On my machine (primary host) I want given permission to access remote machines
$ ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/home/ryan/.ssh/id_rsa): <ENTER> Enter passphrase (empty for no passphrase): <ENTER> Enter same passphrase again: <ENTER> Your identification has been saved in /home/ryan/.ssh/id_rsa. Your public key has been saved in /home/ryan/.ssh/id_rsa.pub. The key fingerprint is: fa:e7:7c:e1:cb:7b:66:8b:67:07:05:99:7f:05:b9:4a ryan@localhost
I then copy id_rsa.pub out to the remote machines user directory, so my localhost user can access the remote host user account without password, a network of trusted hosts .
$ mkdir remote_server/.ssh $ chmod 700 remote_server/.ssh $ cat .ssh/id_rsa.pub >> remote_server/.ssh/authorized_keys $ chmod 600 remote_server/.ssh/authorized_keys
Time Series Correlator
February 16, 2009
Purpose: Present the data in a time series snapshot
- show multiple series, and try to draw correlations.
- place labels when campaigns are executed
- track users and look for patterns


