July 16 2010 by
Ryan Carter in
PHP |
This is extremely helpful when trying to figure out what is going on in your page. When troubleshooting or just trying to figure out what data is in that mysteriously finicky array, this is a charmer: Var_Dump the contents of an Array <?php $arr = array(); //start the array empty $arr[] = 1; // these [...]
You need to start with document ready of course, and include your jQuery script in your page as shown below, then adding a delete confirmation to any button is as easy as this: <script type="text/javascript" src="jQuery/jQuery-1.4.2.js"></script> $(document).ready(function(){ // here’s the magic: $(‘.delete’).click(function(){ // this will display a confirm (ok/cancel) pop-up box var result = [...]
To set the text, or displayed value of a Label Control in ASP.NET, do this: lblName.Text = "Ryan"; One thing to note is how to name label controls, with a prefix of “lbl” which helps you identify the type of control anywhere in the code. Also, if you are going to be using a variable [...]
July 15 2010 by
Ryan Carter in
PHP |
Is there an echo echo echo…in here? Echo, if you don’t know, is how you output stuff to the screen. Like this: <?php echo ‘Hello, how are you?’; ?> Echo is used heavily in any php program, and you can do goofy crazy things, like: <?php $firstname = ‘Ryan’; $lastname = ‘Coder’; echo ‘Hello ‘.$firstname.’ [...]
July 15 2010 by
Ryan Carter in
SQL |
The local variables here can be ones you send to your stored procedure, local variables, whatever. The first set of parenthesisW “()” contains the list of fields you want to put data in, like telling someone to stuff a flyer in certain mailboxes (except for that being illegal). The second list is the values or [...]
July 15 2010 by
Ryan Carter in
SQL |
DECLARE @var1 VARCHAR(50) SET @var1 = ‘hello’ Then you can use it in your SELECT (and other) statements later, like this: SELECT * FROM tablename WHERE welcomemessage = @var1
July 15 2010 by
Ryan Carter in
SQL |
To repeat a block of code in SQL until a certain condition is reached, you can use a WHILE loop, like this: –DECLARE your vars first DECLARE @var1 INT DECLARE @var2 INT –the WHILE itself WHILE @var1 > 10 BEGIN @var2 = @var2 + @var1 IF @var2 > 10 BREAK END The IF block [...]
July 15 2010 by
Ryan Carter in
XHTML |
Strict <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> Transitional (my favorite) <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> Frameset <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
July 15 2010 by
Ryan Carter in
SQL |
CREATE PROCEDURE procedureName @var1 INT, @var2 VARCHAR(255) AS BEGIN SELECT * FROM tablename WHERE fieldname = @var1 END
$this->set(’posts’,$this->Post->find(’all’)); Typically for an index action, like this (in the controller context): Location: /app/controllers/posts_controller.php <?php class PostsController extends AppController{ var $name = ‘Posts’; function index(){ $this->set(’posts’,$this->Post->find(’all’)); } } ?>