Abstract

PHP Abstract, podcast even I can enjoy

Podcast isn't the kind of media I would like to receive, since reading is much faster than listening.

The above image states the only reason I ever tried the PHP Abstract, Cal Evans is giving out free books to blog about it1! Running Happily
So I picked out 2 podcasts and listened to them...
Oh... cheesy opening...

After hearing the Five Ways To Kill a Software Project. It's mostly about how to not do software project for clients. Some things I definitely want to remember. Not now though. the only client is myself....

The opinionated software one is one thing that's really struck me. I don't mean I'm a person creating millions of configurations for the users, I don't give the users options for configure them because everything I wrote is so delicate2. Sounds like PHP codes for embedded systems. I have the feelings I can never write something suitable for anyone else but me.

The podcast's opening + ending took 1 minute in total, that's quite long compare to the entire podcast. Come on, it's an abstract, extended brief news, cut to the point...

Oh, that reminds me another reason I like reading better. No one can jump though sections in podcast as easy as textbooks.
[Nothing against podcast, I'm just jealous about the people who have a iPod to listening to podcast on the go]

So, I recommend PHP Abstract to anyone who have interest in new(or interesting) stuff in PHP and can find 10 minute on a average week3 sitting in the bus with an ipod.

  1. 1. won't it be cool if I can get something not from my book collection
  2. 2. configuration for prime spirals and matrix rain effect? Don't think so
  3. 3. that's 59.52 milliseconds per average minute

Serializing Objects in PHP

Title :Serializing Objects in PHP
Full Article: http://www.phphacks.com/content/view/34/33/

Recommended to : Beginner PHPer and PHPer just starting OO

Introduction: Object serialization is a technique to turn an object's properties and methods into a string. It is then stored in flatfile or database. Unserialize them will turn the object into the original state and can be processed in PHP. This article from phphacks.com shows how to build a class that can self serialize and unserialize.

Abstract:
To serialize a object, use serialize($object). To unserialize, use unserialize($object). The writer demonstrate the usage by making a simple class that simply store data into file. Then, adding a new function in the original class that allow serialization the object itself by this code serialize($this). The serialized object is then stored into a file. Restoration of the file needs another function. The function called fetch() fetches the file and unserialize it. "$newObj = $objSaver-> fetch();" will create an object that's same as the $objSaver.

Facts from Conclusion:

  • Serialization turns a object into string for storage.
  • Unserialization restores a string into an object for PHP script to use.
  • Self-serializing and unserializing objects can be a root class for all classes that need to serialized.

Editor Comment:

Serialize is a practice quite popular around the OO PHPers. The popular CMS e107 uses Serialized object to store settings in the database.

Introduction to Abstract classes in PHP

Title :Introduction to Abstract classes in PHP
Full Article: http://www.phphacks.com/content/view/35/33/

Recommended to : Beginner PHPer

Introduction: An abstract class is a class that cannot(or should not) be instantiated. This is an example of how to create an abstract class by the guy(s) from phphacks.com

Abstract:
Like the introduction said, you only need to ensure this class can't be instantiated. The first version is make an class with a prototype function. The prototype function contains die() command, so when the class it's called, the script simply dies. To improve the code, trigger error is used instead of die. A new conditional test tests if the class called is the abstract class by using a constant _CLASS_. Now this class can't be instantiated by anything other than its subclass. In the final script, a conditional check for the subclass is added. _CLASS_ is replaced with get_class($this).

Facts from Conclusion:

  • Abstract class are classes can't be instantiated.
  • Use get_class($this) insted of the _CLASS_ constant.

Editor Comment:

What's the point of making a class can't be instantiated? I don't know. I was never in a position where I have to organize a well-structured hierarchy. Will you ever need to use abstract classes? I don't know :) But you could learn something about improving coding though this tutorial

How to display Tabular Data--a new perspective

Title : How to display Tabular Data -- a new perspective
Full Article: http://www.webreference.com/programming/javascript/ne/index.html

Recommended to : Any webmaster, Javascripter

Introduction: Nicolas Erlijman showing us a new way to display tabular data without making the table change in size.

Abstract: Normally, a table uses relative size(%) in width can result these 3 problems:
1. cells grow in height: When a field contains too much data
2. ugly scrolling appears: When a field have data that can't be split into different lines
3. Using fixed table values won't solve the problem.
To fix the problems, here are the steps.
1. Use a read only input text controls
2. Get the width of all characters
3. make floating buttons allow user to scroll only one cell
The result
Compatibility: IE 5.5, FF 1.5, NS 8.1, Opera 8.5

Facts from Conclusion:

  • Fixed table width is Evil!
  • Create a span with innerHTML set to a text, the span.offsetwidth will be the string length
  • Don't restrict your mind. There are better interface for humans

Editor Comment:

This is a refreshing idea. I used computer and loved it when I was five. I never thought of this idea until today. I should be ashamed of myself. so should anyone who doesn't read this article.

Syndicate content
Honey Pot that kill bots