Aug 25

A little late but I was pleased with the journal of Stephen on the benefits of using object-oriented programming (OOP) with PHP read parent. Since I've learned about Java and PHP in the same time, I was able to compare the advantages of both languages well together. On the one hand, the slight learning curve for PHP. On the other side of Java, with its integrated object orientation.

The learning curve of OOP is for developers who have started with simple procedural programming certainly more difficult and fun OOP makes only a good development environment (like Eclipse). But one has understood the object orientation and once internalized, one would miss them any more. So it goes at least to me.

The most important are the concepts of OOP, such as:

  • Encapsulation of data
  • Heredity
  • Overload
  • Polymorphism

After that, the syntax is for the OOP programming language, which is in PHP certainly getting used to (just think of __construct () for a constructors), as in Java. But for that there are tutorials. The best deutschsrpachige tutorial is the online edition of the book:

Professional Software Development with PHP 5
Object orientation. Design patterns. Modeling. Advanced Database Programming.

by Sebastian Bergmann.

But nothing helps better than learning by doing . :-)

Similar items:

posted by gklinkmann \ \ tags:

November 2008

Next it's off to the series "weekly links". These were my highlights in the past week:

Linux on the IBM Thinkpad
Notebooks from IBM or Lenovo's successor are particularly well suited for Linux. Here is a short guide for Kubuntu 9.10, how to persuade the laptop to save power and takes even more special keys in operation.
Closure Tools - Google Code
The Google Online Tools to use all Javascript extensively. So it is not surprising that Google now provides its Javascript compiler, a library for DOM manipulation and UI elements and templates for JavaScript and Java under the name Closure tools on Google Code for free use. I'm looking forward to the first comparisons with the Yahoo UI Bilbliothek.
Technical short documentaries by Torsten Horn
I'm on technical short documentaries (tutorials), especially if they have the quality as that of Torsten Horn.
Continuous Integration for PHP with the Hudson
Testing makes sense only if the tests are conducted regularly. Here is an article on how to integrate PHP tests in Hudson.
google-maps-icons
Free icons web developer as you can never have enough. Here is a great choice, as Google may provide.
PDF creation with the Zend Framework
The much-used PHP FPDF library to create PDF documents with complex layouts quickly gets to its limits. This article describes an alternative with Zend, which is through the detour of Office templates allow even complex PDF structures.

Similar items:

posted by gklinkmann \ \ tags: , , , , , , ,

Oct 27

The holiday is over - unfortunately. A little late, but instead more in number, the "weekly get left":

jQuery Accessible-RIA - (disabled jquery)
AJAX Frameworks and accessibility are currently two things that are not really compatible. The fact that there is another way, this shows hosted on GitHub project.
Symfony Components - Standalone libraries for PHP
Symfony is one of these beautiful new framework for PHP. The project has made available a few components that can be use even without installing the entire framework. I am very curious to the recently announced Request Handler.
PHPUnit by PTI integrated into Eclipse
For instructions to link the PHPUnit testing framework in Eclipse.
SystemRescueCd
The rescue CD with many useful tools, if the PC should sometimes experience problems.
Raphaël-JavaScript Library for svg and vml
A javascript library to create graphs and charts in SVG and VML (Microsoft) format. Very worth seeing.

Similar items:

posted by gklinkmann \ \ tags: , , , , , , ,

Oct 19
Series:


Part 1 - Pear

While I was in the first part in my little series on HTTP clients have been busy with Pear, I will now in the second Part of my attention to the Zend Framework addressed.

Even here you need two packages to accomplish the task (see Part 1 ). The package Zend_Http is like the Pear Package Http_Request2 to pure HTTP communication suitable.
With Zend_Dom one can divide the received HTML.

One way to solve the task may be:

  1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
  Php
 ; require_once 'Zend / Http / Client.php';
 ; require_once 'Zend / Http / Response.php';
 ; require_once 'Zend / Dom / Query.php';

 'http://www.google.de' ; $ Url = 'http://www.google.de';

 new Zend_Http_Client ( $url , array ( $ Client = new Zend_Http_Client ($ url, array (
     0 , 'Maxredirects' => 0,
     30 ) ) ; 'Timeout' => 30));

 try (
    $client -> request ( 'GET' ) ; $ Response = $ client -> request ('GET');

    200 == $response -> getStatus ( ) ) { if (200 == $ response -> getStatus ()) (

       new Zend_Dom_Query ( $response -> getBody ( ) ) ; $ Dom = new Zend_Dom_Query ($ response -> getBody ());
       $dom -> query ( 'form' ) ; $ Forms = $ dom -> query ('form');

       $forms -> current ( ) ; $ Form = $ forms -> current ();
       $form -> getAttribute ( 'action' ) ; $ Action = $ form -> getAttribute ('action');

       new Zend_Http_Client ( $url . $action , array ( $ Client = new Zend_Http_Client ($ url. $ Action, array (
           0 , 'Maxredirects' => 0,
           30 ) ) ; 'Timeout' => 30));
       setParameterGet ( 'q' , 'http client examples' ) ; $ Client -> setParameterGet ('q', 'http client examples');
       $client -> request ( 'GET' ) ; $ Response = $ client -> request ('GET');

       new Zend_Dom_Query ( $response -> getBody ( ) ) ; $ Dom = new Zend_Dom_Query ($ response -> getBody ());

       $dom -> query ( 'a.l' ) as $link ) { foreach ($ dom -> query ('a.l') as $ link) (
          $link -> hasAttribute ( 'href' ) ) { if ($ link -> hasAttribute ('href')) (
             $link -> getAttribute ( 'href' ) ; $ Href = $ link -> getAttribute ('href');
             $link -> textContent ; $ Link = $ link text - text content>;

             $href \" > $linkText </a><br />" ; echo "<a href= \" $href \"> $ link text </ a> <br />";
          ) 
       )

    { ) Else (
         . $response -> getStatus ( ) . ' echo 'Unexpected HTTP status:'. $ response -> getStatus (). "  '.
              responseCodeAsText ( ) ; $ Response -> responseCodeAsText ();
     )
 Zend_Http_Exception $e ) { ) Catch (Zend_Http_Exception $ e) (
     . $e -> getMessage ( ) ; echo 'Error:'. $ e -> getMessage ();
 )
 ?> 

The code speaks for itself, so I will not explain it at this point as detailed as in the first part.
The difference is in the parsing of the HTML's. The method query () (lines 18 and 31) provides that is not an array, a special object of class Zend_Dom_Query_Result back. Since this class, the two interface Countable and Iterator implemented, the results of the inquiry with a foreach loop to go through. Every single match is over an object of class DOMElement shown.

Conclusion:
Zend also offers Zend_Http Zend_Dom and a good HTTP client. One uses in his project already have other classes from the Zend Framework this approach is recommended.

View:
In part three, I leave the PHP world and put HttpUnit a very comfortable and feature-rich HTTP client for Java before using.

Similar items:

posted by gklinkmann \ \ tags: , ,

Oct 17

The leave began. Since the family is of course more time than the computer. A [pp] I still have links aar (the cottage is due to Internet):

PHP Simple HTML DOM Parser
A very lightweight HTML DOM (Document Object Model) parser for PHP.
Conversion of characters in Java
With the conversion of characters from different character sets, you can spend lots of time. How to use Java to the problem is Lord, show this journal.

urlaub

Similar items:

posted by gklinkmann \ \ tags: , ,