Archive for the Tag 'PHP'

Feb 16 2008

Posted by coen under General,PHP,c++

About how school can be enjoyed again

Finally I have some time to write another post to you, my dear readers!

After starting up the HULK for about a fortnight, we started to bring up ideas for projects (so if anyone has an idea…). Actually, while I’m writing this I realize that I haven’t told you anything yet about the HULK (hmm.. weird).
Well, HULK stands for Hogeschool Utrecht Linux Kennisgroep, and consists of a few classmates and yours truly, who try to give Linux a shot in our university, the Hogeschool of Utrecht. The website is in Dutch, so if you want to follow up on it, you have to be able to read it.

We thought about some really cool projects like building our own Ubuntu distribution, HUbuntu , setting up Linux on mobile devices, teaching Unix, and also some smaller projects like building a logbook to keep track of what we’re doing and to provide student services (SSH access, web servers, database servers, etc.). Apart from that, I’ve started learning c(++), and for practice I’m building an IRC client, called skaar.

Next week, together with Mattijs, I’m starting on the logbook which will be built in PHP, so that we can start logging quickly.

Keeping you posted!

4 Comments »

Dec 29 2007

Posted by coen under PHP

One step at a time

Some time ago I wrote about some great plans for writing an or-mapping. Well, today, I actually made some progress!

Before I started to write on this code, I divided it in three parts:

  1. Creating Objects
  2. Updating Objects
  3. Deleting Objects

I finished a test version of the first part today. Basically, this is how it works: There is a class Object that should be extended by every class that has to be in a database. If you create a class extending this one, it will also be created in the database (if it doesn’t exist yet) as a table. For example, see this class:

 

/**
 * foo
 * bar
 * @table_name=__TEST__
 *
 */
class Test extends Object {    
     /**
     * @nullable = false
     */
    private $firstname; 

    private $lastname; 

    /**
    * @type = string(12)
    * @nullable = false
    */
    private $dateofbirth; 

    private $city; 

    function __construct() {
       parent::__construct();
   } 

    public function getFirstName(){
   	return $this->firstname;
   } 

    public function setFirstname($firstname){
   	$this->firstname = $firstname;
   } 

    public function getLastname(){
   	return $this->lastname;
   } 

    public function setLastname($lastname){
   	$this->lastname = $lastname;
   } 

    public function getDateofbirth(){
   	return $this->dateofbirth;
   } 

    public function setDateofbirth($dob){
   	$this->dateofbirth = $dob;
   } 

    public function getCity(){
   	return $this->city;
   } 

    public function setCity($city){
   	$this->city = $city;
   }
}

Will result in this table:
table screenie


Pretty cool, huh? I still have to do some work, but the base is there. As you can see, you can also use some kind of annotations to set the information for the table and the columns in the database, but there are also default settings if they are omitted.
Enough for today, I’m going to celebrate my weekend and “Oud & nieuw”, as we call New Year’s Eve in Holland :) Soon more about this!

6 Comments »

Dec 18 2007

Posted by coen under PHP

Great plans

In the 2nd year of my study at the HU we learned about J2EE, in particular EJB. Happy with the general idea of never writing another line of SQL, we started doing our school projects with EJB. However it’s true that you don’t write SQL, there is EJB-QL, which looks a darn lot like SQL.
While I like the concept, I wonder if Java is the right language to use. I can’t help thinking about all the layers my poor code has to go through, and how can that ever be fast? Anyway, according to this test, Java is way faster than PHP, which was originally intended for the web (Wikipedia also has a nice comparison about this).

Strangely enough, at that time there was no framework or abstraction layer available for PHP, so I started building one myself. The idea was for it to work like EJB, and the result was satisfactory. Then doom hit me, because I lost all that code :( So now I’m going to start all over again, with a slightly different angle: I am going to write a framework that communicates with the Zend Framework, but with a little extra: the Zend Framework does not provide creation and automatic querying for your objects in the database, and that’s what will be the extra in my framework.

1 Comment »