LSDJ keyboard tutorial

modz, LSDJ, tech, rawk, nintendo, h4x, tutorial

LSDJ keyboard with prosound gameboys
so, making music for LSDJ is fun. but after a while you start to wish you could "play" the gameboy software as a musical instrument as opposed to composing music in its tracker style interface. that's where the LSDJ keyboard comes in. the idea is, the keyboard sends messages though the gameboy linkport to LSDJ. the commands that can be sent vary from playing/stopping notes or chains or tables, un/muting channels, in/decreasing octives, switching instruments, navigating the LSDJ screens, and more.
here's what the LSDJ wiki says about the keyboard.

things we'll need for the mod:
mini-din / ps2 keyboard
gameboy link cable
soldering iron
solder
flux
wire stripper
screw drivers
heat-srink tubling / electrical tape

finding the right gameboy link cable:
there are a few diffrent types of gameboy link cables, in the most general of sences there are "classic" gameboy cables and gameboy "advance" cables. obviously we will need a classic cable. for this mod to work we will need to power the keyboard, so you'll need a powered gameboy link cable. you can cut off the cable end from a gameboy 4-player link adapter (model# DMG-07), like i did, or you can use the correct powered cable. otherwise you will need to add a +5v external power source. nonfinite sells both powered link cables and 4 player adapters at his shop nonelectronics.com.
the ancient keyboard in question
the first thing you need is an old keyboard. for this mod you need a mini-din, aka a ps2 (not playstation 2), keyboard. i used an old hp ibm keyboard i pulled out of a dumbster at work. step one is testing it. plug it into you computer, open a text editor, and press all the keys. try tapping them very fast and see how often they actually fire. the responsiveness of the keys in this setting will be realitive to their sensitivity in LSDJ.
popping off the keys
step two is popping off all the keys. use a flat head screw driver and stick it in the ridge beside the key then push the screw driver up like a lever. the key should just pop right off. repeat this process for all the normal keys. when you get to the spacebar and some of the other odd shaped keys, like enter, you might find springs or metal wires pressing two points to the keyboard. try and take note of their posisoning, because you will need to put them back that way.
pile of keys
now you should have a piles of keys and a bare keyboard. throw all the keys in a bag, so you don't loose any, and flip the keyboard over. step three is unscrewing the keyboard, prying open and removing it's plasic covering.
unscrew the daughterboard
carefully keep taking the keyboard apart. every model is slightly different, so pay attention so you can reassemble it. eventually you will see a small silicon daughter board with the cable attached. step four is removing the daughter board. unscrew the board from the inards of the keyboard and set it somewhere safe, like in an anti-static bag.
plastic removed
now that you have all the plastic removed, seperate all the diffrent parts and note how they were oriented in the casing.
cleaning
step five is cleaning everything up. i just used air duster and some glass cleaner on a paper towel. clean out all the little dirty recesses between and in the keys. if your keyboard is old like mine was, this step can take a while ;D
art shot of gameboy and keyboard circuits
some of the plasic circuits can get a little dirty or folded, clean them as well and make sure they will align correctly when you put everything back. if you have never taken apart a keyboard before, it's very interesting...
wire color etchings
now take a look at the daughter board from the keyboard. if your lucky, like i was, each of the wires leading to the cables from the board will be labled. if they are not labled, your going to have to cut the end of the mini-din connector off and look at what color wire attaches to which pin number.
paint the keys with paint marker
step six is painting they keyboard. this step is optional. i used regular spray paint on the exterior plastic casings. i painted it all one coat of green, then splattered it slightly with a darker green. for the keys i wanted to make sure they had a less tacky feel, so i painted them with paint-markers. you can get them at an art/craft store or at some office supply stores, i like the "painters" brand. i painted the piano keys white and black and the LSDJ interface keys i painted green.
prep your tools for soldering
step seven is preping your tools for soldering. clean your soldering iron with some steel wool, set it to medium/low heat. you'll need flux, wire strippes, and somthing to wrap your wiring with. you can use heat-scrink tubing, electrical, or duct-tape. step eight is cutting the wires from both your gameboy link cable and the keyboard. then peel apart each of the wires and strip about 1/8" off each wire. use an xacto knife to peel back the cable shielding.
LSDJ keyboard wiring diagram
step nine is reviewing the wiring diagram. click here to download it. you will be connecting data, clock, power, and ground wires from both the keyboard and the gameboy link cable.
wires soldered and wrapped
step ten is soldering the wires. wrap the wires from each cable together and dip them in flux. then add a tiny dab of solder from your iron to connect them. after all your wires are attached, wrap each of them individually, then wrap the entire bundle of wires.
interface complete
using the keyboard
step one is actually syncing the keyboard to LSDJ. insert the link cable you hacked onto the keyboard into the gameboy and load LSDJ. press SELECT+UP and go to the PROJECT screen. move the cursor down to the SYNC dialog, and press A+RIGHT until you selection is KEYBD. notice just to the right of PURGE SEQUENCER an integer prefixed by an "I" appears. if nothing is synced to LSDJ/the gameboy this will display I00. once a device is successfully synced, this will be a larger integer (e.g. I01, I02). my keyboard oddly enought syncs as I06.
LSDJ project screen
making some noise
to get some sounds to play when pressing keys on the keyboard, the sequencer must already be running. (press START) the notes you play will be played back on the next step in the phrase sequencer. if you need to get faster responce timings, use a faster groove for the phrase you are playing.
LSDJ song screen
an important feature of LSDJ, that is easly overlooked, is when the sequencer is running the notes and instruments playing for each channel are displayed on the top right of the SONG screen. this can help a lot when your playing around and press the octave or instrument buttons up and down a bunch of times looking for something, and you get lost in the menus. this brings me to the one negative about the LSDJ keyboard interface. every once in a while the instrument your playing will jump up or down like ten positions. i think the problem is related to pressing multiple keys too rapidly. i am not the only person to report this problem. technically the gameboy's z80i sound chip is playing each channel one note at a time in such a rapid succession it "tricks" the ear into thinking it's hearing them simultaniously. that's just how gameboy music works. and i think smashing keys on the keyboard can sometimes send multiple input messages per cycle in LSDJ and glitches it, but that diagnosis is purely conjecture. and that random issue happens so rarely it's not a big deal. the interface is not perfect, but it's an easy mod, hacky, fun, and adds a new twist to LSDJ.
LSDJ keyboard key layout
key mapping
SPACE play using custom table
F1/F2 octave down/up
F3/F4 instrument down/up
F5/F6 select custom table to assign to SPACE
F8 change pulse instrument playback channels (PU1, PU2, PU1+2)
F9-F12 toggle channel mute (switches on key press)
CTRL + (F9-F12) tap channel mute (switches on key press and release)

demo video

vegan chocolate chip cookie recipe

tutorial, random, nina, 1337

vegan chocolate chip recipe
start with a small container of margarine
(like 7.5oz of promise or smart balance)

blend in some sugar.
i use about 1/3 brown sugar, 1/3 white sugar, and 1/2 a cup of confection [powdered] sugar.

*optional*
you can also use 1 table spoon of honey and/or agave nectar.

stir until creamy.

add 1 tea spoon vanilla and stir.
add flour.
(i like to mix 1/2 cup of whole wheat flour and 1+1/2 cup of white flour.)

*NOTE*
if you used honey / agave nectar you'll need and extra 1/2 cup of flour.

add 1 tea spoon of salt.
add 1 tea spoon of baking soda.
add 1 tea spoon of baking powder.

you want the dough to be stiff not sticky. if necessary, add more flour.

then stir in a small bag of semi-sweet chips. (i use the dark chocolate minis.)

shape the dough into walnut sized balls.
put on a cookie sheet and flatten slightly.
bake at 350 degrees for 12-14 minutes.

getting the dough the right consistency is crucial. if your first batch is coming out too thin or flat, you need to add more flour. the dough shouldn't stick to your hands when rolling then into balls. just keep adding a small amount of flour at a time until they don't feel so sticky.

let cool.
enjoy!

gameboy prosound mod

modz, LSDJ, tech, rawk, nintendo, h4x, tutorial



today’s mod is for the original gameboy. if you want to get serious about chip tunes, whether your using lsdj or nanoloop, the sound quality of your instrument is a priority. the stock nintendo gameboy is equipped with a single headphone jack. and if you have ever tried recording anything from that, it sounds pretty bad. thus the prosound modification was invented. trash80 was first credited with this technique, but i will be using a mix of tutorial's published by both lameboy and animalstyle. this mod adds a new line-level-out jack to the device, while keeping the headphone functionality intact.



things we'll need for the mod:

DMG-01 gameboy
1/8" (3.5mm) stereo phone jack
soldering iron
solder
flux
thin gauge wire
wire stripper
jewelers screw driver
triwing screw driver
awl
dremel or drill
pliers



the triwing screw-driver is an integral part of this mod. nintendo uses a nonstandard screw on the 6 found on the outside of the case. but all the screws on the inside of the gameboy are a normal mini-philips head. i got my triwing on ebay for like $2.00, but you can get them other places if you look.



step one is to remove the screws. like i said before, there are six triwings on the back of the DMG. four are visible, and two are hidden under the batter compartment. make sure you dont loose the screws, or you can just replace them with regular minis.



now you need to disconnect the display cable. BE VERY CAREFUL! the ribbon cable that connects the dot matrix display to the gamboys motherboard is very thin. the cable has minimal metal on the leads at the end. so if you scrape any of it off by pulling it out too hard you can expect some dead pixels. just pull it straight down.



now take a moment to check out the guts of the gameboy. pretty cool. in the image above you can see the 3 points on the board we're going to be soldering two. check out the wiring diagram.



the next step is optional. but its normally necessary. clean it up. all you need is the highest percent alcohol you can get (i use 98%) and some cue-tips. just get into those little recessed areas and get any dust or grime out of there. make sure you do the batter terminals also if they have any corrosion on them.



to fix the jack into the case you'll need to made a little more room. use a mini-philips head screw-driver to remove the audio daughter board with the headphone jack on it.



now take your screw driver an place it between the board and the capacitors. very carefully bend the leads so the capacitors lay flat against the board.



now screw the board back into place. make sure it still lays flush inside the case. dont force it to fit, just carefully rebend them until you get it correctly. if you accidently break one of the leads from bending them too much you'll have to resolder them.



now that we got the space in the case decide where your going to mount the 1/8" jack. you dont have a lot of room to work with, so get the jack as far on the edge of the case as you can.



now use your awl to mark where you are going to drill your hole. press the awl in the center of the jack, about where the cord will be inserted, until you have a deep dent in the plastic.



you dont have to actually break the plastic, but make a groove in it. this will help you a lot when drilling. the grove gives the drill or dremel a place to start at so all you need to do is press.



safty to humans! when drilling the hole in the gameboy lots of plastic chips will go flying. so make sure you wear goggles. unless you like hard, hot plastic in your eyes. i also like to wear a mask or a bandanna over my face when soldering. the hot flux and solder emit a nasty smell, and kill brain cells.



to keep the gameboy steady when dremeling i put it into a table mounted vice. it was a hard decision weather long or short way was the best position. but i decided long way was more stable, and gave me a bit more visibility to see what i was doing.



i used the dremel XLR with the sand grit cone bit. you can use a standard hand drill with a stepping bit, but i feel more comfortable with my dremel. use a medium speed and a little bit of force and you will go right through.



after your first pass you should have a small hole in the case of the DMG. the edges will be rough and uneven. but that's ok for now.



now stop the dremel. and unscrew the end of the 1/8" jack. try and fit it into the hole you just made. if its a little small, turn the dremel on a low setting and go over the edges again, and keep checking until the jack fits tightly in the hole. by going over the edges again you will also get a nice smooth finish.



now is a good time to plug in your soldering iron. it will start getting hot while your doing the prep work for the next stage.



get your three wires ready, and strip both ends of each wire. i left one end of the wire a little longer for the jack, and the other end very short for attaching to the board.



after that i suggest you tin the wires. dip you iron in a little flux to clean it off, then get a tiny drop of solder on the ends of each wire. this will make attaching them a lot easier.



now take the longer stripped ends of the wire and wrap them around the end of a flat head mini screw-driver. this will make a little "hook" at the end of the wire (thats why we made them a bit longer). then take the wires and hook one on the end of each of the prongs of the 1/8" jack.



now that the wires are hooked on the jack, take your screw-driver and flatten the hooks so they dont move as much. now just take a tiny dab of solder and attach the wires to the jack.



to avoid any cross talk that might possibly occur between the wires wrap them up. either use some heat shrink tubing or some electrical tape around the edges.



now mount the jack in the gameboy case. put the end of jack into the hole we drilled. then screw the end piece back on.



now take a pair of pliers and tighten the end of the jack as much as possible. just be careful not to scratch the exterior of the case's plastic when doing so.



the next step is very important. getting the wires ready to solder onto the board. lameboy suggested pushing the wires down into the crevasse under the main board, then pull it over to the three point we're soldering to.



but on my second try i actually made the wires a lot shorter. this made the process of closing the case at the end a lot easier. once you get the wires in the right place tape them down. just remember the old saying, measure twice solder once. i like to double that, just in case.



the wireing is pretty simple. there's 5 solder points that connect the potentiometer to the gameboys board. the top 2 we're gonna ignore. they are volume into the pot. the next 2 are the left and right audio out of the pot then finally the ground.



when it comes to solder, less is more. this is true for both heat and actual metal. the amount of solder to use varies from gameboy unit to unit. some have a moderate amount, so you can just heat up whats already there and use your pre-tinned wires. but some have a huge blob there already. in those cases i suggest you remove the existing solder with some desoldering braid then use a tiny amount to connect your wires.



when doing this take your time. make sure your connecting the correct prongs to the right pins on the board. the pinout diagram should be on the packaging for the actual jack.



now carefully reconnect the display cable. put your fingers under the edge on the ribbon cable and push it up into place. dont try and rock the cable back and forth to get it into place. this could rub off some of the metal on the leads. the photo is the cable fully inserted. notice how much metal is still showing.



the final step is closing the case. this can be tricky. make sure none of the prosound jack's wires are sticking out or stuck between the edges of the case when closing it.



now your gameboy is prosound modified! the added 1/8" jack should reduce background noise when recording and actually increase volume and give you added bass. now pop in your favorite 8bit music application and make some chip tunes!



3DSM abstract render tutorial

tutorial

this is a tutorial i posted on the igraphixz forums under my alias 0x000000

custom flex skins

code, actionscript, flex, flash, mxml, css, tutorial


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 tag, we can create a variety of styles for out 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! macromedia has also created a very useful tool for helping designers/developers write flex 3 specific css. click here to view the flex 3 style explorer

now for some code...
like in all css there are two ways to define a style.
first as an overall style for one type of object, for instance...

    css code
  1. Button {
  2. cornerRadius: 0;
  3. fillColors: #333333, #cccccc, #cccccc, #666666;
  4. color: #ffffff;
  5. borderColor: #ffffff;
  6. }

this style will be applied to all buttons that appear in your application. notice the style name is simply "Button", the name of the component type. this is how flex understands which objects to apply the style to.

    css code
  1. .anotherButton {
  2. cornerRadius: 0;
  3. fillColors: #ffffff, #333333, #333333, #666666;
  4. color: #ffffff;
  5. borderColor: #000000;
  6. }

now, this code by default will not be applied to any components in your application. notice the style name is time is ".anotherButton", the period that prefaces the style name indicates that this is a custom style, not a component style definition. to apply this style to a button in your application use the following code...

<mx:Button styleName="anotherButton"/>

here's a very simple flex 3 application using css styles
    mxml code
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
  3. <mx:Style>
  4. Application {
  5. backgroundColor: #000000;
  6. backgroundGradientColors: #666666, #cccccc;
  7. themeColor: #00ff00;
  8. color: #ffffff;
  9. }
  10. Panel {
  11. borderStyle: solid;
  12. borderColor: #cccccc;
  13. roundedBottomCorners: true;
  14. cornerRadius: 0;
  15. headerHeight: 18;
  16. backgroundColor: #666666;
  17. titleStyleName: "panelTitle";
  18. }
  19. .panelTitle {
  20. letterSpacing: 3;
  21. color: #ffffff;
  22. textAlign: center;
  23. fontFamily: Verdana;
  24. fontSize: 12;
  25. }
  26. TextInput {
  27. borderStyle: solid;
  28. borderColor: #ffffff;
  29. borderThickness: 1;
  30. cornerRadius: 0;
  31. backgroundColor: #333333;
  32. color: #ffffff;
  33. textAlign: center;
  34. fontFamily: Verdana;
  35. fontSize: 12;
  36. }
  37. Button {
  38. cornerRadius: 0;
  39. fillColors: #333333, #999999, #ffffff, #333333;
  40. color: #ffffff;
  41. textRollOverColor: #ffffff;
  42. textSelectedColor: #ffffff;
  43. borderColor: #333333;
  44. }
  45. .anotherButton {
  46. cornerRadius: 0;
  47. fillColors: #ffffff, #666666, #333333, #999999;
  48. color: #ffffff;
  49. textRollOverColor: #ffffff;
  50. textSelectedColor: #ffffff;
  51. borderColor: #333333;
  52. }
  53. </mx:Style>
  54. <mx:Panel styleName="" width="244" height="134" layout="absolute" horizontalCenter="-1" verticalCenter="9" title="here's a panel">
  55. <mx:Label x="0" y="10" text="Label"/>
  56. <mx:TextInput x="0" y="27" width="220" text="text input"/>
  57. <mx:Button x="0" y="57" label="Button"/>
  58. <mx:Button styleName="anotherButton" x="78" y="57" label="Button"/>
  59. <mx:Button x="155" y="57" label="Button"/>
  60. </mx:Panel>
  61. </mx:Application>
  62.  

skinning is the technique of images and/or movieclips to create a visual style for a flex component. being that adobe makes a dozen different applications, there are in fact a dozen different ways to create flex skins. here's a really nice article over viewing the different ways to skin flex
and here's another great article

today in going to discuss creating skins in flash. adobe makes it really easy for us by providing a set of pre-made flex skin templates. go a head and download them from here:

Your looking for the "Flex Skin Design Extension for Flash"
the files
the documentation
(*note* you will need an adobe ID -- they are free btw...)

there are also a set of component classes for creating completely custom, skinnable flex compatable components called "the flex component kit for flash cs3". but im not gonna dive into all that just yet... ;D

now that you have download the "flex3skins-flash.mxp" file, you need to register it with the adobe extension manager. (this should be installed already if you have any cs3 product, but if not grab a copy here) just double click on the file, or open the extension manager and click "File... Install Extension"



after agreeing to the disclaimer, you should see an alert box telling you that your templates have been successfully installed. now we're ready to make some flex skins!

open flash cs3.
select "File... New", then click the "templates" tab on the top left. change the category to "Flex Skins", and now you can see a list of all the available flex component templates. now just to let you know, there is not a template for EVERY available flex component, but the vast majority.



so go ahead and select the "button" template. when the flash file loads take a look at the library, you'll notice there's a movieclip called "button_skin". open it up and take a look at what's there.



in the timeline, in the "states" layer, we have four separate keyframes, up, over, down, and disabled. these keyframes are the four main visual styles for the flex button component. now, take a look at the gridline down in the main design area. these lines are called a scale9grid (more info about that here) they show flex the areas that are allowed to scale, the default size, and the main area where the label is going to be placed. make a new layer in the timeline above "art" and add blank key frames that match the layer below. now add some images for each of the button states. then use the cursor tool to move the scale9grid lines to match up for your skin.



once you have all the images ready to go right click on the "button_skin" object in the library and click "linkage". this brings up the actionscript3 properties for that particular movieclip. give your visual style a name I used "blaqueButtonSkin". now take a look at the base class for this object. it need to be set to "mx.flash.UIMovieClip". the user interface movieclip class is setup to look for the names of the keyframes to decide which images to use for the different states of your skinned components. so make sure you keep the frame names set to "up, over, down, and disabled" or flex will not be able to parse your skin!



the last step in flash is to generate our skin library for flex. click "File... Publish Setting" (or ctrl+shift+f12) make sure your swf setting are set to actionscipt3, and the "Export .SWC" checkbox is checked. then publish your skin. take a look in the directory that flash published to. there should be a few files in there, but were only going to be concerned with the SWC file. copy that file to the clip board and open flex 3.

in flex start by creating a new MXML application. then right click on the /libs folder and paste in our skin.swc file. everything in the lib (or library) folder is automatically added into flex's available namespaces to be used in your application. switch into the source code tab and add a style tag to your application. then add the following css...

    css code
  1. Button {
  2. skin: Embed(skinClass="blaqueButtonSkin");
  3. color: #ffffff;
  4. textRollOverColor: #ffffff;
  5. textSelectedColor: #ffffff;
  6. textAlign: left;
  7. }

notice how the skin is applied to the button with the "skin" tag and we're using the linkage name we set in flash, blaqueButtonSkin. also by using the embed keyword in conjunction with the skinClass tag will attach your visual style completely, even during design time.

one thing to note is that some of the components are based on other ones. the for instance, its template file only contains the up and down arrows. the textbox that the actual selected number appears in is based on the regular flex component. so to skin both parts you will need to make a skin for the numericstepper as well as the textarea. but you can save both of those files into one swc by just copying and pasting the library object from one template into the library of another one.

tracing 3D objects with papervision3D

demo, code, actionscript, flex, flash, papervision3D, fontz, mxml, tutorial


a question popped up on the papervision3D mailing list the other day about using the lines3D class to trace a 3D object. i found the idea fascinating, so i whipped up this little demo to demonstrate how simple it actually was. i started out by creating a simple cylinder with a wide base and small top, and setting its visibility to false. then creating my lines3D object. finally in the render loop i create a new line3D that connects each vertice. by checking to see in a counter variable is less than the total object vertice count ((box.geometry.vertices.length)), and adding a new line3D if the counter is less than that, or deleting all the lines and starting over.

check out that demo here
view the demo source

so that wasnt enough.
i decide that i wanted to trace the actual papervision3D logo. and since i have already made it in a font, it wasnt hard at all. working with the optimized version of the font on my site worked fine, but since there were so few verticies, the script would draw the logo in a matter of seconds. so instead of trying to devise a method of tweening from vertice to vertice i just went into font lab and added more points!
((the font used in this demo is available here))

now, i went into 3D studio max, clicked the "Splines" button, and created a new text object. i used the new PV3D.Flex.Font i just made, set the size to 100 (larger/smaller is fine) and typed in the letter "A" (the only character in the font).

after that i used the rotation tools to stand the letter upright, and moved it forward some. the next step is to do a mesh select, by clicking the modifiers tab and selecting "Mesh Select" from the dropdown menu. then in the mesh select parameters panel select vertices. now click back into your main perspective and select all the vertices (ctrl+a).


the next step is an important one ((and the one i always forget)) we need to give our 3D object a uvw mapping. still under the modifiers tab, select "UVW Mapping" from the dropdown list. and under the parameters panel make sure its mapping mode is set to "Planar". i was having all kinds of trouble exporting 3D objects that were based on points only. seraf explained to me that w/o a uvw mapping on your object the as3geomClassExporter cant map the u and v points onto the triangle mesh, which are needed for texturing purposes.


now its time to export our 3D logo, click on the tools tab and select max script, then run the as3geomClassExporter. set your package folder and the actual class name, then select papervision3D 2.0 from the dropdown list. for this particular object i left the scale set to 1. then click export class and save it in the same folder as you set in your package.



then its onto flex.
i decided i wanted to use the math-based color fade from my last demo again, so i couldnt use the standard color picker. this demo uses 2 states, normal and the color picker. which is just a 2nd state with a panel object w/ blank flex buttons on them. using the flex buttons worked out well because i was able to just set the color gradient to the same colors in the fade, or just solid ones for the normal sets. i tried to make is one a simple as possible so you can understand the core concepts of whats going on more than the over-all "flashy-ness" of the thing. so enjoy!

click here to view the demo
and its source of course!

as3 geometry class exporter

flash, downloadz, linx, actionscript, code, papervision3D, tutorial

a new component for 3D studio max has arrived that allows you to export the geometry of you model directly into a format that actionscript 3 can understand. the plugin has options for exporting to papervision3d, away3d, and sandy. it was developed my dreammania.net and can be downloaded here. and exporting a model couldnt be easier.

step 1. create you model, and select it
(you can tell its selected because of the white bounding box)

step 2. open the utilities panel and select MaxScript

step 3. in the MaxScript window, select Run Script

step 4. select the as3GeomClassExporter.ms file,
then select it from the drop down

step 5. a new as3GeomClassExporter panel will appear. select you 3D engine, give your object a class name, and a package location (if necessary) then press the export class button to save it.


now using this object in papervision3D is a snap! just...

    actionscript 3
  1. import com.fontvirus.KnotAgain;
  2. var theKnot:KnotAgain = new KnotAgain( skin );

asp.net pure code database connection

code, database, dotnet, C#, tutorial, SQL

visual studio 2005 has a tool for connecting to a database called a "sqlDataSource". while this tool works, i find myself wanting to create the connection and build or execute stored procedures within my own C# code. this tutorial will show you how to connect to a sql database 3 different ways in asp.net

the first thing is creating a connection with your database. if you understand how connection strings are built, write your own other wise will can use the visual studio database tool to do that for us.

drag a new sqlDataSource onto the canvas, highlight it, then click the little arrow that appears to reveal configure datasource. in the windows that follow you can create a new database connection (or use an existing one). refresh the server list and select your database server (or localhost). then chose if you want to use windows integrated security (where the server is the database user) or sql server security (where you supply the sql username and password). then select the database you want to connect to on the server, and test your connection.

press ok, and you will return to the previous window, click the little plus sign to expand and show you the connection string that visual studio generated for you. copy it, and click cancel. now you can delete the sqlDataSource and switch to code view.

now the first thing we need to do is create a database connection in our code

    asp.net c# code
  1. SqlConnection con = new SqlConnection("Data Source=DEVELOPMENT;Initial Catalog=rss;Integrated Security=True");
  2.  
hardcoded procedure
    asp.net c# code
  1. int id = 13;
  2. con.Open();
  3. //-create procedure
  4. string select = "SELECT * FROM 'table' WHERE 'id' = @ID";
  5. SqlCommand command = new SqlCommand(select, Con);
  6. //-paramerter adding
  7. command.Parameters.Add("@ID", SqlDbType.Int).Value = id;
  8. //-make a data reader
  9. SqlDataReader reader = command.ExecuteReader();
  10. while (reader.Read())
  11. {
  12. String data = reader["thing"].ToString();
  13. }
  14. //-close connection
  15. con.Close();
using a stored procedure with one parameter
(ie: "DELETE 'tabelname' WHERE 'id' = @ID; ")
    asp.net c# code
  1. int id = 42;
  2. con.Open();
  3. //-setup query
  4. SqlCommand commando = new SqlCommand("deleteUser", con);
  5. commando.CommandType = CommandType.StoredProcedure;
  6. //-paramerter adding
  7. commando.Parameters.Add("@ID", SqlDbType.Int).Value = id;
  8. //-execute the query
  9. commando.ExecuteNonQuery();
  10. con.Close();
using a stored procedure without any parameters
(ie: "SELECT * FROM 'tabelname' ;")
    asp.net c# code
  1. con.Open();
  2. //-select a stored procedure
  3. SqlCommand commander = new SqlCommand("getFilename", con);
  4. commander.CommandType = CommandType.StoredProcedure;
  5. //-make a data reader
  6. SqlDataReader SQLreader;
  7. SQLreader = commander.ExecuteReader();
  8. while (SQLreader.Read())
  9. {
  10. //-select data by array index
  11. String data = SQLreader[0].ToString();
  12. //-select data by sql collumn name
  13. String data2 = SQLreader["name"].ToString();
  14. }
  15. //-close connections
  16. SQLreader.Close();
  17. con.Close();

MMVII .( xero harrison ) . http://the.fontvir.us/b10g
RSS syndication