Sunday 30 June 2013

PHP Basic Calendar with Additional Feature Tutorial

This tutorial is just an add on to my previous tutorial:
PHP Basic Calendar Tutorial By UnknownGhost03 Fix!

Replacing the empty cells, I add previous & next month, days to the current month that user are viewing.

Source code:
<html>

 <head>
   
  <title>PHP Basic Calendar</title>
   
  <script>
   function goLastMonth(month, year){
    if(month == 1) {
     --year;
     month = 13;
    }
    --month
    var monthstring = ""+month+"";
    var monthlength = monthstring.length;
    if(monthlength <=1){
     monthstring = "0" + monthstring;
    }
    document.location.href = "<?php $_SERVER['PHP_SELF'];?>?month="+monthstring+"&year="+year;
   }
   function goNextMonth(month, year){
    if(month == 12) {
     ++year;
     month = 0;
    }
    ++month
    var monthstring = ""+month+"";
    var monthlength = monthstring.length;
    if(monthlength <=1){
     monthstring = "0" + monthstring;
    }
    document.location.href = "<?php $_SERVER['PHP_SELF'];?>?month="+monthstring+"&year="+year;
   }
  </script>
   
 </head>
  
 <body>
  
  <?php
   //get current date or specific month and year
   if (isset($_GET['day'])){
    $day = $_GET['day'];
   } else {
    $day = date("d");
   }
   if(isset($_GET['month'])){
    $month = $_GET['month'];
   } else {
    $month = date("m");
   }
   if(isset($_GET['year'])){
    $year = $_GET['year'];
   }else{
    $year = date("Y");
   }
    
   //get date data for display such as month name
   $currentTimeStamp = strtotime( "01-$month-$year");
   $monthName = date("F", $currentTimeStamp);
  ?>
   
  <table border="1px" cellpadding="0px" cellspacing="0px">
   <tr>
    <td align="center">
     <input style='width:50px;' type='button' value='<'name='previousbutton' onclick ="goLastMonth(<?php echo $month.','.$year?>)">
    </td>
    <td align="center" colspan="5"><?php echo $monthName." ".$year; ?></td>
    <td align="center">
     <input style='width:50px;' type='button' value='>'name='nextbutton' onclick ="goNextMonth(<?php echo $month.','.$year?>)">
    </td>
   </tr>
   <tr>
    <td align="center" width='100px'>Sunday</td>
    <td align="center" width='100px'>Monday</td>
    <td align="center" width='100px'>Tuesday</td>
    <td align="center" width='100px'>Wednesday</td>
    <td align="center" width='100px'>Thursday</td>
    <td align="center" width='100px'>Friday</td>
    <td align="center" width='100px'>Saturday</td>
   </tr>
   <tr>
    <?php
     //get previous month
     $prevMonth = $month - 1;
     $prevYear = $year;
     if($prevMonth <= 0){
       $prevMonth = 12;
       $prevYear--;
     }
     
     $pMonthStr = "" + $prevMonth;
     if(strlen($pMonthStr) <= 1)
       $pMonthStr = "0" + $pMonthStr;

     //get num of day for previous month
     $previousTimeStamp = strtotime( "01-$pMonthStr-$prevYear");
     $prevNumDays = date("t", $previousTimeStamp);

     //get the number of days in the current month and year
     $numDays = date("t", $currentTimeStamp);

     //keep track of the number of cell created
     $counter = 0;
      
     for($i = 1; $i < $numDays+1; $i++, $counter++){
      $timeStamp = strtotime("$year-$month-$i");

      //create empty cell until first day of the month
      if($i == 1) {
       $firstDay = date("w", $timeStamp);
       for($j = 0; $j < $firstDay; $j++, $counter++) {
        //echo previous month day
        $prevDay = $prevNumDays-$firstDay+$j+1;
        echo "<td>$prevDay</td>";
       }
      }
       
      //create new row
      if($counter % 7 == 0) {
       echo"</tr><tr>";
      }
       
      //print day number
      echo "<td>$i</td>";
     }
     
     //fill counter
     $fillCounter = 1;
     //fill up the leftover cells of the table
     while($counter % 7 != 0) {
      //echo next month day
      echo "<td>$fillCounter</td>";
      $fillCounter++;
      $counter++;
     }
    ?>
   </tr>
  </table>
 
 </body>
  
</html>

Tuesday 16 April 2013

PHP MySQL Tutorial: Simple MySQL Config Class

config.php
<?php
 class Config {
  // Config variables
  public $_host = "host"; // eg. localhost
  public $_username = "username";
  public $_password = "password";
  public $_dbname = "dbname"; // Database name
  
  // Constructor
  public function __construct(){
  }
 }
?>
index.php
<?php
 // Include config class file
 include("config.php");
 
 // Create config class
 $config = new Config();
 
 // Create connection
 $con = mysqli_connect($config->_host, $config->_username, $config->_password, $config->_dbname);
 
 // Check connection
 if (mysqli_connect_errno($con))
  die("Failed to connect to MySQL: " . mysqli_connect_error());
 
 echo "MySQL successfully connected!"
?>

Saturday 13 April 2013

Manga Character Design 1 By DinoCaspero

PHP Basic Calendar Tutorial By UnknownGhost03 Fix!

<html>

 <head>
  
  <title>PHP Basic Calendar</title>
  
  <script>
   function goLastMonth(month, year){
    if(month == 1) {
     --year;
     month = 13;
    }
    --month
    var monthstring = ""+month+"";
    var monthlength = monthstring.length;
    if(monthlength <=1){
     monthstring = "0" + monthstring;
    }
    document.location.href = "<?php $_SERVER['PHP_SELF'];?>?month="+monthstring+"&year="+year;
   }
   function goNextMonth(month, year){
    if(month == 12) {
     ++year;
     month = 0;
    }
    ++month
    var monthstring = ""+month+"";
    var monthlength = monthstring.length;
    if(monthlength <=1){
     monthstring = "0" + monthstring;
    }
    document.location.href = "<?php $_SERVER['PHP_SELF'];?>?month="+monthstring+"&year="+year;
   }
  </script>
  
 </head>
 
 <body>
 
  <?php
   //get current date or specific month and year
   if (isset($_GET['day'])){
    $day = $_GET['day'];
   } else {
    $day = date("d");
   }
   if(isset($_GET['month'])){
    $month = $_GET['month'];
   } else {
    $month = date("m");
   }
   if(isset($_GET['year'])){
    $year = $_GET['year'];
   }else{
    $year = date("Y");
   }
   
   //get date data for display such as month name
   $currentTimeStamp = strtotime( "01-$month-$year");
   $monthName = date("F", $currentTimeStamp);
  ?>
  
  <table border="1px" cellpadding="0px" cellspacing="0px">
   <tr>
    <td align="center">
     <input style='width:50px;' type='button' value='<'name='previousbutton' onclick ="goLastMonth(<?php echo $month.','.$year?>)">
    </td>
    <td align="center" colspan="5"><?php echo $monthName." ".$year; ?></td>
    <td align="center">
     <input style='width:50px;' type='button' value='>'name='nextbutton' onclick ="goNextMonth(<?php echo $month.','.$year?>)">
    </td>
   </tr>
   <tr>
    <td align="center" width='100px'>Sunday</td>
    <td align="center" width='100px'>Monday</td>
    <td align="center" width='100px'>Tuesday</td>
    <td align="center" width='100px'>Wednesday</td>
    <td align="center" width='100px'>Thursday</td>
    <td align="center" width='100px'>Friday</td>
    <td align="center" width='100px'>Saturday</td>
   </tr>
   <tr>
    <?php
     //get the number of days in the current month and year
     $numDays = date("t", $currentTimeStamp);
     
     //keep track of the number of cell created
     $counter = 0;
     
     for($i = 1; $i < $numDays+1; $i++, $counter++){
      $timeStamp = strtotime("$year-$month-$i");
      
      //create empty cell until first day of the month
      if($i == 1) {
       $firstDay = date("w", $timeStamp);
       for($j = 0; $j < $firstDay; $j++, $counter++) {
        echo "<td>&nbsp;</td>";
       }
      }
      
      //create new row
      if($counter % 7 == 0) {
       echo"</tr><tr>";
      }
      
      //print day number
      echo "<td>$i</td>";
     }
     
     //fill up the leftover cells of the table
     while($counter % 7 != 0) {
      echo "<td>&nbsp;</td>";
      $counter++;
     }
    ?>
   </tr>
  </table>

 </body>
 
</html>

Friday 5 April 2013

HTML5 Tutorial: Basic Structure

<!DOCTYPE html>
<html lang="en">

 <head>
 
  <meta charset="utf-8" />
  <title>Website Title Here</title>
  
 </head>
 
 <body>
  
 </body>
 
</html>


Tag lists link:

Wednesday 6 March 2013

XNA 3D Tower Defense for Windows Phone 7.1: On Development Progress 003

*[Project Discontinued]


Implemented:
  • Enemy (Basic Spawn, Movement)
  • Add/Remove wall update with reset all enemies waypoints

Tuesday 5 March 2013

Monday 4 March 2013

XNA 4.0 Tutorial: Converting Screen Position To World Position Function

/// <summary>
/// Convert screen position to world position
/// </summary>
public Vector3 ScreenToWorld(Vector2 inPos)
{
    Vector3 minPointSource = graphics.GraphicsDevice.Viewport.Unproject(new Vector3(inPos, 0f), camera.GetProjectionMatrix(), camera.GetViewMatrix(), Matrix.Identity);
    Vector3 maxPointSource = graphics.GraphicsDevice.Viewport.Unproject(new Vector3(inPos, 1f), camera.GetProjectionMatrix(), camera.GetViewMatrix(), Matrix.Identity);

    Vector3 dir = maxPointSource - minPointSource;
    float zFactor = -minPointSource.Y / dir.Y;
    Vector3 zeroWorldPoint = minPointSource + dir * zFactor;

    return zeroWorldPoint;
}

XNA 3D Tower Defense for Windows Phone 7.1: On Development Progress 001

Implemented:
  • Rotated tile selector to select which tile to edit
  • Top view camera which is drag able
  • Simple map class with empty 2D array to store which tiles is walk able for Enemy AI

SP 2013: Bulbs


Team Members:
  • Muhammad Azharuddin Bin Azhar (DinoCaspero)
  • Dickson Ang Jun Wei
  • Mohammad Nashrulhaq Abdullah
  • Ang Jun Yao
  • Edgar Wong Yu En
Platform:

XBox 360

Software Used:
  • XNA 4.0 (C#)
  • Visual Studio Professional 2010
  • Autodesk 3DS Max 2012
  • Adobe Photoshop CS5
More Information:
  • 2.5D battle platform game
  • Character selection available
  • 2 - 4 players game
  • Animation implementation
  • Bloom shader

SP 2013: Wizard Lodge Level Design


Team Members:
  • Muhammad Azharuddin Bin Azhar (DinoCaspero)
  • Dickson Ang Jun Wei
  • Leslie Lau Wei Qi
Software Used:
  • Unreal Engine 2010
  • Autodesk 3DS Max 2012

SP 2013: Pac Man Remake

Platform:

Windows

Software Used:
  • Panda3D (Python)
  • Visual Studio Professional 2010
  • Autodesk 3DS Max 2012
  • Adobe Photoshop CS5
More Information:
  • Finite state management implementation for AI
  • AStar pathfinder for AI

Sunday 3 March 2013

SP 2013: Relic Dissonance 2

Team Members:
  • Muhammad Azharuddin Bin Azhar (DinoCaspero)
  • Dickson Ang Jun Wei
  • Jeric Yim Jun Kang
Platform:

Windows

Software Used:
  • DirectX 9 (C++)
  • Visual Studio Professional 2010
  • Adobe Photoshop CS5
  • Autodesk 3DS Max
Link:

More Information:
  • Quest implementation
  • Particle effects implementation

Bulbs Characters Model Design

Friday 1 March 2013

SP 2013: Battle Bombers

Team Members:
  • Muhammad Azharuddin Bin Azhar (DinoCaspero)
  • Dickson Ang Jun Wei
  • Mohammad Nashrulhaq Abdullah
Platform:

XBox 360

Software Used:
  • XNA 4.0 (C#)
  • Visual Studio Professional 2010
  • Autodesk 3DS Max 2012
More Information:
  • 2.5D battle platform game
  • 2 player game in split screen
  • Character selection available

SP 2013: Haunted Mansion Level Design

Team Members:
  • Muhammad Azharuddin Bin Azhar (DinoCaspero)
  • Dickson Ang Jun Wei
  • Leslie Lau Wei Qi
Software Used:
  • Unreal Engine 2010
  • Autodesk 3DS Max 2012

SP 2012: Galactic Tank

Platform:

Windows

Software Used:
  • Panda3D (Python)
  • Visual Studio Professional 2010

SP 2012: Relic Dissonance

Platform:

Windows

Software Used:
  • DirectX 9 (C++)
  • Visual Studio Professional 2010
  • Autodesk 3DS Max 2012
Link:


SP 2012: Super Human Secret Lab Level Design


Team Members:
  • Muhammad Azharuddin Bin Azhar (DinoCaspero)
  • Dickson Ang Jun Wei
  • Leslie Lau Wei Qi
Software Used:
  • Unreal Engine 2010
  • Autodesk 3DS Max 2012

SP 2012: Galactic Guardian

Platform:

XBox 360

Software Used:
  • XNA 4.0 (C#)
  • Visual Studio Professional 2010
  • Autodesk 3DS Max 2012
More Information:
  • Radar implemented
  • Tank turret bone rotate up and down
  • Simple physics for cannon ball

SP 2012: Dominatus Arena

Game Description:

In the planet Kuglo, Red, Green, Blue, and Yellow factions battle for dominance over one another. Each faction sends a representative into the Dominatus Arena to battle each other.

The winner of this battle royale shall achieve dominance over all other facctions and reign supreme in Kuglo!

Team Members:
  • Muhammad Azharuddin Bin Azhar (DinoCaspero)
  • Leslie Lau Wei Qi
Features:
  • Character colors selection
  • 2 maps available, opened and closed arena
Platform:

Windows Phone 7.1

Software Used:
  • XNA 4.0 (C#)
  • Visual Studio Professional 2010
  • Adobe Photoshop CS5
Link:


More Information:
  • AStar pathfinder implement for AI
  • Shop and inventory  implemented

SP 2012: LightUp

Platform:

Adobe Flash Player

Software Used:
  • Adobe Flash Professional CS5
Link:


More Information:
  • Masking gameplay
  • 5 levels

SP 2012: Recrafto


Platform:

Windows

Software Used:
  • DirectX 9 (C++)
  • Visual Studio Professional 2010
More Information:
  • Minecraft game concept

SP 2012: 3D Car Modeling & Import to UDK

3DS Max Screenshot:

UDK Screenshot:

SP 2012: The Annoying Mat Game Trailer


Platform:

Adobe Flash Player

Software Used:
  • Adobe Flash Professional CS5 (Actionscript 3.0)

SP 2012: Breakout Remake


Platform:

Windows

Software Used:
  • DirectX 9 (C++)
  • Visual Studio Professional 2010
  • Microsoft DirectX SDK (June 2010)

SP 2012: Flag Raiser Mobile


Game Description:

You are a volunteer, supporting a charity in a Flag Day event.
Sounds boring? Not!
Challenge yourself by collecting as much money as possible within the time limit!

Features:
  • Bonus smiley give you additional money for each happy smiley you received
  • Bonus smiley also decrease the money deducted for each angry smiley
  • Hidden thieves disguise themselves as normal people, stealing all the money you have collected
Platform:

Windows Phone 7.1

Software Used:
  • XNA 4.0 (C#)
  • Visual Studio Professional 2010
  • Adobe Photoshop CS5
Link:

http://www.windowsphone.com/en-sg/store/app/flag-raiser/87252dcc-0256-48d3-942d-5186118c0b26

More Information:
  • This game won the Nokia Knight Competition 2012 for the best apps category.

SP 2011: Portfolio Website Design

ITE CE Final Year Project 2010: Flag Raiser

Game Description:

Flag Raiser is a 2.5D platform game which consist of 3 levels. The game objective is to collect the numbers of coins required by each level by the given time limit.

Team Member:
  • Anbarasan
  • Azharuddin (DinoCaspero)
  • Leslie 
  • John
Software Used:
  • XNA 3.1 (C#)
  • Visual Studio Professional 2008
  • Adobe Photoshop CS3
  • Adobe After Effects CS3