blog.x-e.ro / code: page 2 of 38
mobile :: my first itunes release
the Bioregenerative Life Support System Simulator, BLiSS Sim, is an ipad app, built with titanium studio, based on investigations conducted by NASA scientists and engineers to explore how plants can be grown to provide air, water, and food for astronauts at a lunar base.
BLiSS uses a game format to engage youth and adults in the challenges of supporting humans in space or extreme environments on earth.
The app is free and available for download from the iTunes Store.
Visit the promotional website at: http://bliss-sim.cet.edu/
sql :: copy and swap database tables in MSSQL
have you ever had a database table that you needed to clone? you can use any number of convoluted methods such as: manually coping and pasting rows in the database manager, running lots of queries/stored procedures, or writing a script to cycle though each row copying data from one table to the next. all of these methods are inferior and far more complex then the method i'm going to show you.
introducing the select into query...
this method should be used if the table you want to clone exists, but the new table douse not. the select into query will create the new table for you, copying all the column names, properties, and data. if you want to make an exact clone of the table you can select * into the new table. but if you only want a few specific columns, you can declare only the ones you want. the syntax is elegantly simple...
SELECT *
INTO [new-table]
FROM [old-table]
demos :: NES game password generator
many years ago, a rom hacker by the name of SnowBro set out to gain an intuitive understanding of the inner workings of the software we lovingly refer to as metroid. using only the rom file, he was able to convert it into assembly code and learn exactly how the game engine worked.
armed with these files and the knowledge they contained, i set out to build a metroid password generator tool. being a scene kid, i have some experience with keygens already....
sql :: nested queries in MSSQL
the world of database programming can be a dark and treacherous journey. when you first set out, your quest seems manageable. but as time progresses your start to realize you need more queries, more tables, etc, etc, to achieve your goal. well today i’m going teach you a little trick that might help you need one less stored procedure then you thought...
sometimes it’s true, you actually do need two queries to get the job done. but other times you can circumvent this by using something like a "join" or "inner join" query to merge two tables together and pull your results from both.
but the optimizer in you says that still isn’t enough...
demos :: papervision3D math art
here we go again, another papervision3D demo featuring math permeated lines. this time im working with a classic piece of code known as the PQ torus. the vague idea is that you have 2 numbers (P + Q) that are used in the algorithm to define the knot. in general, given P + Q mutually prime, the line wraps meridionally around the torus P times and wraps the longitudinally around it Q times. i was having some trouble grasping exactly how this was going to be achieved, until i read this article on blackpawn’s website. he really breaks down the algo to a very simplistic level...
as3 :: customize your components
creating web-applications with flex 3 is great. there are a ton of pre-made components, and an open-ended architecture to allow you to create your own. built into flex is also a variety of options to change the visual styles of the components. today i will talk about two different types of customization. first, the simplest method, is using css to style your components. next, the more advanced technique, is creating component skins. for this example i will be using flash cs3.
with in a flex mxml application, css is natively understood. so by utilizing the tags, we can create a variety of styles for an application. personally, i don't really care for the eclipse/flex built in css editor, but since flex uses valid css, any editor can work!
as3 :: random number in flash
just another take on a classic piece of code. the pseudo-random number generator. this one is almost the same, just a slightly diffrent algorithm.
private function randomizer(low:Number, high:Number):Number {
var num:Number = high-low;
return (Math.random()*num)+low;
}
then use it...
var x:Number = randomizer(5, 50);
i <3 randomization