blog.x-e.ro / code: page 5 of 38
my latest papervision3d project was a revamp of the video cube. this time around the rotation of the cube is static, not mouse driven, also i added some new filtering, and a different method of using a video texture that doesn’t throw an error message. the flv is from the best cartoon ever lupin the 3rd. this episode is called "buns, guns, and fun in the sun"
and here's the code:
as3 :: papervision3D coverflow & spikey ball
the first version of this demo is lost to time. but i eventually made a cooler one. the coverflow is a popular ui/ux element allowing you to navigate images in 3d space. i made an mp3 player version that incorporates the spikey ball effect.
view the demo / checkout the code
here a nice little one liner. this function returns a random number between a user supplied range.
function randomizer (low:Number, high:Number):Number {
return Math.floor(low + (Math.random() * (high-low)));
}
example useage, will return a number between 5 - 50.
var x:Number = randomizer(5, 50);
demos :: papervision3D torus knot demo
so i had the chance this weekend to create a few 3D models and export their geometry into papervision3D primitives. so i decided to create a demo, using both my as3 torusKnot primitives and the new flex accordion component. about the time i finished my demo i decided to re-sync my pv3d folder with the svn. at that exact same moment their was a slip-up. somehow one of the new dev materials got leaked into the public svn. the new material features dynamic lighting! so i decided to hack it into my new demo. so enjoy my custom primitive shadedColorMaterial demo created in flex3.
so i finally got a copy of adobe cs3 and flex builder2. flex is amazing, combining mxml and actionscript 3 together into a seamless package. now that im on the as3 tip, i decided to dive into papervision3D. pv3d is a set of actionscript classes that are used to create 3D objects within the flash environment. it's currently in beta and the source code is only available to osflash emailing list members. so if you want it signup here. thanx to carlos for creating pv3d, and to his girlfriend for convincing him to release the project open source!
php :: using regular expressions
<?php
$email = 'someone@somewhere.com';
if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) {
//invalid email
} else {
//valid email
}
?>
here's a simple SQL script that returns the last row created. this is great for when you add a new record that has an autogenerated id and you need that number.
mssql
CREATE PROCEDURE [dbo].[getLastLogin]
AS
SELECT TOP 1 *
FROM dbo.login
ORDER BY id DESC
GO
mysql
SELECT * FROM `login`
ORDER BY `id` DESC
LIMIT 1,1;