Since I always forget:
mysqldump –extended-insert=false –host <host> –skip-lock-tables -u <user> –password <database> <table> > file.sql
Since I always forget:
mysqldump –extended-insert=false –host <host> –skip-lock-tables -u <user> –password <database> <table> > file.sql
mysql -e 'SELECT * FROM table' > out.txt
load data local infile 'out.txt' into table 'some_table'
Here’s a good article for realistically modeling collisions between spheres. It’s an oldie but a goodie.
Pool Hall lessons
There’s a bit of pseudo code at the bottom, but I’ll post on a C++ implementation of the article.
Continue reading
A useful (but seemingly underused) SQL keyword is the IF statement.
The usage is as follows:
SELECT IF(expr1, expr2, expr3);
If expr1 evalues to true, then expr2 is executed, otherwise, expr3 is. This is useful for doing conditional queries inside the SQL without having to put logic in your script/program.
SELECT IF( (SELECT name FROM people) = 'john'), (SELECT age FROM people WHERE name = 'john') , 'no age');
The above statement will return the age of the user ‘john’ if he exists in the people table. If not the query will return ‘no age.’
The caveat is that expr2 and expr3 must evaluate to a single value. The braces around expr2′s SELECT statement are required.
How to use BitmapData’s hitTest to do pixel level hit detection against another bitmap.
class Actor extends Sprite {
public var someBitmap:Bitmap;
}
var src:Actor = new Actor();
var target:Actor = new Actor();
// bm is BitmapData.
var bm:BitmapData = obj.someBitmap.bitmapData;
// target is BitmapData
var bm2:BitmapData = target.someBitmap.bitmapData;
// this checks if src object collides with target object.
if (bm.hitTest(new Point(src.x, src.y), 255, bm2, new Point(target.x, target.y))) {
trace('hit!');
}