Simply Program

Simply programming - It’s a life style
Filed under Programming, PHP

When you start creating advanced applications that require different types of data that may be defined by a developer using your system you come across a very interesting issue.

Dynamic Variables...

They are quite easy to master, just look at the below example.

CODE:
  1. $foo = 'howdy';
  2. $$foo = 'not howdy';
  3.  
  4. echo $$foo; //should return not howdy

Learn more by going here:

http://www.php.net/manual/en/language.variables.variable.php

Comments (0) Posted by sp on Thursday, July 17th, 2008


Filed under Make you smile

Enjoy!

http://www.youtube.com/watch?v=g0dIpYw75jA&feature=user

Comments (0) Posted by sp on Wednesday, July 16th, 2008


Filed under Programming, PHP

http://www.phpdoc.org/

Easy, Fast, and Efficient.

Just make sure your code is developed within a standard and you comment very well.

Comments (0) Posted by sp on Wednesday, July 16th, 2008


Filed under Programming, Javascript

In some situations we are required to take a value that was intended to be a string and convert it to a numerical value for calculations.

In this situation we would implement a form of variable control called "Casting".

CODE:
  1. //String
  2. var string = "5.00";
  3.  
  4. //What would happen if we wanted to add another 5.00 to string?
  5. //Well, it would append the 5.00 to the original 5.00 - Example: 5.005.00
  6. //We need to Cast "string" so that we can do numerical calculations.
  7. var numeric = parseFloat(string)+5.00;
  8. //You can use
  9. //parseFloat - number with a decimal point.
  10. //parseInt - whole number.

Simple and effective.

Comments (0) Posted by sp on Thursday, July 10th, 2008


Filed under Programming, PHP

How do you show errors for a single php script when the entire server has the enviorment variable "display_errors" set to 0?

Simple - place the below code at the top of your script.

CODE:
  1. ini_set("display_errors", 1);
  2. error_reporting(E_ALL);

ini_set - allows you to mess with your php.ini file.
error_reporting - sets what kind of errors you wish to show.

Comments (0) Posted by sp on Wednesday, July 9th, 2008


Filed under Programming, PHP

My current employer is in need of a very simple advertisement plugin to be created for their WordPress system - so of course I have decided to use this as an opportunity to create a custom plugin for experimental reasons.

Plugin Title: Make Me Money

Lets see if it does haha.

Comments (0) Posted by sp on Wednesday, June 4th, 2008


Filed under Annoucements

TutorialMachine.com has finally launched, time to start loading Tutorials from photoshop to css design.

Comments (0) Posted by sp on Monday, May 26th, 2008


Filed under Programming, Javascript

Please review this great example by Dav Glass:

http://blog.davglass.com/files/yui/animseq/

Comments (0) Posted by sp on Saturday, May 24th, 2008


Filed under Programming, Javascript

Just an example.

CODE:
  1. /**
  2. * Collects all inner elements and resizes accordingly.
  3. * @method resizeAll
  4. */
  5. this.resizeAll = function () {
  6. var tempEL = el;
  7. var tempObj = tempEL.getElementsByTagName("img");
  8. for(i=0;i<tempObj.length;i++){
  9. var tempAnimation = new YAHOO.util.Anim(tempObj[i].getAttribute("id"), this.attributes, this.duration, this.method);
  10. tempAnimation.animate();
  11. }
  12. var tempObj = tempEL.getElementsByTagName("input");
  13. for(i=0;i<tempObj.length;i++){
  14. var tempAnimation = new YAHOO.util.Anim(tempObj[i].getAttribute("id"), this.attributes, this.duration, this.method);
  15. tempAnimation.animate();
  16. }
  17.  
  18. }

Comments (0) Posted by sp on Friday, May 23rd, 2008


Filed under Programming, Server

I am always on the lookout for a nice simple htpasswd generator and I found a pretty nice one.

http://www.htaccesstools.com/htpasswd-generator/

Enjoy!

Comments (0) Posted by sp on Thursday, May 22nd, 2008