eKini: Web Developer Blog

PHP, MySQL, Javascript, MVC, Zend Framework, AJAX, jQuery

Using E_ALL|E_STRICT a good practice?

September28

I have been using Zend Framework for a few months now, and I really find the E_ALL|E_STRICT set in the bootstrap file really neat. See sample code below:

  1.  
  2. error_reporting(E_ALL|E_STRICT);echo $var;  //display an unset variable. A notice will appear.
  3.  
  4. //using an unset variable inside an if()-condition will also display the notice message
  5. //i use this kind of checking all the time, but i think it would be better to use
  6. //isset() since E_ALL|E_STRICT makes your code "cleaner"
  7.  
  8. if ($var) {
  9.     echo $var;
  10. }
  11.  
  12. //we can avoid this if we use isset()
  13. if(isset($var)) {
  14.     echo $var;
  15. }
  16.  
  17. //so before using a variable, i would set it to ” on the top part of my code
  18. $var = ;
  19. echo $var;
  20. //no notice message will be displayed.

So, I can no longer use variable on the fly. I have to set it somewhere on top of my code and set it to something. Putting a comment beside it really helps too.

  1.  
  2. $str1 = ; //Street Address
  3. $str2 = ; //Building Number
  4. $str3 = ; //Country
  5. …the rest of my code…
posted under Uncategorized | No Comments »

Wasa! New Version of Zend Framework Released!

September27

Lately, I have not been keeping track of Zend Framework due to my busy schedule. But today, I was surfing their site and found out that the guys from Zend has released a new version of the Zend Framework. The release has 93 fixes for issues from the previous version and some key improvements include the following:

  • New database adapter for PDO_IBM
  • Custom database profiler support
  • New Google Base support with Zend_Gdata_Gbase
  • Added CAPTCHA support to Zend Gdata
  • Improved PDF component documentation
  • Enhanced search performance
  • More flexible language translation facilities
  • Additional UTF-8 support for validation
  • Documentation of the Zend Framework system requirements

I have been waiting for the PDO_IBM database adapter. I had a project that needed to connect to JD Edwards - back then I had to “manually” connect to it :(. Search my blog for JDE or JD Edwards, I remember posting about it a few months back.

Alrighty then, here is the release announcement  and the download page.

posted under Uncategorized | No Comments »

Die iTunes! Die!

September25

Haha! Steve Jobs, in your face! Finally, DRM-free legal music downloads - by Amazon. This is certainly better than waiting for someone to seed in Bittorrent downloads *cough* (fucking leechers!)… Can’t wait to buy old tracks - these things are so hard to find illegally.

I would have actually preferred getting my music from Amazon instead of downloading them illegally. The record industry should have thought of this years ago. Imagine 2000+ legal DRM-free mp3s? Universal and EMI could have already profited millions.

posted under Uncategorized | No Comments »

New version of iStat Pro Released!

September25

iStat Pro is one of the best system monitoring tools I have found for Macs. Yeah I know, why use it when MacOS X has the Activity Monitor. But I use it because it looks better and it has this temperature monitoring tab which I find very useful - I live in the Philippines and it gets pretty hot here. And best of all, it is free with no strings attached.

posted under General | No Comments »

Free Icons for Web Developers

September25

A nice set of free (as in free beer) icons.

famfamfam.JPG

Click here.

posted under Uncategorized | No Comments »

Sending POST with Streams - PHP

September18

A very interesting blog post from khankennels.com

… sending a POST message and getting its results. We could do it using cURL or sockets - but why work that hard. Being lazy does have its advantages after all.

I found this at phpdeveloper.org

posted under Uncategorized | No Comments »

Zend Framework Tutorial and Notes: Zend_view

September16

The page deals with the following:

  1. How to suppress auto-rendering: This is useful when you have an action that handles AJAX Requests.
  2. Helper Paths: When you want to specify different helper found in different modules/controllers.
  3. Sample Custom View Helper: Where you will place your view helper and what filename it will be called.
  4. Writing Custom Helpers

The Zend_view tutorial can be found here in my Wiki.

posted under Uncategorized | No Comments »

Zend Framework Book

September13

I have been waiting for this. I’m sure that I will be buying a copy as soon as it is released. Written by Rob Allen and Nick Lo, the book will deal more on “real-world” applications. Manning - the publisher has an early access edition and you can read the first chapter (see bottom of this post for the links).

FYI, I had a few lines of chat with Rob Allen (Akrabat) in #zftalk! I was like: “Akrabat from akrabat.com?! /me bows”. I think anyone who started using Zend Framework just a few ago surely has read his excellent tutorial!

allen_cover150.jpgZend Framework in Action is a collaboration between myself and Nick Lo. We are still writing, but Chapter 1 is available for you to download and see where we are heading with the book. Manning has an early access program where you can get access to pre-production PDFs of each chapter if you can’t wait. As a bonus for signing up early, you get to tell us what’s wrong (and what’s right!) before the prose is committed to the printed page so we can fix it and you’ll get a better final book.

In order to set expectations, I should probably point out that Zend Framework in Action is a tutorial book intended to show how to use the components of the framework together within “real world” projects. Each component is dealt with in a “what is it?”, “why use it?”, “how do you use it?”, “let’s use it in the real world” manner. It’s not an advanced exposition of each component as that would take many books!

Click here for Akrabat’s Post.
Here for the book early access edition of the book.

posted under Uncategorized | No Comments »

Object-oriented programming PHP 5 Tutorial

September12

For those who are not familiar with PHP5 OOP, I found this: HERE

There are many benefits of inheritance with PHP, the most common is simplifying and reducing instances of redundant code. Class inheritance may sound complicated, but think of it this way. Consider a tree. A tree is made up of many parts, such as the roots that reside in the ground, the trunk, bark, branches, leaves, etc. Essentially inheritance is a connection between a child and its parent.Creating a parent object

Let’s say that our intention is to create a storefront where we’ll be selling cars. A simple shopping cart allows us to sell the cars and allows consumers to browse the products, and access specific information such as pricing and a description. With this in mind we know that regardless of what we’re selling, all products have certain things in common, such as a name, description, price and photo. By inheriting the Product object we can share these common properties across unique child objects.

  1.  
  2. class Product
  3. {
  4.    private $name;
  5.    private $price;
  6.    private $photo;
  7.    private $description;public function Product() {}
  8.    protected function setName($name) { $this->name = $name; }
  9.    public function GetName() { return $this->name; }
  10.    protected function setPrice($price = ‘0.00′) { $this->price = $price; }
  11.    public function GetPrice() { return $this->price; }
  12.    protected function setPhoto($photo) { $this->photo = $photo; }
  13.    public function GetPhoto() { return $this->photo; }
  14.    protected function setDescription($description) { $this->description = $description; }
  15.    public function GetDescription() { return $this->description; }
  16. }
  17.  

The Product object is quite simple, it allows us to define specific information such as a name, price, photo and description. The objects setters allow us to set these specific product properties, and by using the protected keyword we only allow these properties to be set by extending child objects. Also, the Products getters are public, which allows us to obtain specific data from an object with any PHP page that includes and instantiates it. The last thing to note about this object are the properties defined at the beginning of the class. We define these as private properties so they can’t be changed directly unless using the setters provided by the Product object, this provides more security and reliability. Let’s look at how to inherit the Product object.

posted under Uncategorized | 1 Comment »

Zend Framework: Zend_pdf Tutorial

September8

Here is a snippet from Zend Developer Zone:

The Zend_Pdf component of the Zend Framework is intended to allow you to create or manipulate PDF documents from within your applications. In addition to its text handling capabilities, it comes complete with poweredby_zf_4lightbg.pngdrawing features that allow you to create or manipulate graphical primitives. When working with text Zend_Pdf gives you the option of using the built-in fonts or custom TrueType fonts. Its page manipulation capabilities allow you to create new pages, remove existing pages or change the order of pages already in the document. In this tutorial my goal is to give you an overview of the capabilities of Zend_Pdf.

It has details on:

  1. Creating a new pdf file using Zend_pdf
  2. Loading/opening an existing pdf file using Zend_pdf
  3. Adding pages to pdfs
  4. Saving the pdf document
  5. Text drawing
  6. Image drawing
  7. Coloring drawings
  8. Using styles
  9. Rotations
  10. and Clipping.

It is a very good tutorial. Click here.

posted under Uncategorized | No Comments »
« Older Entries