This is an ongoing list of things that are different in CCK and Drupal 5 to 7. Basically everyting that I hated about Drupal 5 whenI first started an everything that I dislike about Drupal as a code base and the ideas that I dislike that have been implemented using procedural code. I have done these things in OOP using the native functionality of PHP.
Popular just now
-
When dealing with Amazon Web Services using the command line for accessing the file system to configure the server using Putty is OK. But wh...
-
This was making me a little crazy today so I thought I would share. "Manual" PHP 5.5.x with WampServer Installing Windows (War...
-
One of my favorite pastimes is eavesdropping on programmers and developers while riding the commuter trains. You'd be amazed at the stuf...
ad1
Showing posts with label PHP5. Show all posts
Showing posts with label PHP5. Show all posts
Wampserver: How to Install PHP 5.5.0 manually
This was making me a little crazy today so I thought I would share.
"Manual" PHP 5.5.x with WampServer Installing Windows
(Warning PHP 5.5 does not work on XP, you need at least Vista)
This is an example, it is of course possible to install other PHP version on the same principle
"Manual" PHP 5.5.x with WampServer Installing Windows
(Warning PHP 5.5 does not work on XP, you need at least Vista)
This is an example, it is of course possible to install other PHP version on the same principle
More About:
installation /
manuallly /
PHP5 /
wampserver
Beginning PHP: What is MVC?
MVC (model=logic, view=output, controller=input) is one of the most popular
patterns in PHP but it is not necessary. If you are using procedural
techniques which most beginners do then MVC is not something you want
to use at the moment.
The order of learning that is best is procedural coding, object oriented programming and then patterns. If you are coming from java this can be changed a bit because java forces OOP. So continue to use OOP in PHP and then learn the PHP style of patterns.
The one thing that beginners seem to never do is read. PHP is so easy to learn so the ritual of reading before doing is dropped. Try downloading a PHP manual (recommend chm version for protability ) in your mother tongue and at least scan over the examples and comments in it. The area you want to concentrate most on is architecture. Using procedural code without an understandable architecture (can be MVC style but is not a requirement) is called spagetti code, something all good programmers try to avoid.
The order of learning that is best is procedural coding, object oriented programming and then patterns. If you are coming from java this can be changed a bit because java forces OOP. So continue to use OOP in PHP and then learn the PHP style of patterns.
The one thing that beginners seem to never do is read. PHP is so easy to learn so the ritual of reading before doing is dropped. Try downloading a PHP manual (recommend chm version for protability ) in your mother tongue and at least scan over the examples and comments in it. The area you want to concentrate most on is architecture. Using procedural code without an understandable architecture (can be MVC style but is not a requirement) is called spagetti code, something all good programmers try to avoid.
Zend Framework and Google Maps API Example
When looking for a Senior PHP Developer position I get a lot of tests. Most of them I kindly refuse to do because they always involve array manipulation and have no real world context. They only show that the interviewer is not aware of what is real world. Sometimes the test is trying to solve problem that cannot be solved. I always ask who that works for them has solved the problem and can I meet them. Rather than babble on about the red flags that the answers to my question bring up I'll show my answer to a test. First because it was in the form of a spec. I like this. Secondly, because it involves using Google Maps API and object oriented PHP and Zend Framework I was happy to oblige. It was a useful real world test and harder than I expected because the Zend Framework v1 has horrible documentation and worse examples(none of them work). Zend Framework v2 has less. So after piecing together something that works I decided to share.
This is the code needed to connect to Google Maps API and display the results in JSON using ZF2 as a library.
/**
* @author Carl McDade
* @since 2013-05-09
* @version
*
* Use: go the the address bar and enter a place using the format
* http://berlinto.com/test.php?place=berlin
* http://berlinto.com/test.php?place=new jersey
* http://berlinto.com/test.php?place=1 hampton rd. England
*
* Berlin, Germany
*/
$path = __DIR__ .'/path/to/zend/library';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
require_once('Zend/Loader/StandardAutoloader.php');
$loader = new Zend\Loader\StandardAutoloader(array('autoregister_zf' => true));
$loader->registerNamespaces(array('Zend'));
$loader->register();
use Zend\Http\Request;
use Zend\Http\Client;
class zftest{
protected $place;
function __construct()
{
$this->place = $_GET['place'];
}
function zend_test()
{
$uri = 'http://maps.google.com/maps/api/geocode/json';
$address = urlencode($this->place);
$sensor = 'false';
$request = new Request();
$request->setUri($uri);
$request->setMethod('GET');
$client = new Client($uri);
$client->setRequest($request);
$client->setParameterGet(array('sensor'=>$sensor,'address'=>$address));
$response = $client->dispatch($request);
if ($response->isSuccess())
{
header('Content-Type: text/html; charset=utf-8');
print 'Your Request for:' . print_r($address, 1) . '
';
print '' . print_r($response->getBody(), 1) . '
';
}
}
}
$maps = new zftest();
$maps->zend_test();
More About:
Google Maps /
PHP5 /
Zend Framework
PHP Reflection Performance
The Berlinto Web Architecture uses the PHP5 reflection class. Recently during a job interview I was asked about the performance of the framework because of this choice. To be honest I had not given any thought or any tests. Many other frameworks like code igniter and Symphony2 use reflection. So far this has not made them less used. Since Berlinto's mission is to be the most usable and not the fastest I will not do performance tests. At least not on that level. Perhaps a comparison to Drupal or Wordpress will come later on.
http://stackoverflow.com/questions/294582/php-5-reflection-api-performance
http://stackoverflow.com/questions/294582/php-5-reflection-api-performance
Subscribe to:
Posts (Atom)