Archive for the ‘ Programing ’ Category

Upgrading to CodeIgniter 2.0


As soon as I saw the tweet from EllisLab that CodeIgniter 2.0-dev was available on BitBucket I instantly converted PyroCMS to run on it. I got it all working in a few hours after LOTS of headbanging, mouse throwing and blaspheming. All the bugs I found along the way have since been fixed in the 2.0 branch by the Ellis developers or myself.

While this does not mean everything is running perfectly, at the time of writing all the worrying bugs are squashed so it should be safe for us to have a play.

Grab those new files

Download the new files from BitBucket.

What goes where

Slight change in the folder structure for some of you, the application/ folder and the system/ folder now sit next to each other.

So move your application folder up one level to sit next to system/ then delete that system/ folder. That has killed off CodeIgniter 1.7.2. Bye!

Now you need to copy the new downloaded system/ folder to the empty gap where the old one was.

Sadly that is not entirely it. You must also copy the following files from the new download to your installation:

  • index.php
  • application/config/foreign_chars.php
  • application/config/profiler.php

Noticed that your controllers and models are broked?

CodeIgniter Controllers and Models used to be defined extend like this:

class Blog_model extends Model

Now in CodeIgniter 2.0 you write:

class Blog_model extends CI_Model

Update 10/11/2010: Remember to do this for Controllers too. Instead of Foo extends Controller, you must now write Foo extends CI_Controller and all parent::Controller() calls must be changed to parent::__construct()!

Let’s not argue about why, what, who, where, when, the fact is you have to do this. It can be achieved with some simple Find & Replace over your folder if your IDE/Text editor will allow it. For most applications (especially ones built primarilry during the 1.7.x era) you are nearly there now. Unless you use plugins or the old Validation class…

Artificial Neural Network


Long time no see guys, I have no time to write down my whole activity recently. Many things I’ve learn this week, especially in Java, HTML5, and PHP programming. Thanks to all my friend for supporting me till this second and hopefully every good things will happen to you all guys.

Alright, back to the main topic, this time I’ll give you little review about Artificial Neural Network or we can call it ANN. An artificial neural network (ANN), usually called neural network (NN), is a mathematical model or computational model that is inspired by the structure and/or functional aspects of biological neural networks. A neural network consists of an interconnected group of artificial neurons, and it processes information using a connectionist approach to computation. In most cases an ANN is an adaptive system that changes its structure based on external or internal information that flows through the network during the learning phase. Modern neural networks are non-linear statistical data modeling tools. They are usually used to model complex relationships between inputs and outputs or to find patterns in data.

More about ANN you can see it here..

Starting with HTML 5


What is HTML5?

HTML5 will be the new standard for HTML, XHTML, and the HTML DOM. The previous version of HTML came in 1999. The web has changed a lot since then. HTML5 is still a work in progress. However, most modern browsers have some HTML5 support.


How Did HTML5 Get Started?

HTML5 is a cooperation between the World Wide Web Consortium (W3C) and the Web Hypertext Application Technology Working Group (WHATWG). WHATWG was working with web forms and applications, and W3C was working with XHTML 2.0. In 2006, they decided to cooperate and create a new version of HTML. Some rules for HTML5 were established:

  • New features should be based on HTML, CSS, DOM, and JavaScript
  • Reduce the need for external plugins (like Flash)
  • Better error handling
  • More markup to replace scripting
  • HTML5 should be device independent
  • The development process should be visible to the public

New Features

Some of the most interesting new features in HTML5:

  • The canvas element for drawing
  • The video and audio elements for media playback
  • Better support for local offline storage
  • New content specific elements, like article, footer, header, nav, section
  • New form controls, like calendar, date, time, email, url, search

Browser Support

HTML5 is not yet an official standard, and no browsers have full HTML5 support.

But all major browsers (Safari, Chrome, Firefox, Opera, Internet Explorer) continue to add new HTML5 features to their latest versions.

Malang [Googlemap Embed]


I have no idea about the topic, I just try to embed a google map. Hahahaha thanks for tutorial dude. I love API Programing.



Delphi 2010 for Windows 7


I do love windows 7, but it almost like pain in the ass when I cant use my Delphi, lol its the old version. My friend told me to use Delphi 2010, this version is released by Embarcadero.

This is the best Delphi GUI I ever ran in my laptop. I took a few screenshoots, here they are..

Internet Browser ModeInternet Browser Mode

Starter ScreenStarter Screen

 

Opening Project

Opening Project

Warning:Overload, Warning:Overload


warning

warning

For the last week or so I have been working on a pretty significant software development project for the future. It didn’t start out that complicated – what it’s doing isn’t that complicated, but what you can do with it is complicated, and it’s doing my head in.

 

I can’t explain exactly what I’m building (it’s all top secret), but I suppose an analogy might go some way towards helping you understanding my plight – and then feeling sorry for me.

The analogy

  • Imagine a set of magic dominoes.
  • Imagine you can make the dominoes listen to each other, so perhaps when one falls over, other related ones fall over too.
  • Imagine that standing a domino back up causes a different set of related dominoes to stand back up too.
  • Now try and make a domino topple out of them all, and verify that exactly what should have happened did happen.
  • Just for fun, let the domino topple go in multiple directions at once, and verify that it’s all behaving.

I had one small bug in the code this morning – something I forgot to implement – and the whole thing ground to a halt for 2 hours while I pulled most of my hair out, kicked the desk, and stared incredulously at my own code.

My mood this morning could therefore be described thusly;

  • 9:00am – I hate computers
  • 10:00am – Oh god, what have I built
  • 11:00am – It’s going to be the death of me
  • 12:00am – YAY! I win, I rule, I am the master of all I survey

This kind of grandstanding is pretty common when I solve something complicated… usually punctuated with kicking myself away from my desk on my office chair, fists in the air, doing a mini celebration.

This morning the girl opposite nearly spat her tea out laughing at me, lol just imagine. Actually she laughed at me when she knew what I hate.. 😦

Errr dasar anak buah yang tidak berbakti, kerja lom lama dah mita naek jabatab jadi nyoya, lol I’m sory guys. Seems like I’m out of topic..

Factorial.java


Dedicated to someone who made me feel like I’m a bad guy.. >.<

The main idea of using recursive method to calculate the factorial is call back the method till n=1. The method has the fuction to calculate n*(n-1). LOL, I’m so sorry if you cant sleep tonight because of this code. 🙂

import java.util.*;

/**
 * Factorial.java
 *   A recursive program to calculate the factorial
 *   of a number.
 *   n! = n * (n-1) * (n-2) * ... * 1
 *
 *   A recursive definition of factorial is:
 *   n! = 1          if n <= 1
 *      = n * (n-1)! if n > 2
 *
 * @author Sofa Zainuddin
 * @author Computer Science, Brawijaya University
 * @version 1/15/2011
 */
public class Factorial {
    public static void main (String[] args) {

        Scanner in= new Scanner(System.in);
	int theNum, theFact;

	System.out.println("This program computes the"+
        "factorial of a number.");
	System.out.print("Enter a number: ");
	theNum=in.nextInt();

	theFact = fact(theNum);

	System.out.println(theNum + "! = " + theFact + ".");
    }

    /**
     * Calculate the factorial of n.
     *
     * @param n the number to calculate the factorial of.
     * @return n! - the factorial of n.
     */
    static int fact(int n) {

	// Base Case:
	//    If n <= 1 then n! = 1.
	if (n <= 1) {
	    return 1;
	}
	// Recursive Case:
	//    If n > 1 then n! = n * (n-1)!
	else {
	    return n * fact(n-1);
	}
    }
}